import QtQuick 2.2 import Sailfish.Silica 1.0 import "../components" Page { id: page property var dav SilicaFlickable { anchors.fill: parent contentHeight: column.height Column { id: column width: parent.width PageHeader { title: qsTr("Settings") } SectionHeader { text: qsTr("Connection") } TextField { id: serverField width: parent.width label: qsTr("WebDAV URL (folder)") placeholderText: "https://host/remote.php/dav/files/user/Note" text: appSettings.serverUrl onTextChanged: appSettings.serverUrl = text } TextField { id: userField width: parent.width label: qsTr("Username") text: appSettings.username onTextChanged: appSettings.username = text } TextField { id: passField width: parent.width label: qsTr("Password") echoMode: TextInput.Password text: appSettings.password onTextChanged: appSettings.password = text } Button { width: parent.width text: qsTr("Test connection") onClicked: { if (!appSettings.serverUrl) { banner.show(qsTr("Enter the folder URL"), true) return } banner.show(qsTr("Checking..."), false) dav.testConnection() } } SectionHeader { text: qsTr("Language") } ComboBox { id: langBox width: parent.width label: qsTr("Language") currentIndex: appSettings.language === "it" ? 2 : (appSettings.language === "en" ? 1 : 0) menu: ContextMenu { MenuItem { text: qsTr("System (default)") } MenuItem { text: "English" } MenuItem { text: "Italiano" } } onCurrentIndexChanged: { var v = currentIndex === 2 ? "it" : (currentIndex === 1 ? "en" : "system") if (v !== appSettings.language) { appSettings.language = v banner.show(qsTr("Language will be applied after restarting the app"), false) } } } Label { x: Theme.paddingLarge width: parent.width - 2 * Theme.paddingLarge wrapMode: Text.Wrap color: Theme.secondaryColor font.pixelSize: Theme.fontSizeSmall text: qsTr("On Nextcloud: Settings → Security → App passwords. ") + qsTr("The URL is https://host/remote.php/dav/files/USER/FOLDER. ") + qsTr("The password is stored locally in the app config file.") } SectionHeader { text: qsTr("Notes") } Label { x: Theme.paddingLarge width: parent.width - 2 * Theme.paddingLarge wrapMode: Text.Wrap color: Theme.secondaryColor font.pixelSize: Theme.fontSizeSmall text: qsTr("The app saves automatically when you leave a note. ") + qsTr("Supported: headings, bold, italic, code, lists, quotes, links, tables and rules.") } } } Connections { target: dav onConnOk: banner.show(qsTr("Connection OK"), false) onFailed: banner.show(message, true) } Banner { id: banner } }