Don't force the creation of a DeviceInterface for every pluginchecker
Create one per device and share it
This commit is contained in:
parent
d84a1a108b
commit
b69247b4e5
6 changed files with 13 additions and 20 deletions
|
@ -32,7 +32,7 @@ Kirigami.BasicListItem
|
|||
|
||||
readonly property var checker: PluginChecker {
|
||||
id: checker
|
||||
deviceId: deviceView.currentDevice.id()
|
||||
device: deviceView.currentDevice
|
||||
}
|
||||
visible: checker.available
|
||||
onClicked: {
|
||||
|
|
|
@ -26,14 +26,12 @@ QtObject {
|
|||
|
||||
id: root
|
||||
|
||||
property string deviceId: ""
|
||||
property alias device: conn.target
|
||||
property string pluginName: ""
|
||||
property bool available: false
|
||||
readonly property alias device: conn.target
|
||||
|
||||
readonly property Connections connection: Connections {
|
||||
id: conn
|
||||
target: DeviceDbusInterfaceFactory.create(root.deviceId)
|
||||
onPluginsChanged: pluginsChanged()
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,7 @@ QtObject {
|
|||
|
||||
id: root
|
||||
|
||||
property alias deviceId: checker.deviceId
|
||||
readonly property alias device: checker.device
|
||||
property alias device: checker.device
|
||||
readonly property alias available: checker.available
|
||||
|
||||
readonly property PluginChecker pluginChecker: PluginChecker {
|
||||
|
@ -55,7 +54,7 @@ QtObject {
|
|||
|
||||
onAvailableChanged: {
|
||||
if (available) {
|
||||
battery = DeviceBatteryDbusInterfaceFactory.create(deviceId)
|
||||
battery = DeviceBatteryDbusInterfaceFactory.create(device.id())
|
||||
|
||||
battery.stateChanged.connect(function(c) {charging = c})
|
||||
battery.chargeChanged.connect(function(c) {charge = c})
|
||||
|
|
|
@ -27,9 +27,7 @@ import org.kde.kdeconnect 1.0
|
|||
PlasmaComponents.ListItem
|
||||
{
|
||||
id: root
|
||||
property string deviceId: model.deviceId
|
||||
|
||||
|
||||
readonly property QtObject device: DeviceDbusInterfaceFactory.create(model.deviceId)
|
||||
|
||||
Column {
|
||||
width: parent.width
|
||||
|
@ -53,7 +51,7 @@ PlasmaComponents.ListItem
|
|||
{
|
||||
FindMyPhone {
|
||||
id: findmyphone
|
||||
deviceId: root.deviceId
|
||||
device: root.device
|
||||
}
|
||||
|
||||
id: ring
|
||||
|
@ -71,7 +69,7 @@ PlasmaComponents.ListItem
|
|||
{
|
||||
Sftp {
|
||||
id: sftp
|
||||
deviceId: root.deviceId
|
||||
device: root.device
|
||||
}
|
||||
|
||||
id: browse
|
||||
|
@ -93,7 +91,7 @@ PlasmaComponents.ListItem
|
|||
|
||||
Battery {
|
||||
id: battery
|
||||
deviceId: root.deviceId
|
||||
device: root.device
|
||||
}
|
||||
|
||||
sectionDelegate: true
|
||||
|
@ -129,7 +127,7 @@ PlasmaComponents.ListItem
|
|||
id: notificationsView
|
||||
model: NotificationsModel {
|
||||
id: notificationsModel
|
||||
deviceId: root.deviceId
|
||||
deviceId: root.device.id()
|
||||
}
|
||||
delegate: PlasmaComponents.ListItem {
|
||||
PlasmaComponents.Label {
|
||||
|
|
|
@ -27,8 +27,7 @@ QtObject {
|
|||
|
||||
id: root
|
||||
|
||||
property alias deviceId: checker.deviceId
|
||||
readonly property alias device: checker.device
|
||||
property alias device: checker.device
|
||||
readonly property alias available: checker.available
|
||||
|
||||
readonly property PluginChecker pluginChecker: PluginChecker {
|
||||
|
@ -46,7 +45,7 @@ QtObject {
|
|||
|
||||
onAvailableChanged: {
|
||||
if (available) {
|
||||
findMyPhone = FindMyPhoneDbusInterfaceFactory.create(deviceId)
|
||||
findMyPhone = FindMyPhoneDbusInterfaceFactory.create(device.id())
|
||||
} else {
|
||||
findMyPhone = null
|
||||
}
|
||||
|
|
|
@ -27,8 +27,7 @@ QtObject {
|
|||
|
||||
id: root
|
||||
|
||||
property alias deviceId: checker.deviceId
|
||||
readonly property alias device: checker.device
|
||||
property alias device: checker.device
|
||||
readonly property alias available: checker.available
|
||||
|
||||
readonly property PluginChecker pluginChecker: PluginChecker {
|
||||
|
@ -45,7 +44,7 @@ QtObject {
|
|||
|
||||
onAvailableChanged: {
|
||||
if (available) {
|
||||
sftp = SftpDbusInterfaceFactory.create(deviceId)
|
||||
sftp = SftpDbusInterfaceFactory.create(device.id())
|
||||
} else {
|
||||
sftp = null
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue