OSDN Git Service

ksmserver: start the shutdown feedback from KSMShutdownDlg constructor and stop it...
authorIvailo Monev <xakepa10@gmail.com>
Sat, 19 Nov 2022 23:54:00 +0000 (01:54 +0200)
committerIvailo Monev <xakepa10@gmail.com>
Sat, 19 Nov 2022 23:54:00 +0000 (01:54 +0200)
ksmserver stops it when the dialog is rejected but the test did not for
example

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
ksmserver/shutdown.cpp
ksmserver/shutdowndlg.cpp
ksmserver/shutdowndlg.h
ksmserver/tests/test.cpp

index 7eebae8..b5beffe 100644 (file)
@@ -144,7 +144,6 @@ void KSMServer::shutdown( KWorkSpace::ShutdownConfirm confirm,
     dialogActive = true;
     if ( !logoutConfirmed ) {
         KApplication::kApplication()->updateUserTimestamp();
-        KSMShutdownFeedback::start(); // make the screen gray
         QString theme = cg.readEntry( "theme", "default" );
         logoutConfirmed = KSMShutdownDlg::confirmShutdown( maysd, choose, sdtype, theme);
         // ###### We can't make the screen remain gray while talking to the apps,
@@ -213,8 +212,6 @@ void KSMServer::shutdown( KWorkSpace::ShutdownConfirm confirm,
         }
         if ( clients.isEmpty() )
             completeShutdownOrCheckpoint();
-    } else {
-        KSMShutdownFeedback::stop(); // make the screen become normal again
     }
     dialogActive = false;
 }
index bb48572..f7e33d7 100644 (file)
@@ -112,6 +112,8 @@ KSMShutdownDlg::KSMShutdownDlg( QWidget* parent,
     // this is a WType_Popup on purpose. Do not change that! Not
     // having a popup here has severe side effects.
 {
+    KSMShutdownFeedback::start(); // make the screen gray
+
     KDialog::centerOnScreen(this, -3);
 
     //kDebug() << "Creating QML view";
@@ -167,7 +169,7 @@ KSMShutdownDlg::KSMShutdownDlg( QWidget* parent,
     connect(rootObject, SIGNAL(suspendRequested(int)), SLOT(slotSuspend(int)) );
     connect(rootObject, SIGNAL(rebootRequested()), SLOT(slotReboot()));
     connect(rootObject, SIGNAL(rebootRequested2(int)), SLOT(slotReboot(int)) );
-    connect(rootObject, SIGNAL(cancelRequested()), SLOT(reject()));
+    connect(rootObject, SIGNAL(cancelRequested()), SLOT(slotCancel()));
     connect(rootObject, SIGNAL(lockScreenRequested()), SLOT(slotLockScreen()));
     m_view->show();
     m_view->setFocus();
@@ -213,7 +215,6 @@ void KSMShutdownDlg::slotReboot(int opt)
     accept();
 }
 
-
 void KSMShutdownDlg::slotLockScreen()
 {
     QDBusMessage call = QDBusMessage::createMethodCall("org.freedesktop.ScreenSaver",
@@ -230,7 +231,6 @@ void KSMShutdownDlg::slotHalt()
     accept();
 }
 
-
 void KSMShutdownDlg::slotSuspend(int spdMethod)
 {
     switch (spdMethod) {
@@ -245,6 +245,12 @@ void KSMShutdownDlg::slotSuspend(int spdMethod)
     reject();
 }
 
+void KSMShutdownDlg::slotCancel()
+{
+    KSMShutdownFeedback::stop(); // make the screen become normal again
+    reject();
+}
+
 bool KSMShutdownDlg::confirmShutdown(
         bool maysd, bool choose, KWorkSpace::ShutdownType& sdtype,
         const QString& theme)
index 7f69ee8..9e774bd 100644 (file)
@@ -65,6 +65,7 @@ public Q_SLOTS:
     void slotReboot(int);
     void slotSuspend(int);
     void slotLockScreen();
+    void slotCancel();
 
 protected:
     void resizeEvent(QResizeEvent *e);
index c0e8c5a..9bc3058 100644 (file)
@@ -23,7 +23,6 @@ int main(int argc, char *argv[])
     KApplication::quitOnSignal();
     KIconLoader::global()->addAppDir("ksmserver");
     qAddPostRoutine(KSMShutdownFeedback::stop);
-    KSMShutdownFeedback::start();
 
     QString sdtypeOption = args->getOption("type").toLower();