From 8e963c7e0ff23cb9bb5161f045904993a7ea04d6 Mon Sep 17 00:00:00 2001 From: Scharel Clemens Date: Thu, 31 Dec 2020 14:01:13 +0100 Subject: [PATCH] More properties to check if URL is Valid --- src/notesapi.cpp | 7 ++++- src/notesapi.h | 2 +- translations/harbour-nextcloudnotes.ts | 42 +++++++++++++------------- 3 files changed, 28 insertions(+), 23 deletions(-) diff --git a/src/notesapi.cpp b/src/notesapi.cpp index afcde66..1460320 100644 --- a/src/notesapi.cpp +++ b/src/notesapi.cpp @@ -349,7 +349,12 @@ const QString NotesApi::errorMessage(int error) const { } void NotesApi::verifyUrl(QUrl url) { - emit urlValidChanged(url.isValid()); + emit urlValidChanged( + url.isValid()&& + !url.isRelative() && + !url.userName().isEmpty() && + !url.password().isEmpty() && + !url.host().isEmpty()); } void NotesApi::requireAuthentication(QNetworkReply *reply, QAuthenticator *authenticator) { diff --git a/src/notesapi.h b/src/notesapi.h index fe70b0f..821c493 100644 --- a/src/notesapi.h +++ b/src/notesapi.h @@ -27,7 +27,7 @@ class NotesApi : public QObject // Generic API properties Q_PROPERTY(bool verifySsl READ verifySsl WRITE setVerifySsl NOTIFY verifySslChanged) // to allow selfsigned certificates Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged) // complete API URL = ://:@[:]/ - Q_PROPERTY(QString server READ server WRITE setServer NOTIFY serverChanged) + Q_PROPERTY(QString server READ server WRITE setServer NOTIFY serverChanged) // url without username and password = ://[:]/ Q_PROPERTY(QString scheme READ scheme WRITE setScheme NOTIFY schemeChanged) Q_PROPERTY(QString host READ host WRITE setHost NOTIFY hostChanged) Q_PROPERTY(int port READ port WRITE setPort NOTIFY portChanged) diff --git a/translations/harbour-nextcloudnotes.ts b/translations/harbour-nextcloudnotes.ts index 3d2e03a..cefac86 100644 --- a/translations/harbour-nextcloudnotes.ts +++ b/translations/harbour-nextcloudnotes.ts @@ -138,103 +138,103 @@ LoginPage - + Nextcloud Login - + Nextcloud server - + Username - + Password - + Abort - + Follow the instructions in the browser - + Login successfull! - - + + Login failed! - + Enter your credentials - + Enforce legacy login - + 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