diff --git a/components/shellsettingsplugin/mobileshellsettings.cpp b/components/shellsettingsplugin/mobileshellsettings.cpp index f90ff7e2..b9e3fc8d 100644 --- a/components/shellsettingsplugin/mobileshellsettings.cpp +++ b/components/shellsettingsplugin/mobileshellsettings.cpp @@ -39,6 +39,7 @@ MobileShellSettings::MobileShellSettings(QObject *parent) Q_EMIT actionDrawerTopLeftModeChanged(); Q_EMIT actionDrawerTopRightModeChanged(); Q_EMIT convergenceModeEnabledChanged(); + Q_EMIT allowLogoutChanged(); } }); } @@ -217,3 +218,9 @@ void MobileShellSettings::updateNavigationBarsInPlasma(bool navigationPanelEnabl // TODO check for error response QDBusConnection::sessionBus().asyncCall(message); } + +bool MobileShellSettings::allowLogout() const +{ + auto group = KConfigGroup{m_config, GENERAL_CONFIG_GROUP}; + return group.readEntry("allowLogout", true); +} diff --git a/components/shellsettingsplugin/mobileshellsettings.h b/components/shellsettingsplugin/mobileshellsettings.h index d1c599e0..86194ece 100644 --- a/components/shellsettingsplugin/mobileshellsettings.h +++ b/components/shellsettingsplugin/mobileshellsettings.h @@ -45,6 +45,9 @@ class MobileShellSettings : public QObject // convergence mode Q_PROPERTY(bool convergenceModeEnabled READ convergenceModeEnabled WRITE setConvergenceModeEnabled NOTIFY convergenceModeEnabledChanged) + // logout dialog + Q_PROPERTY(bool allowLogout READ allowLogout READ allowLogout NOTIFY allowLogoutChanged) + public: MobileShellSettings(QObject *parent = nullptr); @@ -190,6 +193,11 @@ public: */ void setConvergenceModeEnabled(bool enabled); + /** + * Whether logout button is shown in the logout/shutdown dialog. + */ + bool allowLogout() const; + Q_SIGNALS: void vibrationsEnabledChanged(); void vibrationDurationChanged(); @@ -203,6 +211,7 @@ Q_SIGNALS: void actionDrawerTopLeftModeChanged(); void actionDrawerTopRightModeChanged(); void convergenceModeEnabledChanged(); + void allowLogoutChanged(); private: void updateNavigationBarsInPlasma(bool navigationPanelEnabled); diff --git a/lookandfeel/contents/logout/Logout.qml b/lookandfeel/contents/logout/Logout.qml index 6d269f3c..1bc0e7da 100644 --- a/lookandfeel/contents/logout/Logout.qml +++ b/lookandfeel/contents/logout/Logout.qml @@ -15,6 +15,7 @@ import org.kde.kirigami 2.20 as Kirigami import org.kde.coreaddons 1.0 as KCoreAddons import org.kde.plasma.private.sessions 2.0 +import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings Item { id: root @@ -156,6 +157,7 @@ Item { ActionButton { iconSource: "system-log-out" text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Log Out") + visible: ShellSettings.Settings.allowLogout onClicked: { closeAnim.closeToBlack = true; closeAnim.execute(root.logoutRequested);