2018-06-18 20:01:29 +01:00
|
|
|
/*
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-FileCopyrightText: 2018 Nicolas Fella <nicolas.fella@gmx.de>
|
2018-06-18 20:01:29 +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
|
2018-06-18 20:01:29 +01:00
|
|
|
*/
|
|
|
|
|
2023-12-23 16:48:04 +00:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Controls
|
|
|
|
import QtQuick.Layouts
|
|
|
|
import org.kde.kirigami as Kirigami
|
|
|
|
import org.kde.kdeconnect
|
2018-06-18 20:01:29 +01:00
|
|
|
|
2020-07-12 01:25:38 +01:00
|
|
|
Kirigami.ScrollablePage
|
2018-06-18 20:01:29 +01:00
|
|
|
{
|
|
|
|
id: root
|
2019-12-21 07:59:36 +00:00
|
|
|
title: i18nd("kdeconnect-app", "Run command")
|
2018-06-18 20:01:29 +01:00
|
|
|
property QtObject pluginInterface
|
|
|
|
|
2023-12-23 20:05:48 +00:00
|
|
|
actions: [
|
|
|
|
Kirigami.Action {
|
|
|
|
icon.name: "document-edit"
|
|
|
|
text: i18nd("kdeconnect-app", "Edit commands")
|
|
|
|
onTriggered: {
|
|
|
|
pluginInterface.editCommands();
|
|
|
|
showPassiveNotification(i18nd("kdeconnect-app", "You can edit commands on the connected device"));
|
|
|
|
}
|
2018-10-31 15:56:02 +00:00
|
|
|
}
|
2023-12-23 20:05:48 +00:00
|
|
|
]
|
2018-06-18 20:01:29 +01:00
|
|
|
|
|
|
|
ListView {
|
2018-09-24 20:49:18 +01:00
|
|
|
id: commandsList
|
2018-06-18 20:01:29 +01:00
|
|
|
model: RemoteCommandsModel {
|
|
|
|
deviceId: pluginInterface.deviceId
|
|
|
|
}
|
2023-11-14 22:48:56 +00:00
|
|
|
delegate: ItemDelegate {
|
|
|
|
id: delegate
|
2018-06-18 20:01:29 +01:00
|
|
|
width: ListView.view.width
|
2023-11-14 22:48:56 +00:00
|
|
|
text: name
|
|
|
|
|
|
|
|
contentItem: Kirigami.TitleSubtitle {
|
|
|
|
title: delegate.text
|
|
|
|
subtitle: command
|
|
|
|
}
|
|
|
|
|
2018-06-18 20:01:29 +01:00
|
|
|
onClicked: pluginInterface.triggerCommand(key)
|
|
|
|
}
|
|
|
|
|
2020-07-12 01:25:38 +01:00
|
|
|
Kirigami.PlaceholderMessage {
|
2024-03-12 14:26:37 +00:00
|
|
|
// FIXME: not accessible. screen readers won't read this.
|
|
|
|
// https://invent.kde.org/frameworks/kirigami/-/merge_requests/1482
|
2020-07-12 01:25:38 +01:00
|
|
|
visible: commandsList.count === 0
|
|
|
|
text: i18nd("kdeconnect-app", "No commands defined")
|
|
|
|
anchors.centerIn: parent
|
|
|
|
}
|
2018-09-24 20:49:18 +01:00
|
|
|
}
|
2018-06-18 20:01:29 +01:00
|
|
|
}
|
|
|
|
|