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 {
|
||||
id: deviceLoader
|
||||
anchors.fill: parent
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
|
||||
sourceComponent: {
|
||||
if (deviceView.currentDevice.hasPairingRequests) {
|
||||
|
@ -61,7 +59,7 @@ Kirigami.Page
|
|||
|
||||
Component {
|
||||
id: trustedDevice
|
||||
ColumnLayout {
|
||||
ListView {
|
||||
property list<QtObject> actions: [
|
||||
Kirigami.Action {
|
||||
onTriggered: deviceView.currentDevice.unpair()
|
||||
|
@ -76,67 +74,74 @@ Kirigami.Page
|
|||
]
|
||||
|
||||
id: trustedView
|
||||
spacing: 0
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
|
||||
model: plugins
|
||||
delegate: Kirigami.BasicListItem {
|
||||
label: name
|
||||
icon: iconName
|
||||
visible: loaded
|
||||
onClicked: onClick()
|
||||
}
|
||||
|
||||
property list<QtObject> plugins : [
|
||||
|
||||
PluginItem {
|
||||
label: i18n("Multimedia control")
|
||||
name: i18n("Multimedia control")
|
||||
interfaceFactory: MprisDbusInterfaceFactory
|
||||
component: "qrc:/qml/mpris.qml"
|
||||
pluginName: "mprisremote"
|
||||
}
|
||||
},
|
||||
PluginItem {
|
||||
label: i18n("Remote input")
|
||||
name: i18n("Remote input")
|
||||
interfaceFactory: RemoteControlDbusInterfaceFactory
|
||||
component: "qrc:/qml/mousepad.qml"
|
||||
pluginName: "remotecontrol"
|
||||
}
|
||||
},
|
||||
PluginItem {
|
||||
label: i18n("Presentation Remote")
|
||||
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"
|
||||
label: lockIface.isLocked ? i18n("Unlock") : i18n("Lock")
|
||||
onClicked: {
|
||||
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"
|
||||
label: i18n("Find Device")
|
||||
onClicked: {
|
||||
name: i18n("Find Device")
|
||||
onClick: function() {
|
||||
findmyphoneIface.ring()
|
||||
}
|
||||
}
|
||||
},
|
||||
PluginItem {
|
||||
label: i18n("Run command")
|
||||
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"
|
||||
label: i18n("Share File")
|
||||
onClicked: {
|
||||
name: i18n("Share File")
|
||||
onClick: function() {
|
||||
fileDialog.open()
|
||||
shareIface.shareUrl(fileDialog.fileUrl)
|
||||
}
|
||||
}
|
||||
},
|
||||
PluginItem {
|
||||
label: i18n("Volume control")
|
||||
name: i18n("Volume control")
|
||||
interfaceFactory: RemoteSystemVolumeDbusInterfaceFactory
|
||||
component: "qrc:/qml/volume.qml"
|
||||
pluginName: "remotesystemvolume"
|
||||
}
|
||||
|
||||
Item { Layout.fillHeight: true }
|
||||
]
|
||||
}
|
||||
}
|
||||
Component {
|
||||
|
|
|
@ -24,20 +24,20 @@ import QtQuick.Layouts 1.1
|
|||
import org.kde.kirigami 2.0 as Kirigami
|
||||
import org.kde.kdeconnect 1.0
|
||||
|
||||
Kirigami.BasicListItem
|
||||
QtObject
|
||||
{
|
||||
property alias pluginName: checker.pluginName
|
||||
property alias iconName: checker.iconName
|
||||
property alias loaded: checker.available
|
||||
property var interfaceFactory
|
||||
property var component
|
||||
property var name
|
||||
|
||||
readonly property var checker: PluginChecker {
|
||||
id: checker
|
||||
device: deviceView.currentDevice
|
||||
}
|
||||
visible: checker.available
|
||||
icon: checker.iconName
|
||||
iconColor: "transparent"
|
||||
onClicked: {
|
||||
property var onClick: function() {
|
||||
if (component === "" || !interfaceFactory)
|
||||
return;
|
||||
|
||||
|
|
Loading…
Reference in a new issue