From 67904e212c4fde5870015c3b2bc3af41e648eb6c Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 30 May 2017 11:57:11 +0200 Subject: [PATCH] don't show logout when kauthorized doesn't want it BUG:380344 reviewed-by: kbroulik --- ksmserver/shutdowndlg.cpp | 2 ++ lookandfeel/contents/logout/Logout.qml | 1 + 2 files changed, 3 insertions(+) diff --git a/ksmserver/shutdowndlg.cpp b/ksmserver/shutdowndlg.cpp index 3fd9a1261..5e1fcf1d2 100644 --- a/ksmserver/shutdowndlg.cpp +++ b/ksmserver/shutdowndlg.cpp @@ -47,6 +47,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include +#include #include #include #include @@ -125,6 +126,7 @@ KSMShutdownDlg::KSMShutdownDlg( QWindow* parent, mapSpdMethods->insert(QStringLiteral("SuspendState"), QVariant::fromValue(spdMethods.contains(Solid::PowerManagement::SuspendState))); mapSpdMethods->insert(QStringLiteral("HibernateState"), QVariant::fromValue(spdMethods.contains(Solid::PowerManagement::HibernateState))); context->setContextProperty(QStringLiteral("spdMethods"), mapSpdMethods); + context->setContextProperty(QStringLiteral("canLogout"), KAuthorized::authorize(QStringLiteral("logout"))); QString bootManager = KConfig(QStringLiteral(KDE_CONFDIR "/kdm/kdmrc"), KConfig::SimpleConfig) .group("Shutdown") diff --git a/lookandfeel/contents/logout/Logout.qml b/lookandfeel/contents/logout/Logout.qml index 839c390fb..e9208f3c9 100644 --- a/lookandfeel/contents/logout/Logout.qml +++ b/lookandfeel/contents/logout/Logout.qml @@ -150,6 +150,7 @@ PlasmaCore.ColorScope { KeyNavigation.left: shutdownButton KeyNavigation.right: suspendButton focus: sdtype == ShutdownType.ShutdownTypeNone + visible: canLogout } }