Use ListView for plugins list
This commit is contained in:
parent
7970e3d1c4
commit
f345b05838
2 changed files with 70 additions and 65 deletions
|
@ -40,8 +40,6 @@ Kirigami.Page
|
||||||
Loader {
|
Loader {
|
||||||
id: deviceLoader
|
id: deviceLoader
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
sourceComponent: {
|
sourceComponent: {
|
||||||
if (deviceView.currentDevice.hasPairingRequests) {
|
if (deviceView.currentDevice.hasPairingRequests) {
|
||||||
|
@ -61,7 +59,7 @@ Kirigami.Page
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: trustedDevice
|
id: trustedDevice
|
||||||
ColumnLayout {
|
ListView {
|
||||||
property list<QtObject> actions: [
|
property list<QtObject> actions: [
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
onTriggered: deviceView.currentDevice.unpair()
|
onTriggered: deviceView.currentDevice.unpair()
|
||||||
|
@ -76,67 +74,74 @@ Kirigami.Page
|
||||||
]
|
]
|
||||||
|
|
||||||
id: trustedView
|
id: trustedView
|
||||||
spacing: 0
|
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
PluginItem {
|
model: plugins
|
||||||
label: i18n("Multimedia control")
|
delegate: Kirigami.BasicListItem {
|
||||||
interfaceFactory: MprisDbusInterfaceFactory
|
label: name
|
||||||
component: "qrc:/qml/mpris.qml"
|
icon: iconName
|
||||||
pluginName: "mprisremote"
|
visible: loaded
|
||||||
}
|
onClicked: onClick()
|
||||||
PluginItem {
|
|
||||||
label: i18n("Remote input")
|
|
||||||
interfaceFactory: RemoteControlDbusInterfaceFactory
|
|
||||||
component: "qrc:/qml/mousepad.qml"
|
|
||||||
pluginName: "remotecontrol"
|
|
||||||
}
|
|
||||||
PluginItem {
|
|
||||||
label: i18n("Presentation Remote")
|
|
||||||
interfaceFactory: RemoteKeyboardDbusInterfaceFactory
|
|
||||||
component: "qrc:/qml/presentationRemote.qml"
|
|
||||||
pluginName: "remotecontrol"
|
|
||||||
}
|
|
||||||
PluginItem {
|
|
||||||
readonly property var lockIface: LockDeviceDbusInterfaceFactory.create(deviceView.currentDevice.id())
|
|
||||||
pluginName: "lockdevice"
|
|
||||||
label: lockIface.isLocked ? i18n("Unlock") : i18n("Lock")
|
|
||||||
onClicked: {
|
|
||||||
lockIface.isLocked = !lockIface.isLocked;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PluginItem {
|
|
||||||
readonly property var findmyphoneIface: FindMyPhoneDbusInterfaceFactory.create(deviceView.currentDevice.id())
|
|
||||||
pluginName: "findmyphone"
|
|
||||||
label: i18n("Find Device")
|
|
||||||
onClicked: {
|
|
||||||
findmyphoneIface.ring()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PluginItem {
|
|
||||||
label: i18n("Run command")
|
|
||||||
interfaceFactory: RemoteCommandsDbusInterfaceFactory
|
|
||||||
component: "qrc:/qml/runcommand.qml"
|
|
||||||
pluginName: "remotecommands"
|
|
||||||
}
|
|
||||||
PluginItem {
|
|
||||||
readonly property var shareIface: ShareDbusInterfaceFactory.create(deviceView.currentDevice.id())
|
|
||||||
pluginName: "share"
|
|
||||||
label: i18n("Share File")
|
|
||||||
onClicked: {
|
|
||||||
fileDialog.open()
|
|
||||||
shareIface.shareUrl(fileDialog.fileUrl)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PluginItem {
|
|
||||||
label: i18n("Volume control")
|
|
||||||
interfaceFactory: RemoteSystemVolumeDbusInterfaceFactory
|
|
||||||
component: "qrc:/qml/volume.qml"
|
|
||||||
pluginName: "remotesystemvolume"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Item { Layout.fillHeight: true }
|
property list<QtObject> plugins : [
|
||||||
|
|
||||||
|
PluginItem {
|
||||||
|
name: i18n("Multimedia control")
|
||||||
|
interfaceFactory: MprisDbusInterfaceFactory
|
||||||
|
component: "qrc:/qml/mpris.qml"
|
||||||
|
pluginName: "mprisremote"
|
||||||
|
},
|
||||||
|
PluginItem {
|
||||||
|
name: i18n("Remote input")
|
||||||
|
interfaceFactory: RemoteControlDbusInterfaceFactory
|
||||||
|
component: "qrc:/qml/mousepad.qml"
|
||||||
|
pluginName: "remotecontrol"
|
||||||
|
},
|
||||||
|
PluginItem {
|
||||||
|
name: i18n("Presentation Remote")
|
||||||
|
interfaceFactory: RemoteKeyboardDbusInterfaceFactory
|
||||||
|
component: "qrc:/qml/presentationRemote.qml"
|
||||||
|
pluginName: "remotecontrol"
|
||||||
|
},
|
||||||
|
PluginItem {
|
||||||
|
readonly property var lockIface: LockDeviceDbusInterfaceFactory.create(deviceView.currentDevice.id())
|
||||||
|
pluginName: "lockdevice"
|
||||||
|
name: lockIface.isLocked ? i18n("Unlock") : i18n("Lock")
|
||||||
|
onClick: function() {
|
||||||
|
lockIface.isLocked = !lockIface.isLocked;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
PluginItem {
|
||||||
|
readonly property var findmyphoneIface: FindMyPhoneDbusInterfaceFactory.create(deviceView.currentDevice.id())
|
||||||
|
pluginName: "findmyphone"
|
||||||
|
name: i18n("Find Device")
|
||||||
|
onClick: function() {
|
||||||
|
findmyphoneIface.ring()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
PluginItem {
|
||||||
|
name: i18n("Run command")
|
||||||
|
interfaceFactory: RemoteCommandsDbusInterfaceFactory
|
||||||
|
component: "qrc:/qml/runcommand.qml"
|
||||||
|
pluginName: "remotecommands"
|
||||||
|
},
|
||||||
|
PluginItem {
|
||||||
|
readonly property var shareIface: ShareDbusInterfaceFactory.create(deviceView.currentDevice.id())
|
||||||
|
pluginName: "share"
|
||||||
|
name: i18n("Share File")
|
||||||
|
onClick: function() {
|
||||||
|
fileDialog.open()
|
||||||
|
shareIface.shareUrl(fileDialog.fileUrl)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
PluginItem {
|
||||||
|
name: i18n("Volume control")
|
||||||
|
interfaceFactory: RemoteSystemVolumeDbusInterfaceFactory
|
||||||
|
component: "qrc:/qml/volume.qml"
|
||||||
|
pluginName: "remotesystemvolume"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Component {
|
Component {
|
||||||
|
|
|
@ -24,20 +24,20 @@ import QtQuick.Layouts 1.1
|
||||||
import org.kde.kirigami 2.0 as Kirigami
|
import org.kde.kirigami 2.0 as Kirigami
|
||||||
import org.kde.kdeconnect 1.0
|
import org.kde.kdeconnect 1.0
|
||||||
|
|
||||||
Kirigami.BasicListItem
|
QtObject
|
||||||
{
|
{
|
||||||
property alias pluginName: checker.pluginName
|
property alias pluginName: checker.pluginName
|
||||||
|
property alias iconName: checker.iconName
|
||||||
|
property alias loaded: checker.available
|
||||||
property var interfaceFactory
|
property var interfaceFactory
|
||||||
property var component
|
property var component
|
||||||
|
property var name
|
||||||
|
|
||||||
readonly property var checker: PluginChecker {
|
readonly property var checker: PluginChecker {
|
||||||
id: checker
|
id: checker
|
||||||
device: deviceView.currentDevice
|
device: deviceView.currentDevice
|
||||||
}
|
}
|
||||||
visible: checker.available
|
property var onClick: function() {
|
||||||
icon: checker.iconName
|
|
||||||
iconColor: "transparent"
|
|
||||||
onClicked: {
|
|
||||||
if (component === "" || !interfaceFactory)
|
if (component === "" || !interfaceFactory)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue