From ffffd306d677811e03e3e57f89338517c7825be3 Mon Sep 17 00:00:00 2001 From: Scharel Clemens Date: Sun, 29 Mar 2020 18:03:05 +0200 Subject: [PATCH] A somehow working version again --- harbour-nextcloudnotes.pro | 4 +- qml/harbour-nextcloudnotes.qml | 78 +++++++-------- qml/js/showdown | 2 +- qml/pages/LoginPage.qml | 62 +++++++++--- qml/pages/NotePage.qml | 4 +- qml/pages/NotesPage.qml | 29 ++++-- qml/pages/SettingsPage.qml | 12 +-- rpm/harbour-nextcloudnotes.changes | 3 + rpm/harbour-nextcloudnotes.spec | 2 +- rpm/harbour-nextcloudnotes.yaml | 2 +- src/notesapi.cpp | 19 +++- src/notesmodel.cpp | 16 ++-- translations/harbour-nextcloudnotes-de.ts | 112 ++++++++++++---------- translations/harbour-nextcloudnotes-sv.ts | 12 +++ translations/harbour-nextcloudnotes.ts | 108 ++++++++++++--------- 15 files changed, 275 insertions(+), 190 deletions(-) diff --git a/harbour-nextcloudnotes.pro b/harbour-nextcloudnotes.pro index 2d33ed9..fea69f6 100644 --- a/harbour-nextcloudnotes.pro +++ b/harbour-nextcloudnotes.pro @@ -16,8 +16,7 @@ CONFIG += sailfishapp DEFINES += APP_VERSION=\\\"$$VERSION\\\" -HEADERS += \ - src/note.h \ +HEADERS += src/note.h \ src/notesapi.h \ src/notesmodel.h @@ -27,7 +26,6 @@ SOURCES += src/harbour-nextcloudnotes.cpp \ src/notesmodel.cpp DISTFILES += qml/harbour-nextcloudnotes.qml \ - LoginWebview.qml \ qml/cover/CoverPage.qml \ qml/pages/LoginPage.qml \ rpm/harbour-nextcloudnotes.changes.run.in \ diff --git a/qml/harbour-nextcloudnotes.qml b/qml/harbour-nextcloudnotes.qml index cb6a146..bdff2e8 100644 --- a/qml/harbour-nextcloudnotes.qml +++ b/qml/harbour-nextcloudnotes.qml @@ -9,24 +9,14 @@ ApplicationWindow { id: appWindow - //property NotesApi notesApi - - Component.onCompleted: { - notesApi.scheme = account.allowUnecrypted ? "http" : "https" - notesApi.host = account.server - notesApi.username = account.username - notesApi.password = account.password - notesApi.sslVerify = !account.doNotVerifySsl - notesApi.dataFile = appSettings.currentAccount !== "" ? StandardPaths.data + "/" + appSettings.currentAccount + ".json" : "" - - } - + // All configured accounts ConfigurationValue { id: accounts key: appSettings.path + "/accountIDs" defaultValue: [ ] } + // Current account in use ConfigurationGroup { id: account path: "/apps/harbour-nextcloudnotes/accounts/" + appSettings.currentAccount @@ -39,32 +29,27 @@ ApplicationWindow property bool doNotVerifySsl: account.value("doNotVerifySsl", false, Boolean) property bool allowUnecrypted: account.value("allowUnecrypted", false, Boolean) property date update: value("update", "", Date) - onValuesChanged: console.log("A property of the current account has changed") - onNameChanged: console.log("Account: " + name) + onServerChanged: notesApi.server = server + onUsernameChanged: notesApi.username = username + onPasswordChanged: notesApi.password = password + onDoNotVerifySslChanged: notesApi.sslVerify = !doNotVerifySsl + onPathChanged: notesApi.dataFile = appSettings.currentAccount !== "" ? StandardPaths.data + "/" + appSettings.currentAccount + ".json" : "" } + // General settings of the app ConfigurationGroup { id: appSettings path: "/apps/harbour-nextcloudnotes/settings" property bool initialized: false property string currentAccount: value("currentAccount", "", String) - property var accountIDs: value("accountIDs", [ ], Array) property int autoSyncInterval: value("autoSyncInterval", 0, Number) property int previewLineCount: value("previewLineCount", 4, Number) property bool favoritesOnTop: value("favoritesOnTop", true, Boolean) - property string sortBy: value("sortBy", "prettyDate", String) + property string sortBy: value("sortBy", "modifiedString", String) property bool showSeparator: value("showSeparator", false, Boolean) property bool useMonoFont: value("useMonoFont", false, Boolean) property bool useCapitalX: value("useCapitalX", false, Boolean) - onCurrentAccountChanged: { - account.path = "/apps/harbour-nextcloudnotes/accounts/" + currentAccount - account.sync() - if (initialized) - notesApi.getAllNotes(); - autoSyncTimer.restart() - } - Component.onCompleted: initialized = true function addAccount() { var uuid = uuidv4() @@ -74,25 +59,36 @@ ApplicationWindow accounts.sync() return uuid } + ConfigurationGroup { + id: removeHelperConfGroup + } function removeAccount(uuid) { autoSyncTimer.stop() - var confGroup = ConfigurationGroup - confGroup.path = "/apps/harbour-nextcloudnotes/accounts/" + uuid - for (var i = accountIDs.length-1; i >= 0; i--) { - if (accountIDs[i] !== uuid && appSettings.currentAccount === uuid) { - appSettings.currentAccount = accountIDs[i] - } - else if (accountIDs[i] === uuid) { - accountIDs.splice(i, 1) + var tmpIDs = accounts.value + removeHelperConfGroup.path = "/apps/harbour-nextcloudnotes/accounts/" + uuid + for (var i = tmpIDs.length-1; i >= 0; i--) { + console.log(tmpIDs) + console.log("Checking:" + tmpIDs[i]) + if (tmpIDs[i] === uuid) { + console.log("Found! Removing ...") + tmpIDs.splice(i, 1) } + console.log(tmpIDs) } if (appSettings.currentAccount === uuid) { appSettings.currentAccount = "" + for (var i = tmpIDs.length-1; i >= 0 && appSettings.currentAccount === ""; i--) { + if (tmpIDs[i] !== uuid) { + appSettings.currentAccount = tmpIDs[i] + } + } } - confGroup.clear() + removeHelperConfGroup.clear() if (autoSyncInterval > 0 && appWindow.visible) { autoSyncTimer.start() } + accounts.value = tmpIDs + accounts.sync() } function uuidv4() { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { @@ -108,14 +104,14 @@ ApplicationWindow appName: "Nextcloud " + qsTr("Notes") summary: qsTr("Offline") body: qsTr("Synced") + ": " + new Date(account.update).toLocaleString(Qt.locale()) - Component.onDestruction: close(Notification.Expired) + Component.onDestruction: close() } Notification { id: errorNotification appName: offlineNotification.appName summary: qsTr("Error") - Component.onDestruction: close(Notification.Expired) + Component.onDestruction: close() } Timer { @@ -123,7 +119,7 @@ ApplicationWindow interval: appSettings.autoSyncInterval * 1000 repeat: true running: interval > 0 && notesApi.networkAccessible && appWindow.visible - triggeredOnStart: false + triggeredOnStart: true onTriggered: { if (!notesApi.busy) { notesApi.getAllNotes(); @@ -142,15 +138,6 @@ ApplicationWindow NotesApi { id: notesApi - scheme: account.allowUnecrypted ? "http" : "https" - host: account.server - username: account.username - password: account.password - sslVerify: !account.doNotVerifySsl - dataFile: appSettings.currentAccount !== "" ? StandardPaths.data + "/" + appSettings.currentAccount + ".json" : "" - Component.onCompleted: { - getAllNotes() - } onNetworkAccessibleChanged: { console.log("Device is " + (networkAccessible ? "online" : "offline")) networkAccessible ? offlineNotification.close(Notification.Closed) : offlineNotification.publish() @@ -167,7 +154,6 @@ ApplicationWindow } initialPage: Component { NotesPage { } } - //initialPage: Component { LoginPage { } } // testing cover: Qt.resolvedUrl("cover/CoverPage.qml") allowedOrientations: defaultAllowedOrientations } diff --git a/qml/js/showdown b/qml/js/showdown index 8afa1ff..483e51f 160000 --- a/qml/js/showdown +++ b/qml/js/showdown @@ -1 +1 @@ -Subproject commit 8afa1fff0e1de2481e0545be17a906e2a68bb4e2 +Subproject commit 483e51f7a624c94c95787a14cbf577c053f8076f diff --git a/qml/pages/LoginPage.qml b/qml/pages/LoginPage.qml index adee90c..5a97571 100644 --- a/qml/pages/LoginPage.qml +++ b/qml/pages/LoginPage.qml @@ -14,17 +14,35 @@ Page { ConfigurationGroup { id: account path: "/apps/harbour-nextcloudnotes/accounts/" + accountId + + property string name: value("name", qsTr("Nextcloud Login"), String) + property url server: value("server", "", String) + property string version: value("version", "v0.2", String) + property string username: value("username", "", String) + property string password: account.value("password", "", String) + property bool doNotVerifySsl: account.value("doNotVerifySsl", false, Boolean) + property bool allowUnecrypted: account.value("allowUnecrypted", false, Boolean) + Component.onCompleted: { - pageHeader.title = value("name", qsTr("Nextcloud Login"), String) - serverField.text = "https://" + value("server", "", String) - usernameField.text = value("username", "", String) - passwordField.text = value("password", "", String) - unsecureConnectionTextSwitch.checked = value("unsecureConnection", false, Boolean) - unencryptedConnectionTextSwitch.checked = value("unencryptedConnection", false, Boolean) + pageHeader.title = name + serverField.text = server ? server : allowUnecrypted ? "http://" : "https://" + usernameField.text = username + passwordField.text = password + unsecureConnectionTextSwitch.checked = doNotVerifySsl + unencryptedConnectionTextSwitch.checked = allowUnecrypted + if (username !== "" && password !== "") { + notesApi.server = server + notesApi.username = username + notesApi.password = password + notesApi.sslVerify = !doNotVerifySsl + notesApi.verifyLogin() + } } } onStatusChanged: { + if (status === PageStatus.Activating) + notesApi.getNcStatus() if (status === PageStatus.Deactivating) notesApi.abortFlowV2Login() } @@ -34,6 +52,9 @@ Page { onStatusInstalledChanged: { if (notesApi.statusInstalled) serverField.focus = false + else { + pageHeader.title + } } onStatusVersionChanged: { if (notesApi.statusVersion) { @@ -55,12 +76,12 @@ Page { } onStatusVersionStringChanged: { if (notesApi.statusVersionString) - console.log("Nextcloud " + notesApi.statusVersionString) + pageHeader.description = "Nextcloud " + notesApi.statusVersionString } onStatusProductNameChanged: { if (notesApi.statusProductName) { pageHeader.title = notesApi.statusProductName - account.setValue("name", notesApi.statusProductName) + account.name = notesApi.statusProductName } } onLoginStatusChanged: { @@ -81,8 +102,9 @@ Page { break case NotesApi.LoginSuccess: apiProgressBar.label = qsTr("Login successfull!") - account.setValue("username", notesApi.username) - account.setValue("password", notesApi.password) + account.username = notesApi.username + account.password = notesApi.password + appSettings.currentAccount = accountId break; case NotesApi.LoginFailed: apiProgressBar.label = qsTr("Login failed!") @@ -103,7 +125,7 @@ Page { onServerChanged: { if (notesApi.server) { console.log("Login server: " + notesApi.server) - account.setValue("server", notesApi.server) + account.server = notesApi.server serverField.text = notesApi.server } } @@ -188,7 +210,7 @@ Page { Behavior on opacity { FadeAnimator {} } Button { anchors.horizontalCenter: parent.horizontalCenter - text: notesApi.loginStatus === NotesApi.LoginFlowV2Polling ? qsTr("Abort") : qsTr("Login") + text: notesApi.loginStatus === NotesApi.LoginFlowV2Polling ? qsTr("Abort") : notesApi.loginStatus === NotesApi.LoginSuccess ? qsTr("Re-Login") : qsTr("Login") onClicked: notesApi.loginStatus === NotesApi.LoginFlowV2Polling ? notesApi.abortFlowV2Login() : notesApi.initiateFlowV2Login() } } @@ -227,6 +249,18 @@ Page { } } + SectionHeader { + text: qsTr("Note") + } + Label { + x: Theme.horizontalPageMargin + width: parent.width - 2*x + wrapMode: Text.Wrap + color: Theme.secondaryColor + linkColor: Theme.secondaryHighlightColor + text: qsTr("The Notes app needs to be installed on the Nextcloud server for this app to work.") + } + SectionHeader { text: qsTr("Security") } @@ -241,6 +275,10 @@ Page { id: unsecureConnectionTextSwitch text: qsTr("Do not check certificates") description: qsTr("Enable this option to allow selfsigned certificates") + onCheckedChanged: { + account.doNotVerifySsl = checked + notesApi.sslVerify = !account.doNotVerifySsl + } } TextSwitch { id: unencryptedConnectionTextSwitch diff --git a/qml/pages/NotePage.qml b/qml/pages/NotePage.qml index 0e06ee2..be4d1d3 100644 --- a/qml/pages/NotePage.qml +++ b/qml/pages/NotePage.qml @@ -242,7 +242,7 @@ Dialog { icon.source: (selected ? "image://theme/icon-m-favorite-selected?" : "image://theme/icon-m-favorite?") + (favoriteButton.highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor) onClicked: { - notesApi.updateNote(id, {'favorite': !favorite}) + notesApi.updateNote(id, {'favorite': !favorite, 'modified': new Date().valueOf() / 1000 }) } } TextField { @@ -257,7 +257,7 @@ Dialog { } onFocusChanged: { if (focus === false && text !== category) { - notesApi.updateNote(id, {'content': content, 'category': text}) // This does not seem to work without adding the content + notesApi.updateNote(id, {'content': content, 'category': text, 'modified': new Date().valueOf() / 1000}) // This does not seem to work without adding the content } } } diff --git a/qml/pages/NotesPage.qml b/qml/pages/NotesPage.qml index 5d0d8da..2b4ce4d 100644 --- a/qml/pages/NotesPage.qml +++ b/qml/pages/NotesPage.qml @@ -6,6 +6,7 @@ Page { id: page property NotesModel notesModel: notesApi.model() + property string searchString Connections { target: appSettings @@ -18,6 +19,13 @@ Page { onFavoritesOnTopChanged: { notesModel.favoritesOnTop = appSettings.favoritesOnTop } + onCurrentAccountChanged: { + notesList.model = 0 + notesList.model = notesApi.model() + if (appSettings.currentAccount.length > 0) + notesApi.getAllNotes() + + } } Component.onCompleted: { notesModel.favoritesOnTop = appSettings.favoritesOnTop @@ -26,7 +34,7 @@ Page { onStatusChanged: { if (status === PageStatus.Active) { - if (appSettings.accountIDs.length <= 0) { + if (accounts.value.length <= 0) { addAccountHint.restart() } else { @@ -49,11 +57,11 @@ Page { } MenuItem { text: qsTr("Add note") - enabled: appSettings.currentAccount.length > 0 + enabled: appSettings.currentAccount.length > 0 && notesApi.networkAccessible onClicked: notesApi.createNote( { 'content': "", 'modified': new Date().valueOf() / 1000 } ) } MenuItem { - text: enabled ? qsTr("Reload") : qsTr("Updating...") + text: notesApi.networkAccessible && !notesApi.busy ? qsTr("Reload") : qsTr("Updating...") enabled: appSettings.currentAccount.length > 0 && notesApi.networkAccessible && !notesApi.busy onClicked: notesApi.getAllNotes() } @@ -72,10 +80,13 @@ Page { id: searchField width: parent.width enabled: !busyIndicator.running && !noLoginPlaceholder.enabled && !errorPlaceholder.enabled && !noNotesPlaceholder.enabled - placeholderText: account.name.length > 0 ? account.name : qsTr("Nextcloud Notes") + placeholderText: notesApi.statusProductName.length > 0 ? notesApi.statusProductName : account.name.length > 0 ? account.name : qsTr("Nextcloud Notes") EnterKey.iconSource: "image://theme/icon-m-enter-close" EnterKey.onClicked: focus = false - onTextChanged: notesModel.setFilterFixedString(text) + onTextChanged: { + searchString = text + notesModel.setFilterFixedString(text) + } } Label { id: description @@ -86,7 +97,7 @@ Page { anchors.bottomMargin: Theme.paddingMedium color: Theme.secondaryHighlightColor font.pixelSize: Theme.fontSizeSmall - text: account.username + "@" + account.server + text: notesApi.username + "@" + notesApi.host } BusyIndicator { anchors.verticalCenter: searchField.verticalCenter @@ -146,7 +157,7 @@ Page { icon.source: (favorite ? "image://theme/icon-m-favorite-selected?" : "image://theme/icon-m-favorite?") + (note.highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor) onClicked: { - notesApi.updateNote(id, {'favorite': !favorite} ) + notesApi.updateNote(id, {'favorite': !favorite, 'modified': new Date().valueOf() / 1000 } ) } } @@ -250,7 +261,7 @@ Page { ViewPlaceholder { id: noLoginPlaceholder - enabled: appSettings.accountIDs.length <= 0 + enabled: accounts.value.length <= 0 text: qsTr("No account yet") hintText: qsTr("Got to the settings to add an account") } @@ -264,7 +275,7 @@ Page { ViewPlaceholder { id: noSearchPlaceholder - enabled: notesList.count === 0 && searchField.text !== "" //notesModel.filterRegExp !== "" + enabled: notesList.count === 0 && searchString !== "" //notesModel.filterRegExp !== "" text: qsTr("No result") hintText: qsTr("Try another query") } diff --git a/qml/pages/SettingsPage.qml b/qml/pages/SettingsPage.qml index 8d14b4c..b4d9078 100644 --- a/qml/pages/SettingsPage.qml +++ b/qml/pages/SettingsPage.qml @@ -33,7 +33,7 @@ Page { } Label { id: noAccountsLabel - visible: appSettings.accountIDs.length <= 0 + visible: accounts.value.length <= 0 text: qsTr("No Nextcloud account yet") font.pixelSize: Theme.fontSizeLarge color: Theme.secondaryHighlightColor @@ -41,7 +41,7 @@ Page { } Repeater { id: accountRepeater - model: appSettings.accountIDs + model: accounts.value delegate: ListItem { id: accountListItem @@ -52,8 +52,8 @@ Page { id: account path: "/apps/harbour-nextcloudnotes/accounts/" + modelData Component.onCompleted: { - accountTextSwitch.text = value("name", qsTr("Unnamed account"), String) - accountTextSwitch.description = account.value("username", qsTr("unknown"), String) + "@" + account.value("server", qsTr("unknown"), String) + accountTextSwitch.text = account.value("username", qsTr("unknown"), String) + " @ " + value("name", qsTr("Unnamed account"), String) + accountTextSwitch.description =account.value("server", qsTr("unknown"), String) } } @@ -70,7 +70,7 @@ Page { MenuItem { text: qsTr("Edit") onClicked: { - var login = pageStack.replace(Qt.resolvedUrl("LoginPage.qml"), { accountId: modelData }) + var login = pageStack.push(Qt.resolvedUrl("LoginPage.qml"), { accountId: modelData }) } } MenuItem { @@ -90,7 +90,7 @@ Page { anchors.horizontalCenter: parent.horizontalCenter onClicked: { var newAccountID = appSettings.addAccount() - var login = pageStack.replace(Qt.resolvedUrl("LoginPage.qml"), { accountId: newAccountID, addingNew: true }) + var login = pageStack.push(Qt.resolvedUrl("LoginPage.qml"), { accountId: newAccountID, addingNew: true }) } } diff --git a/rpm/harbour-nextcloudnotes.changes b/rpm/harbour-nextcloudnotes.changes index 2e427a4..07d5fbf 100644 --- a/rpm/harbour-nextcloudnotes.changes +++ b/rpm/harbour-nextcloudnotes.changes @@ -12,6 +12,9 @@ # * date Author's Name version-release # - Summary of changes +* Sun Mar 29 2020 Scharel Clemens 0.6-0 +- Improved changes of 0.5 + * Sun Jan 19 2020 Scharel Clemens 0.5-0 - Added offline mode - Added Nextcloud Flow v2 Login diff --git a/rpm/harbour-nextcloudnotes.spec b/rpm/harbour-nextcloudnotes.spec index f691e1f..895b0ad 100644 --- a/rpm/harbour-nextcloudnotes.spec +++ b/rpm/harbour-nextcloudnotes.spec @@ -13,7 +13,7 @@ Name: harbour-nextcloudnotes %{!?qtc_make:%define qtc_make make} %{?qtc_builddir:%define _builddir %qtc_builddir} Summary: Nextcloud Notes -Version: 0.4 +Version: 0.6 Release: 0 Group: Applications/Editors License: MIT diff --git a/rpm/harbour-nextcloudnotes.yaml b/rpm/harbour-nextcloudnotes.yaml index cfdc6a2..26419d8 100644 --- a/rpm/harbour-nextcloudnotes.yaml +++ b/rpm/harbour-nextcloudnotes.yaml @@ -1,6 +1,6 @@ Name: harbour-nextcloudnotes Summary: Nextcloud Notes -Version: 0.3 +Version: 0.6 Release: 0 # The contents of the Group field should be one of the groups listed here: # https://github.com/mer-tools/spectacle/blob/master/data/GROUPS diff --git a/src/notesapi.cpp b/src/notesapi.cpp index 13827dd..498576e 100644 --- a/src/notesapi.cpp +++ b/src/notesapi.cpp @@ -3,6 +3,7 @@ #include #include #include +#include NotesApi::NotesApi(const QString statusEndpoint, const QString loginEndpoint, const QString ocsEndpoint, const QString notesEndpoint, QObject *parent) : QObject(parent), m_statusEndpoint(statusEndpoint), m_loginEndpoint(loginEndpoint), m_ocsEndpoint(ocsEndpoint), m_notesEndpoint(notesEndpoint) @@ -58,6 +59,10 @@ NotesApi::~NotesApi() { } void NotesApi::setSslVerify(bool verify) { + if (verify != (m_request.sslConfiguration().peerVerifyMode() == QSslSocket::VerifyPeer)) { + m_request.sslConfiguration().setPeerVerifyMode(verify ? QSslSocket::VerifyPeer : QSslSocket::VerifyNone); + emit sslVerifyChanged(verify); + } if (verify != (m_authenticatedRequest.sslConfiguration().peerVerifyMode() == QSslSocket::VerifyPeer)) { m_authenticatedRequest.sslConfiguration().setPeerVerifyMode(verify ? QSslSocket::VerifyPeer : QSslSocket::VerifyNone); emit sslVerifyChanged(verify); @@ -91,7 +96,7 @@ QString NotesApi::server() const { void NotesApi::setServer(QString serverUrl) { QUrl url(serverUrl.trimmed()); - if (serverUrl != server()) { + if (url != server()) { setScheme(url.scheme()); setHost(url.host()); setPort(url.port()); @@ -163,6 +168,9 @@ void NotesApi::setDataFile(const QString &dataFile) { if (dataFile != m_jsonFile.fileName()) { m_jsonFile.close(); m_jsonFile.setFileName(dataFile); + QFileInfo fileinfo(m_jsonFile); + QDir filepath; + filepath.mkpath(fileinfo.absolutePath()); emit dataFileChanged(m_jsonFile.fileName()); } } @@ -268,7 +276,7 @@ void NotesApi::getNote(double noteId, QStringList excludeFields) { void NotesApi::createNote(QVariantMap fields) { // Update note in the model Note note(QJsonObject::fromVariantMap(fields)); - mp_model->insertNote(note); + //mp_model->insertNote(note); // Create note via the API QUrl url = apiEndpointUrl(m_notesEndpoint + "/notes"); @@ -412,7 +420,7 @@ void NotesApi::replyFinished(QNetworkReply *reply) { emit busyChanged(busy()); } else { - qDebug() << "Unknown reply"; + qDebug() << "Unknown or double reply"; } //qDebug() << data; } @@ -444,7 +452,8 @@ void NotesApi::replyFinished(QNetworkReply *reply) { m_notesReplies.removeOne(reply); emit busyChanged(busy()); } - emit error(CommunicationError); + if (reply != m_statusReply) + emit error(CommunicationError); } reply->deleteLater(); } @@ -459,7 +468,7 @@ void NotesApi::sslError(QNetworkReply *reply, const QList &errors) { void NotesApi::saveToFile(QModelIndex, QModelIndex, QVector) { if (m_jsonFile.open(QIODevice::ReadWrite | QIODevice::Truncate | QIODevice::Text)) { - qDebug() << "Writing data to file" << m_jsonFile.fileName(); + //qDebug() << "Writing data to file" << m_jsonFile.fileName(); QByteArray data = mp_model->toJsonDocument().toJson(); if (m_jsonFile.write(data) < data.size()) emit error(LocalFileWriteError); diff --git a/src/notesmodel.cpp b/src/notesmodel.cpp index 8b2b404..1b2feef 100644 --- a/src/notesmodel.cpp +++ b/src/notesmodel.cpp @@ -15,7 +15,7 @@ NotesProxyModel::~NotesProxyModel() { } void NotesProxyModel::setFavoritesOnTop(bool favoritesOnTop) { - qDebug() << "Favorites on top:" << favoritesOnTop; + //qDebug() << "Favorites on top:" << favoritesOnTop; if (favoritesOnTop != m_favoritesOnTop) { m_favoritesOnTop = favoritesOnTop; emit favoritesOnTopChanged(m_favoritesOnTop); @@ -54,7 +54,7 @@ bool NotesModel::fromJsonDocument(const QJsonDocument &jdoc) { qDebug() << "Applying new JSON input"; // << json; if (!jdoc.isNull() && !jdoc.isEmpty()) { if (jdoc.isArray()) { - qDebug() << "- It's an array..."; + //qDebug() << "- It's an array..."; QVector notesIdsToRemove; QJsonArray jarr = jdoc.array(); if (!jarr.empty()) @@ -80,7 +80,7 @@ bool NotesModel::fromJsonDocument(const QJsonDocument &jdoc) { return true; } else if (jdoc.isObject()) { - qDebug() << "- It's a single object..."; + //qDebug() << "- It's a single object..."; insertNote(jdoc.object()); } else if (jdoc.isEmpty()) { @@ -116,18 +116,18 @@ int NotesModel::insertNote(const Note ¬e) { int position = m_notes.indexOf(note); if (position >= 0) { if (m_notes.at(position).equal(note)) { - qDebug() << "-- Note already present but unchanged."; + //qDebug() << "-- Note already present but unchanged."; } else { - qDebug() << "-- Note already present, updating it."; + //qDebug() << "-- Note already present, updating it."; m_notes.replace(position, note); emit dataChanged(index(position), index(position)); } } else { - if (note.id() < 0) - qDebug() << "-- Local only note!"; - qDebug() << "-- New note, adding it"; + //if (note.id() < 0) + // qDebug() << "-- Local only note!"; + //qDebug() << "-- New note, adding it"; position = m_notes.size(); beginInsertRows(QModelIndex(), position, position); m_notes.append(note); diff --git a/translations/harbour-nextcloudnotes-de.ts b/translations/harbour-nextcloudnotes-de.ts index cfe9c58..163705a 100644 --- a/translations/harbour-nextcloudnotes-de.ts +++ b/translations/harbour-nextcloudnotes-de.ts @@ -91,7 +91,7 @@ No content - + Kein Inhalt @@ -112,39 +112,39 @@ LoginPage Nextcloud Login - + Nextcloud Login Nextcloud server - + Nextcloud Server Abort - + Abbrechen Login - + Einloggen Security - + Sicherheit <strong>CAUTION: Your password will be saved without any encryption on the device!</strong><br>Please consider creating a dedicated app password! Open your Nextcloud in a browser and go to <i>Settings</i> → <i>Security</i>. - + <strong>ACHTUNG: Das Password wird unverschlüsselt auf dem Gerät gespeichert!</strong><br>Überlege ein eigenes App-Passwort festzulegen! Öffne Nextcloud im Browser und gehe zu <i>Einstellungen</i> -- > <i>Sicherheit</i>. Do not check certificates - + Zertifikate nicht prüfen Enable this option to allow selfsigned certificates - + Auswählen im selbst signierte Zertifikate zu erlauben Allow unencrypted connections - + Unverschlüsselte Verbindung erlauben @@ -152,31 +152,43 @@ Username - + Benutzername Password - + Passwort Follow the instructions in the browser - + Folge den Anweisungen im Browser Login successfull! - + Login erfolgreich! Login failed! - + Login fehlgeschlagen! Enter your credentials - + Zugangsdaten eingeben Test Login - + Zugang testen + + + Note + Achtung + + + The <a href="https://apps.nextcloud.com/apps/notes">Notes</a> app needs to be installed on the Nextcloud server for this app to work. + Die <a href="https://apps.nextcloud.com/apps/notes">Notes</a> Applikation muss auf dem Nextcloud-Server installiert sein, damit diese App funktioniert. + + + Re-Login + Neu einloggen @@ -244,110 +256,110 @@ NotesApi No network connection available - + Netzwerk Verbindung nicht verfügbar Failed to communicate with the Nextcloud server - + Fehler bei der Server-Kommunikation An error happened while reading from the local storage - + Fehler beim Lesen der lokalen Datei An error happened while writing to the local storage - + Fehler beim Schreiben der lokalen Datei An error occured while establishing an encrypted connection - + Fehler beim Aufbau einer verschlüsselten Kommunikation Could not authenticate to the Nextcloud instance - + Fehler bei der Authentifizierung am Server Unknown error - + Unbekannter Fehler NotesPage Settings - Einstellungen + Einstellungen Add note - + Neue Notiz Reload - Neu laden + Neu laden Updating... - Aktualisiere... + Aktualisiere... Last update - Zuletzt aktualisiert + Zuletzt aktualisiert never - noch nie + noch nie Nextcloud Notes - Nextcloud Notizen + Nextcloud Notizen Modified - Geändert + Geändert Delete - Löschen + Löschen Deleting note - + Lösche Notiz Loading notes... - + Lade Notizen... Open the settings to configure your Nextcloud accounts - + Öffne die EInstellungen um ein Nextcloud Account einzurichten No account yet - + Noch kein Account vohanden Got to the settings to add an account - + Richte ein Account in den Einstellungen ein No notes yet - + Keine Notizen Pull down to add a note - + Ziehen um eine Notiz anzulegen No result - + Kein Ergebnis Try another query - + Probiere eine andere Suche An error occurred - + Ein Fehler ist aufgetreten @@ -490,15 +502,15 @@ Favorites on top - + Favoriten oben anzeigen Show notes marked as favorite above the others - + Markierte Notizen vor allen anderen anzeigen No sorting - + Keine Sortierung @@ -671,19 +683,19 @@ You can also use other markdown syntax inside them. harbour-nextcloudnotes Notes - Notizen + Notizen Offline - + Keine Verbindung Synced - + Synchronisiert Error - + Fehler diff --git a/translations/harbour-nextcloudnotes-sv.ts b/translations/harbour-nextcloudnotes-sv.ts index 1b26c1e..d851a61 100644 --- a/translations/harbour-nextcloudnotes-sv.ts +++ b/translations/harbour-nextcloudnotes-sv.ts @@ -178,6 +178,18 @@ Test Login + + Note + + + + The <a href="https://apps.nextcloud.com/apps/notes">Notes</a> app needs to be installed on the Nextcloud server for this app to work. + + + + Re-Login + + MITLicense diff --git a/translations/harbour-nextcloudnotes.ts b/translations/harbour-nextcloudnotes.ts index 73b59b6..8f8bb15 100644 --- a/translations/harbour-nextcloudnotes.ts +++ b/translations/harbour-nextcloudnotes.ts @@ -138,78 +138,93 @@ - + Nextcloud server - + Username - + Password - + Abort - + Follow the instructions in the browser - + Login successfull! - - + + Login failed! - + Enter your credentials - + Login - + + Re-Login + + + + Test Login - + + Note + + + + + The <a href="https://apps.nextcloud.com/apps/notes">Notes</a> app needs to be installed on the Nextcloud server for this app to work. + + + + Security - + <strong>CAUTION: Your password will be saved without any encryption on the device!</strong><br>Please consider creating a dedicated app password! Open your Nextcloud in a browser and go to <i>Settings</i> → <i>Security</i>. - + Do not check certificates - + Enable this option to allow selfsigned certificates - + Allow unencrypted connections @@ -296,37 +311,37 @@ NotesApi - + No network connection available - + Failed to communicate with the Nextcloud server - + An error happened while reading from the local storage - + An error happened while writing to the local storage - + An error occured while establishing an encrypted connection - + Could not authenticate to the Nextcloud instance - + Unknown error @@ -334,97 +349,97 @@ NotesPage - + Settings - + Add note - + Reload - + Updating... - + Last update - + never - + Nextcloud Notes - + Modified - + Delete - + Deleting note - + Loading notes... - + No account yet - + Got to the settings to add an account - + No notes yet - + Pull down to add a note - + No result - + Try another query - + An error occurred - + Open the settings to configure your Nextcloud accounts @@ -457,6 +472,7 @@ + unknown @@ -824,22 +840,22 @@ You can also use other markdown syntax inside them. harbour-nextcloudnotes - + Notes - + Offline - + Synced - + Error