Warning, /network/kdeconnect-kde/plasmoid/package/contents/ui/FullRepresentation.qml is written in an unsupported language. File is not indexed.

0001 /**
0002  * SPDX-FileCopyrightText: 2013 Albert Vaca <albertvaka@gmail.com>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  */
0006 
0007 import QtQuick
0008 import QtQuick.Controls
0009 import org.kde.plasma.core as PlasmaCore
0010 import org.kde.plasma.components as PlasmaComponents3
0011 import org.kde.plasma.extras as PlasmaExtras
0012 import org.kde.kdeconnect as KdeConnect
0013 import QtQuick.Layouts
0014 import org.kde.kquickcontrolsaddons
0015 import org.kde.kirigami as Kirigami
0016 import org.kde.kcmutils as KCMUtils
0017 import org.kde.config as KConfig
0018 
0019 PlasmaExtras.Representation {
0020     id: kdeconnect
0021     property alias devicesModel: devicesView.model
0022     collapseMarginsHint: true
0023 
0024     KdeConnect.DevicesModel {
0025         id: allDevicesModel
0026     }
0027     KdeConnect.DevicesModel {
0028         id: pairedDevicesModel
0029         displayFilter: KdeConnect.DevicesModel.Paired
0030     }
0031 
0032     PlasmaComponents3.ScrollView {
0033         id: dialogItem
0034         anchors.fill: parent
0035 
0036         contentItem: ListView {
0037             id: devicesView
0038             spacing: Kirigami.Units.smallSpacing
0039 
0040             delegate: DeviceDelegate {
0041                 width: parent.width
0042             }
0043 
0044             PlasmaExtras.PlaceholderMessage {
0045                 width: parent.width - Kirigami.Units.gridUnit * 2
0046                 anchors.centerIn: parent
0047                 visible: devicesView.count === 0
0048 
0049                 iconName: {
0050                     if (pairedDevicesModel.count >= 0) {
0051                         return pairedDevicesModel.count === 0 ? "edit-none" : "network-disconnect";
0052                     }
0053                     return "kdeconnect";
0054                 }
0055 
0056                 text: {
0057                     if (pairedDevicesModel.count >= 0) {
0058                         return pairedDevicesModel.count == 0 ? i18n("No paired devices") : i18np("Paired device is unavailable", "All paired devices are unavailable", pairedDevicesModel.count)
0059                     } else if (allDevicesModel.count == 0) {
0060                         return i18n("Install KDE Connect on your Android device to integrate it with Plasma!")
0061                     }
0062                 }
0063                 helpfulAction: Action {
0064                     text: i18n("Pair a Device...")
0065                     icon.name: "list-add"
0066                     onTriggered: KCMUtils.KCMLauncher.openSystemSettings("kcm_kdeconnect")
0067                     enabled: pairedDevicesModel.count == 0 && KConfig.KAuthorized.authorizeControlModule("kcm_kdeconnect")
0068                 }
0069 
0070                 PlasmaComponents3.Button {
0071                     Layout.leftMargin: Kirigami.Units.gridUnit * 3
0072                     Layout.rightMargin: Kirigami.Units.gridUnit * 3
0073                     Layout.alignment: Qt.AlignHCenter
0074                     Layout.fillWidth: true
0075                     visible: allDevicesModel.count === 0
0076                     text: i18n("Install from Google Play")
0077                     onClicked: Qt.openUrlExternally("https://play.google.com/store/apps/details?id=org.kde.kdeconnect_tp")
0078                 }
0079 
0080                 PlasmaComponents3.Button {
0081                     Layout.leftMargin: Kirigami.Units.gridUnit * 3
0082                     Layout.rightMargin: Kirigami.Units.gridUnit * 3
0083                     Layout.alignment: Qt.AlignHCenter
0084                     Layout.fillWidth: true
0085                     visible: allDevicesModel.count === 0
0086                     text: i18n("Install from F-Droid")
0087                     onClicked: Qt.openUrlExternally("https://f-droid.org/en/packages/org.kde.kdeconnect_tp/")
0088                 }
0089             }
0090         }
0091     }
0092 }