[shutdowndialog]: hide logout option config

This change adds a config entry in plasmamobilerc which allows to hide
the logout button in the shutdown dialog.
As mobile systems are often effectively single user, this makes sense
to offer in Plasma Mobile.

Signed-off-by: Sebastian Kügler <sebas@kde.org>
This commit is contained in:
Sebastian Kügler 2024-11-29 11:49:24 +01:00
parent ad1aa50b7b
commit 0d1f923b5e
3 changed files with 18 additions and 0 deletions

View file

@ -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);
}

View file

@ -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);

View file

@ -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);