Implemented auto prepend for list elements.

This commit is contained in:
Scharel Clemens 2018-12-04 00:46:04 +01:00
parent a8d1b64251
commit d2449f7591
4 changed files with 25 additions and 10 deletions

View file

@ -15,6 +15,7 @@ Dialog {
onStatusChanged: { onStatusChanged: {
if (status === PageStatus.Active) { if (status === PageStatus.Active) {
note = account.getNote(note.id, false) note = account.getNote(note.id, false)
favoriteButton.selected = note.favorite
} }
} }
@ -29,9 +30,6 @@ Dialog {
onClicked: { onClicked: {
note = account.getNote(note.id, false) note = account.getNote(note.id, false)
favoriteButton.selected = note.favorite favoriteButton.selected = note.favorite
//categoryField.text = note.category
//contentArea.text = note.content
//favoriteButton.selected = note.favorite
} }
} }
MenuItem { MenuItem {
@ -53,12 +51,26 @@ Dialog {
width: parent.width width: parent.width
focus: true focus: true
text: note.content text: note.content
property int preTextLength: 0
property var listPrefixes: ["- ", "* ", "+ ", "- [ ] ", "- [x] ", "- [X] "]
onTextChanged: { onTextChanged: {
// TODO Autocomplete list symbols if (page.status === PageStatus.Active &&
/*var preText = text.substring(0, cursorPosition) text.length > preTextLength &&
preText = preText.substring(preText.lastIndexOf('\n')) text.charAt(cursorPosition-1) === "\n") {
console.log(preText) var clipboard = ""
console.log(text.substring(cursorPosition))*/ var preLine = text.substring(text.lastIndexOf("\n", cursorPosition-2), text.indexOf("\n", cursorPosition-1))
listPrefixes.forEach(function(currentValue) {
if (preLine.indexOf(currentValue) === 1)
clipboard = currentValue
})
if (clipboard !== "") {
var tmpClipboard = Clipboard.text
Clipboard.text = clipboard
contentArea.paste()
Clipboard.text = tmpClipboard
}
}
preTextLength = text.length
} }
} }

View file

@ -12,6 +12,9 @@
# * date Author's Name <author's email> version-release # * date Author's Name <author's email> version-release
# - Summary of changes # - Summary of changes
* Tue Dec 04 2018 Scharel Clemens <harbour-nextcloudnotes@scharel.name> 0.1-5
- Implemented auto prepend for list elements
* Mon Dec 03 2018 Scharel Clemens <harbour-nextcloudnotes@scharel.name> 0.1-4 * Mon Dec 03 2018 Scharel Clemens <harbour-nextcloudnotes@scharel.name> 0.1-4
- Implemented searching - Implemented searching
- Larger checkboxes - Larger checkboxes

View file

@ -14,7 +14,7 @@ Name: harbour-nextcloudnotes
%{?qtc_builddir:%define _builddir %qtc_builddir} %{?qtc_builddir:%define _builddir %qtc_builddir}
Summary: Nextcloud Notes Summary: Nextcloud Notes
Version: 0.1 Version: 0.1
Release: 4 Release: 5
Group: Qt/Qt Group: Qt/Qt
License: LICENSE License: LICENSE
URL: http://example.org/ URL: http://example.org/

View file

@ -1,7 +1,7 @@
Name: harbour-nextcloudnotes Name: harbour-nextcloudnotes
Summary: Nextcloud Notes Summary: Nextcloud Notes
Version: 0.1 Version: 0.1
Release: 4 Release: 5
# The contents of the Group field should be one of the groups listed here: # The contents of the Group field should be one of the groups listed here:
# https://github.com/mer-tools/spectacle/blob/master/data/GROUPS # https://github.com/mer-tools/spectacle/blob/master/data/GROUPS
Group: Qt/Qt Group: Qt/Qt