Verified Commit d2bb4807 authored by ivan tkachenko's avatar ivan tkachenko
Browse files

[sddm-theme] Clean up footer buttons code

Component.onCompleted blocks were unnecessary and redundant.

This patch also cleans up QML code style, and swaps visible/text lines to
make both buttons code more similar.
parent fd41bbb5
......@@ -19,9 +19,6 @@ PlasmaComponents.ToolButton {
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Keyboard Layout: %1", keyboard.layouts[currentIndex].shortName)
visible: menu.count > 1 && !Qt.platform.pluginName.includes("wayland") // This menu needs porting to wayland https://github.com/sddm/sddm/issues/1528
Component.onCompleted: {
currentIndex = Qt.binding(() => keyboard.currentLayout);
}
checkable: true
checked: menu.opened
onToggled: {
......
......@@ -12,13 +12,12 @@ import org.kde.plasma.components 3.0 as PlasmaComponents
PlasmaComponents.ToolButton {
id: root
property int currentIndex: -1
visible: menu.count > 1
property int currentIndex: sessionModel.lastIndex
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Desktop Session: %1", instantiator.objectAt(currentIndex).text || "")
visible: menu.count > 1
Component.onCompleted: {
currentIndex = sessionModel.lastIndex
}
checkable: true
checked: menu.opened
onToggled: {
......@@ -29,7 +28,7 @@ PlasmaComponents.ToolButton {
}
}
signal sessionChanged
signal sessionChanged()
PlasmaComponents.Menu {
PlasmaCore.ColorScope.colorGroup: PlasmaCore.Theme.NormalColorGroup
......@@ -40,7 +39,7 @@ PlasmaComponents.ToolButton {
id: instantiator
model: sessionModel
onObjectAdded: menu.insertItem(index, object)
onObjectRemoved: menu.removeItem( object )
onObjectRemoved: menu.removeItem(object)
delegate: PlasmaComponents.MenuItem {
text: model.name
onTriggered: {
......
Supports Markdown
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