Commit e1ad33c6 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

Revert "Integrate the normal keyboard layout switcher"

I didn't mean to land this yet

This reverts commit f2e579f9.
parent 8b2f75f1
......@@ -32,8 +32,6 @@ Item {
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) {
......@@ -44,9 +42,22 @@ Item {
}
}
function iconPath(p) {
if (p.length > 0) {
if (p[0] === '/') {
return p;
} else {
return "image://icon/" + p;
}
}
return p;
}
PlasmaCore.IconItem {
id: imageIcon
anchors.fill: parent
anchors.centerIn: parent
width: iconSize
height: iconSize
scale: mouseArea.pressed ? 0.9 : 1
source: statusIcon.icon
visible: statusIcon.icon.length > 0
......@@ -55,10 +66,12 @@ Item {
}
PlasmaComponents.Label {
id: textIcon
anchors.fill: parent
anchors.centerIn: parent
width: iconSize
height: iconSize
scale: (mouseArea.pressed ? 0.9 : 1)
// a reasonable large size to make Text.Fit work
minimumPointSize: theme.smallestFont.pointSize
minimumPointSize: 0
font.pointSize: 1024
fontSizeMode: Text.Fit
verticalAlignment: Text.AlignVCenter
......
......@@ -22,7 +22,6 @@ import org.kde.plasma.plasmoid 2.0
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
......@@ -44,30 +43,11 @@ Item {
id: items
width: parent.width
height: parent.height
anchors.centerIn: parent
x: (parent.width - childrenRect.width) / 2
y: (parent.height - childrenRect.height) / 2
flow: kimpanel.vertical ? Flow.LeftToRight : Flow.TopToBottom
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()
}
}
property int iconSize: Math.min(units.iconSizeHints.panel, units.roundToIconSize(Math.min(width, height)))
Repeater {
model: ListModel {
......@@ -75,20 +55,28 @@ Item {
dynamicRoles: true
}
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});
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});
}
}
}
}
......
......@@ -34,7 +34,50 @@ kickoff.writeConfig("global", "Alt+F1")
//panel.addWidget("org.kde.plasma.showActivityManager")
panel.addWidget("org.kde.plasma.pager")
panel.addWidget("org.kde.plasma.taskmanager")
panel.addWidget("org.kde.plasma.kimpanel");
/* 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.systemtray")
panel.addWidget("org.kde.plasma.digitalclock")
panel.addWidget("org.kde.plasma.showdesktop")
......
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