From cfa2e5608259f783faeb70f6a160b9b711524b61 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Fri, 21 Jun 2024 05:27:07 +0300 Subject: [PATCH] [foilnotes] Fixed deletion of a newly created note --- qml/NotesGridView.qml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/qml/NotesGridView.qml b/qml/NotesGridView.qml index 19facb9..f11e798 100644 --- a/qml/NotesGridView.qml +++ b/qml/NotesGridView.qml @@ -70,6 +70,7 @@ SilicaGridView { if (noteCreated) { if (body.length > 0) { model.setBodyAt(0, body) + model.setColorAt(0, notePage.color) } else { model.textIndex = -1 model.deleteNoteAt(0) @@ -78,6 +79,7 @@ SilicaGridView { } else if (body.length > 0) { model.addNote(notePage.color, body) model.textIndex = 0 + currentIndex = 0 noteCreated = true } }) @@ -85,16 +87,20 @@ SilicaGridView { if (noteCreated) { if (notePage.body.length > 0) { model.setBodyAt(0, notePage.body) + model.setColorAt(0, notePage.color) grid.positionViewAtBeginning() grid.currentItem.deleteNote() } else { model.deleteNoteAt(0) } } else if (notePage.body.length > 0) { - model.addNote(notePage.color, body) + model.addNote(notePage.color, notePage.body) + currentIndex = 0 grid.positionViewAtBeginning() grid.currentItem.deleteNote() } + // Reset the dirty flag to prevent save on pop + notePage.dirty = false pageStack.pop() }) }