Changed #34: Do not underline lines with tick boxes. Began implementing #18: Page with Markdown syntax

This commit is contained in:
Scharel 2018-12-11 13:34:17 +01:00
parent 413d3e3486
commit a01fe96830
7 changed files with 116 additions and 61 deletions

View file

@ -1,53 +1,54 @@
# NOTICE: # NOTICE:
# #
# Application name defined in TARGET has a corresponding QML filename. # Application name defined in TARGET has a corresponding QML filename.
# If name defined in TARGET is changed, the following needs to be done # If name defined in TARGET is changed, the following needs to be done
# to match new name: # to match new name:
# - corresponding QML filename must be changed # - corresponding QML filename must be changed
# - desktop icon filename must be changed # - desktop icon filename must be changed
# - desktop filename must be changed # - desktop filename must be changed
# - icon definition filename in desktop file must be changed # - icon definition filename in desktop file must be changed
# - translation filenames have to be changed # - translation filenames have to be changed
# The name of your application # The name of your application
TARGET = harbour-nextcloudnotes TARGET = harbour-nextcloudnotes
CONFIG += sailfishapp CONFIG += sailfishapp
DEFINES += APP_VERSION=\\\"$$VERSION\\\" DEFINES += APP_VERSION=\\\"$$VERSION\\\"
SOURCES += src/harbour-nextcloudnotes.cpp SOURCES += src/harbour-nextcloudnotes.cpp
DISTFILES += qml/harbour-nextcloudnotes.qml \ DISTFILES += qml/harbour-nextcloudnotes.qml \
qml/cover/CoverPage.qml \ qml/cover/CoverPage.qml \
rpm/harbour-nextcloudnotes.changes.run.in \ rpm/harbour-nextcloudnotes.changes.run.in \
rpm/harbour-nextcloudnotes.changes \ rpm/harbour-nextcloudnotes.changes \
rpm/harbour-nextcloudnotes.spec \ rpm/harbour-nextcloudnotes.spec \
rpm/harbour-nextcloudnotes.yaml \ rpm/harbour-nextcloudnotes.yaml \
translations/*.ts \ translations/*.ts \
harbour-nextcloudnotes.desktop \ harbour-nextcloudnotes.desktop \
qml/pages/NotePage.qml \ qml/pages/NotePage.qml \
qml/pages/NotesPage.qml \ qml/pages/NotesPage.qml \
qml/pages/LoginDialog.qml \ qml/pages/LoginDialog.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/UnencryptedDialog.qml \ qml/pages/UnencryptedDialog.qml \
qml/pages/NotesApi.qml \ qml/pages/NotesApi.qml \
qml/pages/MITLicense.qml \ qml/pages/MITLicense.qml \
qml/pages/GPLLicense.qml qml/pages/GPLLicense.qml \
qml/pages/SyntaxPage.qml
SAILFISHAPP_ICONS = 86x86 108x108 128x128 172x172
SAILFISHAPP_ICONS = 86x86 108x108 128x128 172x172
# to disable building translations every time, comment out the
# following CONFIG line # to disable building translations every time, comment out the
CONFIG += sailfishapp_i18n # following CONFIG line
CONFIG += sailfishapp_i18n
# German translation is enabled as an example. If you aren't
# planning to localize your app, remember to comment out the # German translation is enabled as an example. If you aren't
# following TRANSLATIONS line. And also do not forget to # planning to localize your app, remember to comment out the
# modify the localized app name in the the .desktop file. # following TRANSLATIONS line. And also do not forget to
TRANSLATIONS += translations/harbour-nextcloudnotes-de.ts \ # modify the localized app name in the the .desktop file.
translations/harbour-nextcloudnotes-sv.ts TRANSLATIONS += translations/harbour-nextcloudnotes-de.ts \
translations/harbour-nextcloudnotes-sv.ts
HEADERS +=
HEADERS +=

View file

@ -33,7 +33,7 @@ Dialog {
} }
MenuItem { MenuItem {
text: qsTr("Markdown syntax") text: qsTr("Markdown syntax")
onClicked: Qt.openUrlExternally("https://github.com/showdownjs/showdown/wiki/Showdown's-Markdown-syntax") onClicked: pageStack.push(Qt.resolvedUrl("SyntaxPage.qml")) //Qt.openUrlExternally("https://github.com/showdownjs/showdown/wiki/Showdown's-Markdown-syntax")
} }
} }

View file

@ -47,20 +47,23 @@ Dialog {
convertedText = convertedText.replace(/^<li>(<p>)?\[ \] (.*)(<.*)$/gmi, convertedText = convertedText.replace(/^<li>(<p>)?\[ \] (.*)(<.*)$/gmi,
function(match, p1, p2, p3, offset) { function(match, p1, p2, p3, offset) {
occurence++ occurence++
return '<li class="tasklist"><a href="tasklist:checkbox_' + occurence + '">' + (p1 ? p1 : "") + '☐ ' + p2 + '</a>' + p3 return '<li class="tasklist"><a class="checkbox" href="tasklist:checkbox_' + occurence + '">' + (p1 ? p1 : "") + '☐ ' + p2 + '</a>' + p3
} ) } )
occurence = -1 occurence = -1
convertedText = convertedText.replace(/^<li>(<p>)?\[[xX]\] (.*)(<.*)$/gmi, convertedText = convertedText.replace(/^<li>(<p>)?\[[xX]\] (.*)(<.*)$/gmi,
function(match, p1, p2, p3, offset) { function(match, p1, p2, p3, offset) {
occurence++ occurence++
return '<li class="tasklist"><a href="tasklist:uncheckbox_' + occurence + '">' + (p1 ? p1 : "") + '☑ ' + p2 + '</a>' + p3 return '<li class="tasklist"><a class="checkbox" href="tasklist:uncheckbox_' + occurence + '">' + (p1 ? p1 : "") + '☑ ' + p2 + '</a>' + p3
} ) } )
convertedText = convertedText.replace("<table>", "<table border='1' cellpadding='" + Theme.paddingMedium + "'>") convertedText = convertedText.replace("<table>", "<table border='1' cellpadding='" + Theme.paddingMedium + "'>")
contentLabel.text = "<style>ul,ol,table,img { margin-bottom: " + Theme.paddingLarge + "px; margin-top: " + Theme.paddingLarge + "px; }\n" + contentLabel.text = "<style>\n" +
"ul,ol,table,img { margin: " + Theme.paddingLarge + "px 0px; }\n" +
"a:link { color: " + Theme.primaryColor + "; }\n" + "a:link { color: " + Theme.primaryColor + "; }\n" +
"li.tasklist { font-size:large; margin-bottom: " + Theme.paddingMedium + "px; margin-top: " + Theme.paddingMedium + "px; }\n" + "a.checkbox { text-decoration: none; padding: " + Theme.paddingSmall + "px; display: inline-block; }\n" +
"li.tasklist { font-size:large; margin: " + Theme.paddingMedium + "px 0px; }\n" +
"del { text-decoration: line-through; }\n" + "del { text-decoration: line-through; }\n" +
"table { border-color: " + Theme.secondaryColor + "; }</style>" + convertedText "table { border-color: " + Theme.secondaryColor + "; }\n" +
"</style>\n" + convertedText
//console.log(contentLabel.text) //console.log(contentLabel.text)
} }

47
qml/pages/SyntaxPage.qml Normal file
View file

@ -0,0 +1,47 @@
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
PageHeader {
title: qsTr("Markdown Syntax")
}
SectionHeader {
text: qsTr("Header")
}
Drawer {
id: headerDrawer
width: parent.width
background: LinkedLabel {
x: Theme.horizontalPageMargin
width: parent.width - 2*x
textFormat: Text.RichText
linkColor: Theme.primaryColor
text: "Formatted Text"
}
BackgroundItem {
anchors.fill: parent
onClicked: headerDrawer.open = !headerDrawer.open
Label {
text: "Raw Text"
}
}
}
}
VerticalScrollDecorator {}
}
allowedOrientations: defaultAllowedOrientations
}

View file

@ -12,6 +12,10 @@
# * date Author's Name <author's email> version-release # * date Author's Name <author's email> version-release
# - Summary of changes # - Summary of changes
* Mon Dec 11 2018 Scharel Clemens <harbour-nextcloudnotes@scharel.name> 0.2-6
- Changed #34: "Do not underline lines with tick boxes"
- Began implementing #18: Page with Markdown syntax
* Mon Dec 11 2018 Scharel Clemens <harbour-nextcloudnotes@scharel.name> 0.2-5 * Mon Dec 11 2018 Scharel Clemens <harbour-nextcloudnotes@scharel.name> 0.2-5
- Fixed an issue that prevented to edit accounts - Fixed an issue that prevented to edit accounts

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.2 Version: 0.2
Release: 5 Release: 6
Group: Applications/Editors Group: Applications/Editors
License: MIT License: MIT
URL: https://github.com/scharel/harbour-nextcloudnotes URL: https://github.com/scharel/harbour-nextcloudnotes

View file

@ -1,7 +1,7 @@
Name: harbour-nextcloudnotes Name: harbour-nextcloudnotes
Summary: Nextcloud Notes Summary: Nextcloud Notes
Version: 0.2 Version: 0.2
Release: 5 Release: 6
# 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: Applications/Editors Group: Applications/Editors