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

View file

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