mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
shellsettings property for quicksettings columns
This change adds a property to the shellsettings plugin to allow changing the number of columns in the QuickSettings drawer in the top panel. It defaults to the current value, 3. This will allow us to accommodate for wider displays where the current drawer unnecessarily paginates (and thus hides some of) the quicksettings. Minimum is still 3 since that it computes in the drawer code (and currently not necessary to change), maximum is somewhat arbitrarily, 7. Signed-off-by: Sebastian Kügler <sebas@kde.org>
This commit is contained in:
parent
074007ef48
commit
f23264e451
3 changed files with 51 additions and 0 deletions
|
|
@ -19,6 +19,7 @@
|
||||||
const QString CONFIG_FILE = QStringLiteral("plasmamobilerc");
|
const QString CONFIG_FILE = QStringLiteral("plasmamobilerc");
|
||||||
const QString GENERAL_CONFIG_GROUP = QStringLiteral("General");
|
const QString GENERAL_CONFIG_GROUP = QStringLiteral("General");
|
||||||
const QString LOCKSCREEN_CONFIG_GROUP = QStringLiteral("Lockscreen");
|
const QString LOCKSCREEN_CONFIG_GROUP = QStringLiteral("Lockscreen");
|
||||||
|
const QString QUICKSETTINGS_CONFIG_GROUP = QStringLiteral("QuickSettings");
|
||||||
|
|
||||||
MobileShellSettings::MobileShellSettings(QObject *parent)
|
MobileShellSettings::MobileShellSettings(QObject *parent)
|
||||||
: QObject{parent}
|
: QObject{parent}
|
||||||
|
|
@ -48,6 +49,9 @@ MobileShellSettings::MobileShellSettings(QObject *parent)
|
||||||
Q_EMIT lockscreenLeftButtonActionChanged();
|
Q_EMIT lockscreenLeftButtonActionChanged();
|
||||||
Q_EMIT lockscreenRightButtonActionChanged();
|
Q_EMIT lockscreenRightButtonActionChanged();
|
||||||
}
|
}
|
||||||
|
if (group.name() == QUICKSETTINGS_CONFIG_GROUP) {
|
||||||
|
Q_EMIT quickSettingsColumnsChanged();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -170,6 +174,19 @@ void MobileShellSettings::setActionDrawerTopLeftMode(ActionDrawerMode actionDraw
|
||||||
m_config->sync();
|
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
|
MobileShellSettings::ActionDrawerMode MobileShellSettings::actionDrawerTopRightMode() const
|
||||||
{
|
{
|
||||||
auto group = KConfigGroup{m_config, GENERAL_CONFIG_GROUP};
|
auto group = KConfigGroup{m_config, GENERAL_CONFIG_GROUP};
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,9 @@ class MobileShellSettings : public QObject
|
||||||
Q_PROPERTY(ActionDrawerMode actionDrawerTopLeftMode READ actionDrawerTopLeftMode WRITE setActionDrawerTopLeftMode NOTIFY actionDrawerTopLeftModeChanged)
|
Q_PROPERTY(ActionDrawerMode actionDrawerTopLeftMode READ actionDrawerTopLeftMode WRITE setActionDrawerTopLeftMode NOTIFY actionDrawerTopLeftModeChanged)
|
||||||
Q_PROPERTY(ActionDrawerMode actionDrawerTopRightMode READ actionDrawerTopRightMode WRITE setActionDrawerTopRightMode NOTIFY actionDrawerTopRightModeChanged)
|
Q_PROPERTY(ActionDrawerMode actionDrawerTopRightMode READ actionDrawerTopRightMode WRITE setActionDrawerTopRightMode NOTIFY actionDrawerTopRightModeChanged)
|
||||||
|
|
||||||
|
// quicksettings
|
||||||
|
Q_PROPERTY(int quickSettingsColumns READ quickSettingsColumns WRITE setQuickSettingsColumns NOTIFY quickSettingsColumnsChanged)
|
||||||
|
|
||||||
// convergence mode
|
// convergence mode
|
||||||
Q_PROPERTY(bool convergenceModeEnabled READ convergenceModeEnabled WRITE setConvergenceModeEnabled NOTIFY convergenceModeEnabledChanged)
|
Q_PROPERTY(bool convergenceModeEnabled READ convergenceModeEnabled WRITE setConvergenceModeEnabled NOTIFY convergenceModeEnabledChanged)
|
||||||
|
|
||||||
|
|
@ -210,6 +213,18 @@ public:
|
||||||
*/
|
*/
|
||||||
void setActionDrawerTopRightMode(ActionDrawerMode actionDrawerMode);
|
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.
|
* Whether convergence/docked mode is enabled.
|
||||||
*/
|
*/
|
||||||
|
|
@ -276,6 +291,7 @@ Q_SIGNALS:
|
||||||
void taskSwitcherPreviewsEnabledChanged();
|
void taskSwitcherPreviewsEnabledChanged();
|
||||||
void actionDrawerTopLeftModeChanged();
|
void actionDrawerTopLeftModeChanged();
|
||||||
void actionDrawerTopRightModeChanged();
|
void actionDrawerTopRightModeChanged();
|
||||||
|
void quickSettingsColumnsChanged();
|
||||||
void convergenceModeEnabledChanged();
|
void convergenceModeEnabledChanged();
|
||||||
void autoHidePanelsEnabledChanged();
|
void autoHidePanelsEnabledChanged();
|
||||||
void allowLogoutChanged();
|
void allowLogoutChanged();
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import org.kde.kirigami 2.19 as Kirigami
|
||||||
import org.kde.kcmutils as KCM
|
import org.kde.kcmutils as KCM
|
||||||
import org.kde.kirigamiaddons.formcard as FormCard
|
import org.kde.kirigamiaddons.formcard as FormCard
|
||||||
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||||
|
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
|
||||||
|
|
||||||
FormCard.FormCardPage {
|
FormCard.FormCardPage {
|
||||||
id: root
|
id: root
|
||||||
|
|
@ -72,6 +73,23 @@ FormCard.FormCardPage {
|
||||||
visible: enabledRepeater.count > 0
|
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 {
|
FormCard.FormSectionText {
|
||||||
text: i18n("Customize the order of quick settings in the pull-down panel and hide them.")
|
text: i18n("Customize the order of quick settings in the pull-down panel and hide them.")
|
||||||
visible: enabledRepeater.count > 0
|
visible: enabledRepeater.count > 0
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue