From 96fe9b9a422714b83a91821e6a7533f071d40467 Mon Sep 17 00:00:00 2001 From: Alf Gaida Date: Sat, 12 Sep 2015 00:19:22 +0200 Subject: [PATCH] Cherry-picking upstream version 0.9.0+20150911. --- debian/changelog | 6 +++--- lxqtpower/lxqtpower.cpp | 19 ++++++++++++++----- lxqtpower/lxqtpower.h | 4 ++++ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/debian/changelog b/debian/changelog index 953a921..7d1bfe4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,11 +1,11 @@ -liblxqt (0.9.0+20150901-1) unstable; urgency=medium +liblxqt (0.9.0+20150911-1) unstable; urgency=medium + * Cherry-picked upstream version 0.9.0+20150911. * Fixed copyright, only LGPL2.1+ is used - * Cherry-picking upstream version 0.9.0-20150901 * Fixed Symbols * Fixed license - -- Alf Gaida Wed, 09 Sep 2015 20:06:10 +0200 + -- Alf Gaida Fri, 11 Sep 2015 23:01:56 +0200 liblxqt (0.9.0+20150806-3) unstable; urgency=medium diff --git a/lxqtpower/lxqtpower.cpp b/lxqtpower/lxqtpower.cpp index 742793b..3585227 100644 --- a/lxqtpower/lxqtpower.cpp +++ b/lxqtpower/lxqtpower.cpp @@ -34,8 +34,10 @@ using namespace LXQt; Power::Power(QObject *parent) : - QObject(parent) + QObject(parent), + mScreenSaver(this) { + connect(&mScreenSaver, SIGNAL(done()), &mLoop, SLOT(quit())); mProviders.append(new CustomProvider(this)); mProviders.append(new SystemdProvider(this)); mProviders.append(new UPowerProvider(this)); @@ -66,11 +68,18 @@ bool Power::doAction(Power::Action action) { foreach(PowerProvider* provider, mProviders) { - if (provider->canAction(action) && - provider->doAction(action) - ) + if (provider->canAction(action)) { - return true; + if (action == PowerSuspend || action == PowerHibernate) + { + mScreenSaver.lockScreen(); + mLoop.exec(); + } + if (provider->doAction(action)) + { + return true; + } + return false; } } return false; diff --git a/lxqtpower/lxqtpower.h b/lxqtpower/lxqtpower.h index f738b46..c85e2e2 100644 --- a/lxqtpower/lxqtpower.h +++ b/lxqtpower/lxqtpower.h @@ -31,6 +31,8 @@ #include #include +#include +#include "lxqtscreensaver.h" #include "lxqtglobals.h" namespace LXQt @@ -101,6 +103,8 @@ public slots: private: QList mProviders; + LXQt::ScreenSaver mScreenSaver; + QEventLoop mLoop; }; } // namespace LXQt