diff --git a/components/shellsettingsplugin/mobileshellsettings.cpp b/components/shellsettingsplugin/mobileshellsettings.cpp index 110eac55..f19aba6d 100644 --- a/components/shellsettingsplugin/mobileshellsettings.cpp +++ b/components/shellsettingsplugin/mobileshellsettings.cpp @@ -31,6 +31,7 @@ MobileShellSettings::MobileShellSettings(QObject *parent) Q_EMIT vibrationDurationChanged(); Q_EMIT animationsEnabledChanged(); Q_EMIT navigationPanelEnabledChanged(); + Q_EMIT alwaysShowKeyboardToggleOnNavigationPanelChanged(); Q_EMIT keyboardButtonEnabledChanged(); Q_EMIT taskSwitcherPreviewsEnabledChanged(); Q_EMIT actionDrawerTopLeftModeChanged(); @@ -107,6 +108,19 @@ void MobileShellSettings::setNavigationPanelEnabled(bool navigationPanelEnabled) updateNavigationBarsInPlasma(navigationPanelEnabled); } +bool MobileShellSettings::alwaysShowKeyboardToggleOnNavigationPanel() const +{ + auto group = KConfigGroup{m_config, GENERAL_CONFIG_GROUP}; + return group.readEntry("alwaysShowKeyboardToggleOnNavigationPanel", false); +} + +void MobileShellSettings::setAlwaysShowKeyboardToggleOnNavigationPanel(bool alwaysShowKeyboardToggleOnNavigationPanel) +{ + auto group = KConfigGroup{m_config, GENERAL_CONFIG_GROUP}; + group.writeEntry("alwaysShowKeyboardToggleOnNavigationPanel", alwaysShowKeyboardToggleOnNavigationPanel, KConfigGroup::Notify); + m_config->sync(); +} + MobileShellSettings::ActionDrawerMode MobileShellSettings::actionDrawerTopLeftMode() const { auto group = KConfigGroup{m_config, GENERAL_CONFIG_GROUP}; diff --git a/components/shellsettingsplugin/mobileshellsettings.h b/components/shellsettingsplugin/mobileshellsettings.h index 1a3c9e52..81e13f56 100644 --- a/components/shellsettingsplugin/mobileshellsettings.h +++ b/components/shellsettingsplugin/mobileshellsettings.h @@ -32,6 +32,8 @@ class MobileShellSettings : public QObject // navigation panel Q_PROPERTY(bool navigationPanelEnabled READ navigationPanelEnabled WRITE setNavigationPanelEnabled NOTIFY navigationPanelEnabledChanged) + Q_PROPERTY(bool alwaysShowKeyboardToggleOnNavigationPanel READ alwaysShowKeyboardToggleOnNavigationPanel WRITE setAlwaysShowKeyboardToggleOnNavigationPanel + NOTIFY alwaysShowKeyboardToggleOnNavigationPanelChanged) // action drawer Q_PROPERTY(ActionDrawerMode actionDrawerTopLeftMode READ actionDrawerTopLeftMode WRITE setActionDrawerTopLeftMode NOTIFY actionDrawerTopLeftModeChanged) @@ -117,6 +119,23 @@ public: */ void setNavigationPanelEnabled(bool navigationPanelEnabled); + /** + * Set whether the keyboard toggle button should always show on the navigation panel, regardless of + * whether the app properly supports virtual keyboards. + * + * If this is false, then the keyboard toggle only shows on the navigation panel if the app doesn't + * support virtual keyboards. + */ + bool alwaysShowKeyboardToggleOnNavigationPanel() const; + + /** + * Set whether the keyboard toggle button should always show on the navigation panel, regardless of + * whether the app properly supports virtual keyboards. + * + * @param alwaysShowKeyboardToggleOnNavigationPanel + */ + void setAlwaysShowKeyboardToggleOnNavigationPanel(bool alwaysShowKeyboardToggleOnNavigationPanel); + /** * The mode of the action drawer when swiped down from the top left. */ @@ -158,6 +177,7 @@ Q_SIGNALS: void vibrationIntensityChanged(); void vibrationDurationChanged(); void navigationPanelEnabledChanged(); + void alwaysShowKeyboardToggleOnNavigationPanelChanged(); void keyboardButtonEnabledChanged(); void animationsEnabledChanged(); void taskSwitcherPreviewsEnabledChanged(); diff --git a/containments/taskpanel/package/contents/ui/NavigationPanelComponent.qml b/containments/taskpanel/package/contents/ui/NavigationPanelComponent.qml index 58e76f3c..a5e517ad 100644 --- a/containments/taskpanel/package/contents/ui/NavigationPanelComponent.qml +++ b/containments/taskpanel/package/contents/ui/NavigationPanelComponent.qml @@ -13,6 +13,7 @@ import org.kde.plasma.private.mobileshell as MobileShell import org.kde.plasma.private.mobileshell.state as MobileShellState import org.kde.taskmanager as TaskManager import org.kde.plasma.private.mobileshell.windowplugin as WindowPlugin +import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings import org.kde.kirigami as Kirigami @@ -104,7 +105,8 @@ MobileShell.NavigationPanel { rightCornerAction: MobileShell.NavigationPanelAction { id: keyboardToggleAction - visible: Keyboards.KWinVirtualKeyboard.available && !Keyboards.KWinVirtualKeyboard.activeClientSupportsTextInput + visible: ShellSettings.Settings.alwaysShowKeyboardToggleOnNavigationPanel || + (Keyboards.KWinVirtualKeyboard.available && !Keyboards.KWinVirtualKeyboard.activeClientSupportsTextInput) enabled: true iconSource: "input-keyboard-virtual-symbolic" iconSizeFactor: 0.75 diff --git a/kcms/mobileshell/ui/main.qml b/kcms/mobileshell/ui/main.qml index 688a0b98..a24844a3 100644 --- a/kcms/mobileshell/ui/main.qml +++ b/kcms/mobileshell/ui/main.qml @@ -65,6 +65,21 @@ KCM.SimpleKCM { } } } + + FormCard.FormDelegateSeparator { visible: keyboardToggleDelegate.visible; above: gestureDelegate; below: keyboardToggleDelegate } + + FormCard.FormSwitchDelegate { + id: keyboardToggleDelegate + visible: !gestureDelegate.checked + text: i18n("Always show keyboard toggle") + description: i18n("Whether to always show the keyboard toggle button on the navigation panel.") + checked: ShellSettings.Settings.alwaysShowKeyboardToggleOnNavigationPanel + onCheckedChanged: { + if (checked != ShellSettings.Settings.alwaysShowKeyboardToggleOnNavigationPanel) { + ShellSettings.Settings.alwaysShowKeyboardToggleOnNavigationPanel = checked; + } + } + } } FormCard.FormHeader {