diff --git a/CMakeLists.txt b/CMakeLists.txt index 871d7b663..cc6a19d8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -150,7 +150,11 @@ add_subdirectory(settings) if(NOT WIN32 AND NOT APPLE) add_subdirectory(kio) - add_subdirectory(plasmoid) + if(QT_MAJOR_VERSION STREQUAL "6") + add_subdirectory(plasmoid-kf6) + else() + add_subdirectory(plasmoid-kf5) + endif() endif() add_subdirectory(doc) diff --git a/plasmoid/CMakeLists.txt b/plasmoid-kf5/CMakeLists.txt similarity index 100% rename from plasmoid/CMakeLists.txt rename to plasmoid-kf5/CMakeLists.txt diff --git a/plasmoid/Messages.sh b/plasmoid-kf5/Messages.sh old mode 100755 new mode 100644 similarity index 100% rename from plasmoid/Messages.sh rename to plasmoid-kf5/Messages.sh diff --git a/plasmoid/package/contents/ui/Battery.qml b/plasmoid-kf5/package/contents/ui/Battery.qml similarity index 100% rename from plasmoid/package/contents/ui/Battery.qml rename to plasmoid-kf5/package/contents/ui/Battery.qml diff --git a/plasmoid/package/contents/ui/Clipboard.qml b/plasmoid-kf5/package/contents/ui/Clipboard.qml similarity index 100% rename from plasmoid/package/contents/ui/Clipboard.qml rename to plasmoid-kf5/package/contents/ui/Clipboard.qml diff --git a/plasmoid/package/contents/ui/CompactRepresentation.qml b/plasmoid-kf5/package/contents/ui/CompactRepresentation.qml similarity index 100% rename from plasmoid/package/contents/ui/CompactRepresentation.qml rename to plasmoid-kf5/package/contents/ui/CompactRepresentation.qml diff --git a/plasmoid/package/contents/ui/Connectivity.qml b/plasmoid-kf5/package/contents/ui/Connectivity.qml similarity index 100% rename from plasmoid/package/contents/ui/Connectivity.qml rename to plasmoid-kf5/package/contents/ui/Connectivity.qml diff --git a/plasmoid/package/contents/ui/DeviceDelegate.qml b/plasmoid-kf5/package/contents/ui/DeviceDelegate.qml similarity index 100% rename from plasmoid/package/contents/ui/DeviceDelegate.qml rename to plasmoid-kf5/package/contents/ui/DeviceDelegate.qml diff --git a/plasmoid/package/contents/ui/FindMyPhone.qml b/plasmoid-kf5/package/contents/ui/FindMyPhone.qml similarity index 100% rename from plasmoid/package/contents/ui/FindMyPhone.qml rename to plasmoid-kf5/package/contents/ui/FindMyPhone.qml diff --git a/plasmoid/package/contents/ui/FullRepresentation.qml b/plasmoid-kf5/package/contents/ui/FullRepresentation.qml similarity index 100% rename from plasmoid/package/contents/ui/FullRepresentation.qml rename to plasmoid-kf5/package/contents/ui/FullRepresentation.qml diff --git a/plasmoid/package/contents/ui/RemoteCommands.qml b/plasmoid-kf5/package/contents/ui/RemoteCommands.qml similarity index 100% rename from plasmoid/package/contents/ui/RemoteCommands.qml rename to plasmoid-kf5/package/contents/ui/RemoteCommands.qml diff --git a/plasmoid/package/contents/ui/SMS.qml b/plasmoid-kf5/package/contents/ui/SMS.qml similarity index 100% rename from plasmoid/package/contents/ui/SMS.qml rename to plasmoid-kf5/package/contents/ui/SMS.qml diff --git a/plasmoid/package/contents/ui/Sftp.qml b/plasmoid-kf5/package/contents/ui/Sftp.qml similarity index 100% rename from plasmoid/package/contents/ui/Sftp.qml rename to plasmoid-kf5/package/contents/ui/Sftp.qml diff --git a/plasmoid/package/contents/ui/Share.qml b/plasmoid-kf5/package/contents/ui/Share.qml similarity index 100% rename from plasmoid/package/contents/ui/Share.qml rename to plasmoid-kf5/package/contents/ui/Share.qml diff --git a/plasmoid/package/contents/ui/VirtualMonitor.qml b/plasmoid-kf5/package/contents/ui/VirtualMonitor.qml similarity index 100% rename from plasmoid/package/contents/ui/VirtualMonitor.qml rename to plasmoid-kf5/package/contents/ui/VirtualMonitor.qml diff --git a/plasmoid/package/contents/ui/main.qml b/plasmoid-kf5/package/contents/ui/main.qml similarity index 100% rename from plasmoid/package/contents/ui/main.qml rename to plasmoid-kf5/package/contents/ui/main.qml diff --git a/plasmoid/package/metadata.json b/plasmoid-kf5/package/metadata.json similarity index 100% rename from plasmoid/package/metadata.json rename to plasmoid-kf5/package/metadata.json diff --git a/plasmoid-kf6/CMakeLists.txt b/plasmoid-kf6/CMakeLists.txt new file mode 100644 index 000000000..dabc247b7 --- /dev/null +++ b/plasmoid-kf6/CMakeLists.txt @@ -0,0 +1 @@ +kpackage_install_package(package org.kde.kdeconnect plasmoids plasma) diff --git a/plasmoid-kf6/Messages.sh b/plasmoid-kf6/Messages.sh new file mode 100644 index 000000000..eebe409ed --- /dev/null +++ b/plasmoid-kf6/Messages.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +#.qml +$XGETTEXT `find package -name '*.qml'` -o $podir/plasma_applet_org.kde.kdeconnect.pot diff --git a/plasmoid-kf6/package/contents/ui/Battery.qml b/plasmoid-kf6/package/contents/ui/Battery.qml new file mode 100644 index 000000000..fe204fe5e --- /dev/null +++ b/plasmoid-kf6/package/contents/ui/Battery.qml @@ -0,0 +1,62 @@ +/** + * SPDX-FileCopyrightText: 2014 Samoilenko Yuri + * + * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL + */ + +import QtQuick +import org.kde.plasma.core as PlasmaCore +import org.kde.kdeconnect + +QtObject { + + id: root + + property alias device: checker.device + readonly property alias available: checker.available + + readonly property PluginChecker pluginChecker: PluginChecker { + id: checker + pluginName: "battery" + } + + property bool charging: battery ? battery.isCharging : false + property int charge: battery ? battery.charge : -1 + property string displayString: (available && charge > -1) ? ((charging) ? (i18n("%1% charging", charge)) : (i18n("%1%", charge))) : i18n("No info") + property variant battery: null + + /** + * Suggests an icon name to use for the current battery level + */ + readonly property string iconName: { + charge < 0 ? + "battery-missing-symbolic" : + charge < 10 ? + charging ? + "battery-empty-charging-symbolic" : + "battery-empty-symbolic" : + charge < 25 ? + charging ? + "battery-caution-charging-symbolic" : + "battery-caution-symbolic" : + charge < 50 ? + charging ? + "battery-low-charging-symbolic" : + "battery-low-symbolic" : + charge < 75 ? + charging ? + "battery-good-charging-symbolic" : + "battery-good-symbolic" : + charging ? + "battery-full-charging-symbolic": + "battery-full-symbolic" + } + + onAvailableChanged: { + if (available) { + battery = DeviceBatteryDbusInterfaceFactory.create(device.id()) + } else { + battery = null + } + } +} diff --git a/plasmoid-kf6/package/contents/ui/Clipboard.qml b/plasmoid-kf6/package/contents/ui/Clipboard.qml new file mode 100644 index 000000000..fb8f4ccad --- /dev/null +++ b/plasmoid-kf6/package/contents/ui/Clipboard.qml @@ -0,0 +1,38 @@ +/** + * SPDX-FileCopyrightText: 2021 Yaman Qalieh + * + * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL + */ + +import QtQuick +import org.kde.plasma.core as PlasmaCore +import org.kde.kdeconnect + +QtObject { + + id: root + + property alias device: checker.device + readonly property alias available: checker.available + + readonly property PluginChecker pluginChecker: PluginChecker { + id: checker + pluginName: "clipboard" + } + + property variant clipboard: null + + function sendClipboard() { + if (clipboard) { + clipboard.sendClipboard(); + } + } + + onAvailableChanged: { + if (available) { + clipboard = ClipboardDbusInterfaceFactory.create(device.id()) + } else { + clipboard = null + } + } +} diff --git a/plasmoid-kf6/package/contents/ui/CompactRepresentation.qml b/plasmoid-kf6/package/contents/ui/CompactRepresentation.qml new file mode 100644 index 000000000..762b3380c --- /dev/null +++ b/plasmoid-kf6/package/contents/ui/CompactRepresentation.qml @@ -0,0 +1,32 @@ +/* + SPDX-FileCopyrightText: 2014-2015 Frederic St-Pierre + + SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL +*/ + +import QtQuick +import QtQuick.Layouts +import org.kde.kirigami as Kirigami + +DropArea { + onEntered: { + if (drag.hasUrls) { + root.expanded = true; + } + } + + MouseArea { + id: kdeConnectMouseArea + anchors.fill: parent + + onClicked: { + root.expanded = !root.expanded; + } + } + + Kirigami.Icon { + id: kdeConnectIcon + anchors.fill: parent + source: plasmoid.icon + } +} diff --git a/plasmoid-kf6/package/contents/ui/Connectivity.qml b/plasmoid-kf6/package/contents/ui/Connectivity.qml new file mode 100644 index 000000000..9b58eb778 --- /dev/null +++ b/plasmoid-kf6/package/contents/ui/Connectivity.qml @@ -0,0 +1,124 @@ +/** + * SPDX-FileCopyrightText: 2021 David Shlemayev + * + * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL + */ + +import QtQuick +import org.kde.plasma.core as PlasmaCore +import org.kde.kdeconnect + +QtObject { + + id: root + + property alias device: checker.device + readonly property alias available: checker.available + readonly property bool ready: connectivity + + readonly property PluginChecker pluginChecker: PluginChecker { + id: checker + pluginName: "connectivity_report" + } + + /** + * Reports a string indicating the network type. Possible values: + * 5G + * LTE + * HSPA + * UMTS + * CDMA2000 + * EDGE + * GPRS + * GSM + * CDMA + * iDEN + * + * The parsing from Android values into these strings is handled in the + * [ConnectivityReportPlugin.networkTypeToString method](https://invent.kde.org/network/kdeconnect-android/-/blob/master/src/org/kde/kdeconnect/Plugins/ConnectivityReportPlugin/ConnectivityReportPlugin.java#L82) + */ + readonly property string networkType: connectivity ? connectivity.cellularNetworkType : i18n("Unknown") + + /** + * Reports a value between 0 and 4 (inclusive) which represents the strength of the cellular connection + */ + readonly property int signalStrength: connectivity ? connectivity.cellularNetworkStrength : -1 + property string displayString: { + if (ready) { + return `${networkType} ${signalStrength}/4`; + } else { + return i18n("No signal"); + } + } + property variant connectivity: null + + /** + * Suggests an icon name to use for the current signal level + * + * Returns names which correspond to Plasma Framework's network.svg: + * https://invent.kde.org/frameworks/plasma-framework/-/blob/master/src/desktoptheme/breeze/icons/network.svg + */ + readonly property string iconName: { + // Firstly, get the name prefix which represents the signal strength + var signalStrengthIconName = + (signalStrength < 0 || !ready) ? + // As long as the signal strength is nonsense or the plugin reports as non-ready, + // show us as disconnected + "network-mobile-off" : + (signalStrength == 0) ? + "network-mobile-0" : + (signalStrength == 1) ? + "network-mobile-20" : + (signalStrength == 2) ? + "network-mobile-60" : + (signalStrength == 3) ? + "network-mobile-80" : + (signalStrength == 4) ? + "network-mobile-100" : + // Since all possible values are enumerated above, this default case should never be hit. + // However, I need it in order for my ternary syntax to be valid! + "network-mobile-available" + + // If we understand the network type, append to the icon name to show the type + var networkTypeSuffix = + (networkType === "5G") ? + // No icon for this case! + "" : + (networkType === "LTE") ? + "-lte" : + (networkType === "HSPA") ? + "-hspa" : + (networkType === "UMTS") ? + "-umts" : + (networkType === "CDMA2000") ? + // GSconnect just uses the 3g icon + // No icon for this case! + "" : + (networkType === "EDGE") ? + "-edge" : + (networkType === "GPRS") ? + "-gprs" : + (networkType === "GSM") ? + // GSconnect just uses the 2g icon + // No icon for this case! + "" : + (networkType === "CDMA") ? + // GSconnect just uses the 2g icon + // No icon for this case! + "" : + (networkType === "iDEN") ? + // GSconnect just uses the 2g icon + // No icon for this case! + "" : + "" // We didn't recognize the network type. Don't append anything. + return signalStrengthIconName + networkTypeSuffix + } + + onAvailableChanged: { + if (available) { + connectivity = DeviceConnectivityReportDbusInterfaceFactory.create(device.id()) + } else { + connectivity = null + } + } +} diff --git a/plasmoid-kf6/package/contents/ui/DeviceDelegate.qml b/plasmoid-kf6/package/contents/ui/DeviceDelegate.qml new file mode 100644 index 000000000..b9698a926 --- /dev/null +++ b/plasmoid-kf6/package/contents/ui/DeviceDelegate.qml @@ -0,0 +1,458 @@ +/** + * SPDX-FileCopyrightText: 2013 Albert Vaca + * + * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL + */ + +import QtQuick +import QtQuick.Layouts +import org.kde.plasma.core as PlasmaCore +import org.kde.plasma.components as PlasmaComponents +import org.kde.kdeconnect +import QtQuick.Controls +import org.kde.kirigami as Kirigami +import org.kde.plasma.extras as PlasmaExtras +import QtQuick.Dialogs +import QtCore + +PlasmaComponents.ItemDelegate +{ + id: root + readonly property QtObject device: DeviceDbusInterfaceFactory.create(model.deviceId) + + DropArea { + id: fileDropArea + anchors.fill: parent + + onDropped: { + if (drop.hasUrls) { + + var urls = []; + + for (var v in drop.urls) { + if (drop.urls[v] != null) { + if (urls.indexOf(drop.urls[v].toString()) == -1) { + urls.push(drop.urls[v].toString()); + } + } + } + + var i; + for (i = 0; i < urls.length; i++) { + share.plugin.shareUrl(urls[i]); + } + } + drop.accepted = true; + } + + PlasmaCore.ToolTipArea { + id: dropAreaToolTip + anchors.fill: parent + location: plasmoid.location + active: true + mainText: i18n("File Transfer") + subText: i18n("Drop a file to transfer it onto your phone.") + } + } + + contentItem: ColumnLayout { + spacing: Kirigami.Units.smallSpacing + + RowLayout + { + width: parent.width + spacing: Kirigami.Units.smallSpacing + + Battery { + id: battery + device: root.device + } + + Connectivity { + id: connectivity + device: root.device + } + + PlasmaComponents.Label { + id: deviceName + elide: Text.ElideRight + text: model.name + Layout.fillWidth: true + textFormat: Text.PlainText + } + + PlasmaComponents.ToolButton { + VirtualMonitor { + id: vd + device: root.device + } + icon.name: "video-monitor" + text: i18n("Virtual Display") + visible: vd.available + onClicked: { + if (!vd.plugin.requestVirtualMonitor()) { + console.warn("Failed to create the virtual monitor") + } + } + } + RowLayout + { + id: connectionInformation + visible: connectivity.available + spacing: Kirigami.Units.smallSpacing + + // TODO: In the future, when the Connectivity Report plugin supports more than one + // subscription, add more signal strength icons to represent all the available + // connections. + + Kirigami.Icon { + id: celluarConnectionStrengthIcon + source: connectivity.iconName + Layout.preferredHeight: connectivityText.height + Layout.preferredWidth: Layout.preferredHeight + Layout.alignment: Qt.AlignCenter + visible: valid + } + + PlasmaComponents.Label { + // Fallback plain-text label. Only show this if the icon doesn't work. + id: connectivityText + text: connectivity.displayString + textFormat: Text.PlainText + visible: !celluarConnectionStrengthIcon.visible + } + } + + RowLayout + { + id: batteryInformation + visible: (battery.available && battery.charge > -1) + spacing: Kirigami.Units.smallSpacing + + Kirigami.Icon { + id: batteryIcon + source: battery.iconName + // Make the icon the same size as the text so that it doesn't dominate + Layout.preferredHeight: batteryPercent.height + Layout.preferredWidth: Layout.preferredHeight + Layout.alignment: Qt.AlignCenter + } + + PlasmaComponents.Label { + id: batteryPercent + text: i18nc("Battery charge percentage", "%1%", battery.charge) + textFormat: Text.PlainText + } + } + + PlasmaComponents.ToolButton { + id: overflowMenu + icon.name: "application-menu" + checked: menu.status === PlasmaExtras.Menu.Open + + onPressed: menu.openRelative() + + PlasmaExtras.Menu { + id: menu + visualParent: overflowMenu + placement: PlasmaExtras.Menu.BottomPosedLeftAlignedPopup + + //Share + PlasmaExtras.MenuItem + { + property FileDialog data: FileDialog { + id: fileDialog + title: i18n("Please choose a file") + currentFolder: StandardPaths.writableLocation(StandardPaths.HomeLocation) + fileMode: FileDialog.OpenFiles + onAccepted: fileDialog.selectedFiles.forEach(url => share.plugin.shareUrl(url)) + } + + id: shareFile + icon: "document-share" + visible: share.available + text: i18n("Share file") + onClicked: fileDialog.open() + } + + //Clipboard + PlasmaExtras.MenuItem + { + property Clipboard data: Clipboard { + id: clipboard + device: root.device + } + + id: sendclipboard + icon: "klipper" + visible: clipboard.available && clipboard.clipboard.isAutoShareDisabled + text: i18n("Send Clipboard") + + onClicked: { + clipboard.sendClipboard() + } + } + + + //Find my phone + PlasmaExtras.MenuItem + { + property FindMyPhone data: FindMyPhone { + id: findmyphone + device: root.device + } + + id: ring + icon: "irc-voice" + visible: findmyphone.available + text: i18n("Ring my phone") + + onClicked: { + findmyphone.ring() + } + } + + //SFTP + PlasmaExtras.MenuItem + { + property Sftp data: Sftp { + id: sftp + device: root.device + } + + id: browse + icon: "document-open-folder" + visible: sftp.available + text: i18n("Browse this device") + + onClicked: { + sftp.browse() + } + } + + //SMS + PlasmaExtras.MenuItem + { + property SMS data: SMS { + id: sms + device: root.device + } + + icon: "message-new" + visible: sms.available + text: i18n("SMS Messages") + + onClicked: { + sms.plugin.launchApp() + } + } + } + } + } + + //RemoteKeyboard + PlasmaComponents.ItemDelegate { + visible: remoteKeyboard.remoteState + Layout.fillWidth: true + + contentItem: RowLayout { + width: parent.width + spacing: 5 + + PlasmaComponents.Label { + id: remoteKeyboardLabel + text: i18n("Remote Keyboard") + } + + RemoteKeyboard { + id: remoteKeyboard + device: root.device + Layout.fillWidth: true + } + } + } + + //Notifications + PlasmaComponents.ItemDelegate { + visible: notificationsModel.count>0 + enabled: true + Layout.fillWidth: true + + contentItem: RowLayout { + spacing: Kirigami.Units.smallSpacing + + PlasmaComponents.Label { + text: i18n("Notifications:") + } + + PlasmaComponents.ToolButton { + enabled: true + visible: notificationsModel.isAnyDimissable; + Layout.alignment: Qt.AlignRight + icon.name: "edit-clear-history" + ToolTip.text: i18n("Dismiss all notifications") + onClicked: notificationsModel.dismissAll(); + } + } + } + Repeater { + id: notificationsView + model: NotificationsModel { + id: notificationsModel + deviceId: root.device.id() + } + delegate: PlasmaComponents.ItemDelegate { + id: listitem + enabled: true + onClicked: checked = !checked + Layout.fillWidth: true + + property bool replying: false + + contentItem: ColumnLayout { + spacing: Kirigami.Units.smallSpacing + + RowLayout { + spacing: Kirigami.Units.smallSpacing + + Kirigami.Icon { + id: notificationIcon + source: appIcon + width: (valid && appIcon.length) ? dismissButton.width : 0 + height: width + Layout.alignment: Qt.AlignLeft + } + + PlasmaComponents.Label { + id: notificationLabel + text: appName + ": " + (title.length>0 ? (appName==title?notitext:title+": "+notitext) : model.name) + elide: listitem.checked ? Text.ElideNone : Text.ElideRight + maximumLineCount: listitem.checked ? 0 : 1 + wrapMode: Text.WordWrap + Layout.fillWidth: true + } + + PlasmaComponents.ToolButton { + id: replyButton + visible: repliable + enabled: repliable && !replying + icon.name: "mail-reply-sender" + ToolTip.text: i18n("Reply") + onClicked: { replying = true; replyTextField.forceActiveFocus(); } + } + + PlasmaComponents.ToolButton { + id: dismissButton + visible: notificationsModel.isAnyDimissable; + enabled: dismissable + Layout.alignment: Qt.AlignRight + icon.name: "window-close" + ToolTip.text: i18n("Dismiss") + onClicked: dbusInterface.dismiss(); + } + } + + RowLayout { + visible: replying + width: notificationLabel.width + replyButton.width + dismissButton.width + Kirigami.Units.smallSpacing * 2 + spacing: Kirigami.Units.smallSpacing + + PlasmaComponents.Button { + Layout.alignment: Qt.AlignBottom + id: replyCancelButton + text: i18n("Cancel") + display: PlasmaComponents.AbstractButton.IconOnly + PlasmaComponents.ToolTip { + text: parent.text + } + icon.name: "dialog-cancel" + onClicked: { + replyTextField.text = ""; + replying = false; + } + } + + PlasmaComponents.TextArea { + id: replyTextField + placeholderText: i18nc("@info:placeholder", "Reply to %1…", appName) + wrapMode: TextEdit.Wrap + Layout.fillWidth: true + Keys.onPressed: { + if ((event.key == Qt.Key_Return || event.key == Qt.Key_Enter) && !(event.modifiers & Qt.ShiftModifier)) { + replySendButton.clicked(); + event.accepted = true; + } + if (event.key == Qt.Key_Escape) { + replyCancelButton.clicked(); + event.accepted = true; + } + } + } + + PlasmaComponents.Button { + Layout.alignment: Qt.AlignBottom + id: replySendButton + text: i18n("Send") + icon.name: "document-send" + enabled: replyTextField.text + onClicked: { + dbusInterface.sendReply(replyTextField.text); + replyTextField.text = ""; + replying = false; + } + } + } + } + } + } + + RemoteCommands { + id: rc + device: root.device + } + + // Commands + RowLayout { + visible: rc.available + width: parent.width + spacing: Kirigami.Units.smallSpacing + + PlasmaComponents.Label { + text: i18n("Run command") + Layout.fillWidth: true + } + + PlasmaComponents.Button + { + id: addCommandButton + icon.name: "list-add" + ToolTip.text: i18n("Add command") + onClicked: rc.plugin.editCommands() + visible: rc.plugin && rc.plugin.canAddCommand + } + } + Repeater { + id: commandsView + visible: rc.available + model: RemoteCommandsModel { + id: commandsModel + deviceId: rc.device.id() + } + delegate: PlasmaComponents.ItemDelegate { + enabled: true + onClicked: rc.plugin.triggerCommand(key) + Layout.fillWidth: true + + contentItem: PlasmaComponents.Label { + text: name + "\n" + command + } + } + } + + // Share + Share { + id: share + device: root.device + } + } +} diff --git a/plasmoid-kf6/package/contents/ui/FindMyPhone.qml b/plasmoid-kf6/package/contents/ui/FindMyPhone.qml new file mode 100644 index 000000000..422be4aa7 --- /dev/null +++ b/plasmoid-kf6/package/contents/ui/FindMyPhone.qml @@ -0,0 +1,38 @@ +/** + * SPDX-FileCopyrightText: 2014 Samoilenko Yuri + * + * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL + */ + +import QtQuick +import org.kde.plasma.core as PlasmaCore +import org.kde.kdeconnect + +QtObject { + + id: root + + property alias device: checker.device + readonly property alias available: checker.available + + readonly property PluginChecker pluginChecker: PluginChecker { + id: checker + pluginName: "findmyphone" + } + + property variant findMyPhone: null + + function ring() { + if (findMyPhone) { + findMyPhone.ring(); + } + } + + onAvailableChanged: { + if (available) { + findMyPhone = FindMyPhoneDbusInterfaceFactory.create(device.id()) + } else { + findMyPhone = null + } + } +} diff --git a/plasmoid-kf6/package/contents/ui/FullRepresentation.qml b/plasmoid-kf6/package/contents/ui/FullRepresentation.qml new file mode 100644 index 000000000..7ea89169a --- /dev/null +++ b/plasmoid-kf6/package/contents/ui/FullRepresentation.qml @@ -0,0 +1,92 @@ +/** + * SPDX-FileCopyrightText: 2013 Albert Vaca + * + * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL + */ + +import QtQuick +import QtQuick.Controls +import org.kde.plasma.core as PlasmaCore +import org.kde.plasma.components as PlasmaComponents3 +import org.kde.plasma.extras as PlasmaExtras +import org.kde.kdeconnect as KdeConnect +import QtQuick.Layouts +import org.kde.kquickcontrolsaddons +import org.kde.kirigami as Kirigami +import org.kde.kcmutils as KCMUtils +import org.kde.config as KConfig + +PlasmaExtras.Representation { + id: kdeconnect + property alias devicesModel: devicesView.model + collapseMarginsHint: true + + KdeConnect.DevicesModel { + id: allDevicesModel + } + KdeConnect.DevicesModel { + id: pairedDevicesModel + displayFilter: KdeConnect.DevicesModel.Paired + } + + PlasmaComponents3.ScrollView { + id: dialogItem + anchors.fill: parent + + contentItem: ListView { + id: devicesView + spacing: Kirigami.Units.smallSpacing + + delegate: DeviceDelegate { + width: parent.width + } + + PlasmaExtras.PlaceholderMessage { + width: parent.width - Kirigami.Units.gridUnit * 2 + anchors.centerIn: parent + visible: devicesView.count === 0 + + iconName: { + if (pairedDevicesModel.count >= 0) { + return pairedDevicesModel.count === 0 ? "edit-none" : "network-disconnect"; + } + return "kdeconnect"; + } + + text: { + if (pairedDevicesModel.count >= 0) { + return pairedDevicesModel.count == 0 ? i18n("No paired devices") : i18np("Paired device is unavailable", "All paired devices are unavailable", pairedDevicesModel.count) + } else if (allDevicesModel.count == 0) { + return i18n("Install KDE Connect on your Android device to integrate it with Plasma!") + } + } + helpfulAction: Action { + text: i18n("Pair a Device...") + icon.name: "list-add" + onTriggered: KCMUtils.KCMLauncher.openSystemSettings("kcm_kdeconnect") + enabled: pairedDevicesModel.count == 0 && KConfig.KAuthorized.authorizeControlModule("kcm_kdeconnect") + } + + PlasmaComponents3.Button { + Layout.leftMargin: Kirigami.Units.gridUnit * 3 + Layout.rightMargin: Kirigami.Units.gridUnit * 3 + Layout.alignment: Qt.AlignHCenter + Layout.fillWidth: true + visible: allDevicesModel.count === 0 + text: i18n("Install from Google Play") + onClicked: Qt.openUrlExternally("https://play.google.com/store/apps/details?id=org.kde.kdeconnect_tp") + } + + PlasmaComponents3.Button { + Layout.leftMargin: Kirigami.Units.gridUnit * 3 + Layout.rightMargin: Kirigami.Units.gridUnit * 3 + Layout.alignment: Qt.AlignHCenter + Layout.fillWidth: true + visible: allDevicesModel.count === 0 + text: i18n("Install from F-Droid") + onClicked: Qt.openUrlExternally("https://f-droid.org/en/packages/org.kde.kdeconnect_tp/") + } + } + } + } +} diff --git a/plasmoid-kf6/package/contents/ui/RemoteCommands.qml b/plasmoid-kf6/package/contents/ui/RemoteCommands.qml new file mode 100644 index 000000000..e9c388c5a --- /dev/null +++ b/plasmoid-kf6/package/contents/ui/RemoteCommands.qml @@ -0,0 +1,24 @@ +/** + * SPDX-FileCopyrightText: 2018 Nicolas Fella + * + * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL + */ + +import QtQuick +import org.kde.plasma.core as PlasmaCore +import org.kde.kdeconnect + +QtObject { + + id: root + + property alias device: checker.device + readonly property alias available: checker.available + + readonly property PluginChecker pluginChecker: PluginChecker { + id: checker + pluginName: "remotecommands" + } + + property variant plugin: available ? RemoteCommandsDbusInterfaceFactory.create(device.id()) : null +} diff --git a/plasmoid-kf6/package/contents/ui/SMS.qml b/plasmoid-kf6/package/contents/ui/SMS.qml new file mode 100644 index 000000000..9d615efe2 --- /dev/null +++ b/plasmoid-kf6/package/contents/ui/SMS.qml @@ -0,0 +1,25 @@ +/** + * SPDX-FileCopyrightText: 2019 Aleix Pol Gonzalez + * + * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL + */ + +import QtQuick +import org.kde.plasma.core as PlasmaCore +import org.kde.kdeconnect + +QtObject { + + id: root + + property alias device: checker.device + readonly property alias available: checker.available + + readonly property PluginChecker pluginChecker: PluginChecker { + id: checker + pluginName: "sms" + } + + readonly property variant plugin: available ? SmsDbusInterfaceFactory.create(device.id()) : null +} + diff --git a/plasmoid-kf6/package/contents/ui/Sftp.qml b/plasmoid-kf6/package/contents/ui/Sftp.qml new file mode 100644 index 000000000..0a426fc0a --- /dev/null +++ b/plasmoid-kf6/package/contents/ui/Sftp.qml @@ -0,0 +1,37 @@ +/** + * SPDX-FileCopyrightText: 2014 Samoilenko Yuri + * + * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL + */ + +import QtQuick +import org.kde.plasma.core as PlasmaCore +import org.kde.kdeconnect + +QtObject { + + id: root + + property alias device: checker.device + readonly property alias available: checker.available + + readonly property PluginChecker pluginChecker: PluginChecker { + id: checker + pluginName: "sftp" + } + + property variant sftp: null + + function browse() { + if (sftp) + sftp.startBrowsing(); + } + + onAvailableChanged: { + if (available) { + sftp = SftpDbusInterfaceFactory.create(device.id()) + } else { + sftp = null + } + } +} diff --git a/plasmoid-kf6/package/contents/ui/Share.qml b/plasmoid-kf6/package/contents/ui/Share.qml new file mode 100644 index 000000000..319984865 --- /dev/null +++ b/plasmoid-kf6/package/contents/ui/Share.qml @@ -0,0 +1,25 @@ +/** + * SPDX-FileCopyrightText: 2018 Nicolas Fella + * + * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL + */ + +import QtQuick +import org.kde.plasma.core as PlasmaCore +import org.kde.kdeconnect + +QtObject { + + id: root + + property alias device: checker.device + readonly property alias available: checker.available + + readonly property PluginChecker pluginChecker: PluginChecker { + id: checker + pluginName: "share" + } + + property variant plugin: available ? ShareDbusInterfaceFactory.create(device.id()) : null +} + diff --git a/plasmoid-kf6/package/contents/ui/VirtualMonitor.qml b/plasmoid-kf6/package/contents/ui/VirtualMonitor.qml new file mode 100644 index 000000000..2438214a1 --- /dev/null +++ b/plasmoid-kf6/package/contents/ui/VirtualMonitor.qml @@ -0,0 +1,23 @@ +/** + * SPDX-FileCopyrightText: 2021 Aleix Pol i Gonzalez + * + * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL + */ + +import QtQuick +import org.kde.plasma.core as PlasmaCore +import org.kde.kdeconnect + +QtObject +{ + property alias device: checker.device + readonly property alias available: checker.available + + readonly property PluginChecker pluginChecker: PluginChecker { + id: checker + pluginName: "virtualmonitor" + } + + readonly property QtObject plugin: available ? VirtualmonitorDbusInterfaceFactory.create(device.id()) : null +} + diff --git a/plasmoid-kf6/package/contents/ui/main.qml b/plasmoid-kf6/package/contents/ui/main.qml new file mode 100644 index 000000000..ad6df3278 --- /dev/null +++ b/plasmoid-kf6/package/contents/ui/main.qml @@ -0,0 +1,70 @@ +/** + * SPDX-FileCopyrightText: 2014 Aleix Pol Gonzalez + * + * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL + */ + +import QtQuick +import org.kde.plasma.core as PlasmaCore +import org.kde.plasma.plasmoid +import org.kde.kquickcontrolsaddons +import org.kde.kdeconnect +import org.kde.kcmutils as KCMUtils +import org.kde.config as KConfig + +PlasmoidItem +{ + id: root + + readonly property bool inPanel: (plasmoid.location == PlasmaCore.Types.TopEdge + || plasmoid.location == PlasmaCore.Types.RightEdge + || plasmoid.location == PlasmaCore.Types.BottomEdge + || plasmoid.location == PlasmaCore.Types.LeftEdge) + + DevicesModel { + id: connectDeviceModel + displayFilter: DevicesModel.Paired | DevicesModel.Reachable + } + + DevicesModel { + id: pairedDeviceModel + displayFilter: DevicesModel.Paired + } + + Plasmoid.icon: { + let iconName = "kdeconnect-tray"; + + if (inPanel) { + return "kdeconnect-tray-symbolic"; + } + + return iconName; + } + + Binding { + target: plasmoid + property: "status" + value: (connectDeviceModel.count > 0) ? PlasmaCore.Types.ActiveStatus : PlasmaCore.Types.PassiveStatus + } + + fullRepresentation: FullRepresentation { + devicesModel: connectDeviceModel + } + + compactRepresentation: CompactRepresentation { + } + + PlasmaCore.Action { + id: configureAction + text: i18n("KDE Connect Settings...") + icon.name: "configure" + visible: KConfig.KAuthorized.authorizeControlModule("kcm_kdeconnect"); + onTriggered: { + KCMUtils.KCMLauncher.openSystemSettings("kcm_kdeconnect"); + } + } + + Component.onCompleted: { + Plasmoid.setInternalAction("configure", configureAction); + } +} diff --git a/plasmoid-kf6/package/metadata.json b/plasmoid-kf6/package/metadata.json new file mode 100644 index 000000000..aefeb0e97 --- /dev/null +++ b/plasmoid-kf6/package/metadata.json @@ -0,0 +1,123 @@ +{ + "KPackageStructure": "Plasma/Applet", + "KPlugin": { + "Authors": [ + { + "Email": "albertvaka@gmail.com", + "Name": "Albert Vaca Cintora", + "Name[ar]": "ألبرت فاكا سينتورا", + "Name[az]": "Albert Vaca Cintora", + "Name[bg]": "Albert Vaca Cintora", + "Name[ca@valencia]": "Albert Vaca Cintora", + "Name[ca]": "Albert Vaca Cintora", + "Name[cs]": "Albert Vaca Cintora", + "Name[de]": "Albert Vaca Cintora", + "Name[en_GB]": "Albert Vaca Cintora", + "Name[eo]": "Albert Vaca Cintora", + "Name[es]": "Albert Vaca Cintora", + "Name[eu]": "Albert Vaca Cintora", + "Name[fi]": "Albert Vaca Cintora", + "Name[fr]": "Albert Vaca Cintora", + "Name[gl]": "Albert Vaca Cintora", + "Name[he]": "אלברט ואקה סינטורה", + "Name[ia]": "Albert Vaca Cintora", + "Name[it]": "Albert Vaca Cintora", + "Name[ja]": "Albert Vaca Cintora", + "Name[ka]": "Albert Vaca Cintora", + "Name[ko]": "Albert Vaca Cintora", + "Name[nl]": "Albert Vaca Cintora", + "Name[nn]": "Albert Vaca Cintora", + "Name[pl]": "Albert Vaca Cintora", + "Name[pt]": "Albert Vaca Cintora", + "Name[pt_BR]": "Albert Vaca Cintora", + "Name[ru]": "Albert Vaca Cintora", + "Name[sl]": "Albert Vaca Cintora", + "Name[sv]": "Albert Vaca Cintora", + "Name[tr]": "Albert Vaca Cintora", + "Name[uk]": "Albert Vaca Cintora", + "Name[x-test]": "xxAlbert Vaca Cintoraxx", + "Name[zh_CN]": "Albert Vaca Cintora" + } + ], + "Category": "System Information", + "Description": "Show notifications from your devices using KDE Connect", + "Description[ar]": "أظهر الإخطارات من أجهزتك باستخدام «كِيدِي المتّصل»", + "Description[az]": "KDE Connect istifadə edərək digər cihazlardakı bildirişləri göstərmək", + "Description[bg]": "Показване на известия от вашите устройства чрез KDE Connect", + "Description[ca@valencia]": "Mostra les notificacions dels vostres dispositius emprant KDE Connect", + "Description[ca]": "Mostra les notificacions dels vostres dispositius emprant el KDE Connect", + "Description[cs]": "Zobrazit oznámení z vašich zařízení pomocí KDE Connect", + "Description[eo]": "Montri sciigojn de viaj aparatoj per KDE Connect", + "Description[es]": "Mustra notificaciones de sus otros dispositivos usando KDE Connect", + "Description[eu]": "Erakutsi zure gailuetako jakinarazpenak KDE Connect erabiliz", + "Description[fi]": "Näytä laitteittesi ilmoitukset KDE Connectilla", + "Description[fr]": "Afficher des notifications provenant de vos périphériques en utilisant KDE Connect", + "Description[gl]": "Amosar as notificacións dos dispositivos con KDE Connect.", + "Description[he]": "הצגת התראות מהמכשירים שלך בעזרת KDE Connect", + "Description[ia]": "Monstra notificationes ex tu dispositivos usante KDE Connect", + "Description[it]": "Mostra le notifiche dei tuoi dispositivi tramite KDE Connect", + "Description[ja]": "KDE Connect を使用してデバイスの通知を表示", + "Description[ka]": "KDE Connect-ის გამოყენებით თქვენი მოწყობილობებიდან გაფრთხილებების ჩვენება", + "Description[ko]": "KDE Connect로 장치에 표시된 알림 보기", + "Description[nl]": "Meldingen van uw apparaten met KDE Connect tonen", + "Description[nn]": "Vis varslingar frå einingane dine med KDE Connect", + "Description[pl]": "Pokazuje powiadomienia z urządzeń z KDE Connect", + "Description[pt_BR]": "Mostrar notificações dos seus dispositivos usando o KDE Connect", + "Description[sl]": "Pošljite obvestila iz drugih naprav s pomočjo KDE Connect", + "Description[sv]": "Visa underrättelser från apparater med KDE anslut", + "Description[tr]": "KDE Bağlan'ı kullanarak aygıttan gelen bildirimleri göster", + "Description[uk]": "Показ сповіщень з ваших пристроїв за допомогою програми «З’єднання KDE»", + "Description[x-test]": "xxShow notifications from your devices using KDE Connectxx", + "Description[zh_CN]": "通过 KDE Connect 显示来自其他设备的通知", + "EnabledByDefault": true, + "Icon": "kdeconnect", + "Id": "org.kde.kdeconnect", + "License": "GPL", + "Name": "KDE Connect", + "Name[ar]": "كِيدِي المتّصل", + "Name[az]": "KDE Connect", + "Name[bg]": "KDE Connect", + "Name[ca@valencia]": "KDE Connect", + "Name[ca]": "KDE Connect", + "Name[cs]": "KDE Connect", + "Name[de]": "KDE Connect", + "Name[en_GB]": "KDE Connect", + "Name[eo]": "KDE Konekti", + "Name[es]": "KDE Connect", + "Name[eu]": "KDE Connect", + "Name[fi]": "KDE Connect", + "Name[fr]": "KDE Connect", + "Name[gl]": "KDE Connect", + "Name[he]": "KDE Connect", + "Name[ia]": "KDE Connect", + "Name[is]": "KDE Connect", + "Name[it]": "KDE Connect", + "Name[ja]": "KDE Connect", + "Name[ka]": "KDE Connect", + "Name[ko]": "KDE Connect", + "Name[lt]": "KDE Connect", + "Name[nl]": "KDE Connect", + "Name[nn]": "KDE Connect", + "Name[pl]": "KDE Connect", + "Name[pt]": "KDE Connect", + "Name[pt_BR]": "KDE Connect", + "Name[ru]": "KDE Connect", + "Name[sl]": "KDE Connect", + "Name[sv]": "KDE-anslut", + "Name[tr]": "KDE Bağlan", + "Name[uk]": "KDE Connect", + "Name[x-test]": "xxKDE Connectxx", + "Name[zh_CN]": "KDE Connect", + "Name[zh_TW]": "KDE 連線", + "Version": "0.1", + "Website": "https://albertvaka.wordpress.com" + }, + "X-Plasma-API": "declarativeappletscript", + "X-Plasma-ConfigPlugins": [ + "kcm_kdeconnect" + ], + "X-Plasma-MainScript": "ui/main.qml", + "X-Plasma-API-Minimum-Version": "6.0", + "X-Plasma-NotificationArea": "true", + "X-Plasma-NotificationAreaCategory": "Hardware" +}