Improve and fix pluging modules

- Fix call to removed get() method
- Add PlaceHolderMessage in runcommand plugin
- Simplify qml code when possible
- Use latest qml import
- Fix missing i18n call

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
This commit is contained in:
Carl Schwan 2022-12-13 21:45:50 +01:00
parent c64ac4101a
commit b2e83f506c
5 changed files with 72 additions and 67 deletions

View file

@ -4,10 +4,10 @@
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
import QtQuick 2.2
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.1
import org.kde.kirigami 2.5 as Kirigami
import QtQuick 2.15
import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts 1.15
import org.kde.kirigami 2.20 as Kirigami
import org.kde.kdeconnect 1.0
Kirigami.FormLayout {
@ -21,17 +21,17 @@ Kirigami.FormLayout {
}
Component.onCompleted: {
unknown.checked = config.get("sendUnknown", true)
password.checked = config.get("sendPassword", true)
unknown.checked = config.getBool("sendUnknown", true)
password.checked = config.getBool("sendPassword", true)
}
CheckBox {
QQC2.CheckBox {
id: password
text: i18n("Passwords (as marked by password managers)")
onClicked: config.set("sendPassword", checked)
}
CheckBox {
QQC2.CheckBox {
id: unknown
text: i18n("Anything else")
onClicked: config.set("sendUnknown", checked)

View file

@ -4,10 +4,10 @@
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
import QtQuick 2.2
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.1
import org.kde.kirigami 2.5 as Kirigami
import QtQuick 2.15
import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts 1.15
import org.kde.kirigami 2.20 as Kirigami
import Qt.labs.platform 1.1
import org.kde.kdeconnect 1.0
@ -36,22 +36,20 @@ Kirigami.FormLayout {
pluginName: "kdeconnect_findthisdevice"
onConfigChanged: {
path.text = get("ringtone", StandardPaths.writableLocation(StandardPaths.DownloadsLocation).toString().replace("file://", ""))
path.text = getString("ringtone", StandardPaths.writableLocation(StandardPaths.DownloadsLocation).toString().replace("file://", ""))
}
}
RowLayout {
Kirigami.FormData.label: i18n("Sound to play:")
TextField {
QQC2.TextField {
id: path
}
Button {
QQC2.Button {
icon.name: "document-open"
onClicked: {
fileDialog.open()
}
onClicked: fileDialog.open()
}
}
}

View file

@ -4,14 +4,13 @@
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
import QtQuick 2.2
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.1
import org.kde.kirigami 2.5 as Kirigami
import QtQuick 2.15
import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts 1.15
import org.kde.kirigami 2.20 as Kirigami
import org.kde.kdeconnect 1.0
Kirigami.FormLayout {
property string device
KdeConnectPluginConfig {
@ -21,39 +20,38 @@ Kirigami.FormLayout {
}
Component.onCompleted: {
talking.checked = config.get("conditionTalking", false)
mute.checked = config.get("actionMute", false)
pause.checked = config.get("actionPause", true)
resume.checked = config.get("actionResume", true)
talking.checked = config.getBool("conditionTalking", false)
mute.checked = config.getBool("actionMute", false)
pause.checked = config.getBool("actionPause", true)
resume.checked = config.getBool("actionResume", true)
}
RadioButton {
QQC2.RadioButton {
text: i18n("Pause as soon as phone rings")
checked: !talking.checked
}
RadioButton {
QQC2.RadioButton {
id: talking
onCheckedChanged: config.set("conditionTalking", checked)
text: i18n("Pause only while talking")
}
CheckBox {
QQC2.CheckBox {
id: pause
text: i18n("Pause media players")
onClicked: config.set("actionPause", checked)
}
CheckBox {
QQC2.CheckBox {
id: mute
text: i18n("Mute system sound")
onClicked: config.set("actionMute", checked)
}
CheckBox {
QQC2.CheckBox {
id: resume
text: i18n("Resume automatically when call ends")
onClicked: config.set("actionResume", checked)
}
}

View file

@ -4,18 +4,18 @@
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
import QtQuick 2.2
import QtQuick.Controls 2.5
import org.kde.kirigami 2.4 as Kirigami
import QtQuick 2.15
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
root.leftPadding = 0
root.rightPadding = 0
root.topPadding = 0
root.bottomPadding = 0
}
property string device
@ -32,38 +32,47 @@ ListView {
}
delegate: Kirigami.SwipeListItem {
width: parent.width
enabled: true
width: parent.width
enabled: true
Label {
text: i18n("%1 <br> <i>%2</i>", name, command)
}
actions: [
Kirigami.Action {
icon.name: "delete"
onTriggered: commandModel.removeCommand(index)
}
]
QQC2.Label {
text: i18n("%1 <br> <i>%2</i>", name, command)
}
Dialog {
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: i18n("No Commands")
explanation: i18n("Add commands to run them remotely from other devices")
helpfulAction: view.action
}
QQC2.Dialog {
id: addDialog
title: "Add command"
standardButtons: Dialog.Save | Dialog.Cancel
standardButtons: QQC2.Dialog.Save | QQC2.Dialog.Cancel
Kirigami.FormLayout {
TextField {
QQC2.TextField {
id: nameField
Kirigami.FormData.label: i18n("Name:")
}
TextField {
QQC2.TextField {
id: commandField
Kirigami.FormData.label: i18n("Command:")
}
ComboBox {
QQC2.ComboBox {
Kirigami.FormData.label: i18n("Sample commands:")
textRole: "name"
model: ListModel {

View file

@ -4,10 +4,10 @@
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
import QtQuick 2.2
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.1
import org.kde.kirigami 2.5 as Kirigami
import QtQuick 2.15
import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts 1.15
import org.kde.kirigami 2.20 as Kirigami
import Qt.labs.platform 1.1
import org.kde.kdeconnect 1.0
@ -36,24 +36,24 @@ Kirigami.FormLayout {
pluginName: "kdeconnect_share"
onConfigChanged: {
path.text = get("incoming_path", StandardPaths.writableLocation(StandardPaths.DownloadsLocation).toString().replace("file://", ""))
path.text = getString("incoming_path", StandardPaths.writableLocation(StandardPaths.DownloadsLocation).toString().replace("file://", ""))
}
}
RowLayout {
Kirigami.FormData.label: i18n("Save files in:")
TextField {
QQC2.TextField {
id: path
}
Button {
QQC2.Button {
icon.name: "document-open"
onClicked: folderDialog.open()
}
}
Label {
text: "%1 in the path will be replaced with the specific device name"
QQC2.Label {
text: i18n("%1 in the path will be replaced with the specific device name")
}
}