Commit da00e533 authored by Nate Graham's avatar Nate Graham
Browse files

applets/keyboardlayout: fix bugs in display styles

This commit fixes the following bugs:

1. The text preview is no longer unconditionally made uppercase, so now
   it actually matches what will be displayed in the applet.
2. The text preview no longer always displays the short name even if the
   user set a custom display name, so now it actually matches what will
   be displayed in the applet.
3. When the current layout has no flag defined, the flag preview now
   displays a "no flag available" placeholder warning text, rather than
   nothing at all, which made the UI look like something was missing (in
   fact, there was!).
parent 4ad7bd28
Pipeline #220440 passed with stage
in 5 minutes and 21 seconds
......@@ -12,20 +12,22 @@ Kirigami.FormLayout {
property alias cfg_showFlag: showFlag.checked
readonly property string layoutShortName: keyboardLayout.layoutsList.length ? keyboardLayout.layoutsList[keyboardLayout.layout].shortName
: ""
readonly property string displayName: keyboardLayout.layoutsList.length ? keyboardLayout.layoutsList[keyboardLayout.layout].displayName
: ""
KeyboardLayout { id: keyboardLayout }
RadioButton {
id: showLabel
Kirigami.FormData.label: i18n("Display style:")
checked: true
text: root.layoutShortName.toUpperCase()
text: root.displayName.length > 0 ? root.displayName: root.layoutShortName
RadioButton {
id: showFlag
contentItem: Item {
implicitWidth: flagImage.implicitWidth + showFlag.indicator.width
implicitHeight: flagImage.implicitHeight
implicitWidth: childrenRect.width + showFlag.indicator.width
implicitHeight: childrenRect.height
Image {
id: flagImage
......@@ -33,6 +35,24 @@ Kirigami.FormLayout {
anchors.verticalCenter: parent.verticalCenter
source: Platform.StandardPaths.locate(Platform.StandardPaths.GenericDataLocation,
"kf5/locale/countries/" + root.layoutShortName + "/flag.png")
visible: status == Image.Ready
RowLayout {
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
spacing: Kirigami.Units.smallSpacing
width: visible ? implicitWidth : 0
height: visible ? implicitHeight : 0
visible: !flagImage.visible
Kirigami.Icon {
implicitWidth: Kirigami.Units.iconSizes.smallMedium
implicitHeight: Kirigami.Units.iconSizes.smallMedium
source: "emblem-warning"
Label {
text: i18nc("@info:placeholder Make this translation as short as possible", "No flag available")
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment