[app] Fixup plugin config pages
Depending on the content we want to use Page or ScrollablePage The runcommand config should be a scrollablepage, but isn't right now The code even (incompletely) works around that To address this make the individual config files add their page instead of an additional wrapper page
This commit is contained in:
parent
01a605652d
commit
6366ceb530
9 changed files with 278 additions and 284 deletions
|
@ -40,7 +40,6 @@ ecm_target_qml_sources(kdeconnect-app SOURCES
|
|||
qml/volume.qml
|
||||
qml/MprisSlider.qml
|
||||
qml/PluginSettings.qml
|
||||
qml/PluginInfoPage.qml
|
||||
qml/Settings.qml
|
||||
)
|
||||
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2019 Nicolas Fella <nicolas.fella@gmx.de>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||
*/
|
||||
|
||||
import QtQuick
|
||||
import org.kde.kirigami as Kirigami
|
||||
|
||||
Kirigami.Page {
|
||||
id: root
|
||||
property string configFile
|
||||
property string device
|
||||
|
||||
actions: loader.item && loader.item.action ? [loader.item.action] : []
|
||||
|
||||
onConfigFileChanged: loader.setSource(configFile, {
|
||||
device: root.device
|
||||
})
|
||||
|
||||
Loader {
|
||||
anchors.fill: parent
|
||||
id: loader
|
||||
Component.onCompleted: setSource(configFile, {
|
||||
device: root.device
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -63,19 +63,16 @@ Kirigami.ScrollablePage {
|
|||
// https://bugreports.qt.io/browse/QTBUG-123123
|
||||
Accessible.name: i18nd("kdeconnect-app", "Configure plugin")
|
||||
onTriggered: {
|
||||
if (pageStack.lastItem.toString().startsWith("PluginInfoPage")) {
|
||||
pageStack.lastItem.configFile = configSource;
|
||||
pageStack.lastItem.title = name;
|
||||
pageStack.goForward();
|
||||
} else {
|
||||
pageStack.push(Qt.resolvedUrl("PluginInfoPage.qml"), {
|
||||
if (!pageStack.lastItem.toString().startsWith("PluginSettings")) {
|
||||
pageStack.pop()
|
||||
}
|
||||
|
||||
pageStack.push(configSource, {
|
||||
title: name,
|
||||
configFile: configSource,
|
||||
device: root.device,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,10 +10,14 @@ import QtQuick.Layouts 1.15
|
|||
import org.kde.kirigami 2.20 as Kirigami
|
||||
import org.kde.kdeconnect 1.0
|
||||
|
||||
Kirigami.FormLayout {
|
||||
Kirigami.Page {
|
||||
|
||||
property string device
|
||||
|
||||
Kirigami.FormLayout {
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
KdeConnectPluginConfig {
|
||||
id: config
|
||||
deviceId: device
|
||||
|
@ -38,3 +42,4 @@ Kirigami.FormLayout {
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,15 +11,21 @@ import org.kde.kirigami 2.20 as Kirigami
|
|||
import Qt.labs.platform 1.1
|
||||
import org.kde.kdeconnect 1.0
|
||||
|
||||
Kirigami.FormLayout {
|
||||
Kirigami.Page {
|
||||
|
||||
property string device
|
||||
|
||||
property var action: Kirigami.Action {
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
icon.name: "dialog-ok"
|
||||
text: i18n("Apply")
|
||||
onTriggered: config.set("ringtone", path.text)
|
||||
}
|
||||
]
|
||||
|
||||
Kirigami.FormLayout {
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
FileDialog {
|
||||
id: fileDialog
|
||||
|
@ -53,4 +59,4 @@ Kirigami.FormLayout {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,9 +10,14 @@ import QtQuick.Layouts 1.15
|
|||
import org.kde.kirigami 2.20 as Kirigami
|
||||
import org.kde.kdeconnect 1.0
|
||||
|
||||
Kirigami.FormLayout {
|
||||
Kirigami.Page {
|
||||
|
||||
property string device
|
||||
|
||||
Kirigami.FormLayout {
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
KdeConnectPluginConfig {
|
||||
id: config
|
||||
deviceId: device
|
||||
|
@ -55,3 +60,4 @@ Kirigami.FormLayout {
|
|||
onClicked: config.set("actionResume", checked)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,22 +9,21 @@ import QtQuick.Controls 2.15 as QQC2
|
|||
import org.kde.kirigami 2.20 as Kirigami
|
||||
import org.kde.kdeconnect 1.0
|
||||
|
||||
ListView {
|
||||
id: view
|
||||
Component.onCompleted: {
|
||||
root.leftPadding = 0
|
||||
root.rightPadding = 0
|
||||
root.topPadding = 0
|
||||
root.bottomPadding = 0
|
||||
}
|
||||
Kirigami.ScrollablePage {
|
||||
id: root
|
||||
|
||||
property string device
|
||||
|
||||
property var action: Kirigami.Action {
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
icon.name: "list-add"
|
||||
text: i18n("Add command")
|
||||
onTriggered: addDialog.open()
|
||||
}
|
||||
]
|
||||
|
||||
ListView {
|
||||
id: view
|
||||
|
||||
model: CommandsModel {
|
||||
id: commandModel
|
||||
|
@ -53,7 +52,7 @@ ListView {
|
|||
width: parent.width - Kirigami.Units.gridUnit * 4
|
||||
text: i18n("No Commands")
|
||||
explanation: i18n("Add commands to run them remotely from other devices")
|
||||
helpfulAction: view.action
|
||||
helpfulAction: root.actions[0]
|
||||
}
|
||||
|
||||
QQC2.Dialog {
|
||||
|
@ -118,3 +117,4 @@ ListView {
|
|||
onAccepted: commandModel.addCommand(nameField.text, commandField.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,10 +10,14 @@ import QtQuick.Layouts 1.1
|
|||
import org.kde.kirigami 2.5 as Kirigami
|
||||
import org.kde.kdeconnect 1.0
|
||||
|
||||
Kirigami.FormLayout {
|
||||
Kirigami.Page {
|
||||
|
||||
property string device
|
||||
|
||||
Kirigami.FormLayout {
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
KdeConnectPluginConfig {
|
||||
id: config
|
||||
deviceId: device
|
||||
|
@ -54,3 +58,4 @@ Kirigami.FormLayout {
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,15 +11,21 @@ import org.kde.kirigami 2.20 as Kirigami
|
|||
import Qt.labs.platform 1.1
|
||||
import org.kde.kdeconnect 1.0
|
||||
|
||||
Kirigami.FormLayout {
|
||||
Kirigami.Page {
|
||||
|
||||
property string device
|
||||
|
||||
property var action: Kirigami.Action {
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
icon.name: "dialog-ok"
|
||||
text: i18n("Apply")
|
||||
onTriggered: config.set("incoming_path", path.text)
|
||||
}
|
||||
]
|
||||
|
||||
Kirigami.FormLayout {
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
FolderDialog {
|
||||
id: folderDialog
|
||||
|
@ -57,3 +63,4 @@ Kirigami.FormLayout {
|
|||
text: i18n("%1 in the path will be replaced with the specific device name", "%1")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue