Fix notification for deleted entries

This commit is contained in:
Martchus 2018-12-08 20:51:19 +01:00
parent 56243eb70c
commit 9428f449bd
1 changed files with 7 additions and 8 deletions

View File

@ -72,19 +72,18 @@ Kirigami.ScrollablePage {
} }
function confirmDeletion(entryName, entryIndex) { function confirmDeletion(entryName, entryIndex) {
// skip if undo is supported var isNode = entryModel.isNode(entryModel.index(entryIndex, 0,
rootIndex))
var entryType = isNode ? qsTr("category ") : qsTr("account ")
this.entryIndex = entryIndex
this.entryDesc = entryType + entryName
// skip dialog if undo is supported
if (nativeInterface.undoStack) { if (nativeInterface.undoStack) {
entryModel.removeRows(entryIndex, 1, rootIndex) entryModel.removeRows(entryIndex, 1, rootIndex)
showPassiveNotification(qsTr("Deleted %1").arg(entryDesc)) showPassiveNotification(qsTr("Deleted %1").arg(entryDesc))
return return
} }
var isNode = entryModel.isNode(entryModel.index(entryIndex, 0,
rootIndex))
var entryType = isNode ? qsTr("category ") : qsTr("account ")
this.entryIndex = entryIndex
this.entryDesc = entryType + entryName
this.open() this.open()
} }
} }