Accepting request 525867 from X11:LXQt

1

OBS-URL: https://build.opensuse.org/request/show/525867
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/liblxqt?expand=0&rev=8
This commit is contained in:
Dominique Leuenberger 2017-09-13 20:38:13 +00:00 committed by Git OBS Bridge
commit bc0977f07e
3 changed files with 135 additions and 0 deletions

View File

@ -0,0 +1,126 @@
From f3f824c85811596bc8886b86f31b5f37c2480736 Mon Sep 17 00:00:00 2001
From: Palo Kisa <palo.kisa@gmail.com>
Date: Wed, 28 Jun 2017 09:25:43 +0200
Subject: [PATCH] lxqtpower: Allow disabling of lxqt-session provider
To allow usage of LXQt::Power object inside of lxqt-session (handling
the called method of LXQtSessionProvider) we need to avoid recurently
calling lxqt-session itself.
---
lxqtpower/lxqtpower.cpp | 10 ++++++++--
lxqtpower/lxqtpower.h | 12 ++++++++++--
lxqtpower/lxqtpowerproviders.cpp | 36 +++++++++++++++++++++++++-----------
3 files changed, 43 insertions(+), 15 deletions(-)
diff --git a/lxqtpower/lxqtpower.cpp b/lxqtpower/lxqtpower.cpp
index 742793b..07cd19e 100644
--- a/lxqtpower/lxqtpower.cpp
+++ b/lxqtpower/lxqtpower.cpp
@@ -33,15 +33,21 @@
using namespace LXQt;
-Power::Power(QObject *parent) :
+Power::Power(bool useLxqtSessionProvider, QObject * parent /*= nullptr*/) :
QObject(parent)
{
mProviders.append(new CustomProvider(this));
+ if (useLxqtSessionProvider)
+ mProviders.append(new LXQtProvider(this));
mProviders.append(new SystemdProvider(this));
mProviders.append(new UPowerProvider(this));
mProviders.append(new ConsoleKitProvider(this));
mProviders.append(new LxSessionProvider(this));
- mProviders.append(new LXQtProvider(this));
+}
+
+Power::Power(QObject * parent /*= nullptr*/)
+ : Power(true, parent)
+{
}
diff --git a/lxqtpower/lxqtpower.h b/lxqtpower/lxqtpower.h
index f738b46..98b021e 100644
--- a/lxqtpower/lxqtpower.h
+++ b/lxqtpower/lxqtpower.h
@@ -56,8 +56,16 @@ class LXQT_API Power : public QObject
PowerSuspend /// Suspend the computer
};
- /// Constructs a Power with parent.
- explicit Power(QObject *parent = 0);
+ /*!
+ * Constructs the Power object.
+ * \param useLxqtSessionProvider indicates if the DBus methods
+ * provided by lxqt-session should be considered. This is useful to
+ * avoid recursion if the lxqt-session wants to provide some of the
+ * methods by itself with internal use of this object.
+ */
+ explicit Power(bool useLxqtSessionProvider, QObject *parent = nullptr);
+ /// Constructs a Power with using the lxqt-session provider.
+ explicit Power(QObject *parent = nullptr);
/// Destroys the object.
virtual ~Power();
diff --git a/lxqtpower/lxqtpowerproviders.cpp b/lxqtpower/lxqtpowerproviders.cpp
index 1304e05..3907cc7 100644
--- a/lxqtpower/lxqtpowerproviders.cpp
+++ b/lxqtpower/lxqtpowerproviders.cpp
@@ -500,31 +500,45 @@ LXQtProvider::~LXQtProvider()
bool LXQtProvider::canAction(Power::Action action) const
{
+ QString command;
switch (action)
{
case Power::PowerLogout:
- // there can be case when razo-session does not run
- return dbusCall(LXQT_SERVICE, LXQT_PATH, LXQT_SERVICE,
- QDBusConnection::sessionBus(), "canLogout",
- PowerProvider::DontCheckDBUS);
+ command = "canLogout";
+ break;
+ case Power::PowerReboot:
+ command = "canReboot";
+ break;
+ case Power::PowerShutdown:
+ command = "canPowerOff";
+ break;
default:
return false;
}
+
+ // there can be case when lxqtsession-session does not run
+ return dbusCall(LXQT_SERVICE, LXQT_PATH, LXQT_SERVICE,
+ QDBusConnection::sessionBus(), command,
+ PowerProvider::DontCheckDBUS);
}
bool LXQtProvider::doAction(Power::Action action)
{
QString command;
-
switch (action)
{
- case Power::PowerLogout:
- command = "logout";
- break;
-
- default:
- return false;
+ case Power::PowerLogout:
+ command = "logout";
+ break;
+ case Power::PowerReboot:
+ command = "reboot";
+ break;
+ case Power::PowerShutdown:
+ command = "powerOff";
+ break;
+ default:
+ return false;
}
return dbusCall(LXQT_SERVICE,

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Sep 13 11:47:59 UTC 2017 - mvetter@suse.com
- boo#1044483:
* Add liblxqt-0.11.1-allow-disabl-lxqt-session.patch
to allow disabling of lxqt-session
-------------------------------------------------------------------
Thu Feb 23 17:01:53 UTC 2017 - sfalken@opensuse.org

View File

@ -26,6 +26,7 @@ Url: http://www.lxqt.org
Source: http://downloads.lxqt.org/lxqt/%{version}/%{name}-%{version}.tar.xz
Source1: http://downloads.lxqt.org/lxqt/%{version}/%{name}-%{version}.tar.xz.asc
Source2: %{name}.keyring
Patch0: liblxqt-0.11.1-allow-disabl-lxqt-session.patch
BuildRequires: cmake >= 3.0.2
BuildRequires: fdupes
BuildRequires: gcc-c++
@ -71,6 +72,7 @@ applications that want to make use of liblxqt.
%prep
%setup -q -n liblxqt-%{version}
%patch0 -p1
%build
%cmake -DPULL_TRANSLATIONS=No