Fix how the plasmoid status is specified
No need to show the FullRepresentation to figure out the status of the plasmoid. Moves the code back to the main.qml file so that we're always tracking if there's actually paired devices. REVIEW: 122912
This commit is contained in:
parent
ce2bb1e433
commit
5d8cf9544c
2 changed files with 16 additions and 18 deletions
|
@ -26,6 +26,7 @@ import org.kde.kdeconnect 1.0 as KdeConnect
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: kdeconnect
|
id: kdeconnect
|
||||||
|
property alias devicesModel: devicesView.model
|
||||||
|
|
||||||
PlasmaExtras.Heading {
|
PlasmaExtras.Heading {
|
||||||
width: parent.width
|
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 {
|
PlasmaExtras.ScrollArea {
|
||||||
id: dialogItem
|
id: dialogItem
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -60,15 +52,7 @@ Item {
|
||||||
ListView {
|
ListView {
|
||||||
id: devicesView
|
id: devicesView
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
model: KdeConnect.DevicesModel {
|
|
||||||
id: connectDeviceModel
|
|
||||||
displayFilter: KdeConnect.DevicesModel.StatusPaired | KdeConnect.DevicesModel.StatusReachable
|
|
||||||
|
|
||||||
}
|
|
||||||
delegate: DeviceDelegate { }
|
delegate: DeviceDelegate { }
|
||||||
onCountChanged: shouldPlasmoidBeShown()
|
|
||||||
Component.onCompleted: shouldPlasmoidBeShown();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,8 +32,22 @@ Item
|
||||||
return (plasmoid.formFactor == PlasmaCore.Types.Vertical || plasmoid.formFactor == PlasmaCore.Types.Horizontal);
|
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.compactRepresentation: CompactRepresentation {}
|
||||||
Plasmoid.fullRepresentation: FullRepresentation {}
|
Plasmoid.fullRepresentation: FullRepresentation {
|
||||||
|
devicesModel: connectDeviceModel
|
||||||
|
}
|
||||||
|
|
||||||
Plasmoid.preferredRepresentation: isConstrained() ? Plasmoid.compactRepresentation : Plasmoid.fullRepresentation
|
Plasmoid.preferredRepresentation: isConstrained() ? Plasmoid.compactRepresentation : Plasmoid.fullRepresentation
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue