mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
shell/configuration: fix applet
This commit is contained in:
parent
c4f0ce09cb
commit
25e4ef3ab4
3 changed files with 17 additions and 18 deletions
|
|
@ -7,6 +7,7 @@ import QtQuick.Controls 2.15 as QQC2
|
||||||
import QtQuick.Layouts 1.15
|
import QtQuick.Layouts 1.15
|
||||||
import QtQuick.Window 2.15
|
import QtQuick.Window 2.15
|
||||||
|
|
||||||
|
import org.kde.plasma.plasmoid
|
||||||
import org.kde.kirigami 2.19 as Kirigami
|
import org.kde.kirigami 2.19 as Kirigami
|
||||||
import org.kde.plasma.configuration 2.0
|
import org.kde.plasma.configuration 2.0
|
||||||
import org.kde.kitemmodels 1.0 as KItemModels
|
import org.kde.kitemmodels 1.0 as KItemModels
|
||||||
|
|
@ -52,25 +53,25 @@ Rectangle {
|
||||||
if (app.pageStack.currentItem.saveConfig) {
|
if (app.pageStack.currentItem.saveConfig) {
|
||||||
app.pageStack.currentItem.saveConfig()
|
app.pageStack.currentItem.saveConfig()
|
||||||
}
|
}
|
||||||
for (var key in plasmoid.configuration) {
|
for (var key in Plasmoid.configuration) {
|
||||||
if (app.pageStack.currentItem["cfg_"+key] !== undefined) {
|
if (app.pageStack.currentItem["cfg_"+key] !== undefined) {
|
||||||
plasmoid.configuration[key] = app.pageStack.currentItem["cfg_"+key]
|
Plasmoid.configuration[key] = app.pageStack.currentItem["cfg_"+key]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function configurationHasChanged() {
|
function configurationHasChanged() {
|
||||||
for (var key in plasmoid.configuration) {
|
for (var key in Plasmoid.configuration) {
|
||||||
if (app.pageStack.currentItem["cfg_"+key] !== undefined) {
|
if (app.pageStack.currentItem["cfg_"+key] !== undefined) {
|
||||||
//for objects == doesn't work
|
//for objects == doesn't work
|
||||||
if (typeof plasmoid.configuration[key] == 'object') {
|
if (typeof Plasmoid.configuration[key] == 'object') {
|
||||||
for (var i in plasmoid.configuration[key]) {
|
for (var i in Plasmoid.configuration[key]) {
|
||||||
if (plasmoid.configuration[key][i] != app.pageStack.currentItem["cfg_"+key][i]) {
|
if (Plasmoid.configuration[key][i] != app.pageStack.currentItem["cfg_"+key][i]) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} else if (app.pageStack.currentItem["cfg_"+key] != plasmoid.configuration[key]) {
|
} else if (app.pageStack.currentItem["cfg_"+key] != Plasmoid.configuration[key]) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
|
|
||||||
|
import org.kde.plasma.plasmoid
|
||||||
import org.kde.kirigami 2.10 as Kirigami
|
import org.kde.kirigami 2.10 as Kirigami
|
||||||
|
|
||||||
Kirigami.ScrollablePage {
|
Kirigami.ScrollablePage {
|
||||||
|
|
@ -16,9 +17,9 @@ Kirigami.ScrollablePage {
|
||||||
onSettingValueChanged: saveConfig() // we save config immediately on mobile
|
onSettingValueChanged: saveConfig() // we save config immediately on mobile
|
||||||
|
|
||||||
function saveConfig() {
|
function saveConfig() {
|
||||||
for (let key in plasmoid.configuration) {
|
for (let key in Plasmoid.configuration) {
|
||||||
if (loader.item["cfg_" + key] != undefined) {
|
if (loader.item["cfg_" + key] != undefined) {
|
||||||
plasmoid.configuration[key] = loader.item["cfg_" + key]
|
Plasmoid.configuration[key] = loader.item["cfg_" + key]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -50,22 +51,18 @@ Kirigami.ScrollablePage {
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (!plasmoid) {
|
const plasmoidConfig = Plasmoid.configuration
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const plasmoidConfig = plasmoid.configuration
|
|
||||||
|
|
||||||
const props = {}
|
const props = {}
|
||||||
for (let key in plasmoidConfig) {
|
for (let key in plasmoidConfig) {
|
||||||
props["cfg_" + key] = plasmoid.configuration[key]
|
props["cfg_" + key] = Plasmoid.configuration[key]
|
||||||
}
|
}
|
||||||
|
|
||||||
setSource(configItem.source, props)
|
setSource(configItem.source, props)
|
||||||
}
|
}
|
||||||
|
|
||||||
onLoaded: {
|
onLoaded: {
|
||||||
const plasmoidConfig = plasmoid.configuration;
|
const plasmoidConfig = Plasmoid.configuration;
|
||||||
|
|
||||||
for (let key in plasmoidConfig) {
|
for (let key in plasmoidConfig) {
|
||||||
const changedSignal = item["cfg_" + key + "Changed"]
|
const changedSignal = item["cfg_" + key + "Changed"]
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import org.kde.plasma.configuration 2.0
|
||||||
import QtQuick.Controls 2.15 as QQC2
|
import QtQuick.Controls 2.15 as QQC2
|
||||||
import QtQuick.Layouts 1.15
|
import QtQuick.Layouts 1.15
|
||||||
|
|
||||||
|
import org.kde.plasma.plasmoid
|
||||||
import org.kde.newstuff 1.62 as NewStuff
|
import org.kde.newstuff 1.62 as NewStuff
|
||||||
import org.kde.kirigami 2.19 as Kirigami
|
import org.kde.kirigami 2.19 as Kirigami
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
|
|
@ -40,7 +41,7 @@ ColumnLayout {
|
||||||
|
|
||||||
Kirigami.InlineMessage {
|
Kirigami.InlineMessage {
|
||||||
Layout.alignment: Qt.AlignTop
|
Layout.alignment: Qt.AlignTop
|
||||||
visible: plasmoid.immutable || animating
|
visible: Plasmoid.immutable || animating
|
||||||
text: i18nd("plasma_shell_org.kde.plasma.desktop", "Layout changes have been restricted by the system administrator")
|
text: i18nd("plasma_shell_org.kde.plasma.desktop", "Layout changes have been restricted by the system administrator")
|
||||||
showCloseButton: true
|
showCloseButton: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
@ -67,7 +68,7 @@ ColumnLayout {
|
||||||
|
|
||||||
MobileForm.FormComboBoxDelegate {
|
MobileForm.FormComboBoxDelegate {
|
||||||
id: layoutSelectComboBox
|
id: layoutSelectComboBox
|
||||||
enabled: !plasmoid.immutable
|
enabled: !Plasmoid.immutable
|
||||||
text: i18nd("plasma_shell_org.kde.plasma.desktop", "Homescreen Layout")
|
text: i18nd("plasma_shell_org.kde.plasma.desktop", "Homescreen Layout")
|
||||||
description: i18n("The homescreen layout to use.")
|
description: i18n("The homescreen layout to use.")
|
||||||
visible: model.count > 1 // only show if there are multiple plugins
|
visible: model.count > 1 // only show if there are multiple plugins
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue