Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Frameworks
Solid
Commits
72094323
Commit
72094323
authored
Sep 22, 2014
by
Lukáš Tinkl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement resumeFromSuspend()
parent
51181d4c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
11 deletions
+34
-11
src/solid/power/backends/freedesktop/fdpowernotifier.cpp
src/solid/power/backends/freedesktop/fdpowernotifier.cpp
+23
-9
src/solid/power/backends/freedesktop/fdpowernotifier.h
src/solid/power/backends/freedesktop/fdpowernotifier.h
+3
-2
src/solid/power/backends/powernotifier.h
src/solid/power/backends/powernotifier.h
+1
-0
src/solid/power/power.cpp
src/solid/power/power.cpp
+2
-0
src/solid/power/power.h
src/solid/power/power.h
+5
-0
No files found.
src/solid/power/backends/freedesktop/fdpowernotifier.cpp
View file @
72094323
/*
Copyright 2014 Alejandro Fiestas Olivares <afiestas@kde.org>
Copyright 2014 Lukáš Tinkl <ltinkl@redhat.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -23,21 +24,27 @@
#include <QDebug>
#include <QDBusConnection>
#include <QtDBus/QDBusConnection>
Solid
::
FDPowerNotifier
::
FDPowerNotifier
(
QObject
*
parent
)
:
PowerNotifier
(
parent
)
{
auto
conn
=
QDBusConnection
::
systemBus
();
conn
.
connect
(
QStringLiteral
(
"org.freedesktop.UPower"
),
QStringLiteral
(
"/org/freedesktop/UPower"
),
QStringLiteral
(
"org.freedesktop.DBus.Properties"
),
QStringLiteral
(
"PropertiesChanged"
),
this
,
SLOT
(
propertiesChanged
(
QString
,
QVariantMap
,
QStringList
))
);
QStringLiteral
(
"/org/freedesktop/UPower"
),
QStringLiteral
(
"org.freedesktop.DBus.Properties"
),
QStringLiteral
(
"PropertiesChanged"
),
this
,
SLOT
(
upowerPropertiesChanged
(
QString
,
QVariantMap
,
QStringList
))
);
conn
.
connect
(
QStringLiteral
(
"org.freedesktop.login1"
),
QStringLiteral
(
"/org/freedesktop/login1"
),
QStringLiteral
(
"org.freedesktop.login1.Manager"
),
QStringLiteral
(
"PrepareForSleep"
),
this
,
SLOT
(
login1Resuming
(
bool
))
);
}
void
Solid
::
FDPowerNotifier
::
p
ropertiesChanged
(
const
QString
&
interface
,
const
QVariantMap
&
changedProperties
,
const
QStringList
&
invalidated
)
void
Solid
::
FDPowerNotifier
::
upowerP
ropertiesChanged
(
const
QString
&
interface
,
const
QVariantMap
&
changedProperties
,
const
QStringList
&
invalidated
)
{
if
(
interface
!=
QStringLiteral
(
"org.freedesktop.UPower"
))
{
return
;
...
...
@@ -52,3 +59,10 @@ void Solid::FDPowerNotifier::propertiesChanged(const QString &interface, const Q
qDebug
()
<<
"Invalidated"
<<
invalidated
;
}
}
void
Solid
::
FDPowerNotifier
::
login1Resuming
(
bool
active
)
{
if
(
!
active
)
{
Q_EMIT
resumeFromSuspend
();
}
}
src/solid/power/backends/freedesktop/fdpowernotifier.h
View file @
72094323
...
...
@@ -32,8 +32,9 @@ class FDPowerNotifier : public PowerNotifier
public:
explicit
FDPowerNotifier
(
QObject
*
parent
=
0
);
public
Q_SLOTS
:
void
propertiesChanged
(
const
QString
&
interface
,
const
QVariantMap
&
changedProperties
,
const
QStringList
&
invalidated
);
private
Q_SLOTS
:
void
upowerPropertiesChanged
(
const
QString
&
interface
,
const
QVariantMap
&
changedProperties
,
const
QStringList
&
invalidated
);
void
login1Resuming
(
bool
active
);
};
}
...
...
src/solid/power/backends/powernotifier.h
View file @
72094323
...
...
@@ -33,6 +33,7 @@ public:
Q_SIGNALS:
void
acPluggedChanged
(
bool
plugged
);
void
resumeFromSuspend
();
};
}
...
...
src/solid/power/power.cpp
View file @
72094323
...
...
@@ -45,8 +45,10 @@ Power* Power::self()
Power
::
Power
(
QObject
*
parent
)
:
QObject
(
parent
),
d
(
new
Private
)
{
qRegisterMetaType
<
Solid
::
Inhibition
::
State
>
(
"Inhibition::State"
);
d
->
notifier
=
PowerBackendLoader
::
notifier
();
connect
(
d
->
notifier
,
&
PowerNotifier
::
acPluggedChanged
,
this
,
&
Power
::
acPluggedChanged
);
connect
(
d
->
notifier
,
&
PowerNotifier
::
resumeFromSuspend
,
this
,
&
Power
::
resumeFromSuspend
);
}
AcPluggedJob
*
Power
::
isAcPlugged
(
QObject
*
parent
)
...
...
src/solid/power/power.h
View file @
72094323
...
...
@@ -112,6 +112,11 @@ Q_SIGNALS:
*/
void
acPluggedChanged
(
bool
plugged
);
/**
* Emitted when the system has just resumed from being suspended/hibernated
*/
void
resumeFromSuspend
();
private:
class
Private
;
Private
*
const
d
;
...
...
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