From 30947fb251a4335c53f50a0a75e3798066d771e1 Mon Sep 17 00:00:00 2001 From: Scharel Clemens Date: Tue, 4 Dec 2018 11:44:06 +0100 Subject: [PATCH] Added options for monospaced font and capital X in checkboxes --- qml/harbour-nextcloudnotes.qml | 2 + qml/pages/EditPage.qml | 1 + qml/pages/NotePage.qml | 7 +--- qml/pages/SettingsPage.qml | 64 +++++++++++++++++++----------- rpm/harbour-nextcloudnotes.changes | 2 + 5 files changed, 46 insertions(+), 30 deletions(-) diff --git a/qml/harbour-nextcloudnotes.qml b/qml/harbour-nextcloudnotes.qml index 16bdd51..28d0b4d 100644 --- a/qml/harbour-nextcloudnotes.qml +++ b/qml/harbour-nextcloudnotes.qml @@ -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 { diff --git a/qml/pages/EditPage.qml b/qml/pages/EditPage.qml index 30c28e2..9c53f15 100644 --- a/qml/pages/EditPage.qml +++ b/qml/pages/EditPage.qml @@ -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: { diff --git a/qml/pages/NotePage.qml b/qml/pages/NotePage.qml index b7cdad9..8f66bc9 100644 --- a/qml/pages/NotePage.qml +++ b/qml/pages/NotePage.qml @@ -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>$/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 diff --git a/qml/pages/SettingsPage.qml b/qml/pages/SettingsPage.qml index a1cab6d..f940056 100644 --- a/qml/pages/SettingsPage.qml +++ b/qml/pages/SettingsPage.qml @@ -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 } } diff --git a/rpm/harbour-nextcloudnotes.changes b/rpm/harbour-nextcloudnotes.changes index 82ad54b..8b37032 100644 --- a/rpm/harbour-nextcloudnotes.changes +++ b/rpm/harbour-nextcloudnotes.changes @@ -14,6 +14,8 @@ * Tue Dec 04 2018 Scharel Clemens 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 0.1-5 - Implemented auto prepend for list elements