diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 02c4b8ae5..f91b6278a 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -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 ) diff --git a/app/qml/PluginInfoPage.qml b/app/qml/PluginInfoPage.qml deleted file mode 100644 index 7e6008567..000000000 --- a/app/qml/PluginInfoPage.qml +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2019 Nicolas Fella - * - * 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 - }) - } -} - - - diff --git a/app/qml/PluginSettings.qml b/app/qml/PluginSettings.qml index f515712f1..8fb270c66 100644 --- a/app/qml/PluginSettings.qml +++ b/app/qml/PluginSettings.qml @@ -63,17 +63,10 @@ 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"), { - title: name, - configFile: configSource, - device: root.device, - }); - } + pageStack.push(configSource, { + title: name, + device: root.device, + }); } } ] diff --git a/plugins/clipboard/kdeconnect_clipboard_config.qml b/plugins/clipboard/kdeconnect_clipboard_config.qml index dfd83ebb3..8335af022 100644 --- a/plugins/clipboard/kdeconnect_clipboard_config.qml +++ b/plugins/clipboard/kdeconnect_clipboard_config.qml @@ -10,31 +10,33 @@ 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) } - QQC2.CheckBox { - id: autoShare - text: i18n("Automatically share the clipboard from this device") - onClicked: config.set("autoShare", checked) - } + Kirigami.FormLayout { + KdeConnectPluginConfig { + id: config + deviceId: device + pluginName: "kdeconnect_clipboard" + } - QQC2.CheckBox { - id: password - text: i18n("Including passwords (as marked by password managers)") - onClicked: config.set("sendPassword", checked) - } + QQC2.CheckBox { + id: autoShare + text: i18n("Automatically share the clipboard from this device") + onClicked: config.set("autoShare", checked) + } + QQC2.CheckBox { + id: password + text: i18n("Including passwords (as marked by password managers)") + onClicked: config.set("sendPassword", checked) + } + } } diff --git a/plugins/findthisdevice/kdeconnect_findthisdevice_config.qml b/plugins/findthisdevice/kdeconnect_findthisdevice_config.qml index 3479b05fc..efc723faf 100644 --- a/plugins/findthisdevice/kdeconnect_findthisdevice_config.qml +++ b/plugins/findthisdevice/kdeconnect_findthisdevice_config.qml @@ -11,46 +11,48 @@ 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) } - FileDialog { - id: fileDialog - currentFile: path.text + Kirigami.FormLayout { + FileDialog { + id: fileDialog + currentFile: path.text - onAccepted: { - path.text = currentFile.toString().replace("file://", "") - } - } - - KdeConnectPluginConfig { - id: config - deviceId: device - pluginName: "kdeconnect_findthisdevice" - - onConfigChanged: { - path.text = getString("ringtone", StandardPaths.writableLocation(StandardPaths.DownloadsLocation).toString().replace("file://", "")) - } - } - - RowLayout { - Kirigami.FormData.label: i18n("Sound to play:") - - QQC2.TextField { - id: path + onAccepted: { + path.text = currentFile.toString().replace("file://", "") + } } - QQC2.Button { - icon.name: "document-open" - onClicked: fileDialog.open() + KdeConnectPluginConfig { + id: config + deviceId: device + pluginName: "kdeconnect_findthisdevice" + + onConfigChanged: { + path.text = getString("ringtone", StandardPaths.writableLocation(StandardPaths.DownloadsLocation).toString().replace("file://", "")) + } + } + + RowLayout { + Kirigami.FormData.label: i18n("Sound to play:") + + QQC2.TextField { + id: path + } + + QQC2.Button { + icon.name: "document-open" + onClicked: fileDialog.open() + } } } } - diff --git a/plugins/pausemusic/kdeconnect_pausemusic_config.qml b/plugins/pausemusic/kdeconnect_pausemusic_config.qml index 9a347c825..c8a83684a 100644 --- a/plugins/pausemusic/kdeconnect_pausemusic_config.qml +++ b/plugins/pausemusic/kdeconnect_pausemusic_config.qml @@ -10,48 +10,51 @@ 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 - KdeConnectPluginConfig { - id: config - deviceId: device - pluginName: "kdeconnect_pausemusic" - } + Kirigami.FormLayout { - Component.onCompleted: { - talking.checked = config.getBool("conditionTalking", false) - mute.checked = config.getBool("actionMute", false) - pause.checked = config.getBool("actionPause", true) - resume.checked = config.getBool("actionResume", true) - } + KdeConnectPluginConfig { + id: config + deviceId: device + pluginName: "kdeconnect_pausemusic" + } - QQC2.RadioButton { - text: i18n("Pause as soon as phone rings") - checked: !talking.checked - } + Component.onCompleted: { + talking.checked = config.getBool("conditionTalking", false) + mute.checked = config.getBool("actionMute", false) + pause.checked = config.getBool("actionPause", true) + resume.checked = config.getBool("actionResume", true) + } - QQC2.RadioButton { - id: talking - onCheckedChanged: config.set("conditionTalking", checked) - text: i18n("Pause only while talking") - } + QQC2.RadioButton { + text: i18n("Pause as soon as phone rings") + checked: !talking.checked + } - QQC2.CheckBox { - id: pause - text: i18n("Pause media players") - onClicked: config.set("actionPause", checked) - } + QQC2.RadioButton { + id: talking + onCheckedChanged: config.set("conditionTalking", checked) + text: i18n("Pause only while talking") + } - QQC2.CheckBox { - id: mute - text: i18n("Mute system sound") - onClicked: config.set("actionMute", checked) - } + QQC2.CheckBox { + id: pause + text: i18n("Pause media players") + onClicked: config.set("actionPause", checked) + } - QQC2.CheckBox { - id: resume - text: i18n("Resume automatically when call ends") - onClicked: config.set("actionResume", checked) + QQC2.CheckBox { + id: mute + text: i18n("Mute system sound") + onClicked: config.set("actionMute", checked) + } + + QQC2.CheckBox { + id: resume + text: i18n("Resume automatically when call ends") + onClicked: config.set("actionResume", checked) + } } } diff --git a/plugins/runcommand/kdeconnect_runcommand_config.qml b/plugins/runcommand/kdeconnect_runcommand_config.qml index cad4fbebb..a327ef35e 100644 --- a/plugins/runcommand/kdeconnect_runcommand_config.qml +++ b/plugins/runcommand/kdeconnect_runcommand_config.qml @@ -10,135 +10,134 @@ 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() } - model: CommandsModel { - id: commandModel - deviceId: device - } + ListView { + id: view - delegate: Kirigami.SwipeListItem { - width: parent.width - enabled: true - - contentItem: ColumnLayout { - QQC2.Label { - text: name - Layout.fillWidth: true - elide: Text.ElideRight - } - QQC2.Label { - text: command - font.italic: true - Layout.fillWidth: true - elide: Text.ElideRight - } + model: CommandsModel { + id: commandModel + deviceId: device } - actions: Kirigami.Action { - text: i18n("Delete") - icon.name: "delete" - onTriggered: commandModel.removeCommand(index) - } - } + delegate: Kirigami.SwipeListItem { + width: parent.width + enabled: true - Kirigami.PlaceholderMessage { - icon.name: 'utilities-terminal' - anchors.centerIn: parent - visible: view.count === 0 - 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 - } - - Kirigami.Dialog { - id: addDialog - title: i18nc("@title:window", "Add Command") - - padding: Kirigami.Units.largeSpacing - preferredWidth: Kirigami.Units.gridUnit * 20 - - property Kirigami.Action addCommandAction: Kirigami.Action { - text: i18nc("@action:button", "Add") - icon.name: "list-add" - enabled: commandField.length > 0 - onTriggered: { - commandModel.addCommand(nameField.text, commandField.text) - addDialog.close(); - } - Component.onCompleted: { - // TODO: can be set directly once Qt 6.8 is required - Accessible.Name = i18nc("@action:button accessible", "Add command") - } - } - - standardButtons: Kirigami.Dialog.Cancel - customFooterActions: [addCommandAction] - - Kirigami.FormLayout { - QQC2.TextField { - id: nameField - Kirigami.FormData.label: i18n("Name:") - } - QQC2.TextField { - id: commandField - Kirigami.FormData.label: i18n("Command:") - } - - QQC2.ComboBox { - Kirigami.FormData.label: i18n("Sample commands:") - textRole: "name" - model: ListModel { - id: sampleCommands - ListElement { - name: "Sample command" - command: "" - } - ListElement { - name: "Suspend" - command: "systemctl suspend" - } - ListElement { - name: "Maximum Brightness" - command: "qdbus org.kde.Solid.PowerManagement /org/kde/Solid/PowerManagement/Actions/BrightnessControl org.kde.Solid.PowerManagement.Actions.BrightnessControl.setBrightness `qdbus org.kde.Solid.PowerManagement /org/kde/Solid/PowerManagement/Actions/BrightnessControl org.kde.Solid.PowerManagement.Actions.BrightnessControl.brightnessMax`" - } - ListElement { - name: "Lock Screen" - command: "loginctl lock-session" - } - ListElement { - name: "Unlock Screen" - command: "loginctl unlock-session" - } - ListElement { - name: "Close All Vaults" - command: "qdbus org.kde.kded5 /modules/plasmavault closeAllVaults" - } - ListElement { - name: "Forcefully Close All Vaults" - command: "qdbus org.kde.kded5 /modules/plasmavault forceCloseAllVaults" - } + contentItem: ColumnLayout { + QQC2.Label { + text: name + Layout.fillWidth: true + elide: Text.ElideRight } - onActivated: { - if (index > 0) { - nameField.text = sampleCommands.get(index).name - commandField.text = sampleCommands.get(index).command + QQC2.Label { + text: command + font.italic: true + Layout.fillWidth: true + elide: Text.ElideRight + } + } + + actions: Kirigami.Action { + text: i18n("Delete") + icon.name: "delete" + onTriggered: commandModel.removeCommand(index) + } + } + + Kirigami.PlaceholderMessage { + icon.name: 'utilities-terminal' + anchors.centerIn: parent + visible: view.count === 0 + 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: addCommandDialogAction + } + + Kirigami.Dialog { + id: addDialog + title: i18nc("@title:window", "Add Command") + + padding: Kirigami.Units.largeSpacing + preferredWidth: Kirigami.Units.gridUnit * 20 + + property Kirigami.Action addCommandAction: Kirigami.Action { + text: i18nc("@action:button", "Add") + icon.name: "list-add" + enabled: commandField.length > 0 + onTriggered: { + commandModel.addCommand(nameField.text, commandField.text) + addDialog.close(); + } + Component.onCompleted: { + // TODO: can be set directly once Qt 6.8 is required + Accessible.Name = i18nc("@action:button accessible", "Add command") + } + } + + standardButtons: Kirigami.Dialog.Cancel + customFooterActions: [addCommandAction] + + Kirigami.FormLayout { + QQC2.TextField { + id: nameField + Kirigami.FormData.label: i18n("Name:") + } + QQC2.TextField { + id: commandField + Kirigami.FormData.label: i18n("Command:") + } + + QQC2.ComboBox { + Kirigami.FormData.label: i18n("Sample commands:") + textRole: "name" + model: ListModel { + id: sampleCommands + ListElement { + name: "Sample command" + command: "" + } + ListElement { + name: "Suspend" + command: "systemctl suspend" + } + ListElement { + name: "Maximum Brightness" + command: "qdbus org.kde.Solid.PowerManagement /org/kde/Solid/PowerManagement/Actions/BrightnessControl org.kde.Solid.PowerManagement.Actions.BrightnessControl.setBrightness `qdbus org.kde.Solid.PowerManagement /org/kde/Solid/PowerManagement/Actions/BrightnessControl org.kde.Solid.PowerManagement.Actions.BrightnessControl.brightnessMax`" + } + ListElement { + name: "Lock Screen" + command: "loginctl lock-session" + } + ListElement { + name: "Unlock Screen" + command: "loginctl unlock-session" + } + ListElement { + name: "Close All Vaults" + command: "qdbus org.kde.kded5 /modules/plasmavault closeAllVaults" + } + ListElement { + name: "Forcefully Close All Vaults" + command: "qdbus org.kde.kded5 /modules/plasmavault forceCloseAllVaults" + } + } + onActivated: { + if (index > 0) { + nameField.text = sampleCommands.get(index).name + commandField.text = sampleCommands.get(index).command + } } } } diff --git a/plugins/sendnotifications/kdeconnect_sendnotifications_config.qml b/plugins/sendnotifications/kdeconnect_sendnotifications_config.qml index d54b4cce2..5e4cf4076 100644 --- a/plugins/sendnotifications/kdeconnect_sendnotifications_config.qml +++ b/plugins/sendnotifications/kdeconnect_sendnotifications_config.qml @@ -10,47 +10,49 @@ 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 - KdeConnectPluginConfig { - id: config - deviceId: device - pluginName: "kdeconnect_sendnotifications" - } + Kirigami.FormLayout { + KdeConnectPluginConfig { + id: config + deviceId: root.device + pluginName: "kdeconnect_sendnotifications" + } - Component.onCompleted: { - persistent.checked = config.getBool("generalPersistent", false) - includeBody.checked = config.getBool("generalIncludeBody", true) - includeIcon.checked = config.getBool("generalSynchronizeIcons", true) - urgency.value = config.getInt("generalUrgency", 0) - } + Component.onCompleted: { + persistent.checked = config.getBool("generalPersistent", false) + includeBody.checked = config.getBool("generalIncludeBody", true) + includeIcon.checked = config.getBool("generalSynchronizeIcons", true) + urgency.value = config.getInt("generalUrgency", 0) + } - CheckBox { - id: persistent - text: i18n("Persistent notifications only") - onClicked: config.set("generalPersistent", checked) - } + CheckBox { + id: persistent + text: i18n("Persistent notifications only") + onClicked: config.set("generalPersistent", checked) + } - CheckBox { - id: includeBody - text: i18n("Include body") - onClicked: config.set("generalIncludeBody", checked) - } + CheckBox { + id: includeBody + text: i18n("Include body") + onClicked: config.set("generalIncludeBody", checked) + } - CheckBox { - id: includeIcon - text: i18n("Include icon") - onClicked: config.set("generalSynchronizeIcons", checked) - } + CheckBox { + id: includeIcon + text: i18n("Include icon") + onClicked: config.set("generalSynchronizeIcons", checked) + } - SpinBox { - id: urgency - Kirigami.FormData.label: i18n("Minimum urgency level:") - from: 0 - to: 2 - onValueModified: config.set("generalUrgency", value) + SpinBox { + id: urgency + Kirigami.FormData.label: i18n("Minimum urgency level:") + from: 0 + to: 2 + onValueModified: config.set("generalUrgency", value) + } } - } diff --git a/plugins/share/kdeconnect_share_config.qml b/plugins/share/kdeconnect_share_config.qml index d66d95878..ce3c5248c 100644 --- a/plugins/share/kdeconnect_share_config.qml +++ b/plugins/share/kdeconnect_share_config.qml @@ -11,49 +11,52 @@ 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) } - FolderDialog { - id: folderDialog - currentFolder: path.text + Kirigami.FormLayout { + FolderDialog { + id: folderDialog + currentFolder: path.text - onAccepted: { - path.text = currentFolder.toString().replace("file://", "") - } - } - - KdeConnectPluginConfig { - id: config - deviceId: device - pluginName: "kdeconnect_share" - - onConfigChanged: { - path.text = getString("incoming_path", StandardPaths.writableLocation(StandardPaths.DownloadsLocation).toString().replace("file://", "")) - } - } - - RowLayout { - Kirigami.FormData.label: i18n("Save files in:") - - QQC2.TextField { - id: path + onAccepted: { + path.text = currentFolder.toString().replace("file://", "") + } } - QQC2.Button { - icon.name: "document-open" - onClicked: folderDialog.open() - } - } + KdeConnectPluginConfig { + id: config + deviceId: device + pluginName: "kdeconnect_share" - QQC2.Label { - text: i18n("%1 in the path will be replaced with the specific device name", "%1") + onConfigChanged: { + path.text = getString("incoming_path", StandardPaths.writableLocation(StandardPaths.DownloadsLocation).toString().replace("file://", "")) + } + } + + RowLayout { + Kirigami.FormData.label: i18n("Save files in:") + + QQC2.TextField { + id: path + } + + QQC2.Button { + icon.name: "document-open" + onClicked: folderDialog.open() + } + } + + QQC2.Label { + text: i18n("%1 in the path will be replaced with the specific device name", "%1") + } } }