Merge PR #344: Allow removing childs which weren't autocreated
This commit is contained in:
commit
ad490ba00c
@ -57,10 +57,14 @@ Page {
|
|||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
deviceMenu.addItem(menuEntryComponent.createObject(deviceMenu, {text: qsTr("Rename"), iconSource: "../images/edit.svg", functionName: "renameThing"}))
|
deviceMenu.addItem(menuEntryComponent.createObject(deviceMenu, {text: qsTr("Rename"), iconSource: "../images/edit.svg", functionName: "renameThing"}))
|
||||||
if (!root.device.isChild) {
|
// 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"]) {
|
||||||
deviceMenu.addItem(menuEntryComponent.createObject(deviceMenu, {text: qsTr("Delete"), iconSource: "../images/delete.svg", functionName: "deleteThing"}))
|
deviceMenu.addItem(menuEntryComponent.createObject(deviceMenu, {text: qsTr("Delete"), iconSource: "../images/delete.svg", functionName: "deleteThing"}))
|
||||||
}
|
}
|
||||||
if (!root.device.isChild) {
|
// 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"]) {
|
||||||
deviceMenu.addItem(menuEntryComponent.createObject(deviceMenu, {text: qsTr("Reconfigure"), iconSource: "../images/configure.svg", functionName: "reconfigureThing"}))
|
deviceMenu.addItem(menuEntryComponent.createObject(deviceMenu, {text: qsTr("Reconfigure"), iconSource: "../images/configure.svg", functionName: "reconfigureThing"}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -105,7 +105,9 @@ Page {
|
|||||||
|
|
||||||
delegate: ThingDelegate {
|
delegate: ThingDelegate {
|
||||||
device: deviceProxy.getDevice(model.id)
|
device: deviceProxy.getDevice(model.id)
|
||||||
canDelete: !device.isChild
|
// 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"]
|
||||||
onClicked: {
|
onClicked: {
|
||||||
print("clicked:", model.id)
|
print("clicked:", model.id)
|
||||||
pageStack.push(Qt.resolvedUrl("ConfigureThingPage.qml"), {device: device})
|
pageStack.push(Qt.resolvedUrl("ConfigureThingPage.qml"), {device: device})
|
||||||
|
|||||||
Reference in New Issue
Block a user