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
|
2018-10-17 00:52:28 +03:00
|
|
|
path: "/apps/harbour-nextcloudnotes/settings"
|
2018-11-24 21:34:01 +03:00
|
|
|
//synchronous: true
|
2018-11-15 00:13:47 +03:00
|
|
|
|
|
|
|
property int currentAccount: value("currentAccount", -1)
|
2018-11-24 21:34:01 +03:00
|
|
|
property int autoSyncInterval: value("autoSyncInterval", 0)
|
|
|
|
property int previewLineCount: value("previewLineCount", 4)
|
2018-11-25 16:08:00 +03:00
|
|
|
property string sortBy: value("sortBy", "date")
|
2018-11-24 21:34:01 +03:00
|
|
|
property bool showSeparator: value("showSeparator", false)
|
2018-12-04 13:44:06 +03:00
|
|
|
property bool useMonoFont: value("useMonoFont", false)
|
|
|
|
property bool useCapitalX: value("useCapitalX", false)
|
2018-11-15 00:13:47 +03:00
|
|
|
}
|
|
|
|
|
2018-11-18 00:28:25 +03:00
|
|
|
ConfigurationValue {
|
|
|
|
id: nextcloudUUIDs
|
|
|
|
key: "/apps/harbour-nextcloudnotes/settings/accountIDs"
|
|
|
|
defaultValue: []
|
|
|
|
onValueChanged: {
|
|
|
|
nextcloudAccounts.model = value
|
2018-10-21 02:44:23 +03:00
|
|
|
}
|
2018-11-18 00:28:25 +03:00
|
|
|
Component.onCompleted: nextcloudAccounts.model = value
|
|
|
|
}
|
2018-11-15 00:13:47 +03:00
|
|
|
|
2018-11-18 00:28:25 +03:00
|
|
|
Repeater {
|
|
|
|
id: nextcloudAccounts
|
2018-11-30 17:12:16 +03:00
|
|
|
delegate: NotesApi {
|
|
|
|
uuid: nextcloudUUIDs.value[index]
|
2018-11-30 20:40:03 +03:00
|
|
|
saveFile: true
|
2018-11-30 17:12:16 +03:00
|
|
|
}
|
2018-11-15 00:13:47 +03:00
|
|
|
function add() {
|
2018-11-18 00:28:25 +03:00
|
|
|
push(uuidv4())
|
|
|
|
}
|
2018-12-04 18:31:28 +03:00
|
|
|
function remove(uuid) {
|
|
|
|
for (var i = 0; i < count; i++) {
|
|
|
|
if (itemAt(i).uuid === uuid) {
|
|
|
|
itemAt(i).clear()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var newIds = [ ]
|
|
|
|
nextcloudUUIDs.value.forEach(function(currentValue) {
|
|
|
|
if (currentValue !== uuid) {
|
|
|
|
newIds.push(currentValue)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
nextcloudUUIDs.value = newIds
|
|
|
|
}
|
2018-11-18 00:28:25 +03:00
|
|
|
function push(uuid) {
|
|
|
|
var accountIDs = nextcloudUUIDs.value
|
|
|
|
accountIDs.push(uuid)
|
|
|
|
nextcloudUUIDs.value = accountIDs
|
|
|
|
}
|
|
|
|
function pop() {
|
|
|
|
var accountIDs = nextcloudUUIDs.value
|
|
|
|
accountIDs.pop()
|
|
|
|
nextcloudUUIDs.value = accountIDs
|
2018-11-15 00:13:47 +03:00
|
|
|
}
|
2018-10-16 18:50:58 +03:00
|
|
|
}
|
|
|
|
|
2018-11-18 00:28:25 +03:00
|
|
|
function uuidv4() {
|
|
|
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
|
|
|
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
|
|
|
|
return v.toString(16);
|
|
|
|
});
|
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
|
|
|
|
}
|