From f7bc0ed9b81581a98dc0bba63f2072572c6e9a9e Mon Sep 17 00:00:00 2001 From: Scharel Clemens Date: Sat, 4 Jan 2020 14:53:50 +0100 Subject: [PATCH] Always provide the attribute \'modified\' when creating or modifying a note to allow the API to handle conflicts --- qml/pages/EditPage.qml | 2 +- qml/pages/NotePage.qml | 4 ++-- qml/pages/NotesPage.qml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/qml/pages/EditPage.qml b/qml/pages/EditPage.qml index 057ef75..54755d4 100644 --- a/qml/pages/EditPage.qml +++ b/qml/pages/EditPage.qml @@ -16,7 +16,7 @@ Dialog { property string errorMessage onAccepted: { - notesApi.updateNote(id, { 'category': categoryField.text, 'content': contentArea.text, 'favorite': favoriteButton.selected } ) + notesApi.updateNote(id, { 'category': categoryField.text, 'content': contentArea.text, 'favorite': favoriteButton.selected, 'modified': new Date().valueOf() / 1000 } ) } function reloadContent() { diff --git a/qml/pages/NotePage.qml b/qml/pages/NotePage.qml index 8e58fc7..ded12a2 100644 --- a/qml/pages/NotePage.qml +++ b/qml/pages/NotePage.qml @@ -119,8 +119,8 @@ Dialog { MenuLabel { visible: appSettings.currentAccount.length >= 0 text: qsTr("Last update") + ": " + ( - new Date(notesApi.update).valueOf() !== 0 ? - new Date(notesApi.update).toLocaleString(Qt.locale(), Locale.ShortFormat) : + new Date(account.update).valueOf() !== 0 ? + new Date(account.update).toLocaleString(Qt.locale(), Locale.ShortFormat) : qsTr("never")) } } diff --git a/qml/pages/NotesPage.qml b/qml/pages/NotesPage.qml index dde9c5a..de339c1 100644 --- a/qml/pages/NotesPage.qml +++ b/qml/pages/NotesPage.qml @@ -50,7 +50,7 @@ Page { MenuItem { text: qsTr("Add note") enabled: appSettings.currentAccount.length > 0 - onClicked: notesApi.createNote( { 'content': "" } ) + onClicked: notesApi.createNote( { 'content': "", 'modified': new Date().valueOf() / 1000 } ) } MenuItem { text: enabled ? qsTr("Reload") : qsTr("Updating...")