2018-10-22 23:53:14 +03:00
|
|
|
import QtQuick 2.0
|
|
|
|
import Sailfish.Silica 1.0
|
2018-11-15 00:13:47 +03:00
|
|
|
import Nemo.Configuration 1.0
|
2018-10-22 23:53:14 +03:00
|
|
|
|
|
|
|
Page {
|
|
|
|
id: page
|
|
|
|
|
|
|
|
SilicaFlickable {
|
|
|
|
id: flickable
|
|
|
|
anchors.fill: parent
|
|
|
|
contentHeight: column.height
|
|
|
|
|
2018-10-23 23:15:59 +03:00
|
|
|
PullDownMenu {
|
|
|
|
MenuItem {
|
|
|
|
text: qsTr("About")
|
|
|
|
onClicked: pageStack.push(Qt.resolvedUrl("AboutPage.qml"))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-22 23:53:14 +03:00
|
|
|
Column {
|
|
|
|
id: column
|
|
|
|
width: parent.width
|
|
|
|
spacing: Theme.paddingMedium
|
|
|
|
|
|
|
|
PageHeader {
|
|
|
|
title: qsTr("Settings")
|
|
|
|
}
|
|
|
|
|
|
|
|
SectionHeader {
|
|
|
|
text: qsTr("Accounts")
|
|
|
|
}
|
|
|
|
Label {
|
|
|
|
id: noAccountsLabel
|
2018-11-18 00:28:25 +03:00
|
|
|
visible: nextcloudAccounts.count <= 0
|
2018-10-22 23:53:14 +03:00
|
|
|
text: qsTr("No Nextcloud account yet")
|
2018-10-23 23:15:59 +03:00
|
|
|
font.pixelSize: Theme.fontSizeLarge
|
2018-10-22 23:53:14 +03:00
|
|
|
color: Theme.secondaryHighlightColor
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
}
|
|
|
|
Repeater {
|
2018-11-18 00:28:25 +03:00
|
|
|
model: nextcloudAccounts.count
|
2018-10-23 23:15:59 +03:00
|
|
|
delegate: ListItem {
|
2018-11-18 00:28:25 +03:00
|
|
|
id: accountListItem
|
2018-11-24 21:34:01 +03:00
|
|
|
contentHeight: accountTextSwitch.height
|
|
|
|
highlighted: accountTextSwitch.down
|
2018-11-15 00:13:47 +03:00
|
|
|
|
2018-10-23 23:15:59 +03:00
|
|
|
TextSwitch {
|
2018-11-24 21:34:01 +03:00
|
|
|
id: accountTextSwitch
|
2018-10-23 23:15:59 +03:00
|
|
|
automaticCheck: false
|
|
|
|
checked: index === appSettings.currentAccount
|
2018-11-18 00:28:25 +03:00
|
|
|
text: nextcloudAccounts.itemAt(index).name.length <= 0 ? qsTr("Unnamed account") : nextcloudAccounts.itemAt(index).name
|
|
|
|
description: nextcloudAccounts.itemAt(index).username + "@" + nextcloudAccounts.itemAt(index).server// : qsTr("Press and hold to configure")
|
|
|
|
onClicked: appSettings.currentAccount = index
|
|
|
|
onPressAndHold: openMenu()
|
2018-10-22 23:53:14 +03:00
|
|
|
}
|
2018-10-23 23:15:59 +03:00
|
|
|
menu: ContextMenu {
|
|
|
|
MenuItem {
|
2018-11-18 00:28:25 +03:00
|
|
|
text: qsTr("Edit")
|
2018-10-23 23:15:59 +03:00
|
|
|
onClicked: {
|
2018-11-18 00:28:25 +03:00
|
|
|
var login = pageStack.push(Qt.resolvedUrl("LoginDialog.qml"), { account: index })
|
2018-10-23 23:15:59 +03:00
|
|
|
login.accepted.connect(function() {
|
2018-11-15 00:13:47 +03:00
|
|
|
})
|
|
|
|
login.rejected.connect(function() {
|
2018-10-23 23:15:59 +03:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
2018-11-18 00:28:25 +03:00
|
|
|
MenuItem {
|
|
|
|
visible: index === nextcloudAccounts.count-1
|
2018-10-23 23:15:59 +03:00
|
|
|
text: qsTr("Delete")
|
2018-11-15 00:13:47 +03:00
|
|
|
onClicked: {
|
2018-11-18 00:28:25 +03:00
|
|
|
accountListItem.remorseAction(qsTr("Deleting account"), function() {
|
|
|
|
nextcloudAccounts.itemAt(index).clear()
|
|
|
|
nextcloudAccounts.pop()
|
|
|
|
})
|
2018-11-15 00:13:47 +03:00
|
|
|
}
|
2018-11-18 00:28:25 +03:00
|
|
|
}
|
2018-10-22 23:53:14 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Button {
|
|
|
|
text: qsTr("Add account")
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
onClicked: {
|
2018-11-18 00:28:25 +03:00
|
|
|
nextcloudAccounts.add()
|
|
|
|
var login = pageStack.push(Qt.resolvedUrl("LoginDialog.qml"), { account:nextcloudAccounts.count-1 })
|
2018-10-22 23:53:14 +03:00
|
|
|
login.accepted.connect(function() {
|
2018-11-18 00:28:25 +03:00
|
|
|
console.log("Adding account " + nextcloudAccounts.itemAt(login.account).name)
|
|
|
|
if (appSettings.currentAccount < 0)
|
|
|
|
appSettings.currentAccount = nextcloudUUIDs.value.length-1
|
|
|
|
appWindow.update()
|
2018-11-15 00:13:47 +03:00
|
|
|
})
|
|
|
|
login.rejected.connect(function() {
|
2018-11-18 00:28:25 +03:00
|
|
|
nextcloudAccounts.pop()
|
2018-10-22 23:53:14 +03:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
2018-11-24 21:34:01 +03:00
|
|
|
|
2018-12-04 13:44:06 +03:00
|
|
|
SectionHeader {
|
|
|
|
text: qsTr("Synchronization")
|
|
|
|
}
|
|
|
|
ComboBox {
|
|
|
|
id: autoSyncComboBox
|
|
|
|
label: qsTr("Auto-Sync")
|
|
|
|
description: qsTr("Periodically pull notes from the server")
|
|
|
|
menu: ContextMenu {
|
|
|
|
Repeater {
|
|
|
|
id: autoSyncIntervalRepeater
|
|
|
|
model: [0, 3, 5, 10, 20, 30, 60, 120, 300, 600]
|
|
|
|
MenuItem {
|
|
|
|
text: modelData === 0 ?
|
|
|
|
qsTr("Disabled") : (qsTr("every") + " " +
|
|
|
|
(parseInt(modelData / 60) ?
|
|
|
|
(parseInt(modelData / 60) + " " + qsTr("Minutes")) :
|
|
|
|
(modelData + " " + qsTr("Seconds"))))
|
|
|
|
Component.onCompleted: {
|
|
|
|
if (modelData === appSettings.autoSyncInterval) {
|
|
|
|
autoSyncComboBox.currentIndex = index
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
onCurrentIndexChanged: appSettings.autoSyncInterval = autoSyncIntervalRepeater.model[currentIndex]
|
|
|
|
}
|
|
|
|
|
2018-11-24 21:34:01 +03:00
|
|
|
SectionHeader {
|
|
|
|
text: qsTr("Appearance")
|
|
|
|
}
|
|
|
|
ComboBox {
|
2018-11-25 16:08:00 +03:00
|
|
|
id: sortByComboBox
|
2018-11-25 22:39:03 +03:00
|
|
|
property var names: [qsTr("Date"), qsTr("Category"), qsTr("Title alphabetically")]
|
|
|
|
label: qsTr("Sort notes by")
|
|
|
|
description: qsTr("This will also change how the notes are segmented")
|
2018-11-24 21:34:01 +03:00
|
|
|
menu: ContextMenu {
|
|
|
|
Repeater {
|
2018-11-25 16:08:00 +03:00
|
|
|
id: sortByRepeater
|
|
|
|
model: ["date", "category", "title"]
|
2018-11-24 21:34:01 +03:00
|
|
|
MenuItem {
|
2018-11-25 16:08:00 +03:00
|
|
|
text: sortByComboBox.names[index]
|
|
|
|
//enabled: modelData !== "title"
|
2018-11-24 21:34:01 +03:00
|
|
|
Component.onCompleted: {
|
2018-11-25 16:08:00 +03:00
|
|
|
if (modelData === appSettings.sortBy) {
|
|
|
|
sortByComboBox.currentIndex = index
|
2018-11-24 21:34:01 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
onCurrentIndexChanged: {
|
2018-11-25 16:08:00 +03:00
|
|
|
appSettings.sortBy = sortByRepeater.model[currentIndex]
|
2018-11-24 21:34:01 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
TextSwitch {
|
|
|
|
text: qsTr("Show separator")
|
|
|
|
description: qsTr("Show a separator line between the notes")
|
|
|
|
checked: appSettings.showSeparator
|
|
|
|
onCheckedChanged: appSettings.showSeparator = checked
|
|
|
|
}
|
|
|
|
Slider {
|
|
|
|
width: parent.width
|
|
|
|
minimumValue: 0
|
|
|
|
maximumValue: 20
|
|
|
|
stepSize: 1
|
|
|
|
value: appSettings.previewLineCount
|
|
|
|
valueText: sliderValue + " " + qsTr("lines")
|
|
|
|
label: qsTr("Number of lines to preview in the list view")
|
|
|
|
onSliderValueChanged: appSettings.previewLineCount = sliderValue
|
|
|
|
}
|
|
|
|
|
|
|
|
SectionHeader {
|
2018-12-04 13:44:06 +03:00
|
|
|
text: qsTr("Editing")
|
2018-11-24 21:34:01 +03:00
|
|
|
}
|
2018-12-04 13:44:06 +03:00
|
|
|
TextSwitch {
|
|
|
|
text: qsTr("Use monospaced font")
|
|
|
|
description: qsTr("Use a monospeced font to edit a note")
|
|
|
|
checked: appSettings.useMonoFont
|
|
|
|
onCheckedChanged: appSettings.useMonoFont = checked
|
|
|
|
}
|
|
|
|
TextSwitch {
|
|
|
|
text: qsTr("Use capital 'X' in checkboxes")
|
|
|
|
description: qsTr("For compatibility with other apps such as Joplin")
|
|
|
|
checked: appSettings.useCapitalX
|
|
|
|
onCheckedChanged: appSettings.useCapitalX = checked
|
2018-11-24 21:34:01 +03:00
|
|
|
}
|
2018-10-22 23:53:14 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
VerticalScrollDecorator {}
|
|
|
|
}
|
|
|
|
}
|