[app] Fix plugin list

Filter out not loaded plugins

Fix loading the plugin components
This commit is contained in:
Nicolas Fella 2024-01-09 23:14:26 +01:00
parent aa09d338ee
commit 42ce4764d2
2 changed files with 10 additions and 11 deletions

View file

@ -46,36 +46,35 @@ Kirigami.ScrollablePage {
] ]
ListView { ListView {
model: plugins model: plugins.filter((plugin) => plugin.loaded)
delegate: QQC2.ItemDelegate { delegate: QQC2.ItemDelegate {
text: name text: modelData.name
icon.name: iconName icon.name: modelData.iconName
highlighted: false highlighted: false
icon.color: "transparent" icon.color: "transparent"
width: ListView.view.width width: ListView.view.width
visible: loaded onClicked: modelData.onClick()
onClicked: onClick()
} }
property list<QtObject> plugins: [ property list<QtObject> plugins: [
PluginItem { PluginItem {
name: i18nd("kdeconnect-app", "Multimedia control") name: i18nd("kdeconnect-app", "Multimedia control")
interfaceFactory: MprisDbusInterfaceFactory interfaceFactory: MprisDbusInterfaceFactory
component: "qrc:/qml/mpris.qml" component: "mpris.qml"
pluginName: "mprisremote" pluginName: "mprisremote"
device: root.currentDevice device: root.currentDevice
}, },
PluginItem { PluginItem {
name: i18nd("kdeconnect-app", "Remote input") name: i18nd("kdeconnect-app", "Remote input")
interfaceFactory: RemoteControlDbusInterfaceFactory interfaceFactory: RemoteControlDbusInterfaceFactory
component: "qrc:/qml/mousepad.qml" component: "mousepad.qml"
pluginName: "remotecontrol" pluginName: "remotecontrol"
device: root.currentDevice device: root.currentDevice
}, },
PluginItem { PluginItem {
name: i18nd("kdeconnect-app", "Presentation Remote") name: i18nd("kdeconnect-app", "Presentation Remote")
interfaceFactory: RemoteKeyboardDbusInterfaceFactory interfaceFactory: RemoteKeyboardDbusInterfaceFactory
component: "qrc:/qml/presentationRemote.qml" component: "presentationRemote.qml"
pluginName: "remotecontrol" pluginName: "remotecontrol"
device: root.currentDevice device: root.currentDevice
}, },
@ -96,7 +95,7 @@ Kirigami.ScrollablePage {
PluginItem { PluginItem {
name: i18nd("kdeconnect-app", "Run command") name: i18nd("kdeconnect-app", "Run command")
interfaceFactory: RemoteCommandsDbusInterfaceFactory interfaceFactory: RemoteCommandsDbusInterfaceFactory
component: "qrc:/qml/runcommand.qml" component: "runcommand.qml"
pluginName: "remotecommands" pluginName: "remotecommands"
device: root.currentDevice device: root.currentDevice
}, },
@ -116,7 +115,7 @@ Kirigami.ScrollablePage {
PluginItem { PluginItem {
name: i18nd("kdeconnect-app", "Volume control") name: i18nd("kdeconnect-app", "Volume control")
interfaceFactory: RemoteSystemVolumeDbusInterfaceFactory interfaceFactory: RemoteSystemVolumeDbusInterfaceFactory
component: "qrc:/qml/volume.qml" component: "volume.qml"
pluginName: "remotesystemvolume" pluginName: "remotesystemvolume"
device: root.currentDevice device: root.currentDevice
} }

View file

@ -29,7 +29,7 @@ QtObject
var obj = interfaceFactory.create(checker.device.id()); var obj = interfaceFactory.create(checker.device.id());
var page = pageStack.push( var page = pageStack.push(
component, Qt.resolvedUrl(component),
{ pluginInterface: obj, { pluginInterface: obj,
device: checker.device device: checker.device
} }