From 29fe3a31df261c0da858ffbb24d79634877e9465 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sun, 20 Nov 2022 01:54:00 +0200 Subject: [PATCH] ksmserver: start the shutdown feedback from KSMShutdownDlg constructor and stop it on reject ksmserver stops it when the dialog is rejected but the test did not for example Signed-off-by: Ivailo Monev --- ksmserver/shutdown.cpp | 3 --- ksmserver/shutdowndlg.cpp | 12 +++++++++--- ksmserver/shutdowndlg.h | 1 + ksmserver/tests/test.cpp | 1 - 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/ksmserver/shutdown.cpp b/ksmserver/shutdown.cpp index 7eebae88..b5beffe1 100644 --- a/ksmserver/shutdown.cpp +++ b/ksmserver/shutdown.cpp @@ -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; } diff --git a/ksmserver/shutdowndlg.cpp b/ksmserver/shutdowndlg.cpp index bb48572f..f7e33d78 100644 --- a/ksmserver/shutdowndlg.cpp +++ b/ksmserver/shutdowndlg.cpp @@ -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) diff --git a/ksmserver/shutdowndlg.h b/ksmserver/shutdowndlg.h index 7f69ee81..9e774bdd 100644 --- a/ksmserver/shutdowndlg.h +++ b/ksmserver/shutdowndlg.h @@ -65,6 +65,7 @@ public Q_SLOTS: void slotReboot(int); void slotSuspend(int); void slotLockScreen(); + void slotCancel(); protected: void resizeEvent(QResizeEvent *e); diff --git a/ksmserver/tests/test.cpp b/ksmserver/tests/test.cpp index c0e8c5aa..9bc30587 100644 --- a/ksmserver/tests/test.cpp +++ b/ksmserver/tests/test.cpp @@ -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(); -- 2.11.0