mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
a mechanism for the toggle action
This commit is contained in:
parent
7263c9ac15
commit
129adccee6
2 changed files with 16 additions and 4 deletions
|
|
@ -42,7 +42,13 @@ RowLayout {
|
|||
MouseArea {
|
||||
id: iconMouseArea
|
||||
anchors.fill: parent
|
||||
onClicked: print("action of mouse area")
|
||||
onClicked: {
|
||||
if (model.toggleFunction) {
|
||||
root[model.toggleFunction]();
|
||||
} else if (model.settingsCommand) {
|
||||
plasmoid.nativeInterface.executeCommand(model.settingsCommand);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -64,6 +70,8 @@ RowLayout {
|
|||
onClicked: {
|
||||
if (model.settingsCommand) {
|
||||
plasmoid.nativeInterface.executeCommand(model.settingsCommand);
|
||||
} else if (model.toggleFunction) {
|
||||
root[model.toggleFunction]();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,10 +25,12 @@ import org.kde.plasma.plasmoid 2.0
|
|||
|
||||
|
||||
Item {
|
||||
id: bigClock
|
||||
id: root
|
||||
|
||||
function toggleAirplane() {
|
||||
print("toggle airplane mode")
|
||||
}
|
||||
|
||||
/*Layout.minimumWidth: implicitWidth
|
||||
Layout.minimumHeight: implicitHeight*/
|
||||
Plasmoid.preferredRepresentation: plasmoid.fullRepresentation
|
||||
|
||||
ListModel {
|
||||
|
|
@ -39,6 +41,7 @@ Item {
|
|||
icon: "configure"
|
||||
enabled: false
|
||||
settingsCommand: "active-settings"
|
||||
toggleFunction: ""
|
||||
}
|
||||
ListElement {
|
||||
text: "Mobile network"
|
||||
|
|
@ -51,6 +54,7 @@ Item {
|
|||
icon: "flightmode-on"
|
||||
enabled: false
|
||||
settingsCommand: ""
|
||||
toggleFunction: "toggleAirplane"
|
||||
}
|
||||
ListElement {
|
||||
text: "Bluetooth"
|
||||
|
|
|
|||
Loading…
Reference in a new issue