Merge PR #354: Fix the check for preventing to remove auto things
This commit is contained in:
commit
ce99769e6c
@ -59,12 +59,12 @@ Page {
|
||||
deviceMenu.addItem(menuEntryComponent.createObject(deviceMenu, {text: qsTr("Rename"), iconSource: "../images/edit.svg", functionName: "renameThing"}))
|
||||
// FIXME: This isn't entirely correct... we should have a way to know if a particular thing is in fact autocreated
|
||||
// This check might be wrong for thingClasses with multiple create methods...
|
||||
if (!root.device.isChild || root.deviceClass.createMethods !== ["auto"]) {
|
||||
if (!root.device.isChild || root.deviceClass.createMethods.indexOf("CreateMethodAuto") < 0) {
|
||||
deviceMenu.addItem(menuEntryComponent.createObject(deviceMenu, {text: qsTr("Delete"), iconSource: "../images/delete.svg", functionName: "deleteThing"}))
|
||||
}
|
||||
// FIXME: This isn't entirely correct... we should have a way to know if a particular thing is in fact autocreated
|
||||
// This check might be wrong for thingClasses with multiple create methods...
|
||||
if (!root.device.isChild || root.deviceClass.createMethods !== ["auto"]) {
|
||||
if (!root.device.isChild || root.deviceClass.createMethods.indexOf("CreateMethodAuto") < 0) {
|
||||
deviceMenu.addItem(menuEntryComponent.createObject(deviceMenu, {text: qsTr("Reconfigure"), iconSource: "../images/configure.svg", functionName: "reconfigureThing"}))
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,10 +106,9 @@ Page {
|
||||
delegate: ThingDelegate {
|
||||
device: deviceProxy.getDevice(model.id)
|
||||
// FIXME: This isn't entirely correct... we should have a way to know if a particular thing is in fact autocreated
|
||||
// This check might be wrong for thingClasses with multiple create methods...
|
||||
canDelete: !device.isChild && device.deviceClass.createMethods === ["auto"]
|
||||
// This check might be wrong for thingClasses with multiple create methods...
|
||||
canDelete: !device.isChild || device.deviceClass.createMethods.indexOf("CreateMethodAuto") < 0
|
||||
onClicked: {
|
||||
print("clicked:", model.id)
|
||||
pageStack.push(Qt.resolvedUrl("ConfigureThingPage.qml"), {device: device})
|
||||
}
|
||||
onDeleteClicked: {
|
||||
|
||||
Reference in New Issue
Block a user