Add configurable Plasma panel scroll and click actions
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
import QtQuick
|
||||
import QtQuick.Controls as Controls
|
||||
import QtQuick.Layouts
|
||||
import org.kde.kirigami as Kirigami
|
||||
|
||||
Kirigami.ApplicationWindow {
|
||||
id: window
|
||||
title: i18n("Panel Actions")
|
||||
width: 760
|
||||
height: 840
|
||||
minimumWidth: 600
|
||||
minimumHeight: 400
|
||||
visible: true
|
||||
pageStack.initialPage: Kirigami.ScrollablePage {
|
||||
title: window.title
|
||||
ColumnLayout {
|
||||
Kirigami.InlineMessage {
|
||||
id: result
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
ConfigGeneral {
|
||||
id: form
|
||||
objectName: "settingsForm"
|
||||
applications: panelSettings.applications
|
||||
Layout.fillWidth: true
|
||||
function load() {
|
||||
for (const key in panelSettings.values) form["cfg_" + key] = panelSettings.values[key];
|
||||
}
|
||||
Component.onCompleted: load()
|
||||
}
|
||||
}
|
||||
footer: Controls.ToolBar {
|
||||
contentItem: RowLayout {
|
||||
spacing: Kirigami.Units.smallSpacing
|
||||
Item { Layout.fillWidth: true }
|
||||
Controls.Button {
|
||||
objectName: "saveSettings"
|
||||
text: i18n("Save")
|
||||
icon.name: "document-save"
|
||||
onClicked: {
|
||||
const values = {};
|
||||
for (const key in panelSettings.values) values[key] = form["cfg_" + key];
|
||||
const saved = panelSettings.save(values);
|
||||
result.type = saved ? Kirigami.MessageType.Positive : Kirigami.MessageType.Error;
|
||||
result.text = saved ? i18n("Settings saved. Changes apply immediately.") : i18n("Could not save settings. Select an application or enter a command for each launch action, and check that the configuration file is writable.");
|
||||
result.visible = true;
|
||||
}
|
||||
}
|
||||
Controls.Button {
|
||||
text: i18n("Close")
|
||||
onClicked: window.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user