Skip to content

Commit

Permalink
[foilnotes] Fixed deletion of a newly created note
Browse files Browse the repository at this point in the history
  • Loading branch information
monich committed Jun 21, 2024
1 parent 7bb34d5 commit cfa2e56
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion qml/NotesGridView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -78,23 +79,28 @@ SilicaGridView {
} else if (body.length > 0) {
model.addNote(notePage.color, body)
model.textIndex = 0
currentIndex = 0
noteCreated = true
}
})
notePage.deleteNote.connect(function() {
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()
})
}
Expand Down

0 comments on commit cfa2e56

Please sign in to comment.