rpms/kdebase-workspace/devel kdebase-workspace-4.3.95-ck-shutdown.patch, NONE, 1.1 kdebase-workspace.spec, 1.354, 1.355 kdebase-workspace-4.2.85-ck-shutdown.patch, 1.1, NONE

Kevin Kofler kkofler at fedoraproject.org
Sat Jan 30 16:44:27 UTC 2010


Author: kkofler

Update of /cvs/pkgs/rpms/kdebase-workspace/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv708/devel

Modified Files:
	kdebase-workspace.spec 
Added Files:
	kdebase-workspace-4.3.95-ck-shutdown.patch 
Removed Files:
	kdebase-workspace-4.2.85-ck-shutdown.patch 
Log Message:
* Sat Jan 30 2010 Kevin Kofler <Kevin at tigcc.ticalc.org> - 4.3.95-2
- ck-shutdown: don't offer shutdown/restart when not allowed by CK (#529644)

kdebase-workspace-4.3.95-ck-shutdown.patch:
 kdisplaymanager.cpp |   34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

--- NEW FILE kdebase-workspace-4.3.95-ck-shutdown.patch ---
diff -ur kdebase-workspace-4.3.95/libs/kworkspace/kdisplaymanager.cpp kdebase-workspace-4.3.95-ck-shutdown/libs/kworkspace/kdisplaymanager.cpp
--- kdebase-workspace-4.3.95/libs/kworkspace/kdisplaymanager.cpp	2009-04-28 15:46:11.000000000 +0200
+++ kdebase-workspace-4.3.95-ck-shutdown/libs/kworkspace/kdisplaymanager.cpp	2010-01-30 17:31:58.000000000 +0100
@@ -26,6 +26,7 @@
 #include <QtDBus/QtDBus>
 
 #include <QRegExp>
+#include <QLatin1String>
 
 #include <X11/Xauth.h>
 #include <X11/Xlib.h>
@@ -85,6 +86,7 @@
 				strcpy( sa.sun_path, "/tmp/.gdm_socket" );
 				if (::connect( d->fd, (struct sockaddr *)&sa, sizeof(sa) )) {
 					::close( d->fd );
+					DMType = NoDM;
 					d->fd = -1;
 					break;
 				}
@@ -186,6 +188,23 @@
 bool
 KDisplayManager::canShutdown()
 {
+	if (DMType == NoDM) {
+		// No DM or newest GDM running, we'll try shutting down through ConsoleKit.
+		QDBusConnection systemBus = QDBusConnection::systemBus();
+		if (!systemBus.isConnected())
+			return false;
+		QDBusInterface consoleKit( QLatin1String( "org.freedesktop.ConsoleKit" ),
+		                           QLatin1String( "/org/freedesktop/ConsoleKit/Manager" ),
+		                           QLatin1String( "org.freedesktop.ConsoleKit.Manager" ),
+		                           systemBus );
+		if (!consoleKit.isValid())
+			return false;
+		// Unfortunately, at this point we don't know whether we should be querying
+		// CanStop or CanRestart. Let's do what the code below does and just use CanStop.
+		QDBusReply<bool> canStop = consoleKit.call( QLatin1String( "CanStop" ) );
+		return (canStop.isValid() && canStop.value());
+	}
+
 	if (DMType == OldKDM)
 		return strstr( ctl, ",maysd" ) != 0;
 
@@ -205,6 +224,21 @@
 	if (shutdownType == KWorkSpace::ShutdownTypeNone || shutdownType == KWorkSpace::ShutdownTypeLogout)
 		return;
 
+        if (DMType == NoDM) {
+               // No DM or newest GDM running, try shutting down through ConsoleKit.
+               QDBusConnection systemBus = QDBusConnection::systemBus();
+               if (!systemBus.isConnected())
+                       return;
+               QDBusInterface consoleKit( QLatin1String( "org.freedesktop.ConsoleKit" ),
+                                          QLatin1String( "/org/freedesktop/ConsoleKit/Manager" ),
+                                          QLatin1String( "org.freedesktop.ConsoleKit.Manager" ),
+                                          systemBus );
+               if (consoleKit.isValid())
+                       consoleKit.call( QLatin1String( shutdownType == KWorkSpace::ShutdownTypeReboot ?
+                                                       "Restart" : "Stop" ) );
+               return;
+        }
+
 	bool cap_ask;
 	if (DMType == NewKDM) {
 		QByteArray re;


Index: kdebase-workspace.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kdebase-workspace/devel/kdebase-workspace.spec,v
retrieving revision 1.354
retrieving revision 1.355
diff -u -p -r1.354 -r1.355
--- kdebase-workspace.spec	23 Jan 2010 19:30:48 -0000	1.354
+++ kdebase-workspace.spec	30 Jan 2010 16:44:27 -0000	1.355
@@ -22,7 +22,7 @@
 Summary: KDE Workspace
 Name:    kdebase-workspace
 Version: 4.3.95
-Release: 1%{?dist}
+Release: 2%{?dist}
 
 License: GPLv2
 Group:   User Interface/Desktops
@@ -33,7 +33,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version
 Patch1: kdebase-workspace-4.3.95-redhat-startkde.patch
 Patch2: kdebase-workspace-4.3.75-plasma-konsole.patch
 Patch3: kdebase-workspace-4.3.75-show_systemsettings.patch
-Patch4: kdebase-workspace-4.2.85-ck-shutdown.patch
+Patch4: kdebase-workspace-4.3.95-ck-shutdown.patch
 # 441062: packagekit tools do not show icons correctly on KDE
 Patch7: kdebase-workspace-4.0.3-krdb.patch
 Patch8: kdebase-workspace-4.2.85-klipper-url.patch
@@ -655,6 +655,9 @@ fi
 
 
 %changelog
+* Sat Jan 30 2010 Kevin Kofler <Kevin at tigcc.ticalc.org> - 4.3.95-2
+- ck-shutdown: don't offer shutdown/restart when not allowed by CK (#529644)
+
 * Thu Jan 21 2010 Lukas Tinkl <ltinkl at redhat.com> - 4.3.95-1
 - KDE 4.3.95 (4.4rc2)
 


--- kdebase-workspace-4.2.85-ck-shutdown.patch DELETED ---



More information about the scm-commits mailing list