Merge pull request #152 from Apxdono/lockscreen-kbd-layout-switch

Fix KeyboardLayoutButton in LockScreen
This commit is contained in:
Eliver L authored and GitHub committed 2021-08-28 14:59:12 -05:00
commit eb0b5bdf6a
2 files changed
+16 -54

No files matched your search

@@ -32,21 +32,31 @@ PlasmaComponents.ToolButton {
iconName: "input-keyboard"
implicitWidth: minimumWidth
text: layout.currentLayoutDisplayName
text: layout.layoutName()
font.pointSize: Math.max(fontSize,theme.defaultFont.pointSize)
Accessible.name: i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "Button to change keyboard layout", "Switch layout")
visible: layout.layouts.length > 1
visible: layout.shouldBeVisible()
onClicked: layout.nextLayout()
KeyboardLayout {
id: layout
function nextLayout() {
var layouts = layout.layouts;
var index = (layouts.indexOf(layout.currentLayout)+1) % layouts.length;
layout.currentLayout = layouts[index];
function nextLayout() {
layout.layout = (layout.layout + 1) % layout.layoutsList.length;
}
function shouldBeVisible() {
return layout.layoutsList.length > 1;
}
function layoutName() {
return (layout.isInitialized() && layout.layoutsList[layout.layout].displayName) || '';
}
function isInitialized() {
return layout.layoutsList.length > 0;
}
}
}