diff --git a/plasmoid/package/contents/ui/FullRepresentation.qml b/plasmoid/package/contents/ui/FullRepresentation.qml index 98e2e0349..99f25ed31 100644 --- a/plasmoid/package/contents/ui/FullRepresentation.qml +++ b/plasmoid/package/contents/ui/FullRepresentation.qml @@ -26,6 +26,7 @@ import org.kde.kdeconnect 1.0 as KdeConnect Item { id: kdeconnect + property alias devicesModel: devicesView.model PlasmaExtras.Heading { width: parent.width @@ -44,15 +45,6 @@ Item { } */ - function shouldPlasmoidBeShown() - { - if (devicesView.count > 0) { - plasmoid.status = PlasmaCore.Types.ActiveStatus; - } else { - plasmoid.status = PlasmaCore.Types.PassiveStatus; - } - } - PlasmaExtras.ScrollArea { id: dialogItem anchors.fill: parent @@ -60,15 +52,7 @@ Item { ListView { id: devicesView anchors.fill: parent - model: KdeConnect.DevicesModel { - id: connectDeviceModel - displayFilter: KdeConnect.DevicesModel.StatusPaired | KdeConnect.DevicesModel.StatusReachable - - } delegate: DeviceDelegate { } - onCountChanged: shouldPlasmoidBeShown() - Component.onCompleted: shouldPlasmoidBeShown(); } } - } diff --git a/plasmoid/package/contents/ui/main.qml b/plasmoid/package/contents/ui/main.qml index 71e66b1d5..3e3be274e 100644 --- a/plasmoid/package/contents/ui/main.qml +++ b/plasmoid/package/contents/ui/main.qml @@ -32,8 +32,22 @@ Item return (plasmoid.formFactor == PlasmaCore.Types.Vertical || plasmoid.formFactor == PlasmaCore.Types.Horizontal); } + DevicesModel { + id: connectDeviceModel + displayFilter: DevicesModel.StatusPaired | DevicesModel.StatusReachable + + } + + Binding { + target: plasmoid + property: "status" + value: (connectDeviceModel.count > 0) ? PlasmaCore.Types.ActiveStatus : PlasmaCore.Types.PassiveStatus + } + Plasmoid.compactRepresentation: CompactRepresentation {} - Plasmoid.fullRepresentation: FullRepresentation {} + Plasmoid.fullRepresentation: FullRepresentation { + devicesModel: connectDeviceModel + } Plasmoid.preferredRepresentation: isConstrained() ? Plasmoid.compactRepresentation : Plasmoid.fullRepresentation