Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Frameworks
Solid
Commits
51181d4c
Commit
51181d4c
authored
Sep 22, 2014
by
Lukáš Tinkl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify and fix the AcPluggedJob
parent
094908f6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
10 deletions
+8
-10
src/solid/power/backends/freedesktop/fdacpluggedjob.cpp
src/solid/power/backends/freedesktop/fdacpluggedjob.cpp
+7
-9
src/solid/power/backends/freedesktop/fdacpluggedjob.h
src/solid/power/backends/freedesktop/fdacpluggedjob.h
+1
-1
No files found.
src/solid/power/backends/freedesktop/fdacpluggedjob.cpp
View file @
51181d4c
...
...
@@ -26,8 +26,8 @@
#include <QDBusMessage>
#include <QDBusPendingCall>
#include <QDBusPendingReply>
#include <QDBusInterface>
using
namespace
Solid
;
FDAcPluggedJob
::
FDAcPluggedJob
(
QObject
*
parent
)
...
...
@@ -44,19 +44,17 @@ void FDAcPluggedJob::doStart()
QStringLiteral
(
"org.freedesktop.DBus.Properties"
),
QStringLiteral
(
"Get"
));
QList
<
QVariant
>
args
;
args
<<
QStringLiteral
(
"org.freedesktop.UPower"
)
<<
QStringLiteral
(
"OnBattery"
);
msg
.
setArguments
(
args
);
msg
<<
QStringLiteral
(
"org.freedesktop.UPower"
);
msg
<<
QStringLiteral
(
"OnBattery"
);
QDBusConnection
::
systemBus
().
callWithCallback
(
msg
,
this
,
SLOT
(
slotDBusReply
(
Q
Variant
)),
SLOT
(
slotDBusError
(
QDBusError
)));
QDBusConnection
::
systemBus
().
callWithCallback
(
msg
,
this
,
SLOT
(
slotDBusReply
(
Q
DBusMessage
)),
SLOT
(
slotDBusError
(
QDBusError
)));
}
void
FDAcPluggedJob
::
slotDBusReply
(
const
Q
Variant
&
reply
)
void
FDAcPluggedJob
::
slotDBusReply
(
const
Q
DBusMessage
&
msg
)
{
Q_ASSERT
(
reply
.
isValid
());
Q_ASSERT
(
!
msg
.
arguments
().
isEmpty
());
m_isPlugged
=
!
reply
.
toBool
();
m_isPlugged
=
!
msg
.
arguments
().
first
().
value
<
QDBusVariant
>
().
variant
()
.
toBool
();
emitResult
();
}
...
...
src/solid/power/backends/freedesktop/fdacpluggedjob.h
View file @
51181d4c
...
...
@@ -38,7 +38,7 @@ public:
private
Q_SLOTS
:
virtual
void
doStart
()
Q_DECL_OVERRIDE
;
void
slotDBusReply
(
const
Q
Variant
&
reply
);
void
slotDBusReply
(
const
Q
DBusMessage
&
msg
);
void
slotDBusError
(
const
QDBusError
&
error
);
private:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment