diff --git a/README.md b/README.md
index d3c6365..4fa0a99 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@ The [Sailfish OS SDK](https://sailfishos.org/wiki/Application_SDK) is used to wr
## Planned features
(The ordering represents the priority for the implementation)
-- Login screen for the nextcloud account (using the [Login Flow](https://docs.nextcloud.com/server/14/developer_manual/client_apis/LoginFlow/index.html))
+- Login screen for the nextcloud account (using the [Login Flow](https://docs.nextcloud.com/server/14/developer_manual/client_apis/LoginFlow/index.html) if possible)
- Create new notes
- Delete notes
- Edit notes
diff --git a/harbour-nextcloudnotes.pro b/harbour-nextcloudnotes.pro
index 6d6fac6..2ff5329 100644
--- a/harbour-nextcloudnotes.pro
+++ b/harbour-nextcloudnotes.pro
@@ -26,7 +26,8 @@ DISTFILES += qml/harbour-nextcloudnotes.qml \
rpm/harbour-nextcloudnotes.yaml \
translations/*.ts \
harbour-nextcloudnotes.desktop \
- qml/pages/NotePage.qml
+ qml/pages/NotePage.qml \
+ qml/pages/LoginPage.qml
SAILFISHAPP_ICONS = 86x86 108x108 128x128 172x172
diff --git a/qml/harbour-nextcloudnotes.qml b/qml/harbour-nextcloudnotes.qml
index 6cf7500..24e4bb2 100644
--- a/qml/harbour-nextcloudnotes.qml
+++ b/qml/harbour-nextcloudnotes.qml
@@ -11,7 +11,7 @@ ApplicationWindow
id: appSettings
path: "/apps/harbour-nextcloudnotes/settings"
property string lastUpdate: qsTr("never")
- property url server: "https://127.0.0.1" + "/index.php/apps/notes/api/v0.2/notes"
+ property url server: "https://127.0.0.1"
property string username: "test"
property string password // TODO provide password before testing. Just use revocable passwords for testing!
}
diff --git a/qml/pages/LoginPage.qml b/qml/pages/LoginPage.qml
new file mode 100644
index 0000000..50499b8
--- /dev/null
+++ b/qml/pages/LoginPage.qml
@@ -0,0 +1,48 @@
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+Page {
+ id: page
+
+ allowedOrientations: Orientation.Portrait
+
+ SilicaFlickable {
+ id: webView
+ anchors.fill: parent
+
+ PullDownMenu {
+ MenuItem {
+ text: qsTr("Reload")
+ onClicked: webView.reload()
+ }
+ }
+
+ PageHeader {
+ title: qsTr("Login")
+ }
+
+ Column {
+ TextField {
+ focus: true
+ width: parent.width
+ placeholderText: qsTr("https://cloud.nextcloud.com")
+ label: qsTr("Nextcloud server")
+ inputMethodHints: Qt.ImhUrlCharactersOnly
+ }
+
+ TextField {
+ width: parent.width
+ placeholderText: qsTr("Username")
+ label: qsTr("Nextcloud user")
+ inputMethodHints: Qt.ImhUrlCharactersOnly
+ }
+
+ TextField {
+ width: parent.width
+ placeholderText: qsTr("Password")
+ label: qsTr("Nextcloud App-Password")
+ inputMethodHints: Qt.ImhUrlCharactersOnly
+ }
+ }
+ }
+}
diff --git a/qml/pages/NotesApi.qml b/qml/pages/NotesApi.qml
index c84d85a..df475cd 100644
--- a/qml/pages/NotesApi.qml
+++ b/qml/pages/NotesApi.qml
@@ -14,16 +14,16 @@ Item {
function callApi(method, data) {
busy = true
- var endpoint = ""
+ var endpoint = appSettings.server + "/index.php/apps/notes/api/v0.2/notes"
if (data && (method === "GET" || method === "PUT" || method === "DELETE"))
if (data.id)
- endpoint = "/" + data.id
+ endpoint = endpoint + "/" + data.id
var apiReq = new XMLHttpRequest
- apiReq.open(method, appSettings.server + endpoint, true)
+ apiReq.open(method, endpoint, true)
apiReq.setRequestHeader('User-Agent', 'SailfishOS/harbour-nextcloudnotes')
apiReq.setRequestHeader('OCS-APIRequest', 'true')
- apiReq.setRequestHeader("Content-Type", "application/json");
+ apiReq.setRequestHeader("Content-Type", "application/json")
apiReq.setRequestHeader("Authorization", "Basic " + Qt.btoa(appSettings.username + ":" + appSettings.password))
apiReq.onreadystatechange = function() {
if (apiReq.readyState === XMLHttpRequest.DONE) {
diff --git a/translations/harbour-nextcloudnotes.ts b/translations/harbour-nextcloudnotes.ts
index 95869c2..af8adc1 100644
--- a/translations/harbour-nextcloudnotes.ts
+++ b/translations/harbour-nextcloudnotes.ts
@@ -43,6 +43,41 @@
+
+ LoginFlow
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
harbour-nextcloudnotes