2013-08-22 02:21:08 +01:00
|
|
|
/**
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-FileCopyrightText: 2013 Albert Vaca <albertvaka@gmail.com>
|
2024-06-30 23:03:57 +01:00
|
|
|
* SPDX-FileCopyrightText: 2024 ivan tkachenko <me@ratijas.tk>
|
2013-08-21 17:28:11 +01:00
|
|
|
*
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
2013-08-21 17:28:11 +01:00
|
|
|
*/
|
|
|
|
|
2024-06-30 23:59:11 +01:00
|
|
|
pragma ComponentBehavior: Bound
|
|
|
|
|
2024-06-30 23:03:57 +01:00
|
|
|
import QtCore
|
2023-11-30 23:41:36 +00:00
|
|
|
import QtQuick
|
2024-06-30 23:03:57 +01:00
|
|
|
import QtQuick.Dialogs as QtDialogs
|
2023-11-30 23:41:36 +00:00
|
|
|
import QtQuick.Layouts
|
2024-06-30 23:03:57 +01:00
|
|
|
|
|
|
|
import org.kde.kdeconnect as KDEConnect
|
2023-11-30 23:41:36 +00:00
|
|
|
import org.kde.kirigami as Kirigami
|
2024-06-30 23:03:57 +01:00
|
|
|
import org.kde.plasma.components as PlasmaComponents
|
|
|
|
import org.kde.plasma.core as PlasmaCore
|
2023-11-30 23:41:36 +00:00
|
|
|
import org.kde.plasma.extras as PlasmaExtras
|
|
|
|
|
2024-06-30 23:03:57 +01:00
|
|
|
PlasmaComponents.ItemDelegate {
|
2013-08-22 02:21:08 +01:00
|
|
|
id: root
|
2024-06-30 23:03:57 +01:00
|
|
|
|
2024-06-30 23:59:11 +01:00
|
|
|
required property int index
|
|
|
|
required property var model
|
|
|
|
|
2024-06-30 23:03:57 +01:00
|
|
|
readonly property KDEConnect.DeviceDbusInterface device: KDEConnect.DeviceDbusInterfaceFactory.create(model.deviceId)
|
2014-01-29 05:16:23 +00:00
|
|
|
|
2023-12-14 00:04:04 +00:00
|
|
|
hoverEnabled: false
|
|
|
|
down: false
|
|
|
|
|
2024-06-30 23:34:20 +01:00
|
|
|
Battery {
|
|
|
|
id: battery
|
|
|
|
device: root.device
|
|
|
|
}
|
|
|
|
|
|
|
|
Clipboard {
|
|
|
|
id: clipboard
|
|
|
|
device: root.device
|
|
|
|
}
|
|
|
|
|
|
|
|
Connectivity {
|
|
|
|
id: connectivity
|
|
|
|
device: root.device
|
|
|
|
}
|
|
|
|
|
|
|
|
FindMyPhone {
|
|
|
|
id: findmyphone
|
|
|
|
device: root.device
|
|
|
|
}
|
|
|
|
|
|
|
|
RemoteCommands {
|
|
|
|
id: remoteCommands
|
|
|
|
device: root.device
|
|
|
|
}
|
|
|
|
|
|
|
|
Sftp {
|
|
|
|
id: sftp
|
|
|
|
device: root.device
|
|
|
|
}
|
|
|
|
|
|
|
|
Share {
|
|
|
|
id: share
|
|
|
|
device: root.device
|
|
|
|
}
|
|
|
|
|
|
|
|
SMS {
|
|
|
|
id: sms
|
|
|
|
device: root.device
|
|
|
|
}
|
|
|
|
|
|
|
|
VirtualMonitor {
|
|
|
|
id: virtualmonitor
|
|
|
|
device: root.device
|
|
|
|
}
|
|
|
|
|
virtualmonitor: implemented capabilities check
BUG: 485829
## Summary
Currently, the plugin just fails silently if the local device is missing the `krfb` package or if the remote device misses an `vnc://` protocol/scheme handler. You click the button and nothing happens.
One issue is, that the plugin is considered `virtualmonitor.available` in the `DeviceDelegate.qml`, even if the check for `krfb-virtualmonitor` fails and no dbus-path is provided. I investigated the behavior a bit, but ignored it in the end as this MR benefits from being shown for device constellations that _could_ provide this feature.
A warning is shown with brief instructions, how to get the plugin working correctly.
- Check if krfb-virtualmonitor is available locally
- Check default scheme handler for vnc:// on device (Linux)
- Show warnings / reasons, if no connection could be established
## Test Plan
Regarding if the devices have mentioned packages installed, we should see different behaviors.
If the remote device has no VNC client, it can not connect to out server. _A warning should be shown._
If the local device hasn't the `krfb-virtualmonitor` available, the remote device couldn't connect. _A warning should be shown._
If both problems are present, _both warnings should be shown._
If none of these are present, no warning should be shown and we should try to establish a connection.
The connection attempts failed? _A warning should be shown._
2024-05-31 00:13:54 +01:00
|
|
|
Kirigami.PromptDialog {
|
|
|
|
id: prompt
|
|
|
|
visible: false
|
|
|
|
showCloseButton: true
|
|
|
|
standardButtons: Kirigami.Dialog.NoButton
|
|
|
|
title: i18n("Virtual Monitor is not available")
|
|
|
|
}
|
|
|
|
|
2024-06-30 23:34:20 +01:00
|
|
|
QtDialogs.FileDialog {
|
|
|
|
id: fileDialog
|
|
|
|
title: i18n("Please choose a file")
|
|
|
|
currentFolder: StandardPaths.writableLocation(StandardPaths.HomeLocation)
|
|
|
|
fileMode: QtDialogs.FileDialog.OpenFiles
|
|
|
|
onAccepted: {
|
|
|
|
selectedFiles.forEach(url => share.plugin.shareUrl(url));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PlasmaExtras.Menu {
|
|
|
|
id: menu
|
|
|
|
|
|
|
|
visualParent: overflowMenu
|
|
|
|
placement: PlasmaExtras.Menu.BottomPosedLeftAlignedPopup
|
|
|
|
|
|
|
|
// Share
|
|
|
|
PlasmaExtras.MenuItem {
|
|
|
|
icon: "document-share"
|
|
|
|
visible: share.available
|
|
|
|
text: i18n("Share file")
|
|
|
|
onClicked: fileDialog.open()
|
|
|
|
}
|
|
|
|
|
|
|
|
// Clipboard
|
|
|
|
PlasmaExtras.MenuItem {
|
|
|
|
icon: "klipper"
|
|
|
|
visible: clipboard.clipboard?.isAutoShareDisabled ?? false
|
|
|
|
text: i18n("Send Clipboard")
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
clipboard.sendClipboard()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Find my phone
|
|
|
|
PlasmaExtras.MenuItem {
|
|
|
|
icon: "irc-voice"
|
|
|
|
visible: findmyphone.available
|
|
|
|
text: i18n("Ring my phone")
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
findmyphone.ring()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SFTP
|
|
|
|
PlasmaExtras.MenuItem {
|
|
|
|
icon: "document-open-folder"
|
|
|
|
visible: sftp.available
|
|
|
|
text: i18n("Browse this device")
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
sftp.browse()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SMS
|
|
|
|
PlasmaExtras.MenuItem {
|
|
|
|
icon: "message-new"
|
|
|
|
visible: sms.available
|
|
|
|
text: i18n("SMS Messages")
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
sms.plugin.launchApp()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-02 17:26:21 +00:00
|
|
|
DropArea {
|
|
|
|
id: fileDropArea
|
|
|
|
anchors.fill: parent
|
|
|
|
|
2024-06-30 23:03:57 +01:00
|
|
|
onDropped: drop => {
|
2019-01-02 17:26:21 +00:00
|
|
|
if (drop.hasUrls) {
|
2024-06-30 23:03:57 +01:00
|
|
|
const urls = new Set(drop.urls.map(url => url.toString()));
|
|
|
|
urls.forEach(url => share.plugin.shareUrl(url));
|
2019-01-02 17:26:21 +00:00
|
|
|
}
|
|
|
|
drop.accepted = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
PlasmaCore.ToolTipArea {
|
|
|
|
id: dropAreaToolTip
|
|
|
|
anchors.fill: parent
|
|
|
|
active: true
|
|
|
|
mainText: i18n("File Transfer")
|
|
|
|
subText: i18n("Drop a file to transfer it onto your phone.")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-11-30 23:41:36 +00:00
|
|
|
contentItem: ColumnLayout {
|
|
|
|
spacing: Kirigami.Units.smallSpacing
|
2018-05-09 00:15:03 +01:00
|
|
|
|
2024-06-30 23:03:57 +01:00
|
|
|
RowLayout {
|
2019-10-12 19:06:12 +01:00
|
|
|
width: parent.width
|
2023-11-30 23:41:36 +00:00
|
|
|
spacing: Kirigami.Units.smallSpacing
|
|
|
|
|
2014-01-27 16:52:29 +00:00
|
|
|
PlasmaComponents.Label {
|
2019-10-12 19:06:12 +01:00
|
|
|
id: deviceName
|
2015-09-11 16:51:50 +01:00
|
|
|
elide: Text.ElideRight
|
2024-06-30 23:59:11 +01:00
|
|
|
text: root.model.name
|
2021-07-14 04:30:25 +01:00
|
|
|
Layout.fillWidth: true
|
|
|
|
textFormat: Text.PlainText
|
|
|
|
}
|
2021-03-12 23:27:16 +00:00
|
|
|
|
2023-11-30 23:41:36 +00:00
|
|
|
PlasmaComponents.ToolButton {
|
2024-07-27 20:21:06 +01:00
|
|
|
icon.name: "krdc"
|
virtualmonitor: implemented capabilities check
BUG: 485829
## Summary
Currently, the plugin just fails silently if the local device is missing the `krfb` package or if the remote device misses an `vnc://` protocol/scheme handler. You click the button and nothing happens.
One issue is, that the plugin is considered `virtualmonitor.available` in the `DeviceDelegate.qml`, even if the check for `krfb-virtualmonitor` fails and no dbus-path is provided. I investigated the behavior a bit, but ignored it in the end as this MR benefits from being shown for device constellations that _could_ provide this feature.
A warning is shown with brief instructions, how to get the plugin working correctly.
- Check if krfb-virtualmonitor is available locally
- Check default scheme handler for vnc:// on device (Linux)
- Show warnings / reasons, if no connection could be established
## Test Plan
Regarding if the devices have mentioned packages installed, we should see different behaviors.
If the remote device has no VNC client, it can not connect to out server. _A warning should be shown._
If the local device hasn't the `krfb-virtualmonitor` available, the remote device couldn't connect. _A warning should be shown._
If both problems are present, _both warnings should be shown._
If none of these are present, no warning should be shown and we should try to establish a connection.
The connection attempts failed? _A warning should be shown._
2024-05-31 00:13:54 +01:00
|
|
|
visible: virtualmonitor.available
|
2021-10-19 00:25:14 +01:00
|
|
|
text: i18n("Virtual Display")
|
|
|
|
onClicked: {
|
virtualmonitor: implemented capabilities check
BUG: 485829
## Summary
Currently, the plugin just fails silently if the local device is missing the `krfb` package or if the remote device misses an `vnc://` protocol/scheme handler. You click the button and nothing happens.
One issue is, that the plugin is considered `virtualmonitor.available` in the `DeviceDelegate.qml`, even if the check for `krfb-virtualmonitor` fails and no dbus-path is provided. I investigated the behavior a bit, but ignored it in the end as this MR benefits from being shown for device constellations that _could_ provide this feature.
A warning is shown with brief instructions, how to get the plugin working correctly.
- Check if krfb-virtualmonitor is available locally
- Check default scheme handler for vnc:// on device (Linux)
- Show warnings / reasons, if no connection could be established
## Test Plan
Regarding if the devices have mentioned packages installed, we should see different behaviors.
If the remote device has no VNC client, it can not connect to out server. _A warning should be shown._
If the local device hasn't the `krfb-virtualmonitor` available, the remote device couldn't connect. _A warning should be shown._
If both problems are present, _both warnings should be shown._
If none of these are present, no warning should be shown and we should try to establish a connection.
The connection attempts failed? _A warning should be shown._
2024-05-31 00:13:54 +01:00
|
|
|
let err = "";
|
|
|
|
if (virtualmonitor?.plugin?.hasRemoteVncClient === false) {
|
|
|
|
err = i18n("Remote device does not have a VNC client (eg. krdc) installed.");
|
|
|
|
}
|
|
|
|
if (virtualmonitor?.plugin?.isVirtualMonitorAvailable === false) {
|
|
|
|
err = (err ? err + "\n\n" : "")
|
|
|
|
+ i18n("The krfb package is required on the local device.");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (err) {
|
|
|
|
prompt.subtitle = err;
|
|
|
|
prompt.visible = true;
|
|
|
|
} else if (!virtualmonitor.plugin.requestVirtualMonitor()) {
|
|
|
|
prompt.subtitle = i18n("Failed to create the virtual monitor.");
|
|
|
|
prompt.visible = true;
|
2021-10-19 00:25:14 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-06-30 23:03:57 +01:00
|
|
|
|
|
|
|
RowLayout {
|
2021-07-14 04:30:25 +01:00
|
|
|
id: connectionInformation
|
2024-06-30 23:03:57 +01:00
|
|
|
|
2021-07-14 04:30:25 +01:00
|
|
|
visible: connectivity.available
|
2023-11-30 23:41:36 +00:00
|
|
|
spacing: Kirigami.Units.smallSpacing
|
2021-07-14 04:30:25 +01:00
|
|
|
|
|
|
|
// 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.
|
|
|
|
|
2023-11-30 23:41:36 +00:00
|
|
|
Kirigami.Icon {
|
2021-07-14 04:30:25 +01:00
|
|
|
id: celluarConnectionStrengthIcon
|
|
|
|
source: connectivity.iconName
|
|
|
|
Layout.preferredHeight: connectivityText.height
|
|
|
|
Layout.preferredWidth: Layout.preferredHeight
|
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
visible: valid
|
|
|
|
}
|
2021-03-12 23:27:16 +00:00
|
|
|
|
2021-07-14 04:30:25 +01:00
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
2021-03-12 23:27:16 +00:00
|
|
|
|
2024-06-30 23:03:57 +01:00
|
|
|
RowLayout {
|
2021-07-14 04:30:25 +01:00
|
|
|
id: batteryInformation
|
2024-06-30 23:03:57 +01:00
|
|
|
|
|
|
|
visible: battery.available && battery.charge > -1
|
2023-11-30 23:41:36 +00:00
|
|
|
spacing: Kirigami.Units.smallSpacing
|
2021-07-14 04:30:25 +01:00
|
|
|
|
2023-11-30 23:41:36 +00:00
|
|
|
Kirigami.Icon {
|
2021-07-14 04:30:25 +01:00
|
|
|
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
|
2021-03-12 23:27:16 +00:00
|
|
|
}
|
2015-09-11 16:51:50 +01:00
|
|
|
}
|
|
|
|
|
2023-11-30 23:41:36 +00:00
|
|
|
PlasmaComponents.ToolButton {
|
2019-10-12 19:06:12 +01:00
|
|
|
id: overflowMenu
|
2024-06-30 23:03:57 +01:00
|
|
|
|
2020-02-11 09:12:12 +00:00
|
|
|
icon.name: "application-menu"
|
2023-11-30 23:41:36 +00:00
|
|
|
checked: menu.status === PlasmaExtras.Menu.Open
|
2020-02-11 09:12:12 +00:00
|
|
|
|
2021-07-23 19:40:41 +01:00
|
|
|
onPressed: menu.openRelative()
|
2019-07-20 15:02:38 +01:00
|
|
|
}
|
2013-08-21 17:28:11 +01:00
|
|
|
}
|
2014-02-14 16:11:41 +00:00
|
|
|
|
2024-06-30 23:03:57 +01:00
|
|
|
// RemoteKeyboard
|
2023-11-30 23:41:36 +00:00
|
|
|
PlasmaComponents.ItemDelegate {
|
2018-05-09 00:15:03 +01:00
|
|
|
visible: remoteKeyboard.remoteState
|
2023-11-30 23:41:36 +00:00
|
|
|
Layout.fillWidth: true
|
2017-01-23 08:08:27 +00:00
|
|
|
|
2023-11-30 23:41:36 +00:00
|
|
|
contentItem: RowLayout {
|
2017-01-23 08:08:27 +00:00
|
|
|
width: parent.width
|
|
|
|
spacing: 5
|
|
|
|
|
|
|
|
PlasmaComponents.Label {
|
|
|
|
id: remoteKeyboardLabel
|
|
|
|
text: i18n("Remote Keyboard")
|
|
|
|
}
|
|
|
|
|
2024-06-30 23:03:57 +01:00
|
|
|
KDEConnect.RemoteKeyboard {
|
2018-11-08 01:01:51 +00:00
|
|
|
id: remoteKeyboard
|
|
|
|
device: root.device
|
|
|
|
Layout.fillWidth: true
|
2017-01-23 08:08:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-06-30 23:03:57 +01:00
|
|
|
// Notifications
|
2023-11-30 23:41:36 +00:00
|
|
|
PlasmaComponents.ItemDelegate {
|
2024-06-30 23:03:57 +01:00
|
|
|
visible: notificationsModel.count > 0
|
2013-08-28 18:33:46 +01:00
|
|
|
enabled: true
|
2023-11-30 23:41:36 +00:00
|
|
|
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"
|
2024-06-30 23:03:57 +01:00
|
|
|
PlasmaComponents.ToolTip.text: i18n("Dismiss all notifications")
|
2023-11-30 23:41:36 +00:00
|
|
|
onClicked: notificationsModel.dismissAll();
|
|
|
|
}
|
2013-08-22 02:21:08 +01:00
|
|
|
}
|
|
|
|
}
|
2024-06-30 23:03:57 +01:00
|
|
|
|
2013-08-22 02:21:08 +01:00
|
|
|
Repeater {
|
|
|
|
id: notificationsView
|
2024-06-30 23:03:57 +01:00
|
|
|
|
|
|
|
model: KDEConnect.NotificationsModel {
|
2013-08-22 02:21:08 +01:00
|
|
|
id: notificationsModel
|
2024-06-30 23:59:11 +01:00
|
|
|
deviceId: root.model.deviceId
|
2013-08-22 02:21:08 +01:00
|
|
|
}
|
2024-06-30 23:03:57 +01:00
|
|
|
|
2023-11-30 23:41:36 +00:00
|
|
|
delegate: PlasmaComponents.ItemDelegate {
|
2016-10-04 00:12:04 +01:00
|
|
|
id: listitem
|
2024-06-30 23:03:57 +01:00
|
|
|
|
2024-06-30 23:59:11 +01:00
|
|
|
required property int index
|
|
|
|
required property var model
|
|
|
|
|
2016-10-04 00:12:04 +01:00
|
|
|
enabled: true
|
|
|
|
onClicked: checked = !checked
|
2023-11-30 23:41:36 +00:00
|
|
|
Layout.fillWidth: true
|
2016-10-04 00:12:04 +01:00
|
|
|
|
2022-09-26 20:51:28 +01:00
|
|
|
property bool replying: false
|
|
|
|
|
2023-11-30 23:41:36 +00:00
|
|
|
contentItem: ColumnLayout {
|
|
|
|
spacing: Kirigami.Units.smallSpacing
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
spacing: Kirigami.Units.smallSpacing
|
|
|
|
|
|
|
|
Kirigami.Icon {
|
|
|
|
id: notificationIcon
|
2024-06-30 23:59:11 +01:00
|
|
|
source: listitem.model.appIcon
|
|
|
|
width: (valid && listitem.model.appIcon !== "") ? dismissButton.width : 0
|
2023-11-30 23:41:36 +00:00
|
|
|
height: width
|
|
|
|
Layout.alignment: Qt.AlignLeft
|
2022-09-26 20:51:28 +01:00
|
|
|
}
|
2023-11-30 23:41:36 +00:00
|
|
|
|
|
|
|
PlasmaComponents.Label {
|
|
|
|
id: notificationLabel
|
2024-06-30 23:59:11 +01:00
|
|
|
text: {
|
|
|
|
const { appName, notitext, title } = listitem.model;
|
|
|
|
const description = title !== "" ? (appName === title ? notitext : `${title}: ${notitext}`) : notitext;
|
|
|
|
return `${appName}: ${description}`;
|
|
|
|
}
|
2023-11-30 23:41:36 +00:00
|
|
|
elide: listitem.checked ? Text.ElideNone : Text.ElideRight
|
|
|
|
maximumLineCount: listitem.checked ? 0 : 1
|
2024-06-30 23:59:11 +01:00
|
|
|
wrapMode: Text.Wrap
|
2023-11-30 23:41:36 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
|
|
|
|
PlasmaComponents.ToolButton {
|
|
|
|
id: replyButton
|
2024-06-30 23:59:11 +01:00
|
|
|
visible: listitem.model.repliable
|
|
|
|
enabled: listitem.model.repliable && !listitem.replying
|
2023-11-30 23:41:36 +00:00
|
|
|
icon.name: "mail-reply-sender"
|
2024-06-30 23:03:57 +01:00
|
|
|
PlasmaComponents.ToolTip.text: i18n("Reply")
|
2024-06-30 23:59:11 +01:00
|
|
|
onClicked: {
|
|
|
|
listitem.replying = true;
|
|
|
|
replyTextField.forceActiveFocus();
|
|
|
|
}
|
2023-11-30 23:41:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PlasmaComponents.ToolButton {
|
|
|
|
id: dismissButton
|
|
|
|
visible: notificationsModel.isAnyDimissable;
|
2024-06-30 23:59:11 +01:00
|
|
|
enabled: listitem.model.dismissable
|
2023-11-30 23:41:36 +00:00
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
icon.name: "window-close"
|
2024-06-30 23:03:57 +01:00
|
|
|
PlasmaComponents.ToolTip.text: i18n("Dismiss")
|
2024-06-30 23:59:11 +01:00
|
|
|
onClicked: listitem.model.dbusInterface.dismiss();
|
2022-09-26 20:51:28 +01:00
|
|
|
}
|
|
|
|
}
|
2023-11-30 23:41:36 +00:00
|
|
|
|
|
|
|
RowLayout {
|
2024-06-30 23:59:11 +01:00
|
|
|
visible: listitem.replying
|
2023-11-30 23:41:36 +00:00
|
|
|
width: notificationLabel.width + replyButton.width + dismissButton.width + Kirigami.Units.smallSpacing * 2
|
|
|
|
spacing: Kirigami.Units.smallSpacing
|
|
|
|
|
|
|
|
PlasmaComponents.Button {
|
|
|
|
id: replyCancelButton
|
2024-06-30 23:59:11 +01:00
|
|
|
Layout.alignment: Qt.AlignBottom
|
2023-11-30 23:41:36 +00:00
|
|
|
text: i18n("Cancel")
|
|
|
|
display: PlasmaComponents.AbstractButton.IconOnly
|
|
|
|
PlasmaComponents.ToolTip {
|
2024-06-30 23:59:11 +01:00
|
|
|
text: replyCancelButton.text
|
2022-09-26 20:51:28 +01:00
|
|
|
}
|
2023-11-30 23:41:36 +00:00
|
|
|
icon.name: "dialog-cancel"
|
|
|
|
onClicked: {
|
|
|
|
replyTextField.text = "";
|
2024-06-30 23:59:11 +01:00
|
|
|
listitem.replying = false;
|
2022-09-26 20:51:28 +01:00
|
|
|
}
|
|
|
|
}
|
2023-11-30 23:41:36 +00:00
|
|
|
|
|
|
|
PlasmaComponents.TextArea {
|
|
|
|
id: replyTextField
|
2024-06-30 23:59:11 +01:00
|
|
|
placeholderText: i18nc("@info:placeholder", "Reply to %1…", listitem.model.appName)
|
2023-11-30 23:41:36 +00:00
|
|
|
wrapMode: TextEdit.Wrap
|
|
|
|
Layout.fillWidth: true
|
2024-06-30 23:03:57 +01:00
|
|
|
Keys.onPressed: event => {
|
|
|
|
if ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && !(event.modifiers & Qt.ShiftModifier)) {
|
2023-11-30 23:41:36 +00:00
|
|
|
replySendButton.clicked();
|
|
|
|
event.accepted = true;
|
|
|
|
}
|
2024-06-30 23:03:57 +01:00
|
|
|
if (event.key === Qt.Key_Escape) {
|
2023-11-30 23:41:36 +00:00
|
|
|
replyCancelButton.clicked();
|
|
|
|
event.accepted = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PlasmaComponents.Button {
|
|
|
|
Layout.alignment: Qt.AlignBottom
|
|
|
|
id: replySendButton
|
|
|
|
text: i18n("Send")
|
|
|
|
icon.name: "document-send"
|
2024-06-30 23:59:11 +01:00
|
|
|
enabled: replyTextField.text !== ""
|
2023-11-30 23:41:36 +00:00
|
|
|
onClicked: {
|
2024-06-30 23:59:11 +01:00
|
|
|
listitem.model.dbusInterface.sendReply(replyTextField.text);
|
2023-11-30 23:41:36 +00:00
|
|
|
replyTextField.text = "";
|
2024-06-30 23:59:11 +01:00
|
|
|
listitem.replying = false;
|
2023-11-30 23:41:36 +00:00
|
|
|
}
|
2022-09-26 20:51:28 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-08-22 02:21:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-27 07:04:05 +01:00
|
|
|
// Commands
|
2018-11-02 14:38:52 +00:00
|
|
|
RowLayout {
|
2024-06-30 23:03:57 +01:00
|
|
|
visible: remoteCommands.available
|
2018-11-02 14:38:52 +00:00
|
|
|
width: parent.width
|
2023-11-30 23:41:36 +00:00
|
|
|
spacing: Kirigami.Units.smallSpacing
|
2018-11-02 14:38:52 +00:00
|
|
|
|
2018-10-30 22:37:27 +00:00
|
|
|
PlasmaComponents.Label {
|
2018-11-02 14:44:14 +00:00
|
|
|
text: i18n("Run command")
|
2018-11-02 14:38:52 +00:00
|
|
|
Layout.fillWidth: true
|
2018-10-30 22:37:27 +00:00
|
|
|
}
|
2018-11-02 14:38:52 +00:00
|
|
|
|
2024-06-30 23:03:57 +01:00
|
|
|
PlasmaComponents.Button {
|
2018-10-30 22:37:27 +00:00
|
|
|
id: addCommandButton
|
2023-11-30 23:41:36 +00:00
|
|
|
icon.name: "list-add"
|
2024-06-30 23:03:57 +01:00
|
|
|
PlasmaComponents.ToolTip.text: i18n("Add command")
|
|
|
|
onClicked: remoteCommands.plugin.editCommands()
|
|
|
|
visible: remoteCommands.plugin?.canAddCommand ?? false
|
2018-10-30 22:37:27 +00:00
|
|
|
}
|
2018-07-27 07:04:05 +01:00
|
|
|
}
|
2024-06-30 23:03:57 +01:00
|
|
|
|
2018-07-27 07:04:05 +01:00
|
|
|
Repeater {
|
|
|
|
id: commandsView
|
2024-06-30 23:03:57 +01:00
|
|
|
|
|
|
|
visible: remoteCommands.available
|
|
|
|
|
|
|
|
model: KDEConnect.RemoteCommandsModel {
|
2018-07-27 07:04:05 +01:00
|
|
|
id: commandsModel
|
2024-06-30 23:59:11 +01:00
|
|
|
deviceId: root.model.deviceId
|
2018-07-27 07:04:05 +01:00
|
|
|
}
|
2024-06-30 23:03:57 +01:00
|
|
|
|
2023-11-30 23:41:36 +00:00
|
|
|
delegate: PlasmaComponents.ItemDelegate {
|
2024-06-30 23:59:11 +01:00
|
|
|
id: commandDelegate
|
|
|
|
|
|
|
|
required property int index
|
|
|
|
required property var model
|
|
|
|
|
2018-07-27 07:04:05 +01:00
|
|
|
enabled: true
|
2024-06-30 23:59:11 +01:00
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
remoteCommands.plugin?.triggerCommand(commandDelegate.model.key);
|
|
|
|
}
|
|
|
|
|
2023-11-30 23:41:36 +00:00
|
|
|
Layout.fillWidth: true
|
2013-08-22 02:21:08 +01:00
|
|
|
|
2023-11-30 23:41:36 +00:00
|
|
|
contentItem: PlasmaComponents.Label {
|
2024-06-30 23:59:11 +01:00
|
|
|
text: `${commandDelegate.model.name}\n${commandDelegate.model.command}`
|
2018-07-27 07:04:05 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-08-22 02:21:08 +01:00
|
|
|
}
|
2013-08-21 17:28:11 +01:00
|
|
|
}
|