Enable running commands from the plasmoid

Summary: {F5926667}

Reviewers: #kde_connect, apol

Reviewed By: #kde_connect, apol

Subscribers: apol, kdeconnect, #kde_connect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D13660
This commit is contained in:
Nicolas Fella 2018-07-27 08:04:05 +02:00
parent 040f30e33e
commit fc4d4e7685
2 changed files with 66 additions and 1 deletions

View file

@ -247,7 +247,33 @@ PlasmaComponents.ListItem
}
}
//NOTE: More information could be displayed here
RemoteCommands {
id: rc
device: root.device
}
// Commands
PlasmaComponents.Label {
visible: rc.available && commandsModel.rowCount() > 0
text: i18n("Run command")
}
Repeater {
id: commandsView
visible: rc.available
model: RemoteCommandsModel {
id: commandsModel
deviceId: rc.device.id()
}
delegate: PlasmaComponents.ListItem {
enabled: true
onClicked: rc.plugin.triggerCommand(key)
PlasmaComponents.Label {
text: name + "\n" + command
}
}
}
//NOTE: More information could be displayed here
}
}

View file

@ -0,0 +1,39 @@
/**
* Copyright 2018 Nicolas Fella <nicolas.fella@gmx.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.kdeconnect 1.0
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
}