Improve coding style

- Use latest QQC2 import
- Remove curvy brance from single statement block

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
This commit is contained in:
Carl Schwan 2022-12-13 22:49:55 +01:00
parent cd0db29609
commit b55013f57a
2 changed files with 20 additions and 34 deletions

View file

@ -4,15 +4,14 @@
* 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
*/ */
import QtQuick 2.2 import QtQuick 2.15
import QtQuick.Controls 2.1 import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.15
import QtQuick.Dialogs 1.0 import QtQuick.Dialogs 1.0
import org.kde.kirigami 2.12 as Kirigami import org.kde.kirigami 2.20 as Kirigami
import org.kde.kdeconnect 1.0 import org.kde.kdeconnect 1.0
Kirigami.ScrollablePage Kirigami.ScrollablePage {
{
id: root id: root
property QtObject currentDevice property QtObject currentDevice
title: currentDevice.name title: currentDevice.name
@ -46,7 +45,6 @@ Kirigami.ScrollablePage
] ]
ListView { ListView {
model: plugins model: plugins
delegate: Kirigami.BasicListItem { delegate: Kirigami.BasicListItem {
label: name label: name
@ -57,8 +55,7 @@ Kirigami.ScrollablePage
onClicked: onClick() onClicked: onClick()
} }
property list<QtObject> plugins : [ property list<QtObject> plugins: [
PluginItem { PluginItem {
name: i18nd("kdeconnect-app", "Multimedia control") name: i18nd("kdeconnect-app", "Multimedia control")
interfaceFactory: MprisDbusInterfaceFactory interfaceFactory: MprisDbusInterfaceFactory
@ -127,24 +124,19 @@ Kirigami.ScrollablePage
} }
} }
Column { Kirigami.PlaceholderMessage {
visible: root.currentDevice.hasPairingRequests text: i18n("Pair requested")
visible: root.currentDevice && root.currentDevice.hasPairingRequests
anchors.centerIn: parent anchors.centerIn: parent
spacing: Kirigami.Units.largeSpacing spacing: Kirigami.Units.largeSpacing
Kirigami.PlaceholderMessage {
text: i18n("Pair requested")
anchors.horizontalCenter: parent.horizontalCenter
}
RowLayout { RowLayout {
Button { QQC2.Button {
text: i18nd("kdeconnect-app", "Accept") text: i18nd("kdeconnect-app", "Accept")
icon.name:"dialog-ok" icon.name:"dialog-ok"
onClicked: root.currentDevice.acceptPairing() onClicked: root.currentDevice.acceptPairing()
} }
Button { QQC2.Button {
text: i18nd("kdeconnect-app", "Reject") text: i18nd("kdeconnect-app", "Reject")
icon.name:"dialog-cancel" icon.name:"dialog-cancel"
onClicked: root.currentDevice.rejectPairing() onClicked: root.currentDevice.rejectPairing()

View file

@ -4,32 +4,26 @@
* 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
*/ */
import QtQuick 2.2 import QtQuick 2.15
import QtQuick.Controls 2.2 import org.kde.kirigami 2.20 as Kirigami
import org.kde.kirigami 2.0 as Kirigami
Kirigami.Page Kirigami.Page {
{
id: root id: root
property string configFile property string configFile
property string device property string device
actions.main: loader.item.action actions.main: loader.item.action
onConfigFileChanged: { onConfigFileChanged: loader.setSource(configFile, {
loader.setSource(configFile, { device: root.device
device: root.device })
})
}
Loader { Loader {
anchors.fill: parent anchors.fill: parent
id: loader id: loader
Component.onCompleted: { Component.onCompleted: setSource(configFile, {
setSource(configFile, { device: root.device
device: root.device })
})
}
} }
} }