diff --git a/components/shellsettingsplugin/mobileshellsettings.cpp b/components/shellsettingsplugin/mobileshellsettings.cpp index 4e8efdf9..624f9077 100644 --- a/components/shellsettingsplugin/mobileshellsettings.cpp +++ b/components/shellsettingsplugin/mobileshellsettings.cpp @@ -19,6 +19,7 @@ const QString CONFIG_FILE = QStringLiteral("plasmamobilerc"); const QString GENERAL_CONFIG_GROUP = QStringLiteral("General"); const QString LOCKSCREEN_CONFIG_GROUP = QStringLiteral("Lockscreen"); +const QString QUICKSETTINGS_CONFIG_GROUP = QStringLiteral("QuickSettings"); MobileShellSettings::MobileShellSettings(QObject *parent) : QObject{parent} @@ -48,6 +49,9 @@ MobileShellSettings::MobileShellSettings(QObject *parent) Q_EMIT lockscreenLeftButtonActionChanged(); Q_EMIT lockscreenRightButtonActionChanged(); } + if (group.name() == QUICKSETTINGS_CONFIG_GROUP) { + Q_EMIT quickSettingsColumnsChanged(); + } }); } @@ -170,6 +174,19 @@ void MobileShellSettings::setActionDrawerTopLeftMode(ActionDrawerMode actionDraw m_config->sync(); } +int MobileShellSettings::quickSettingsColumns() const +{ + auto group = KConfigGroup{m_config, QUICKSETTINGS_CONFIG_GROUP}; + return group.readEntry("quickSettingsColumns", 3); +} + +void MobileShellSettings::setQuickSettingsColumns(int columns) +{ + auto group = KConfigGroup{m_config, QUICKSETTINGS_CONFIG_GROUP}; + group.writeEntry("quickSettingsColumns", columns, KConfigGroup::Notify); + m_config->sync(); +} + MobileShellSettings::ActionDrawerMode MobileShellSettings::actionDrawerTopRightMode() const { auto group = KConfigGroup{m_config, GENERAL_CONFIG_GROUP}; diff --git a/components/shellsettingsplugin/mobileshellsettings.h b/components/shellsettingsplugin/mobileshellsettings.h index 46e4616c..4b3f5fc0 100644 --- a/components/shellsettingsplugin/mobileshellsettings.h +++ b/components/shellsettingsplugin/mobileshellsettings.h @@ -42,6 +42,9 @@ class MobileShellSettings : public QObject Q_PROPERTY(ActionDrawerMode actionDrawerTopLeftMode READ actionDrawerTopLeftMode WRITE setActionDrawerTopLeftMode NOTIFY actionDrawerTopLeftModeChanged) Q_PROPERTY(ActionDrawerMode actionDrawerTopRightMode READ actionDrawerTopRightMode WRITE setActionDrawerTopRightMode NOTIFY actionDrawerTopRightModeChanged) + // quicksettings + Q_PROPERTY(int quickSettingsColumns READ quickSettingsColumns WRITE setQuickSettingsColumns NOTIFY quickSettingsColumnsChanged) + // convergence mode Q_PROPERTY(bool convergenceModeEnabled READ convergenceModeEnabled WRITE setConvergenceModeEnabled NOTIFY convergenceModeEnabledChanged) @@ -210,6 +213,18 @@ public: */ void setActionDrawerTopRightMode(ActionDrawerMode actionDrawerMode); + /** + * The number of columns to use for the QuickSettings drawer. + */ + int quickSettingsColumns() const; + + /** + * Set the number of columns to use for the QuickSettings drawer. + * + * @param columns The number of columns to use. + */ + void setQuickSettingsColumns(int columns); + /** * Whether convergence/docked mode is enabled. */ @@ -276,6 +291,7 @@ Q_SIGNALS: void taskSwitcherPreviewsEnabledChanged(); void actionDrawerTopLeftModeChanged(); void actionDrawerTopRightModeChanged(); + void quickSettingsColumnsChanged(); void convergenceModeEnabledChanged(); void autoHidePanelsEnabledChanged(); void allowLogoutChanged(); diff --git a/kcms/mobileshell/ui/QuickSettingsForm.qml b/kcms/mobileshell/ui/QuickSettingsForm.qml index bcd6c313..b10961a9 100644 --- a/kcms/mobileshell/ui/QuickSettingsForm.qml +++ b/kcms/mobileshell/ui/QuickSettingsForm.qml @@ -11,6 +11,7 @@ import org.kde.kirigami 2.19 as Kirigami import org.kde.kcmutils as KCM import org.kde.kirigamiaddons.formcard as FormCard import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS +import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings FormCard.FormCardPage { id: root @@ -72,6 +73,23 @@ FormCard.FormCardPage { visible: enabledRepeater.count > 0 } + FormCard.FormCard { + FormCard.FormComboBoxDelegate { + id: statusBarScaleFactorDelegate + + text: i18n("Quick Settings Columns") + description: i18n("Maximum number of columns in landscape orientation.") + + model: [3, 4, 5, 6] + + Component.onCompleted: { + currentIndex = indexOfValue(ShellSettings.Settings.quickSettingsColumns); + dialog.parent = root; + } + onCurrentValueChanged: ShellSettings.Settings.quickSettingsColumns = currentValue + } + } + FormCard.FormSectionText { text: i18n("Customize the order of quick settings in the pull-down panel and hide them.") visible: enabledRepeater.count > 0