Added options for monospaced font and capital X in checkboxes

This commit is contained in:
Scharel Clemens 2018-12-04 11:44:06 +01:00
parent 1396633e34
commit 30947fb251
5 changed files with 46 additions and 30 deletions

View file

@ -17,6 +17,8 @@ ApplicationWindow
property int previewLineCount: value("previewLineCount", 4)
property string sortBy: value("sortBy", "date")
property bool showSeparator: value("showSeparator", false)
property bool useMonoFont: value("useMonoFont", false)
property bool useCapitalX: value("useCapitalX", false)
}
ConfigurationValue {

View file

@ -51,6 +51,7 @@ Dialog {
width: parent.width
focus: true
text: note.content
font.family: appSettings.useMonoFont ? "DejaVu Sans Mono" : Theme.fontFamily // "Courier"
property int preTextLength: 0
property var listPrefixes: ["- ", "* ", "+ ", "- [ ] ", "- [x] ", "- [X] "]
onTextChanged: {

View file

@ -35,9 +35,6 @@ Dialog {
function parseContent() {
note = account.getNote(note.id, false)
//modifiedDetail.value = new Date(note.modified * 1000).toLocaleString(Qt.locale(), Locale.ShortFormat)
//favoriteDetail.value = note.favorite ? qsTr("yes") : qsTr("no")
//categoryDetail.value = note.category
var convertedText = converter.makeHtml(note.content)
var occurence = -1
convertedText = convertedText.replace(/^<li>\[ \] (.*)<\/li>$/gm,
@ -73,13 +70,11 @@ Dialog {
MenuItem {
text: qsTr("Delete")
enabled: account ? true : false
//visible: appSettings.currentAccount >= 0
onClicked: remorse.execute("Deleting", function() { account.deleteNote(notey.id) } )
}
MenuItem {
text: enabled ? qsTr("Reload") : qsTr("Updating...")
enabled: account ? !account.busy : false
//visible: appSettings.currentAccount >= 0
onClicked: account.getNote(note.id)
}
MenuLabel {
@ -117,7 +112,7 @@ Dialog {
function(match, p1, offset, string) {
occurence++
if (occurence === parseInt(link.split('_')[1])) {
return '- [x] ' + p1 }
return (appSettings.useCapitalX ? '- [X] ' : '- [x] ') + p1 }
else { return match }
} )
note.content = newContent

View file

@ -95,6 +95,34 @@ Page {
}
}
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]
}
SectionHeader {
text: qsTr("Appearance")
}
@ -140,31 +168,19 @@ Page {
}
SectionHeader {
text: qsTr("Synchronization")
text: qsTr("Editing")
}
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]
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
}
}

View file

@ -14,6 +14,8 @@
* Tue Dec 04 2018 Scharel Clemens <harbour-nextcloudnotes@scharel.name> 0.1-6
- Bugfix: Adding notes is possible again
- Added: Option for monospaced font
- Added: Option for capital X in checkboxes
* Tue Dec 04 2018 Scharel Clemens <harbour-nextcloudnotes@scharel.name> 0.1-5
- Implemented auto prepend for list elements