Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Zolotopupov Volodymyr
PowerDevil
Commits
91bc1b3c
Commit
91bc1b3c
authored
Oct 16, 2021
by
Méven Car
Browse files
UPowerBackend: remove dead code
parent
4f70ad3f
Changes
2
Hide whitespace changes
Inline
Side-by-side
daemon/backends/upower/powerdevilupowerbackend.cpp
View file @
91bc1b3c
...
...
@@ -59,62 +59,6 @@ PowerDevilUPowerBackend::PowerDevilUPowerBackend(QObject* parent)
PowerDevilUPowerBackend
::~
PowerDevilUPowerBackend
()
=
default
;
bool
PowerDevilUPowerBackend
::
isAvailable
()
{
if
(
!
QDBusConnection
::
systemBus
().
interface
()
->
isServiceRegistered
(
UPOWER_SERVICE
))
{
// Is it pending activation?
qCDebug
(
POWERDEVIL
)
<<
"UPower service, "
<<
UPOWER_SERVICE
<<
", is not registered on the bus. Trying to find out if it is activated."
;
QDBusMessage
message
=
QDBusMessage
::
createMethodCall
(
"org.freedesktop.DBus"
,
"/org/freedesktop/DBus"
,
"org.freedesktop.DBus"
,
"ListActivatableNames"
);
QDBusPendingReply
<
QStringList
>
reply
=
QDBusConnection
::
systemBus
().
asyncCall
(
message
);
reply
.
waitForFinished
();
if
(
reply
.
isValid
())
{
if
(
reply
.
value
().
contains
(
UPOWER_SERVICE
))
{
qCDebug
(
POWERDEVIL
)
<<
"UPower was found, activating service..."
;
QDBusConnection
::
systemBus
().
interface
()
->
startService
(
UPOWER_SERVICE
);
if
(
!
QDBusConnection
::
systemBus
().
interface
()
->
isServiceRegistered
(
UPOWER_SERVICE
))
{
// Wait for it
QEventLoop
e
;
QTimer
*
timer
=
new
QTimer
;
timer
->
setInterval
(
10000
);
timer
->
setSingleShot
(
true
);
connect
(
QDBusConnection
::
systemBus
().
interface
(),
&
QDBusConnectionInterface
::
serviceRegistered
,
&
e
,
&
QEventLoop
::
quit
);
connect
(
timer
,
&
QTimer
::
timeout
,
&
e
,
&
QEventLoop
::
quit
);
timer
->
start
();
while
(
!
QDBusConnection
::
systemBus
().
interface
()
->
isServiceRegistered
(
UPOWER_SERVICE
))
{
e
.
exec
();
if
(
!
timer
->
isActive
())
{
qCDebug
(
POWERDEVIL
)
<<
"Activation of UPower timed out. There is likely a problem with your configuration."
;
timer
->
deleteLater
();
return
false
;
}
}
timer
->
deleteLater
();
}
return
true
;
}
else
{
qCDebug
(
POWERDEVIL
)
<<
"UPower cannot be found on this system."
;
return
false
;
}
}
else
{
qCWarning
(
POWERDEVIL
)
<<
"Could not request activatable names to DBus!"
;
return
false
;
}
}
else
{
return
true
;
}
}
void
PowerDevilUPowerBackend
::
init
()
{
// interfaces
...
...
daemon/backends/upower/powerdevilupowerbackend.h
View file @
91bc1b3c
...
...
@@ -55,7 +55,6 @@ public:
~
PowerDevilUPowerBackend
()
override
;
void
init
()
override
;
static
bool
isAvailable
();
int
brightness
(
BrightnessControlType
type
=
Screen
)
const
override
;
int
brightnessMax
(
BrightnessControlType
type
=
Screen
)
const
override
;
...
...
Write
Preview
Supports
Markdown
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