harbour-nextcloudnotes/qml/harbour-nextcloudnotes.qml

52 lines
1.8 KiB
QML
Raw Normal View History

2018-10-16 18:50:58 +03:00
import QtQuick 2.0
import Sailfish.Silica 1.0
import Nemo.Configuration 1.0
import "pages"
ApplicationWindow
{
id: appWindow
ConfigurationGroup {
id: appSettings
path: "/apps/harbour-nextcloudnotes/settings"
2018-10-23 23:15:59 +03:00
property var accounts: [ ] // FIXME
property int currentAccount: 0 // FIXME
2018-10-21 02:44:23 +03:00
// For testing
Component.onCompleted: {
2018-10-23 23:15:59 +03:00
appSettings.clear()
//accounts[0] = { server: "127.0.0.1", username: "fu", password: "bar", lastUpdate: new Date(0) }
//accounts[1] = { server: "127.0.0.2", username: "fu", password: "bar", lastUpdate: new Date(0) }
//accounts[2] = { server: "127.0.0.3", username: "fu", password: "bar", lastUpdate: new Date(0) }
console.log("Configured accounts: " + accounts.length)
for(var i=0; i<accounts.length; i++) {
2018-10-23 23:15:59 +03:00
console.log("Account " + i + (i === currentAccount ? " (active):" : ":"))
console.log("- Server: " + accounts[i].server)
console.log("- Username: " + accounts[i].username)
console.log("- Password: " + accounts[i].password)
}
if (typeof(accounts[currentAccount]) !== 'undefined') {
notes.account = appSettings.accounts[appSettings.currentAccount]
}
else {
currentAccount = 0
notes.account = appSettings.accounts[0]
}
2018-10-21 02:44:23 +03:00
}
2018-10-16 18:50:58 +03:00
}
property var notes: NotesApi {
2018-10-16 18:50:58 +03:00
name: "notes"
2018-10-23 23:15:59 +03:00
//account: appSettings.accounts[appSettings.currentAccount]
2018-10-16 18:50:58 +03:00
saveFile: false
}
Connections {
target: notes
2018-10-23 23:15:59 +03:00
//onLastUpdateChanged: appSettings.lastUpdate = notes.lastUpdate
2018-10-16 18:50:58 +03:00
}
2018-10-21 02:44:23 +03:00
initialPage: Component { NotesPage { } }
2018-10-16 18:50:58 +03:00
cover: Qt.resolvedUrl("cover/CoverPage.qml")
allowedOrientations: defaultAllowedOrientations
}