virtualkeyboard-kcm: Port to FormCard

This commit is contained in:
Carl Schwan 2023-09-21 21:12:47 +02:00
parent c864d9f5e1
commit 595db85a04
No known key found for this signature in database
GPG key ID: 02325448204E452A

View file

@ -12,7 +12,7 @@ import QtQuick.Controls 2.11 as QQC2
import org.kde.kirigami 2.19 as Kirigami import org.kde.kirigami 2.19 as Kirigami
import org.kde.kcmutils as KCM import org.kde.kcmutils as KCM
import org.kde.kitemmodels 1.0 as KItemModel 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 { KCM.SimpleKCM {
id: root id: root
@ -21,44 +21,27 @@ KCM.SimpleKCM {
leftPadding: 0 leftPadding: 0
rightPadding: 0 rightPadding: 0
topPadding: Kirigami.Units.gridUnit topPadding: 0
bottomPadding: Kirigami.Units.gridUnit bottomPadding: Kirigami.Units.gridUnit
ColumnLayout { ColumnLayout {
spacing: 0 spacing: 0
width: parent.width width: parent.width
MobileForm.FormCard { FormCard.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…")
}
}
}
}
}
MobileForm.FormCard {
Layout.topMargin: Kirigami.Units.gridUnit Layout.topMargin: Kirigami.Units.gridUnit
Layout.fillWidth: true
contentItem: ColumnLayout { FormCard.FormTextFieldDelegate {
spacing: 0 label: i18n("Type anything here…")
}
MobileForm.FormCardHeader {
title: "Feedback"
} }
MobileForm.FormSwitchDelegate { FormCard.FormHeader {
title: i18nc("@title:group", "Feedback")
}
FormCard.FormCard {
FormCard.FormSwitchDelegate {
id: firstFeedbackCheckBox id: firstFeedbackCheckBox
text: i18n("Sound") text: i18n("Sound")
description: i18n("Whether to emit a sound on keypress.") description: i18n("Whether to emit a sound on keypress.")
@ -66,9 +49,9 @@ KCM.SimpleKCM {
onCheckedChanged: kcm.soundFeedback = checked; onCheckedChanged: kcm.soundFeedback = checked;
} }
MobileForm.FormDelegateSeparator { above: firstFeedbackCheckBox; below: secondFeedbackCheckBox } FormCard.FormDelegateSeparator { above: firstFeedbackCheckBox; below: secondFeedbackCheckBox }
MobileForm.FormSwitchDelegate { FormCard.FormSwitchDelegate {
id: secondFeedbackCheckBox id: secondFeedbackCheckBox
text: i18n("Vibration") text: i18n("Vibration")
description: i18n("Whether to vibrate on keypress.") description: i18n("Whether to vibrate on keypress.")
@ -76,47 +59,41 @@ KCM.SimpleKCM {
onCheckedChanged: kcm.vibrateFeedback = checked; onCheckedChanged: kcm.vibrateFeedback = checked;
} }
} }
FormCard.FormHeader {
title: i18nc("@title:group", "Text Correction")
} }
MobileForm.FormCard { FormCard.FormCard {
Layout.topMargin: Kirigami.Units.gridUnit
Layout.fillWidth: true
contentItem: ColumnLayout { FormCard.FormCheckDelegate {
spacing: 0
MobileForm.FormCardHeader {
title: "Text Correction"
}
MobileForm.FormCheckDelegate {
id: firstTextCorrectionCheckBox id: firstTextCorrectionCheckBox
text: i18n("Check spelling of entered text") text: i18n("Check spelling of entered text")
checked: kcm.spellCheck checked: kcm.spellCheck
onCheckedChanged: kcm.spellCheck = checked; onCheckedChanged: kcm.spellCheck = checked;
} }
MobileForm.FormDelegateSeparator { above: firstTextCorrectionCheckBox; below: capitalizeCheck } FormCard.FormDelegateSeparator { above: firstTextCorrectionCheckBox; below: capitalizeCheck }
MobileForm.FormCheckDelegate { FormCard.FormCheckDelegate {
id: capitalizeCheck id: capitalizeCheck
text: i18n("Capitalize the first letter of each sentence") text: i18n("Capitalize the first letter of each sentence")
checked: kcm.autoCapitalize checked: kcm.autoCapitalize
onCheckedChanged: kcm.autoCapitalize = checked; onCheckedChanged: kcm.autoCapitalize = checked;
} }
MobileForm.FormDelegateSeparator { above: capitalizeCheck; below: wordCompletionCheck } FormCard.FormDelegateSeparator { above: capitalizeCheck; below: wordCompletionCheck }
MobileForm.FormCheckDelegate { FormCard.FormCheckDelegate {
id: wordCompletionCheck id: wordCompletionCheck
text: i18n("Complete current word with first suggestion when hitting space") text: i18n("Complete current word with first suggestion when hitting space")
checked: kcm.autoCompleteOnSpace checked: kcm.autoCompleteOnSpace
onCheckedChanged: kcm.autoCompleteOnSpace = checked; onCheckedChanged: kcm.autoCompleteOnSpace = checked;
} }
MobileForm.FormDelegateSeparator { above: wordCompletionCheck; below: wordSuggestionCheck } FormCard.FormDelegateSeparator { above: wordCompletionCheck; below: wordSuggestionCheck }
MobileForm.FormCheckDelegate { FormCard.FormCheckDelegate {
id: wordSuggestionCheck id: wordSuggestionCheck
text: i18n("Suggest potential words in word ribbon") text: i18n("Suggest potential words in word ribbon")
checked: kcm.showSuggestions checked: kcm.showSuggestions
@ -125,9 +102,9 @@ KCM.SimpleKCM {
} }
} }
MobileForm.FormDelegateSeparator { above: wordSuggestionCheck; below: fullStopCheck } FormCard.FormDelegateSeparator { above: wordSuggestionCheck; below: fullStopCheck }
MobileForm.FormCheckDelegate { FormCard.FormCheckDelegate {
id: fullStopCheck id: fullStopCheck
text: i18n("Insert a full-stop when space is pressed twice") text: i18n("Insert a full-stop when space is pressed twice")
checked: kcm.fullStopOnDoubleSpace checked: kcm.fullStopOnDoubleSpace
@ -136,9 +113,9 @@ KCM.SimpleKCM {
} }
} }
MobileForm.FormDelegateSeparator { above: fullStopCheck; below: languageButton } FormCard.FormDelegateSeparator { above: fullStopCheck; below: languageButton }
MobileForm.FormButtonDelegate { FormCard.FormButtonDelegate {
id: languageButton id: languageButton
text: i18n("Configure Languages") text: i18n("Configure Languages")
icon.name: "set-language" icon.name: "set-language"
@ -146,5 +123,4 @@ KCM.SimpleKCM {
} }
} }
} }
}
} }