mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03: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 {
|
MouseArea {
|
||||||
id: iconMouseArea
|
id: iconMouseArea
|
||||||
anchors.fill: parent
|
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: {
|
onClicked: {
|
||||||
if (model.settingsCommand) {
|
if (model.settingsCommand) {
|
||||||
plasmoid.nativeInterface.executeCommand(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 {
|
Item {
|
||||||
id: bigClock
|
id: root
|
||||||
|
|
||||||
|
function toggleAirplane() {
|
||||||
|
print("toggle airplane mode")
|
||||||
|
}
|
||||||
|
|
||||||
/*Layout.minimumWidth: implicitWidth
|
|
||||||
Layout.minimumHeight: implicitHeight*/
|
|
||||||
Plasmoid.preferredRepresentation: plasmoid.fullRepresentation
|
Plasmoid.preferredRepresentation: plasmoid.fullRepresentation
|
||||||
|
|
||||||
ListModel {
|
ListModel {
|
||||||
|
|
@ -39,6 +41,7 @@ Item {
|
||||||
icon: "configure"
|
icon: "configure"
|
||||||
enabled: false
|
enabled: false
|
||||||
settingsCommand: "active-settings"
|
settingsCommand: "active-settings"
|
||||||
|
toggleFunction: ""
|
||||||
}
|
}
|
||||||
ListElement {
|
ListElement {
|
||||||
text: "Mobile network"
|
text: "Mobile network"
|
||||||
|
|
@ -51,6 +54,7 @@ Item {
|
||||||
icon: "flightmode-on"
|
icon: "flightmode-on"
|
||||||
enabled: false
|
enabled: false
|
||||||
settingsCommand: ""
|
settingsCommand: ""
|
||||||
|
toggleFunction: "toggleAirplane"
|
||||||
}
|
}
|
||||||
ListElement {
|
ListElement {
|
||||||
text: "Bluetooth"
|
text: "Bluetooth"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue