Commit 0c65f91e authored by Andrey Butirsky's avatar Andrey Butirsky

feat: flags support for Keyboard Layout applet

This still relies on deprecated kdelibs4support library.
Should be ported to Emoji flags or standard-compliant theme:
frameworks/breeze-icons#1
https://phabricator.kde.org/T13722

FEATURE:
CCBUG: 390079
parent 6b673cfd
import QtQuick 2.12
import org.kde.plasma.configuration 2.0
ConfigModel {
ConfigCategory {
name: i18n("General")
icon: "configure"
source: "configGeneral.qml"
}
}
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd">
<kcfgfile name=""/>
<group name="General">
<entry name="showFlag" type="Bool"/>
</group>
</kcfg>
import QtQuick 2.12
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.12
import org.kde.kirigami 2.5 as Kirigami
Kirigami.FormLayout {
CheckBox {
checked: plasmoid.configuration.showFlag
onCheckedChanged: plasmoid.configuration.showFlag = checked
text: "Show flag"
}
}
......@@ -4,6 +4,8 @@
*/
import QtQuick 2.12
import QtQuick.Controls 2.15
import Qt.labs.platform 1.1
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.workspace.components 2.0
......@@ -11,12 +13,12 @@ import org.kde.plasma.workspace.components 2.0
KeyboardLayoutButton {
text: layout.layoutDisplayName
Plasmoid.toolTipSubText: layout.layoutLongName
// TODO: add flag support
icon.name: ""
Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
icon.name: StandardPaths.locate(StandardPaths.GenericDataLocation,
"kf5/locale/countries/" + layout.layoutDisplayName + "/flag.png")
display: plasmoid.configuration.showFlag && icon.name ? AbstractButton.IconOnly : AbstractButton.TextOnly
Plasmoid.status: hasMultipleKeyboardLayouts ? PlasmaCore.Types.ActiveStatus : PlasmaCore.Types.HiddenStatus
Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
Connections {
target: layout
......@@ -25,7 +27,8 @@ KeyboardLayoutButton {
layout.layouts.forEach(
function(layoutID) {
plasmoid.setAction(layoutID, layoutID)
// TODO: add layoutDisplayName to layouts and lookup icon.name by index here
plasmoid.setAction(layoutID, layoutID /* ,icon.name */)
}
)
}
......
Markdown is supported
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