From 24eb0799f1ff8331175b6afa075d412517d37704 Mon Sep 17 00:00:00 2001 From: Matthijs Tijink Date: Sat, 22 Jun 2019 12:12:48 +0200 Subject: [PATCH] Show install instructions for Android when there are no devices --- .../contents/ui/FullRepresentation.qml | 53 +++++++++++++++++-- plasmoid/package/contents/ui/main.qml | 6 ++- 2 files changed, 53 insertions(+), 6 deletions(-) diff --git a/plasmoid/package/contents/ui/FullRepresentation.qml b/plasmoid/package/contents/ui/FullRepresentation.qml index e77f13e0a..1f322468a 100644 --- a/plasmoid/package/contents/ui/FullRepresentation.qml +++ b/plasmoid/package/contents/ui/FullRepresentation.qml @@ -23,17 +23,59 @@ import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.extras 2.0 as PlasmaExtras import org.kde.kdeconnect 1.0 as KdeConnect +import QtQuick.Layouts 1.9 Item { id: kdeconnect property alias devicesModel: devicesView.model - PlasmaExtras.Heading { + ColumnLayout { + spacing: 5 + visible: devicesView.count == 0 width: parent.width - level: 3 - opacity: 0.6 - text: i18n("No paired devices available") - visible: devicesView.count==0 + height: parent.height + + PlasmaExtras.Heading { + id: heading + Layout.fillWidth: true + level: 3 + opacity: 0.6 + text: i18n("No paired devices available") + } + + Item { + Layout.fillHeight: true + } + + PlasmaComponents.Label { + Layout.fillWidth: true + + text: i18n("Install KDE Connect on your Android device to integrate it with Plasma!") + horizontalAlignment: Text.AlignHCenter + wrapMode: Text.WordWrap + } + + PlasmaComponents.Button { + Layout.alignment: Qt.AlignHCenter + + text: i18n("Install from Google Play") + onClicked: Qt.openUrlExternally("https://play.google.com/store/apps/details?id=org.kde.kdeconnect_tp") + } + + PlasmaComponents.Button { + Layout.alignment: Qt.AlignHCenter + + text: i18n("Install from F-Droid") + onClicked: Qt.openUrlExternally("https://f-droid.org/en/packages/org.kde.kdeconnect_tp/") + } + + Item { + Layout.fillHeight: true + } + + Item { + height: heading.height + } } /* @@ -48,6 +90,7 @@ Item { PlasmaExtras.ScrollArea { id: dialogItem anchors.fill: parent + visible: devicesView.count > 0 ListView { id: devicesView diff --git a/plasmoid/package/contents/ui/main.qml b/plasmoid/package/contents/ui/main.qml index 8b29d989c..c17b35bf1 100644 --- a/plasmoid/package/contents/ui/main.qml +++ b/plasmoid/package/contents/ui/main.qml @@ -32,13 +32,17 @@ Item DevicesModel { id: connectDeviceModel displayFilter: DevicesModel.Paired | DevicesModel.Reachable + } + DevicesModel { + id: pairedDeviceModel + displayFilter: DevicesModel.Paired } Binding { target: plasmoid property: "status" - value: (connectDeviceModel.count > 0) ? PlasmaCore.Types.ActiveStatus : PlasmaCore.Types.HiddenStatus + value: (connectDeviceModel.count > 0) ? PlasmaCore.Types.ActiveStatus : ((pairedDeviceModel.count > 0) ? PlasmaCore.Types.HiddenStatus : PlasmaCore.Types.PassiveStatus) } Plasmoid.fullRepresentation: FullRepresentation {