Merge PR #1019: Add a confirmation question when removing a thing
This commit is contained in:
commit
29169b293c
@ -683,6 +683,14 @@
|
|||||||
<source>ID</source>
|
<source>ID</source>
|
||||||
<translation>ID</translation>
|
<translation>ID</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Remove thing?</source>
|
||||||
|
<translation>"Thing" entfernen?</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Are you sure you want to remove %1 and all associated settings?</source>
|
||||||
|
<translation>Bist Du sicher, dass %1 und alle zugehörigen Einstellungen entfernt werden sollen?</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>ConnectingPage</name>
|
<name>ConnectingPage</name>
|
||||||
@ -1726,6 +1734,14 @@
|
|||||||
<source>In order for your %1 system to be useful, go ahead and add some things.</source>
|
<source>In order for your %1 system to be useful, go ahead and add some things.</source>
|
||||||
<translation>Damit Dein %1 System sich nützlich machen kann, füge einige "Things" hinzu.</translation>
|
<translation>Damit Dein %1 System sich nützlich machen kann, füge einige "Things" hinzu.</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Remove thing?</source>
|
||||||
|
<translation>"Thing" entfernen?</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Are you sure you want to remove %1 and all associated settings?</source>
|
||||||
|
<translation>Bist Du sicher, dass %1 und alle zugehörigen Einstellungen entfernt werden sollen?</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>EditTimeEventItemPage</name>
|
<name>EditTimeEventItemPage</name>
|
||||||
|
|||||||
@ -683,6 +683,14 @@
|
|||||||
<source>ID</source>
|
<source>ID</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Remove thing?</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Are you sure you want to remove %1 and all associated settings?</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>ConnectingPage</name>
|
<name>ConnectingPage</name>
|
||||||
@ -1720,6 +1728,14 @@
|
|||||||
<source>In order for your %1 system to be useful, go ahead and add some things.</source>
|
<source>In order for your %1 system to be useful, go ahead and add some things.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Remove thing?</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Are you sure you want to remove %1 and all associated settings?</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>EditTimeEventItemPage</name>
|
<name>EditTimeEventItemPage</name>
|
||||||
|
|||||||
@ -683,6 +683,14 @@
|
|||||||
<source>ID</source>
|
<source>ID</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Remove thing?</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Are you sure you want to remove %1 and all associated settings?</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>ConnectingPage</name>
|
<name>ConnectingPage</name>
|
||||||
@ -1720,6 +1728,14 @@
|
|||||||
<source>In order for your %1 system to be useful, go ahead and add some things.</source>
|
<source>In order for your %1 system to be useful, go ahead and add some things.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Remove thing?</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Are you sure you want to remove %1 and all associated settings?</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>EditTimeEventItemPage</name>
|
<name>EditTimeEventItemPage</name>
|
||||||
|
|||||||
@ -683,6 +683,14 @@
|
|||||||
<source>ID</source>
|
<source>ID</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Remove thing?</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Are you sure you want to remove %1 and all associated settings?</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>ConnectingPage</name>
|
<name>ConnectingPage</name>
|
||||||
@ -1720,6 +1728,14 @@
|
|||||||
<source>In order for your %1 system to be useful, go ahead and add some things.</source>
|
<source>In order for your %1 system to be useful, go ahead and add some things.</source>
|
||||||
<translation></translation>
|
<translation></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Remove thing?</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Are you sure you want to remove %1 and all associated settings?</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>EditTimeEventItemPage</name>
|
<name>EditTimeEventItemPage</name>
|
||||||
|
|||||||
@ -682,6 +682,14 @@
|
|||||||
<source>ID</source>
|
<source>ID</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Remove thing?</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Are you sure you want to remove %1 and all associated settings?</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>ConnectingPage</name>
|
<name>ConnectingPage</name>
|
||||||
@ -1722,6 +1730,14 @@
|
|||||||
<source>In order for your %1 system to be useful, go ahead and add some things.</source>
|
<source>In order for your %1 system to be useful, go ahead and add some things.</source>
|
||||||
<translation>%1 시스템이 유용하려면 먼저 몇 가지를 추가하십시오.</translation>
|
<translation>%1 시스템이 유용하려면 먼저 몇 가지를 추가하십시오.</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Remove thing?</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Are you sure you want to remove %1 and all associated settings?</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>EditTimeEventItemPage</name>
|
<name>EditTimeEventItemPage</name>
|
||||||
|
|||||||
@ -683,6 +683,14 @@
|
|||||||
<source>ID</source>
|
<source>ID</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Remove thing?</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Are you sure you want to remove %1 and all associated settings?</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>ConnectingPage</name>
|
<name>ConnectingPage</name>
|
||||||
@ -1720,6 +1728,14 @@
|
|||||||
<source>In order for your %1 system to be useful, go ahead and add some things.</source>
|
<source>In order for your %1 system to be useful, go ahead and add some things.</source>
|
||||||
<translation></translation>
|
<translation></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Remove thing?</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Are you sure you want to remove %1 and all associated settings?</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>EditTimeEventItemPage</name>
|
<name>EditTimeEventItemPage</name>
|
||||||
|
|||||||
@ -682,6 +682,14 @@
|
|||||||
<source>ID</source>
|
<source>ID</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Remove thing?</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Are you sure you want to remove %1 and all associated settings?</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>ConnectingPage</name>
|
<name>ConnectingPage</name>
|
||||||
@ -1722,6 +1730,14 @@
|
|||||||
<source>In order for your %1 system to be useful, go ahead and add some things.</source>
|
<source>In order for your %1 system to be useful, go ahead and add some things.</source>
|
||||||
<translation>%1 sisteminizin kullanışlı olması için devam edin ve bazı şeyler ekleyin.</translation>
|
<translation>%1 sisteminizin kullanışlı olması için devam edin ve bazı şeyler ekleyin.</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Remove thing?</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Are you sure you want to remove %1 and all associated settings?</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>EditTimeEventItemPage</name>
|
<name>EditTimeEventItemPage</name>
|
||||||
|
|||||||
@ -682,6 +682,14 @@
|
|||||||
<source>ID</source>
|
<source>ID</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Remove thing?</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Are you sure you want to remove %1 and all associated settings?</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>ConnectingPage</name>
|
<name>ConnectingPage</name>
|
||||||
@ -1719,6 +1727,14 @@
|
|||||||
<source>In order for your %1 system to be useful, go ahead and add some things.</source>
|
<source>In order for your %1 system to be useful, go ahead and add some things.</source>
|
||||||
<translation></translation>
|
<translation></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Remove thing?</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Are you sure you want to remove %1 and all associated settings?</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>EditTimeEventItemPage</name>
|
<name>EditTimeEventItemPage</name>
|
||||||
|
|||||||
@ -38,6 +38,7 @@ import "../delegates"
|
|||||||
SettingsPageBase {
|
SettingsPageBase {
|
||||||
id: root
|
id: root
|
||||||
property Thing thing: null
|
property Thing thing: null
|
||||||
|
busy: d.pendingCommand != -1
|
||||||
|
|
||||||
header: NymeaHeader {
|
header: NymeaHeader {
|
||||||
text: root.thing.name
|
text: root.thing.name
|
||||||
@ -80,7 +81,8 @@ SettingsPageBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function deleteThing() {
|
function deleteThing() {
|
||||||
engine.thingManager.removeThing(root.thing.id)
|
var popup = removeDialogComponent.createObject(root)
|
||||||
|
popup.open()
|
||||||
}
|
}
|
||||||
|
|
||||||
function reconfigureThing() {
|
function reconfigureThing() {
|
||||||
@ -101,15 +103,16 @@ SettingsPageBase {
|
|||||||
Connections {
|
Connections {
|
||||||
target: engine.thingManager
|
target: engine.thingManager
|
||||||
onRemoveThingReply: {
|
onRemoveThingReply: {
|
||||||
|
if (d.pendingCommand != commandId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
d.pendingCommand = -1
|
||||||
|
|
||||||
switch (thingError) {
|
switch (thingError) {
|
||||||
case Thing.ThingErrorNoError:
|
case Thing.ThingErrorNoError:
|
||||||
pageStack.pop();
|
pageStack.pop();
|
||||||
return;
|
return;
|
||||||
case Thing.ThingErrorThingInRule:
|
|
||||||
var removeMethodComponent = Qt.createComponent(Qt.resolvedUrl("../components/RemoveThingMethodDialog.qml"))
|
|
||||||
var popup = removeMethodComponent.createObject(root, {thing: root.thing, rulesList: ruleIds});
|
|
||||||
popup.open();
|
|
||||||
return;
|
|
||||||
default:
|
default:
|
||||||
var popup = errorDialog.createObject(root, {error: thingError})
|
var popup = errorDialog.createObject(root, {error: thingError})
|
||||||
popup.open();
|
popup.open();
|
||||||
@ -117,6 +120,11 @@ SettingsPageBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QtObject {
|
||||||
|
id: d
|
||||||
|
property int pendingCommand: -1
|
||||||
|
}
|
||||||
|
|
||||||
SettingsPageSectionHeader {
|
SettingsPageSectionHeader {
|
||||||
text: qsTr("Information")
|
text: qsTr("Information")
|
||||||
}
|
}
|
||||||
@ -289,6 +297,20 @@ SettingsPageBase {
|
|||||||
ErrorDialog { }
|
ErrorDialog { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: removeDialogComponent
|
||||||
|
NymeaDialog {
|
||||||
|
id: removeDialog
|
||||||
|
title: qsTr("Remove thing?")
|
||||||
|
text: qsTr("Are you sure you want to remove %1 and all associated settings?").arg(root.thing.name)
|
||||||
|
standardButtons: Dialog.Yes | Dialog.No
|
||||||
|
|
||||||
|
onAccepted: {
|
||||||
|
d.pendingCommand = engine.thingManager.removeThing(root.thing.id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: renameDialog
|
id: renameDialog
|
||||||
Dialog {
|
Dialog {
|
||||||
|
|||||||
@ -56,24 +56,20 @@ Page {
|
|||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: d
|
id: d
|
||||||
property var thingToRemove: null
|
property int pendingCommandId: -1
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: engine.thingManager
|
target: engine.thingManager
|
||||||
onRemoveThingReply: {
|
onRemoveThingReply: {
|
||||||
if (!d.thingToRemove) {
|
if (commandId != d.pendingCommandId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d.pendingCommandId = -1
|
||||||
|
|
||||||
switch (thingError) {
|
switch (thingError) {
|
||||||
case Thing.ThingErrorNoError:
|
case Thing.ThingErrorNoError:
|
||||||
d.thingToRemove = null;
|
|
||||||
return;
|
|
||||||
case Thing.ThingErrorThingInRule:
|
|
||||||
var removeMethodComponent = Qt.createComponent(Qt.resolvedUrl("../components/RemoveThingMethodDialog.qml"))
|
|
||||||
var popup = removeMethodComponent.createObject(root, {thing: d.thingToRemove, rulesList: ruleIds});
|
|
||||||
popup.open();
|
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
var errorDialog = Qt.createComponent(Qt.resolvedUrl("../components/ErrorDialog.qml"))
|
var errorDialog = Qt.createComponent(Qt.resolvedUrl("../components/ErrorDialog.qml"))
|
||||||
@ -112,13 +108,28 @@ Page {
|
|||||||
pageStack.push(Qt.resolvedUrl("ConfigureThingPage.qml"), {thing: thing})
|
pageStack.push(Qt.resolvedUrl("ConfigureThingPage.qml"), {thing: thing})
|
||||||
}
|
}
|
||||||
onDeleteClicked: {
|
onDeleteClicked: {
|
||||||
d.thingToRemove = thing;
|
var popup = removeDialogComponent.createObject(root, {thing: thing})
|
||||||
engine.thingManager.removeThing(d.thingToRemove.id)
|
popup.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: removeDialogComponent
|
||||||
|
NymeaDialog {
|
||||||
|
id: removeDialog
|
||||||
|
title: qsTr("Remove thing?")
|
||||||
|
text: qsTr("Are you sure you want to remove %1 and all associated settings?").arg(thing.name)
|
||||||
|
standardButtons: Dialog.Yes | Dialog.No
|
||||||
|
|
||||||
|
property Thing thing: null
|
||||||
|
|
||||||
|
onAccepted: {
|
||||||
|
d.pendingCommand = engine.thingManager.removeThing(thing.id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EmptyViewPlaceholder {
|
EmptyViewPlaceholder {
|
||||||
anchors { left: parent.left; right: parent.right; margins: app.margins }
|
anchors { left: parent.left; right: parent.right; margins: app.margins }
|
||||||
|
|||||||
Reference in New Issue
Block a user