diff --git a/ksmserver/main.cpp b/ksmserver/main.cpp --- a/ksmserver/main.cpp +++ b/ksmserver/main.cpp @@ -333,7 +333,6 @@ KDBusService service(KDBusService::Unique); - server->setupShortcuts(); int ret = a->exec(); kde_running.release(); // needs to be done before QApplication destruction delete a; diff --git a/ksmserver/server.h b/ksmserver/server.h --- a/ksmserver/server.h +++ b/ksmserver/server.h @@ -117,8 +117,6 @@ KWorkSpace::ShutdownType sdtype, KWorkSpace::ShutdownMode sdmode ); - void setupShortcuts(); - Q_SIGNALS: void windowManagerLoaded(); void logoutCancelled(); diff --git a/ksmserver/server.cpp b/ksmserver/server.cpp --- a/ksmserver/server.cpp +++ b/ksmserver/server.cpp @@ -993,33 +993,6 @@ return sessionGroup.isEmpty(); } -void KSMServer::setupShortcuts() -{ - if (KAuthorized::authorize( QStringLiteral( "logout" ))) { - KActionCollection* actionCollection = new KActionCollection(this); - QAction* a; - a = actionCollection->addAction(QStringLiteral("Log Out")); - a->setText(i18n("Log Out")); - KGlobalAccel::self()->setShortcut(a, QList() << Qt::ALT+Qt::CTRL+Qt::Key_Delete); - connect(a, &QAction::triggered, this, &KSMServer::defaultLogout); - - a = actionCollection->addAction(QStringLiteral("Log Out Without Confirmation")); - a->setText(i18n("Log Out Without Confirmation")); - KGlobalAccel::self()->setShortcut(a, QList() << Qt::ALT+Qt::CTRL+Qt::SHIFT+Qt::Key_Delete); - connect(a, &QAction::triggered, this, &KSMServer::logoutWithoutConfirmation); - - a = actionCollection->addAction(QStringLiteral("Halt Without Confirmation")); - a->setText(i18n("Halt Without Confirmation")); - KGlobalAccel::self()->setShortcut(a, QList() << Qt::ALT+Qt::CTRL+Qt::SHIFT+Qt::Key_PageDown); - connect(a, &QAction::triggered, this, &KSMServer::haltWithoutConfirmation); - - a = actionCollection->addAction(QStringLiteral("Reboot Without Confirmation")); - a->setText(i18n("Reboot Without Confirmation")); - KGlobalAccel::self()->setShortcut(a, QList() << Qt::ALT+Qt::CTRL+Qt::SHIFT+Qt::Key_PageUp); - connect(a, &QAction::triggered, this, &KSMServer::rebootWithoutConfirmation); - } -} - /*! Restores the previous session. Ensures the window manager is running (if specified). */ diff --git a/startkde/plasma-session/CMakeLists.txt b/startkde/plasma-session/CMakeLists.txt --- a/startkde/plasma-session/CMakeLists.txt +++ b/startkde/plasma-session/CMakeLists.txt @@ -40,4 +40,5 @@ ) install(TARGETS plasma_session ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) +install(FILES org.kde.plasma.session.desktop DESTINATION "${KDE_INSTALL_FULL_DATAROOTDIR}/kglobalaccel") diff --git a/startkde/plasma-session/org.kde.plasma.session.desktop b/startkde/plasma-session/org.kde.plasma.session.desktop new file mode 100644 --- /dev/null +++ b/startkde/plasma-session/org.kde.plasma.session.desktop @@ -0,0 +1,25 @@ +[Desktop Entry] +Name=Session +OnlyShowIn=KDE; +Type=Application +Actions=Logout;LogOutNoConfirm;HaltNoConfirm;RebootNoConfirm + +[Desktop Action Logout] +Exec=qdbus org.kde.LogoutPrompt /LogoutPrompt org.kde.LogoutPrompt.promptLogout +Name=Logout +X-KDE-Shortcuts=Alt+Ctrl+Delete + +[Desktop Action LogOutNoConfirm] +Exec=qdbus org.kde.Shutdown /Shutdown org.kde.Shutdown.logout +Name=Log Out Without Confirmation +X-KDE-Shortcuts=Alt+Ctrl+Shift+Delete + +[Desktop Action HaltNoConfirm] +Exec=qdbus org.kde.Shutdown /Shutdown org.kde.Shutdown.logoutAndShutdown +Name=Logout +X-KDE-Shortcuts=Alt+Ctrl+Shift+Delete+PageDown + +[Desktop Action RebootNoConfirm] +Exec=qdbus org.kde.Shutdown /Shutdown org.kde.Shutdown.logoutAndReboot +Name=Log Out Without Confirmation +X-KDE-Shortcuts=Alt+Ctrl+Shift+Delete+PageUp