Changeset View
Changeset View
Standalone View
Standalone View
lookandfeel/contents/components/KeyboardLayoutButton.qml
Show All 19 Lines | |||||
20 | import QtQuick 2.1 | 20 | import QtQuick 2.1 | ||
21 | import QtQuick.Controls 1.1 as QQC | 21 | import QtQuick.Controls 1.1 as QQC | ||
22 | 22 | | |||
23 | import org.kde.plasma.components 2.0 as PlasmaComponents | 23 | import org.kde.plasma.components 2.0 as PlasmaComponents | ||
24 | 24 | | |||
25 | import org.kde.plasma.workspace.keyboardlayout 1.0 | 25 | import org.kde.plasma.workspace.keyboardlayout 1.0 | ||
26 | 26 | | |||
27 | PlasmaComponents.ToolButton { | 27 | PlasmaComponents.ToolButton { | ||
28 | | ||||
29 | property int fontSize: config.fontSize | ||||
30 | | ||||
28 | id: kbLayoutButton | 31 | id: kbLayoutButton | ||
29 | 32 | | |||
30 | iconName: "input-keyboard" | 33 | iconName: "input-keyboard" | ||
31 | implicitWidth: minimumWidth | 34 | implicitWidth: minimumWidth | ||
32 | text: layout.currentLayoutDisplayName | 35 | text: layout.currentLayoutDisplayName | ||
36 | font.pointSize: Math.max(fontSize, theme.defaultFont.pointSize) | ||||
33 | 37 | | |||
34 | Accessible.name: i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "Button to change keyboard layout", "Switch layout") | 38 | Accessible.name: i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "Button to change keyboard layout", "Switch layout") | ||
35 | 39 | | |||
36 | visible: layout.layouts.length > 1 | 40 | visible: layout.layouts.length > 1 | ||
37 | 41 | | |||
38 | onClicked: layout.nextLayout() | 42 | onClicked: layout.nextLayout() | ||
39 | 43 | | |||
40 | KeyboardLayout { | 44 | KeyboardLayout { | ||
41 | id: layout | 45 | id: layout | ||
42 | function nextLayout() { | 46 | function nextLayout() { | ||
43 | var layouts = layout.layouts; | 47 | var layouts = layout.layouts; | ||
44 | var index = (layouts.indexOf(layout.currentLayout)+1) % layouts.length; | 48 | var index = (layouts.indexOf(layout.currentLayout)+1) % layouts.length; | ||
45 | layout.currentLayout = layouts[index]; | 49 | layout.currentLayout = layouts[index]; | ||
46 | } | 50 | } | ||
47 | } | 51 | } | ||
48 | } | 52 | } |