diff --git a/applets/kimpanel/package/contents/ui/StatusIcon.qml b/applets/kimpanel/package/contents/ui/StatusIcon.qml --- a/applets/kimpanel/package/contents/ui/StatusIcon.qml +++ b/applets/kimpanel/package/contents/ui/StatusIcon.qml @@ -32,6 +32,8 @@ signal triggered(variant button); property int iconSize: units.roundToIconSize(Math.min(parent.width, parent.height)) + width: iconSize + height: iconSize opacity: 'disable' == hint ? 0.3 : 1 function extractLabelString(l) { @@ -42,36 +44,21 @@ } } - function iconPath(p) { - if (p.length > 0) { - if (p[0] === '/') { - return p; - } else { - return "image://icon/" + p; - } - } - return p; - } - PlasmaCore.IconItem { id: imageIcon - anchors.centerIn: parent - width: iconSize - height: iconSize + anchors.fill: parent scale: mouseArea.pressed ? 0.9 : 1 source: statusIcon.icon visible: statusIcon.icon.length > 0 animated: false // active: mouseArea.containsMouse } PlasmaComponents.Label { id: textIcon - anchors.centerIn: parent - width: iconSize - height: iconSize + anchors.fill: parent scale: (mouseArea.pressed ? 0.9 : 1) // a reasonable large size to make Text.Fit work - minimumPointSize: 0 + minimumPointSize: theme.smallestFont.pointSize font.pointSize: 1024 fontSizeMode: Text.Fit verticalAlignment: Text.AlignVCenter diff --git a/applets/kimpanel/package/contents/ui/main.qml b/applets/kimpanel/package/contents/ui/main.qml --- a/applets/kimpanel/package/contents/ui/main.qml +++ b/applets/kimpanel/package/contents/ui/main.qml @@ -22,6 +22,7 @@ import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.kquickcontrolsaddons 2.0 +import org.kde.plasma.workspace.keyboardlayout 1.0 Item { id: kimpanel @@ -43,40 +44,51 @@ id: items width: parent.width height: parent.height - x: (parent.width - childrenRect.width) / 2 - y: (parent.height - childrenRect.height) / 2 + anchors.centerIn: parent flow: kimpanel.vertical ? Flow.LeftToRight : Flow.TopToBottom - property int iconSize: Math.min(units.iconSizeHints.panel, units.roundToIconSize(Math.min(width, height))) + property int iconSize: units.roundToIconSize(Math.min(width, height)) + + StatusIcon { + readonly property QtObject kl: KeyboardLayout { + id: layout + function nextLayout() { + var layouts = layout.layouts; + var index = (layouts.indexOf(layout.currentLayout)+1) % layouts.length; + layout.currentLayout = layouts[index]; + } + } + + width: visible ? items.iconSize : 0 + height: items.iconSize + visible: list.count === 0 + label: layout.currentLayout.substr(0, 2).toLowerCase() + tip: layout.currentLayout + onTriggered: if (button === Qt.LeftButton) { + layout.nextLayout() + } + } Repeater { model: ListModel { id: list dynamicRoles: true } - delegate: Item { - id: iconDelegate - width: items.iconSize - height: items.iconSize - StatusIcon { - id: statusIcon - anchors.centerIn: parent - width: items.iconSize - height: items.iconSize - label: model.label - tip: model.tip - icon: model.icon - hint: model.hint - onTriggered : { - if (button === Qt.LeftButton) { - clickHandler(model.key); - // clickHandler will trigger the menu, but we have to wait for - // the menu data. So we have to set the visual parent ahead. - actionMenu.visualParent = statusIcon; - } else { - contextMenu.open(statusIcon, {key: model.key, label: model.label}); - } + delegate: StatusIcon { + id: statusIcon + label: model.label + tip: model.tip + icon: model.icon + hint: model.hint + onTriggered : { + if (button === Qt.LeftButton) { + clickHandler(model.key); + // clickHandler will trigger the menu, but we have to wait for + // the menu data. So we have to set the visual parent ahead. + actionMenu.visualParent = statusIcon; + } else { + contextMenu.open(statusIcon, {key: model.key, label: model.label}); } } } diff --git a/layout-templates/org.kde.plasma.desktop.defaultPanel/contents/layout.js b/layout-templates/org.kde.plasma.desktop.defaultPanel/contents/layout.js --- a/layout-templates/org.kde.plasma.desktop.defaultPanel/contents/layout.js +++ b/layout-templates/org.kde.plasma.desktop.defaultPanel/contents/layout.js @@ -34,50 +34,7 @@ //panel.addWidget("org.kde.plasma.showActivityManager") panel.addWidget("org.kde.plasma.pager") panel.addWidget("org.kde.plasma.taskmanager") - -/* Next up is determining whether to add the Input Method Panel - * widget to the panel or not. This is done based on whether - * the system locale's language id is a member of the following - * white list of languages which are known to pull in one of - * our supported IME backends when chosen during installation - * of common distributions. */ - -var langIds = ["as", // Assamese - "bn", // Bengali - "bo", // Tibetan - "brx", // Bodo - "doi", // Dogri - "gu", // Gujarati - "hi", // Hindi - "ja", // Japanese - "kn", // Kannada - "ko", // Korean - "kok", // Konkani - "ks", // Kashmiri - "lep", // Lepcha - "mai", // Maithili - "ml", // Malayalam - "mni", // Manipuri - "mr", // Marathi - "ne", // Nepali - "or", // Odia - "pa", // Punjabi - "sa", // Sanskrit - "sat", // Santali - "sd", // Sindhi - "si", // Sinhala - "ta", // Tamil - "te", // Telugu - "th", // Thai - "ur", // Urdu - "vi", // Vietnamese - "zh_CN", // Simplified Chinese - "zh_TW"] // Traditional Chinese - -if (langIds.indexOf(languageId) != -1) { - panel.addWidget("org.kde.plasma.kimpanel"); -} - +panel.addWidget("org.kde.plasma.kimpanel"); panel.addWidget("org.kde.plasma.systemtray") panel.addWidget("org.kde.plasma.digitalclock") panel.addWidget("org.kde.plasma.showdesktop")