Implemented checkboxes
This commit is contained in:
parent
21aa7211ca
commit
af18cc77d2
9 changed files with 71 additions and 55 deletions
|
@ -31,7 +31,6 @@ DISTFILES += qml/harbour-nextcloudnotes.qml \
|
||||||
qml/pages/EditPage.qml \
|
qml/pages/EditPage.qml \
|
||||||
qml/pages/SettingsPage.qml \
|
qml/pages/SettingsPage.qml \
|
||||||
qml/pages/AboutPage.qml \
|
qml/pages/AboutPage.qml \
|
||||||
qml/pages/MarkdownPage.qml \
|
|
||||||
qml/pages/UnencryptedDialog.qml \
|
qml/pages/UnencryptedDialog.qml \
|
||||||
qml/pages/NotesApi.qml \
|
qml/pages/NotesApi.qml \
|
||||||
rpm/harbour-nextcloudnotes.changes \
|
rpm/harbour-nextcloudnotes.changes \
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import Sailfish.Silica 1.0
|
import Sailfish.Silica 1.0
|
||||||
|
import Nemo.Notifications 1.0
|
||||||
|
|
||||||
Dialog {
|
Dialog {
|
||||||
id: page
|
id: page
|
||||||
|
@ -17,10 +18,6 @@ Dialog {
|
||||||
contentHeight: column.height
|
contentHeight: column.height
|
||||||
|
|
||||||
PullDownMenu {
|
PullDownMenu {
|
||||||
/*MenuItem {
|
|
||||||
text: qsTr("Markdown Cheatsheet")
|
|
||||||
onClicked: pageStack.push(Qt.resolvedUrl("MarkdownPage.qml"))
|
|
||||||
}*/
|
|
||||||
MenuItem {
|
MenuItem {
|
||||||
text: qsTr("Reset")
|
text: qsTr("Reset")
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
@ -29,6 +26,10 @@ Dialog {
|
||||||
favoriteButton.selected = account.model.get(noteIndex).favorite
|
favoriteButton.selected = account.model.get(noteIndex).favorite
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
MenuItem {
|
||||||
|
text: qsTr("Markdown syntax")
|
||||||
|
onClicked: Qt.openUrlExternally("https://github.com/showdownjs/showdown/wiki/Showdown's-Markdown-syntax")//pageStack.push(Qt.resolvedUrl("MarkdownPage.qml"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
|
@ -42,6 +43,7 @@ Dialog {
|
||||||
TextArea {
|
TextArea {
|
||||||
id: contentArea
|
id: contentArea
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
focus: true
|
||||||
text: account.model.get(noteIndex).content
|
text: account.model.get(noteIndex).content
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,9 +17,10 @@ Page {
|
||||||
title: qsTr("MIT License")
|
title: qsTr("MIT License")
|
||||||
}
|
}
|
||||||
|
|
||||||
LinkedLabel {
|
Label {
|
||||||
x: Theme.horizontalPageMargin
|
x: Theme.horizontalPageMargin
|
||||||
width: parent.width - 2*x
|
width: parent.width - 2*x
|
||||||
|
wrapMode: Text.Wrap
|
||||||
text: "<p>Copyright (c) 2018 Scharel Clemens</p>
|
text: "<p>Copyright (c) 2018 Scharel Clemens</p>
|
||||||
|
|
||||||
<p>Permission is hereby granted, free of charge, to any person obtaining a copy
|
<p>Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
import QtQuick 2.0
|
|
||||||
import Sailfish.Silica 1.0
|
|
||||||
|
|
||||||
Page {
|
|
||||||
id: page
|
|
||||||
|
|
||||||
SilicaFlickable {
|
|
||||||
id: flickable
|
|
||||||
anchors.fill: parent
|
|
||||||
contentHeight: column.height
|
|
||||||
|
|
||||||
Column {
|
|
||||||
id: column
|
|
||||||
width: parent.width
|
|
||||||
spacing: Theme.paddingMedium
|
|
||||||
|
|
||||||
PageHeader {
|
|
||||||
title: qsTr("Markdown Cheatsheet")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
VerticalScrollDecorator {}
|
|
||||||
}
|
|
||||||
|
|
||||||
ViewPlaceholder {
|
|
||||||
enabled: true // TODO
|
|
||||||
text: qsTr("Markdown Cheatsheet")
|
|
||||||
hintText: qsTr("https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet")
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -8,7 +8,20 @@ Dialog {
|
||||||
property var converter: new showdown.Converter( { noHeaderId: true, simplifiedAutoLink: true, tables: true, tasklists: false, simpleLineBreaks: true, emoji: true } )
|
property var converter: new showdown.Converter( { noHeaderId: true, simplifiedAutoLink: true, tables: true, tasklists: false, simpleLineBreaks: true, emoji: true } )
|
||||||
|
|
||||||
function reloadContent() {
|
function reloadContent() {
|
||||||
contentLabel.text = converter.makeHtml(account.model.get(noteIndex).content)
|
var convertedText = converter.makeHtml(account.model.get(noteIndex).content)
|
||||||
|
var occurence = -1
|
||||||
|
convertedText = convertedText.replace(/^<li>\[ \]\s(.*)<\/li>$/gm,
|
||||||
|
function(match, p1, offset) {
|
||||||
|
occurence++
|
||||||
|
return '<li><a href="tasklist:checkbox_' + occurence + '">☐ ' + p1 + '</a></li>'
|
||||||
|
} )
|
||||||
|
occurence = -1
|
||||||
|
convertedText = convertedText.replace(/^<li>\[x\]\s(.*)<\/li>$/gm,
|
||||||
|
function(match, p1, offset) {
|
||||||
|
occurence++
|
||||||
|
return '<li><a href="tasklist:uncheckbox_' + occurence + '">☑ ' + p1 + '</a></li>'
|
||||||
|
} )
|
||||||
|
contentLabel.text = convertedText
|
||||||
//console.log(contentLabel.text)
|
//console.log(contentLabel.text)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,6 +94,7 @@ Dialog {
|
||||||
|
|
||||||
DialogHeader {
|
DialogHeader {
|
||||||
id: dialogHeader
|
id: dialogHeader
|
||||||
|
dialog: noteDialog
|
||||||
acceptText: qsTr("Edit")
|
acceptText: qsTr("Edit")
|
||||||
cancelText: qsTr("Notes")
|
cancelText: qsTr("Notes")
|
||||||
}
|
}
|
||||||
|
@ -94,7 +108,40 @@ Dialog {
|
||||||
x: Theme.horizontalPageMargin
|
x: Theme.horizontalPageMargin
|
||||||
width: parent.width - 2*x
|
width: parent.width - 2*x
|
||||||
textFormat: Text.StyledText
|
textFormat: Text.StyledText
|
||||||
defaultLinkActions: true
|
defaultLinkActions: false
|
||||||
|
onLinkActivated: {
|
||||||
|
var occurence = -1
|
||||||
|
var newContent = account.model.get(noteIndex).content
|
||||||
|
if (/^tasklist:checkbox_(\d+)$/m.test(link)) {
|
||||||
|
newContent = newContent.replace(/^- \[ \]\s(.*)$/gm,
|
||||||
|
function(match, p1, offset, string) {
|
||||||
|
occurence++
|
||||||
|
if (occurence === parseInt(link.split('_')[1])) {
|
||||||
|
return '- [x] ' + p1
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return match
|
||||||
|
}
|
||||||
|
} )
|
||||||
|
account.updateNote(account.model.get(noteIndex).id, { 'content': newContent } )
|
||||||
|
}
|
||||||
|
else if (/^tasklist:uncheckbox_(\d+)$/m.test(link)) {
|
||||||
|
newContent = newContent.replace(/^- \[x\]\s(.*)$/gm,
|
||||||
|
function(match, p1, offset, string) {
|
||||||
|
occurence++
|
||||||
|
if (occurence === parseInt(link.split('_')[1])) {
|
||||||
|
return '- [ ] ' + p1
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return match
|
||||||
|
}
|
||||||
|
} )
|
||||||
|
account.updateNote(account.model.get(noteIndex).id, { 'content': newContent } )
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Qt.openUrlExternally(link)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Separator {
|
Separator {
|
||||||
|
|
|
@ -12,6 +12,14 @@
|
||||||
# * date Author's Name <author's email> version-release
|
# * date Author's Name <author's email> version-release
|
||||||
# - Summary of changes
|
# - Summary of changes
|
||||||
|
|
||||||
|
* Wed Nov 28 2018 Scharel Clemens <harbour-nextcloudnotes@scharel.name> 0.1-3
|
||||||
|
- Implemented checkboxes
|
||||||
|
- Link to external website containing the markdown syntax
|
||||||
|
|
||||||
|
* Tue Nov 27 2018 Scharel Clemens <harbour-nextcloudnotes@scharel.name> 0.1-2
|
||||||
|
- Improved "About" Page and included copies of the MIT and GPL licenses
|
||||||
|
- Automated version handling (based no yaml)
|
||||||
|
|
||||||
* Tue Nov 27 2018 Scharel Clemens <harbour-nextcloudnotes@scharel.name> 0.1-1
|
* Tue Nov 27 2018 Scharel Clemens <harbour-nextcloudnotes@scharel.name> 0.1-1
|
||||||
- List all notes of an account
|
- List all notes of an account
|
||||||
- Show the content of the notes
|
- Show the content of the notes
|
||||||
|
@ -22,7 +30,3 @@
|
||||||
- Edit category property
|
- Edit category property
|
||||||
- Markdown rendering powered by ShowdownJS
|
- Markdown rendering powered by ShowdownJS
|
||||||
- Multiple Nextcloud accounts
|
- Multiple Nextcloud accounts
|
||||||
|
|
||||||
* Tue Nov 27 2018 Scharel Clemens <harbour-nextcloudnotes@scharel.name> 0.1-2
|
|
||||||
- Improved "About" Page and included copies of the MIT and GPL licenses
|
|
||||||
- Automated version handling (based no yaml)
|
|
||||||
|
|
|
@ -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: 2
|
Release: 3
|
||||||
Group: Qt/Qt
|
Group: Qt/Qt
|
||||||
License: LICENSE
|
License: LICENSE
|
||||||
URL: http://example.org/
|
URL: http://example.org/
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Name: harbour-nextcloudnotes
|
Name: harbour-nextcloudnotes
|
||||||
Summary: Nextcloud Notes
|
Summary: Nextcloud Notes
|
||||||
Version: 0.1
|
Version: 0.1
|
||||||
Release: 2
|
Release: 3
|
||||||
# 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
|
||||||
|
|
|
@ -53,6 +53,10 @@
|
||||||
<source>Reset</source>
|
<source>Reset</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Markdown syntax</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>GPLLicense</name>
|
<name>GPLLicense</name>
|
||||||
|
@ -107,17 +111,6 @@
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
|
||||||
<name>MarkdownPage</name>
|
|
||||||
<message>
|
|
||||||
<source>Markdown Cheatsheet</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
</context>
|
|
||||||
<context>
|
<context>
|
||||||
<name>NotePage</name>
|
<name>NotePage</name>
|
||||||
<message>
|
<message>
|
||||||
|
|
Loading…
Reference in a new issue