SVN commit 942654 by dafre: CCMAIL: kde-core-devel@kde.org CCBUG: 183273 As discussed on the list, new patch for KSMServer+PowerDevil regarding bug #183273. Now no signals are emitted from ksm, instead an inhibition is triggered from it. Less code, more clean, and we also have more control over this since upon cancelation the inhibition gets released. Also backporting this to 4.2 branch M +0 -3 ksmserver/KSMServerInterface.h M +0 -6 ksmserver/org.kde.KSMServerInterface.xml M +2 -3 ksmserver/server.h M +6 -2 ksmserver/shutdown.cpp M +0 -6 powerdevil/daemon/PowerDevilDaemon.cpp M +0 -2 powerdevil/daemon/PowerDevilDaemon.h --- trunk/KDE/kdebase/workspace/ksmserver/KSMServerInterface.h #942653:942654 @@ -43,9 +43,6 @@ Q_SCRIPTABLE void resumeStartup( QString ); Q_SCRIPTABLE void wmChanged(); -Q_SIGNALS: - Q_SCRIPTABLE void loggingOut( int, int, int ); - }; #endif --- trunk/KDE/kdebase/workspace/ksmserver/org.kde.KSMServerInterface.xml #942653:942654 @@ -27,11 +27,5 @@ - - - - - - --- trunk/KDE/kdebase/workspace/ksmserver/server.h #942653:942654 @@ -194,9 +194,6 @@ QStringList sessionList(); void wmChanged(); - Q_SIGNALS: - void loggingOut( int, int, int ); - private: QList listener; QList clients; @@ -252,6 +249,8 @@ OrgKdeKLauncherInterface* klauncherSignals; QDBusInterface* kcminitSignals; + + int inhibitCookie; }; #endif --- trunk/KDE/kdebase/workspace/ksmserver/shutdown.cpp #942653:942654 @@ -72,6 +72,7 @@ #include "client.h" #include "shutdowndlg.h" +#include #include @@ -82,8 +83,6 @@ void KSMServer::logout( int confirm, int sdtype, int sdmode ) { - emit loggingOut( confirm, sdtype, sdmode ); - shutdown( (KWorkSpace::ShutdownConfirm)confirm, (KWorkSpace::ShutdownType)sdtype, (KWorkSpace::ShutdownMode)sdmode ); @@ -158,6 +157,10 @@ if ( logoutConfirmed ) { + // If the logout was confirmed, let's start a powermanagement inhibition. + // We store the cookie so we can interrupt it if the logout will be canceled + inhibitCookie = Solid::PowerManagement::beginSuppressingSleep(); + shutdownType = sdtype; shutdownMode = sdmode; bootOption = bopt; @@ -357,6 +360,7 @@ void KSMServer::cancelShutdown( KSMClient* c ) { + Solid::PowerManagement::stopSuppressingSleep(inhibitCookie); kDebug( 1218 ) << "Client " << c->program() << " (" << c->clientId() << ") canceled shutdown."; KNotification::event( "cancellogout" , i18n( "Logout canceled by '%1'", c->program()), QPixmap() , 0l , KNotification::DefaultEvent ); --- trunk/KDE/kdebase/workspace/powerdevil/daemon/PowerDevilDaemon.cpp #942653:942654 @@ -188,7 +188,6 @@ const char*, const QString&)), SLOT(emitCriticalNotification(const QString&, const QString&, const char*, const QString&))); - connect(d->ksmServerIface, SIGNAL(loggingOut(int,int,int)), this, SLOT(loggingOut(int,int,int))); /* Time for setting up polling! We can have different methods, so * let's check what we got. @@ -233,11 +232,6 @@ kDebug() << KGlobal::locale()->formatDuration(time); } -void PowerDevilDaemon::loggingOut(int confirm, int sdtype, int sdmode) -{ - d->lockHandler->inhibit("",""); -} - SuspensionLockHandler *PowerDevilDaemon::lockHandler() { return d->lockHandler; --- trunk/KDE/kdebase/workspace/powerdevil/daemon/PowerDevilDaemon.h #942653:942654 @@ -117,8 +117,6 @@ void batteryRemainingTimeChanged(int time); - void loggingOut(int confirm, int sdtype, int sdmode); - Q_SIGNALS: void lidClosed(int code, const QString &action); void errorTriggered(const QString &error);