kdeconnect-app: Remove PluginInfoPage wrapper

Base the config page on Kirigami.Page and create them directly.
This commit is contained in:
Carl Schwan 2024-10-05 22:53:32 +02:00
parent 239e53a469
commit e04072c83e
9 changed files with 278 additions and 306 deletions

View file

@ -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
)

View file

@ -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
})
}
}

View file

@ -63,19 +63,12 @@ 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"), {
pageStack.push(configSource, {
title: name,
configFile: configSource,
device: root.device,
});
}
}
}
]
}
}

View file

@ -10,21 +10,23 @@ import QtQuick.Layouts 1.15
import org.kde.kirigami 2.20 as Kirigami
import org.kde.kdeconnect 1.0
Kirigami.FormLayout {
Kirigami.ScrollablePage {
id: root
property string device
KdeConnectPluginConfig {
id: config
deviceId: device
pluginName: "kdeconnect_clipboard"
}
Component.onCompleted: {
autoShare.checked = config.getBool("autoShare", config.getBool("sendUnknown", true))
password.checked = config.getBool("sendPassword", true)
}
Kirigami.FormLayout {
KdeConnectPluginConfig {
id: config
deviceId: device
pluginName: "kdeconnect_clipboard"
}
QQC2.CheckBox {
id: autoShare
text: i18n("Automatically share the clipboard from this device")
@ -36,5 +38,5 @@ Kirigami.FormLayout {
text: i18n("Including passwords (as marked by password managers)")
onClicked: config.set("sendPassword", checked)
}
}
}

View file

@ -11,16 +11,18 @@ import org.kde.kirigami 2.20 as Kirigami
import Qt.labs.platform 1.1
import org.kde.kdeconnect 1.0
Kirigami.FormLayout {
Kirigami.ScrollablePage {
id: root
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 {
FileDialog {
id: fileDialog
currentFile: path.text
@ -53,4 +55,4 @@ Kirigami.FormLayout {
}
}
}
}

View file

@ -10,9 +10,11 @@ import QtQuick.Layouts 1.15
import org.kde.kirigami 2.20 as Kirigami
import org.kde.kdeconnect 1.0
Kirigami.FormLayout {
Kirigami.ScrollablePage {
property string device
Kirigami.FormLayout {
KdeConnectPluginConfig {
id: config
deviceId: device
@ -55,3 +57,4 @@ Kirigami.FormLayout {
onClicked: config.set("actionResume", checked)
}
}
}

View file

@ -10,23 +10,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 {
id: addCommandDialogAction
icon.name: "list-add"
text: i18n("Add Command…")
onTriggered: addDialog.open()
}
ListView {
id: view
model: CommandsModel {
id: commandModel
deviceId: device
@ -64,7 +62,7 @@ ListView {
width: parent.width - Kirigami.Units.gridUnit * 4
text: i18nc("@info", "No commands configured")
explanation: i18n("@info", "Add commands to run them remotely from other devices")
helpfulAction: view.action
helpfulAction: addCommandDialogAction
}
Kirigami.Dialog {
@ -145,3 +143,4 @@ ListView {
}
}
}
}

View file

@ -10,13 +10,15 @@ import QtQuick.Layouts 1.1
import org.kde.kirigami 2.5 as Kirigami
import org.kde.kdeconnect 1.0
Kirigami.FormLayout {
Kirigami.ScrollablePage {
id: root
property string device
Kirigami.FormLayout {
KdeConnectPluginConfig {
id: config
deviceId: device
deviceId: root.device
pluginName: "kdeconnect_sendnotifications"
}
@ -52,5 +54,5 @@ Kirigami.FormLayout {
to: 2
onValueModified: config.set("generalUrgency", value)
}
}
}

View file

@ -11,16 +11,18 @@ import org.kde.kirigami 2.20 as Kirigami
import Qt.labs.platform 1.1
import org.kde.kdeconnect 1.0
Kirigami.FormLayout {
Kirigami.ScrollablePage {
id: root
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 {
FolderDialog {
id: folderDialog
currentFolder: path.text
@ -57,3 +59,4 @@ Kirigami.FormLayout {
text: i18n("%1 in the path will be replaced with the specific device name", "%1")
}
}
}