Compare commits

...

4 commits

Author SHA1 Message Date
Nicolas Fella
cbd0eda348 Explictly specify signal handler args 2024-06-06 02:33:34 +02:00
Nicolas Fella
632bf8e450 Port runcommand config to Kirigami.Dialog
It works better out of the box
2024-06-06 02:32:16 +02:00
Nicolas Fella
811101352f Port runcommand config to ItemDelegate 2024-06-06 02:30:05 +02:00
Nicolas Fella
6366ceb530 [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
2024-06-06 02:27:40 +02:00
9 changed files with 299 additions and 286 deletions

View file

@ -40,7 +40,6 @@ ecm_target_qml_sources(kdeconnect-app SOURCES
qml/volume.qml qml/volume.qml
qml/MprisSlider.qml qml/MprisSlider.qml
qml/PluginSettings.qml qml/PluginSettings.qml
qml/PluginInfoPage.qml
qml/Settings.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,16 @@ Kirigami.ScrollablePage {
// https://bugreports.qt.io/browse/QTBUG-123123 // https://bugreports.qt.io/browse/QTBUG-123123
Accessible.name: i18nd("kdeconnect-app", "Configure plugin") Accessible.name: i18nd("kdeconnect-app", "Configure plugin")
onTriggered: { onTriggered: {
if (pageStack.lastItem.toString().startsWith("PluginInfoPage")) { if (!pageStack.lastItem.toString().startsWith("PluginSettings")) {
pageStack.lastItem.configFile = configSource; pageStack.pop()
pageStack.lastItem.title = name; }
pageStack.goForward();
} else { pageStack.push(configSource, {
pageStack.push(Qt.resolvedUrl("PluginInfoPage.qml"), {
title: name, title: name,
configFile: configSource,
device: root.device, device: root.device,
}); });
} }
} }
}
] ]
} }
} }

View file

@ -10,10 +10,14 @@ import QtQuick.Layouts 1.15
import org.kde.kirigami 2.20 as Kirigami import org.kde.kirigami 2.20 as Kirigami
import org.kde.kdeconnect 1.0 import org.kde.kdeconnect 1.0
Kirigami.FormLayout { Kirigami.Page {
property string device property string device
Kirigami.FormLayout {
anchors.fill: parent
KdeConnectPluginConfig { KdeConnectPluginConfig {
id: config id: config
deviceId: device deviceId: device
@ -37,4 +41,5 @@ Kirigami.FormLayout {
onClicked: config.set("sendPassword", checked) onClicked: config.set("sendPassword", checked)
} }
}
} }

View file

@ -11,15 +11,21 @@ import org.kde.kirigami 2.20 as Kirigami
import Qt.labs.platform 1.1 import Qt.labs.platform 1.1
import org.kde.kdeconnect 1.0 import org.kde.kdeconnect 1.0
Kirigami.FormLayout { Kirigami.Page {
property string device property string device
property var action: Kirigami.Action { actions: [
Kirigami.Action {
icon.name: "dialog-ok" icon.name: "dialog-ok"
text: i18n("Apply") text: i18n("Apply")
onTriggered: config.set("ringtone", path.text) onTriggered: config.set("ringtone", path.text)
} }
]
Kirigami.FormLayout {
anchors.fill: parent
FileDialog { FileDialog {
id: fileDialog id: fileDialog
@ -52,5 +58,5 @@ Kirigami.FormLayout {
onClicked: fileDialog.open() onClicked: fileDialog.open()
} }
} }
}
} }

View file

@ -10,9 +10,14 @@ import QtQuick.Layouts 1.15
import org.kde.kirigami 2.20 as Kirigami import org.kde.kirigami 2.20 as Kirigami
import org.kde.kdeconnect 1.0 import org.kde.kdeconnect 1.0
Kirigami.FormLayout { Kirigami.Page {
property string device property string device
Kirigami.FormLayout {
anchors.fill: parent
KdeConnectPluginConfig { KdeConnectPluginConfig {
id: config id: config
deviceId: device deviceId: device
@ -54,4 +59,5 @@ Kirigami.FormLayout {
text: i18n("Resume automatically when call ends") text: i18n("Resume automatically when call ends")
onClicked: config.set("actionResume", checked) onClicked: config.set("actionResume", checked)
} }
}
} }

View file

@ -3,46 +3,62 @@
* *
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/ */
pragma ComponentBehavior: Bound
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Layouts
import QtQuick.Controls 2.15 as QQC2 import QtQuick.Controls 2.15 as QQC2
import org.kde.kirigami 2.20 as Kirigami import org.kde.kirigami 2.20 as Kirigami
import org.kde.kdeconnect 1.0 import org.kde.kdeconnect 1.0
ListView { Kirigami.ScrollablePage {
id: view id: root
Component.onCompleted: {
root.leftPadding = 0
root.rightPadding = 0
root.topPadding = 0
root.bottomPadding = 0
}
property string device property string device
property var action: Kirigami.Action { actions: [
Kirigami.Action {
icon.name: "list-add" icon.name: "list-add"
text: i18n("Add command") text: i18n("Add command")
onTriggered: addDialog.open() onTriggered: addDialog.open()
} }
]
ListView {
id: view
model: CommandsModel { model: CommandsModel {
id: commandModel id: commandModel
deviceId: device deviceId: device
} }
delegate: Kirigami.SwipeListItem { delegate: QQC2.ItemDelegate {
width: parent.width id: commandDelegate
enabled: true
contentItem: QQC2.Label { required property string name
text: i18n("%1 <br> <i>%2</i>", name, command) required property string command
required property int index
text: name
width: ListView.view.width
contentItem: RowLayout {
Kirigami.TitleSubtitle {
title: commandDelegate.text
subtitle: commandDelegate.command
Layout.fillWidth: true
} }
actions: Kirigami.Action { QQC2.ToolButton {
text: i18n("Delete") text: i18n("Delete")
icon.name: "delete" icon.name: "delete"
onTriggered: commandModel.removeCommand(index) onClicked: commandModel.removeCommand(commandDelegate.index)
display: QQC2.ToolButton.IconOnly
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
QQC2.ToolTip.text: text
QQC2.ToolTip.visible: hovered || activeFocus
}
} }
} }
@ -53,15 +69,17 @@ ListView {
width: parent.width - Kirigami.Units.gridUnit * 4 width: parent.width - Kirigami.Units.gridUnit * 4
text: i18n("No Commands") text: i18n("No Commands")
explanation: i18n("Add commands to run them remotely from other devices") explanation: i18n("Add commands to run them remotely from other devices")
helpfulAction: view.action helpfulAction: root.actions[0]
} }
QQC2.Dialog { Kirigami.Dialog {
id: addDialog id: addDialog
title: "Add command" title: "Add command"
standardButtons: QQC2.Dialog.Save | QQC2.Dialog.Cancel standardButtons: QQC2.Dialog.Save | QQC2.Dialog.Cancel
horizontalPadding: Kirigami.Units.largeSpacing
Kirigami.FormLayout { Kirigami.FormLayout {
QQC2.TextField { QQC2.TextField {
id: nameField id: nameField
@ -106,7 +124,7 @@ ListView {
command: "qdbus org.kde.kded5 /modules/plasmavault forceCloseAllVaults" command: "qdbus org.kde.kded5 /modules/plasmavault forceCloseAllVaults"
} }
} }
onActivated: { onActivated: index => {
if (index > 0) { if (index > 0) {
nameField.text = sampleCommands.get(index).name nameField.text = sampleCommands.get(index).name
commandField.text = sampleCommands.get(index).command commandField.text = sampleCommands.get(index).command
@ -117,4 +135,5 @@ ListView {
onAccepted: commandModel.addCommand(nameField.text, commandField.text) onAccepted: commandModel.addCommand(nameField.text, commandField.text)
} }
}
} }

View file

@ -10,10 +10,14 @@ import QtQuick.Layouts 1.1
import org.kde.kirigami 2.5 as Kirigami import org.kde.kirigami 2.5 as Kirigami
import org.kde.kdeconnect 1.0 import org.kde.kdeconnect 1.0
Kirigami.FormLayout { Kirigami.Page {
property string device property string device
Kirigami.FormLayout {
anchors.fill: parent
KdeConnectPluginConfig { KdeConnectPluginConfig {
id: config id: config
deviceId: device deviceId: device
@ -53,4 +57,5 @@ Kirigami.FormLayout {
onValueModified: config.set("generalUrgency", value) onValueModified: config.set("generalUrgency", value)
} }
}
} }

View file

@ -11,15 +11,21 @@ import org.kde.kirigami 2.20 as Kirigami
import Qt.labs.platform 1.1 import Qt.labs.platform 1.1
import org.kde.kdeconnect 1.0 import org.kde.kdeconnect 1.0
Kirigami.FormLayout { Kirigami.Page {
property string device property string device
property var action: Kirigami.Action { actions: [
Kirigami.Action {
icon.name: "dialog-ok" icon.name: "dialog-ok"
text: i18n("Apply") text: i18n("Apply")
onTriggered: config.set("incoming_path", path.text) onTriggered: config.set("incoming_path", path.text)
} }
]
Kirigami.FormLayout {
anchors.fill: parent
FolderDialog { FolderDialog {
id: folderDialog id: folderDialog
@ -56,4 +62,5 @@ Kirigami.FormLayout {
QQC2.Label { QQC2.Label {
text: i18n("%1 in the path will be replaced with the specific device name", "%1") text: i18n("%1 in the path will be replaced with the specific device name", "%1")
} }
}
} }