From 595db85a0426583fc266f1a1ec60552dec00437d Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Thu, 21 Sep 2023 21:12:47 +0200 Subject: [PATCH] virtualkeyboard-kcm: Port to FormCard --- kcms/virtualkeyboard/ui/main.qml | 196 ++++++++++++++----------------- 1 file changed, 86 insertions(+), 110 deletions(-) diff --git a/kcms/virtualkeyboard/ui/main.qml b/kcms/virtualkeyboard/ui/main.qml index 3a4dda34..6fe95ee1 100644 --- a/kcms/virtualkeyboard/ui/main.qml +++ b/kcms/virtualkeyboard/ui/main.qml @@ -12,7 +12,7 @@ import QtQuick.Controls 2.11 as QQC2 import org.kde.kirigami 2.19 as Kirigami import org.kde.kcmutils as KCM import org.kde.kitemmodels 1.0 as KItemModel -import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm +import org.kde.kirigamiaddons.formcard 1.0 as FormCard KCM.SimpleKCM { id: root @@ -21,130 +21,106 @@ KCM.SimpleKCM { leftPadding: 0 rightPadding: 0 - topPadding: Kirigami.Units.gridUnit + topPadding: 0 bottomPadding: Kirigami.Units.gridUnit - + ColumnLayout { spacing: 0 width: parent.width - - MobileForm.FormCard { - Layout.fillWidth: true - - contentItem: ColumnLayout { - spacing: 0 - - MobileForm.AbstractFormDelegate { - Layout.fillWidth: true - background: Item {} - contentItem: RowLayout { - QQC2.TextField { - Layout.fillWidth: true - placeholderText: i18n("Type anything here…") - } - } - } + + FormCard.FormCard { + Layout.topMargin: Kirigami.Units.gridUnit + + FormCard.FormTextFieldDelegate { + label: i18n("Type anything here…") } } - - MobileForm.FormCard { - Layout.topMargin: Kirigami.Units.gridUnit - Layout.fillWidth: true - - contentItem: ColumnLayout { - spacing: 0 - - MobileForm.FormCardHeader { - title: "Feedback" - } - - MobileForm.FormSwitchDelegate { - id: firstFeedbackCheckBox - text: i18n("Sound") - description: i18n("Whether to emit a sound on keypress.") - checked: kcm.soundFeedback - onCheckedChanged: kcm.soundFeedback = checked; - } - MobileForm.FormDelegateSeparator { above: firstFeedbackCheckBox; below: secondFeedbackCheckBox } - - MobileForm.FormSwitchDelegate { - id: secondFeedbackCheckBox - text: i18n("Vibration") - description: i18n("Whether to vibrate on keypress.") - checked: kcm.vibrateFeedback - onCheckedChanged: kcm.vibrateFeedback = checked; - } + FormCard.FormHeader { + title: i18nc("@title:group", "Feedback") + } + + FormCard.FormCard { + FormCard.FormSwitchDelegate { + id: firstFeedbackCheckBox + text: i18n("Sound") + description: i18n("Whether to emit a sound on keypress.") + checked: kcm.soundFeedback + onCheckedChanged: kcm.soundFeedback = checked; + } + + FormCard.FormDelegateSeparator { above: firstFeedbackCheckBox; below: secondFeedbackCheckBox } + + FormCard.FormSwitchDelegate { + id: secondFeedbackCheckBox + text: i18n("Vibration") + description: i18n("Whether to vibrate on keypress.") + checked: kcm.vibrateFeedback + onCheckedChanged: kcm.vibrateFeedback = checked; } } - - MobileForm.FormCard { - Layout.topMargin: Kirigami.Units.gridUnit - Layout.fillWidth: true - - contentItem: ColumnLayout { - spacing: 0 - - MobileForm.FormCardHeader { - title: "Text Correction" - } - - MobileForm.FormCheckDelegate { - id: firstTextCorrectionCheckBox - text: i18n("Check spelling of entered text") - checked: kcm.spellCheck - onCheckedChanged: kcm.spellCheck = checked; - } - - MobileForm.FormDelegateSeparator { above: firstTextCorrectionCheckBox; below: capitalizeCheck } - MobileForm.FormCheckDelegate { - id: capitalizeCheck - text: i18n("Capitalize the first letter of each sentence") - checked: kcm.autoCapitalize - onCheckedChanged: kcm.autoCapitalize = checked; - } - - MobileForm.FormDelegateSeparator { above: capitalizeCheck; below: wordCompletionCheck } + FormCard.FormHeader { + title: i18nc("@title:group", "Text Correction") + } - MobileForm.FormCheckDelegate { - id: wordCompletionCheck - text: i18n("Complete current word with first suggestion when hitting space") - checked: kcm.autoCompleteOnSpace - onCheckedChanged: kcm.autoCompleteOnSpace = checked; - } - - MobileForm.FormDelegateSeparator { above: wordCompletionCheck; below: wordSuggestionCheck } + FormCard.FormCard { - MobileForm.FormCheckDelegate { - id: wordSuggestionCheck - text: i18n("Suggest potential words in word ribbon") - checked: kcm.showSuggestions - onCheckedChanged: { - kcm.showSuggestions = checked; - } + FormCard.FormCheckDelegate { + id: firstTextCorrectionCheckBox + text: i18n("Check spelling of entered text") + checked: kcm.spellCheck + onCheckedChanged: kcm.spellCheck = checked; + } + + FormCard.FormDelegateSeparator { above: firstTextCorrectionCheckBox; below: capitalizeCheck } + + FormCard.FormCheckDelegate { + id: capitalizeCheck + text: i18n("Capitalize the first letter of each sentence") + checked: kcm.autoCapitalize + onCheckedChanged: kcm.autoCapitalize = checked; + } + + FormCard.FormDelegateSeparator { above: capitalizeCheck; below: wordCompletionCheck } + + FormCard.FormCheckDelegate { + id: wordCompletionCheck + text: i18n("Complete current word with first suggestion when hitting space") + checked: kcm.autoCompleteOnSpace + onCheckedChanged: kcm.autoCompleteOnSpace = checked; + } + + FormCard.FormDelegateSeparator { above: wordCompletionCheck; below: wordSuggestionCheck } + + FormCard.FormCheckDelegate { + id: wordSuggestionCheck + text: i18n("Suggest potential words in word ribbon") + checked: kcm.showSuggestions + onCheckedChanged: { + kcm.showSuggestions = checked; } - - MobileForm.FormDelegateSeparator { above: wordSuggestionCheck; below: fullStopCheck } - - MobileForm.FormCheckDelegate { - id: fullStopCheck - text: i18n("Insert a full-stop when space is pressed twice") - checked: kcm.fullStopOnDoubleSpace - onCheckedChanged: { - kcm.fullStopOnDoubleSpace = checked; - } - } - - MobileForm.FormDelegateSeparator { above: fullStopCheck; below: languageButton } - - MobileForm.FormButtonDelegate { - id: languageButton - text: i18n("Configure Languages") - icon.name: "set-language" - onClicked: kcm.push("languages.qml") + } + + FormCard.FormDelegateSeparator { above: wordSuggestionCheck; below: fullStopCheck } + + FormCard.FormCheckDelegate { + id: fullStopCheck + text: i18n("Insert a full-stop when space is pressed twice") + checked: kcm.fullStopOnDoubleSpace + onCheckedChanged: { + kcm.fullStopOnDoubleSpace = checked; } } + + FormCard.FormDelegateSeparator { above: fullStopCheck; below: languageButton } + + FormCard.FormButtonDelegate { + id: languageButton + text: i18n("Configure Languages") + icon.name: "set-language" + onClicked: kcm.push("languages.qml") + } } } }