0.3.0: ricerca nel testo, caselle di spunta toccabili, tag

- Ricerca nel testo: la cartella viene percorsa ricorsivamente e le note .md
  scaricate una alla volta (il WebDAV non cerca nel contenuto), con avanzamento,
  possibilità di fermare e il passaggio che contiene la parola. La ricerca per
  titolo nella lista resta istantanea.
- Caselle di spunta: "- [ ]" e "- [x]" diventano caselle toccabili
  nell'anteprima; il tocco riscrive quella sola riga e salva subito, e l'editor
  segue (senza, uscendo riscriverebbe la versione vecchia sul server).
- Tag: front-matter (tags: [a, b], lista a trattini o separata da virgole) e
  #tag nel testo; pastiglie in cima all'anteprima, #tag toccabili, nuova
  schermata Tag con il conteggio per tag. Il blocco front-matter non viene più
  stampato come testo.
- tests/qml_contract_check.py: confronta i nomi JS e le proprietà usati dalla
  QML con i sorgenti, le pagine raggiungibili e i parametri dei gestori dei
  segnali — la classe di errori che la compilazione non vede.
- Catalogo italiano aggiornato (25 stringhe nuove); repo ripulito dai residui di
  build e .gitignore esteso.
This commit is contained in:
kaneda committed 2026-11-08 20:55:22 +01:00
1 parent aab29c76cb
commit 8259297a27
15 files changed
+1280 -64

No files matched your search

+7
View File
@@ -5,3 +5,10 @@ build-*/
Makefile
.qmake.stash
*.qm
# Residui di una build fatta nella cartella dei sorgenti (qtcreator/sfdk
# ombreggiata a volte lascia qui oggetti e moc): non sono sorgenti.
*.o
moc_*.cpp
moc_*.h
/harbour-quill
documentation.list
+18 -1
View File
@@ -16,7 +16,16 @@ server.
- inline images with local cache
- relative links resolved against the note's WebDAV folder
- local `file:` links blocked with a banner (safety)
- **Note search** (title filter)
- **Note search** two ways: instant title filter in the list, and full-text
search over the whole folder (the tree is walked and the `.md` files are
downloaded one at a time — WebDAV has no content search), with the passage
that contains the word and a stop button
- **Task checkboxes**: `- [ ]` / `- [x]` are drawn as boxes in the preview and
can be tapped; the tap rewrites that one line and saves the note at once
- **Tags**: front-matter (`tags: [a, b]`, dash list or comma separated) and
inline `#tag`; front-matter tags show as chips on top of the preview, `#tag`
in the text is tappable, and a **Tags** screen lists every tag with how many
notes carry it (most used first)
- **New / delete notes** from the folder list
- **English and Italian** UI: language selector (system / English / Italiano),
applied on restart; Italian catalogue `.qm` in the app data dir
@@ -72,6 +81,14 @@ rpm/ spec (lrelease → .qm in app data dir) and desktop
- The preview is a local render; some exotic Markdown edge cases may differ
from Obsidian.
- The language change takes effect on restart.
- Full-text search and the tag list download every note in the folder: on a
big vault the first scan takes time (it is sequential, one note at a time).
Notes are kept in memory up to 16 MB; past that they are still listed and
searchable by title, and a banner says so. Files over 256 KB and beyond the
first 500 are skipped.
- Front matter is understood only as simple `key: value` pairs with scalar,
bracket or dash-list values; nested YAML is not interpreted (the block is
never printed as text either way).
## License
+2
View File
@@ -22,6 +22,8 @@ DISTFILES += \
qml/pages/EditorPage.qml \
qml/pages/PreviewPage.qml \
qml/pages/SettingsPage.qml \
qml/pages/SearchPage.qml \
qml/pages/TagPage.qml \
qml/pages/NewNoteDialog.qml \
qml/components/DavClient.qml \
qml/components/Banner.qml \
+111
View File
@@ -15,6 +15,26 @@ Item {
signal connOk()
signal failed(string message)
// Vault scan: search across the text and tag listing need the CONTENT of
// many notes, and WebDAV has no content search. So the tree is walked and
// the .md files are downloaded one at a time (same watchdog, same busy
// flag), emitting each file as it lands. The scan has its own signals so it
// never disturbs the list/read signals of the page underneath.
signal scanStart(int count)
signal scanProgress(int done, int all)
signal scanFile(string path, string content)
signal scanFinished(int done, int errs)
property bool scanning: false
property int scanRead: 0
property int scanErrors: 0
property var scanFolders: []
property var scanFiles: []
property string scanRoot: ""
// Bounds: a scan must never eat the phone's memory or the battery.
property int scanMaxFiles: 500
property int scanMaxBytes: 262144
property var currentXhr: null
Timer {
@@ -27,6 +47,13 @@ Item {
dav.currentXhr = null
}
dav.busy = false
// A scan cut by the watchdog would otherwise never report back.
if (dav.scanning) {
dav.scanning = false
dav.scanFolders = []
dav.scanFiles = []
dav.scanFinished(dav.scanRead, dav.scanErrors + 1)
}
dav.failed(qsTr("Network timeout"))
}
}
@@ -133,6 +160,90 @@ Item {
})
}
function isNote(name) {
return /\.(md|markdown)$/i.test(String(name))
}
// Walk rootPath (recursively) and download every .md file: first the folder
// listings, then the contents. cancelScan() stops it cleanly; the watchdog
// closes it if the network hangs.
function scanVault(rootPath) {
if (busy || scanning) {
failed(qsTr("Request already in progress"))
return
}
scanning = true
scanRoot = rootPath || ""
scanFolders = [scanRoot]
scanFiles = []
scanRead = 0
scanErrors = 0
nextScanFolder()
}
function cancelScan() {
if (!scanning) return
scanning = false
scanFolders = []
scanFiles = []
if (currentXhr) {
currentXhr.abort()
currentXhr = null
}
watchdog.stop()
busy = false
scanFinished(scanRead, scanErrors)
}
function nextScanFolder() {
if (!scanning) return
if (scanFolders.length === 0) {
scanStart(scanFiles.length)
readNextScanFile()
return
}
var folder = scanFolders.shift()
request("PROPFIND", fullUrl(folder), "", function (xhr) {
if (!dav.scanning) return
if (xhr.status >= 200 && xhr.status < 300) {
var entries = Prop.parse(xhr.responseText, appSettings.serverUrl)
for (var i = 0; i < entries.length; i++) {
var e = entries[i]
if (e.isDir) {
dav.scanFolders.push(e.path)
} else if (dav.isNote(e.name) && e.size <= dav.scanMaxBytes
&& dav.scanFiles.length < dav.scanMaxFiles) {
dav.scanFiles.push({ path: e.path, name: e.name, mtime: e.mtime })
}
}
} else {
dav.scanErrors++
}
dav.nextScanFolder()
})
}
function readNextScanFile() {
if (!scanning) return
if (scanFiles.length === 0) {
scanning = false
scanFinished(scanRead, scanErrors)
return
}
var f = scanFiles.shift()
request("GET", fullUrl(f.path), "", function (xhr) {
if (!dav.scanning) return
if (xhr.status >= 200 && xhr.status < 300) {
dav.scanRead++
dav.scanFile(f.path, xhr.responseText)
} else {
dav.scanErrors++
}
dav.scanProgress(dav.scanRead, dav.scanRead + dav.scanFiles.length)
dav.readNextScanFile()
})
}
function statusMessage(status) {
if (status === 401) return qsTr("Invalid credentials (401)")
if (status === 403) return qsTr("Access denied (403)")
+203 -4
View File
@@ -10,6 +10,15 @@
// baseUrl - resolves relative links/images against (the note's WebDAV folder)
// opts.imageMap - { url: localCachePath } -> inline <img> instead of placeholder
// opts.imageLabel - localized word for the image placeholder ("image")
// opts.checkOff / opts.checkOn - colours of the task checkbox glyphs
//
// Notes on the extra syntax supported here:
// - a leading front-matter block (--- ... ---) is NOT rendered as text: the
// page shows its tags as chips, so the block is skipped, not printed
// - task list items (- [ ] / - [x]) become tappable checkboxes: the glyph is
// an <a> whose href carries the SOURCE LINE NUMBER (quill-check://12), so
// the preview can rewrite exactly that line on the server
// - #tags become quill-tag:// links (the app opens a tag search)
function escapeHtml(s) {
return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
@@ -22,6 +31,172 @@ function resolveUrl(u, baseUrl) {
return u;
}
// ── front matter ───────────────────────────────────────────────────────────
// Only the subset that matters to a notes client is understood: a "key: value"
// map where a value can be a scalar, an inline list ([a, b]) or a block list
// (dash lines). Everything else is kept as text in fields[] but not interpreted.
function addTagValues(raw, out) {
if (!raw) return;
var v = String(raw).trim().replace(/^["']|["']$/g, "");
if (v.charAt(0) === "[") v = v.substring(1);
if (v.charAt(v.length - 1) === "]") v = v.substring(0, v.length - 1);
var parts = v.split(",");
for (var i = 0; i < parts.length; i++) {
var t = parts[i].trim().replace(/^#/, "");
if (t) out.push(t);
}
}
function frontMatterInfo(src) {
var info = { present: false, bodyStart: 0, tags: [], fields: {} };
if (!src) return info;
var text = String(src).replace(/\r\n/g, "\n").replace(/\r/g, "\n").replace(/^\uFEFF/, "");
var lines = text.split("\n");
if (lines.length < 2 || lines[0].trim() !== "---") return info;
var end = -1;
for (var i = 1; i < lines.length; i++) {
if (lines[i].trim() === "---" || lines[i].trim() === "...") { end = i; break; }
}
if (end < 0) return info; // unterminated: treat the dashes as normal text
info.present = true;
info.bodyStart = end + 1;
var key = null;
var values = {};
for (var j = 1; j < end; j++) {
var line = lines[j];
var item = /^\s*-\s+(.+)$/.exec(line);
if (item && key) {
values[key].push(item[1].trim());
continue;
}
var kv = /^([A-Za-z0-9_.-]+)\s*:\s*(.*)$/.exec(line);
if (!kv) continue;
key = kv[1].toLowerCase();
values[key] = [];
var v = kv[2].trim();
if (v) values[key].push(v);
}
for (var k in values) {
if (values.hasOwnProperty(k)) info.fields[k] = values[k].join(", ");
}
var tagValues = values.tags || values.tag || [];
for (var t = 0; t < tagValues.length; t++) addTagValues(tagValues[t], info.tags);
return info;
}
// Tags of a note: front matter first, then inline #tags in the body (code
// fences skipped, because a "#" there is a comment and not a tag).
// Deduplicated case-insensitively, original case kept.
function tagDetails(src) {
var out = { frontMatter: [], inline: [] };
if (!src) return out;
var fm = frontMatterInfo(src);
var seen = {};
function add(tag, bucket) {
var t = String(tag).replace(/^#/, "").trim();
if (!t || /^[0-9]+$/.test(t)) return;
var k = t.toLowerCase();
if (seen[k]) return;
seen[k] = true;
bucket.push(t);
}
for (var f = 0; f < fm.tags.length; f++) add(fm.tags[f], out.frontMatter);
var text = String(src).replace(/\r\n/g, "\n").replace(/\r/g, "\n").replace(/^\uFEFF/, "");
var lines = text.split("\n");
var fence = false;
var re = /(^|[\s(])#([0-9A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF_\/-]{2,})/g;
for (var i = fm.bodyStart; i < lines.length; i++) {
var l = lines[i];
if (/^\s*(```|~~~)/.test(l)) { fence = !fence; continue; }
if (fence) continue;
re.lastIndex = 0;
var m;
while ((m = re.exec(l)) !== null) add(m[2], out.inline);
}
return out;
}
function hasTag(src, tag) {
if (!tag) return false;
var d = tagDetails(src);
var want = String(tag).replace(/^#/, "").toLowerCase();
var all = d.frontMatter.concat(d.inline);
for (var i = 0; i < all.length; i++) {
if (all[i].toLowerCase() === want) return true;
}
return false;
}
// ── task lists ─────────────────────────────────────────────────────────────
// Flip one task marker, keeping the file's line endings. Returns the new source
// or null when the line is not a task item.
function toggleTask(src, lineIndex) {
if (!src) return null;
var text = String(src);
var crlf = text.indexOf("\r\n") >= 0;
var lines = text.replace(/\r\n/g, "\n").replace(/\r/g, "\n").split("\n");
if (lineIndex < 0 || lineIndex >= lines.length) return null;
var re = /^(\s*(?:[-*+]|\d+[.)])\s+\[)([ xX])(\])([\s\S]*)$/;
var m = re.exec(lines[lineIndex]);
if (!m) return null;
var next = m[2].toLowerCase() === "x" ? " " : "x";
lines[lineIndex] = m[1] + next + m[3] + m[4];
return lines.join(crlf ? "\r\n" : "\n");
}
// ── text search ────────────────────────────────────────────────────────────
// Plain-text (not markdown-aware) search: the query is what the reader typed,
// so it must match what is written in the file. Returns the offset and a
// readable excerpt around the first hit.
function snippetAround(text, at, len) {
var start = at - 40;
if (start < 0) start = 0;
var end = at + len + 60;
if (end > text.length) end = text.length;
var s = text.substring(start, end).replace(/\s+/g, " ");
// Drop the markdown noise that would otherwise open the excerpt
// ("- [x] ", "> ", "| ", "### ") and the inline markers inside it.
s = s.replace(/^[\s\-*+>#|]+/, "").replace(/\s*\|\s*/g, " · ");
s = s.replace(/\*\*|__|`|\[\[|\]\]/g, "");
// A cut in the middle of a word is worse than a shorter excerpt.
if (start > 0) s = s.replace(/^\S*\s+/, "");
return (start > 0 ? "\u2026" : "") + s.trim() + (end < text.length ? "\u2026" : "");
}
function searchText(content, term) {
if (!content || !term) return null;
var hay = String(content).toLowerCase();
var needle = String(term).toLowerCase();
var at = hay.indexOf(needle);
if (at < 0) return null;
return { index: at, snippet: snippetAround(String(content), at, needle.length) };
}
// ── inline formatting ──────────────────────────────────────────────────────
// #tag -> quill-tag://<tag>. Applied only OUTSIDE existing anchors: a tag typed
// inside a link label must not produce a link inside a link.
function linkTags(html) {
var parts = String(html).split(/(<a\b[^>]*>[\s\S]*?<\/a>)/);
var re = /(^|[\s(])#([0-9A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF_\/-]{2,})/g;
for (var p = 0; p < parts.length; p++) {
if (/^<a\b/.test(parts[p])) continue;
parts[p] = parts[p].replace(re, function (m, pre, tag) {
if (/^[0-9]+$/.test(tag)) return m;
return pre + '<a href="quill-tag://' + encodeURIComponent(tag) + '">#' + tag + "</a>";
});
}
return parts.join("");
}
function inline(s, baseUrl, opts) {
s = escapeHtml(s);
s = s.replace(/`([^`]+)`/g, "<tt>$1</tt>");
@@ -52,7 +227,7 @@ function inline(s, baseUrl, opts) {
s = s.replace(/\*\*(.+?)\*\*/g, "<b>$1</b>");
s = s.replace(/(^|[^*])\*([^*\n]+)\*(?!\*)/g, "$1<i>$2</i>");
s = s.replace(/~~([^~]+)~~/g, "<s>$1</s>");
return s;
return linkTags(s);
}
// Split a table row on unescaped pipes; leading/trailing pipe is optional.
@@ -92,13 +267,19 @@ function render(src, baseUrl, opts) {
src = src.replace(/^\uFEFF/, "");
var lines = src.split("\n");
var out = [];
var i = 0;
var fm = frontMatterInfo(src);
// Front matter is shown by the page as tag chips, never as body text.
var i = fm.bodyStart;
var n = lines.length;
var checkOff = (opts && opts.checkOff) || "#7f7f7f";
var checkOn = (opts && opts.checkOn) || "#3b9c9c";
var headingRe = /^\s*(#{1,6})\s+(.*)$/;
var hrRe = /^\s*(-{3,}|\*{3,}|_{3,})\s*$/;
var quoteRe = /^>\s?(.*)$/;
var listRe = /^\s*([-*+]|\d+[.)])\s+(.*)$/;
var taskRe = /^\s*(?:[-*+]|\d+[.)])\s+\[([ xX])\]\s*([\s\S]*)$/;
var fenceRe = /^```/;
var tableHeaderRe = /^\s*\|.*\|/;
var tableSepRe = /^\s*\|?[\s:|-]+\|?\s*$/;
@@ -188,7 +369,18 @@ function render(src, baseUrl, opts) {
while (i < n) {
var lm = listRe.exec(lines[i]);
if (!lm) break;
items.push("<li>" + inline(lm[2], baseUrl, opts) + "</li>");
var task = taskRe.exec(lines[i]);
if (task) {
var done = task[1].toLowerCase() === "x";
var glyph = done ? "\u2611" : "\u2610";
var colour = done ? checkOn : checkOff;
// The href carries the absolute source line: the preview
// rewrites that line, so it must not drift with offsets.
items.push('<li><a href="quill-check://' + i + '"><font color="' + colour + '">' +
glyph + "</font></a> " + inline(task[2], baseUrl, opts) + "</li>");
} else {
items.push("<li>" + inline(lm[2], baseUrl, opts) + "</li>");
}
i++;
}
out.push(ordered ? "<ol>" + items.join("") + "</ol>" : "<ul>" + items.join("") + "</ul>");
@@ -216,5 +408,12 @@ function render(src, baseUrl, opts) {
}
if (typeof module !== "undefined" && module.exports) {
module.exports = { render: render };
module.exports = {
render: render,
frontMatterInfo: frontMatterInfo,
tagDetails: tagDetails,
hasTag: hasTag,
toggleTask: toggleTask,
searchText: searchText
};
}
+12 -1
View File
@@ -47,6 +47,16 @@ Page {
if (notify) banner.show(qsTr("Saving..."), false)
}
// Called by the preview when it changes the note (a checked box): the text
// typed here must follow, or leaving the editor would write the old version
// back over the server copy. `saved` says whether the change already
// reached the server, and therefore whether the note is still dirty.
function externalUpdate(text, saved) {
if (saved) initialContent = text
editor.text = text
dirty = !saved
}
Connections {
target: dav
onFileReady: {
@@ -100,7 +110,8 @@ Page {
MenuItem {
text: qsTr("Preview")
onClicked: pageStack.push(Qt.resolvedUrl("PreviewPage.qml"),
{ dav: page.dav, noteName: page.noteName, notePath: page.notePath, markdown: editor.text })
{ dav: page.dav, noteName: page.noteName, notePath: page.notePath,
markdown: editor.text, owner: page })
}
MenuItem {
text: qsTr("Delete note")
+11 -1
View File
@@ -86,7 +86,7 @@ Page {
SearchField {
id: searchField
width: parent.width
placeholderText: qsTr("Search")
placeholderText: qsTr("Filter by title")
// Bound to the page property so the delegates (which cannot
// see header ids) can clear it via page.filterText.
text: page.filterText
@@ -170,6 +170,16 @@ Page {
})
}
}
MenuItem {
text: qsTr("Search in the text")
onClicked: pageStack.push(Qt.resolvedUrl("SearchPage.qml"),
{ dav: page.dav, rootPath: page.currentPath })
}
MenuItem {
text: qsTr("Tags")
onClicked: pageStack.push(Qt.resolvedUrl("TagPage.qml"),
{ dav: page.dav, rootPath: "" })
}
MenuItem {
text: qsTr("Refresh")
onClicked: page.reload()
+82 -3
View File
@@ -14,6 +14,11 @@ Page {
property string baseUrl: ""
property var imageMap: ({})
property string pendingOpen: ""
// The editor below: it must follow every change made here (a checked box),
// otherwise leaving the editor would save the old text back.
property var owner: null
// Front-matter tags: the block itself is not rendered, these chips are it.
property var fmTags: []
Component.onCompleted: {
// Base for relative links: the note's WebDAV folder. Relative links
@@ -23,10 +28,19 @@ Page {
if (notePath && notePath.indexOf("/") >= 0) {
baseUrl += "/" + notePath.substring(0, notePath.lastIndexOf("/"))
}
refreshTags()
renderPreview()
extractImages()
}
function refreshTags() {
try {
page.fmTags = Markdown.tagDetails(page.markdown).frontMatter
} catch (e) {
page.fmTags = []
}
}
function resolveImg(u) {
if (/^[a-z]+:/i.test(u) || u.charAt(0) === "/" || u.charAt(0) === "#") return u
return String(page.baseUrl).replace(/\/+$/, "") + "/" + u
@@ -35,7 +49,10 @@ Page {
function renderPreview() {
try {
htmlText = Markdown.render(markdown, baseUrl,
{ imageMap: page.imageMap, imageLabel: qsTr("image") })
{ imageMap: page.imageMap,
imageLabel: qsTr("image"),
checkOff: Theme.secondaryColor,
checkOn: Theme.highlightColor })
} catch (e) {
console.log("Quill markdown render error:", e)
htmlText = "<tt>" + String(markdown).replace(/&/g, "&amp;").replace(/</g, "&lt;") + "</tt>"
@@ -63,6 +80,31 @@ Page {
dav.readFile(page.pendingOpen)
}
// A tapped checkbox rewrites exactly one line and saves it at once: the
// note on the server is the only copy, so waiting for the editor to be left
// would lose the tick if the app were closed first.
function toggleLine(lineIndex) {
var next = Markdown.toggleTask(page.markdown, lineIndex)
if (next === null) {
banner.show(qsTr("This line is not a task"), true)
return
}
page.markdown = next
page.refreshTags()
page.renderPreview()
if (page.owner && page.owner.externalUpdate) page.owner.externalUpdate(next, false)
if (page.dav.busy) {
banner.show(qsTr("Save in progress, the change is kept"), false)
return
}
page.dav.writeFile(page.notePath, next)
}
function openTag(tag) {
pageStack.push(Qt.resolvedUrl("SearchPage.qml"),
{ dav: page.dav, tagFilter: tag, rootPath: "" })
}
Connections {
target: dav
onFileReady: {
@@ -79,6 +121,8 @@ Page {
if (page.pendingOpen) {
page.pendingOpen = ""
banner.show(qsTr("Cannot open the note: %1").arg(message), true)
} else {
banner.show(message, true)
}
}
}
@@ -94,24 +138,59 @@ Page {
SilicaFlickable {
anchors.fill: parent
contentHeight: previewLabel.height + Theme.paddingLarge * 2
contentHeight: column.height + Theme.paddingLarge * 2
Column {
id: column
width: parent.width
PageHeader { title: noteName }
Flow {
x: Theme.paddingLarge
width: column.width - 2 * Theme.paddingLarge
spacing: Theme.paddingSmall
visible: page.fmTags.length > 0
Repeater {
model: page.fmTags
delegate: Rectangle {
width: tagLabel.implicitWidth + Theme.paddingMedium * 2
height: tagLabel.implicitHeight + Theme.paddingSmall
radius: height / 2
color: Theme.rgba(Theme.highlightBackgroundColor, 0.2)
Label {
id: tagLabel
anchors.centerIn: parent
text: "#" + modelData
color: Theme.highlightColor
font.pixelSize: Theme.fontSizeExtraSmall
}
MouseArea {
anchors.fill: parent
onClicked: page.openTag(modelData)
}
}
}
}
Label {
id: previewLabel
x: Theme.paddingLarge
width: parent.width - 2 * Theme.paddingLarge
topPadding: Theme.paddingMedium
text: page.htmlText
textFormat: Text.RichText
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
linkColor: Theme.highlightColor
onLinkActivated: {
var l = String(link)
if (l.indexOf("quill://") === 0) {
if (l.indexOf("quill-check://") === 0) {
page.toggleLine(parseInt(l.substring("quill-check://".length), 10))
} else if (l.indexOf("quill-tag://") === 0) {
page.openTag(decodeURIComponent(l.substring("quill-tag://".length)))
} else if (l.indexOf("quill://") === 0) {
page.openWikiLink(decodeURIComponent(l.substring("quill://".length)))
} else if (l.indexOf("file:") === 0) {
// A link that still resolved to a local file (no base):
+221
View File
@@ -0,0 +1,221 @@
import QtQuick 2.2
import Sailfish.Silica 1.0
import "../components/Markdown.js" as Markdown
import "../components"
// Search across the TEXT of the notes (WebDAV cannot do it: the folder is
// walked and the .md files are downloaded one at a time).
//
// The scan runs once, when the page opens; typing afterwards filters what is
// already in memory, so the field stays responsive. Notes are kept in memory up
// to a budget: past it a note is still listed (and searchable by title) but its
// text is not held, and a banner says so.
//
// With tagFilter set the page becomes a tag listing: no search field, only the
// notes that carry that tag.
Page {
id: page
property var dav
property string rootPath: "" // folder to scan ("" = whole vault root)
property string tagFilter: "" // when set: notes carrying this tag
property string term: ""
property bool scanning: false
property int total: 0
property int read: 0
property int errors: 0
property int matched: 0
property var notes: []
property real storedBytes: 0
property real maxStoredBytes: 16777216 // 16 MB of note text
property bool truncated: false
property string coverText: tagFilter !== "" ? "#" + tagFilter : qsTr("Search")
ListModel { id: results }
onTermChanged: refresh()
Component.onCompleted: start()
function start() {
if (!dav) return
results.clear()
notes = []
storedBytes = 0
truncated = false
matched = 0
total = 0
read = 0
errors = 0
scanning = true
dav.scanVault(rootPath)
}
function addNote(notePath, content) {
var name = notePath.substring(notePath.lastIndexOf("/") + 1)
var text = content || ""
if (storedBytes + text.length > maxStoredBytes) {
text = ""
truncated = true
} else {
storedBytes += text.length
}
notes.push({ path: notePath, name: name, content: text })
}
// Rebuild the result list from what is in memory.
function refresh() {
results.clear()
matched = 0
var t = term.trim().toLowerCase()
for (var i = 0; i < notes.length; i++) {
var n = notes[i]
var hitTitle = false
var hit = null
if (tagFilter !== "") {
if (!n.content) continue
if (!Markdown.hasTag(n.content, tagFilter)) continue
} else {
if (t === "") {
// No query yet: the whole scanned tree, folder paths
// included, so the page doubles as an index of the vault.
} else {
hitTitle = n.name.toLowerCase().indexOf(t) >= 0
hit = n.content ? Markdown.searchText(n.content, t) : null
if (!hitTitle && !hit) continue
}
}
results.append({
name: n.name,
path: n.path,
snippet: hit ? hit.snippet : ""
})
matched++
if (matched >= 500) break
}
}
Connections {
target: page.dav
onScanStart: {
page.total = count
page.scanning = count > 0
}
onScanProgress: {
page.read = done
page.total = all
}
onScanFile: page.addNote(path, content)
onScanFinished: {
page.read = done
page.errors = errs
page.scanning = false
page.refresh()
if (page.truncated) banner.show(qsTr("Only the first notes are kept in memory"), true)
}
onFailed: banner.show(message, true)
}
SilicaListView {
id: listView
anchors.fill: parent
model: results
header: Column {
width: parent.width
PageHeader { title: page.tagFilter !== "" ? "#" + page.tagFilter : qsTr("Search in the text") }
SearchField {
visible: page.tagFilter === ""
width: parent.width
placeholderText: qsTr("Search the notes")
text: page.term
onTextChanged: {
if (text !== page.term) page.term = text
}
}
Label {
visible: page.scanning
x: Theme.paddingLarge
width: parent.width - 2 * Theme.paddingLarge
text: page.total > 0 ? qsTr("Reading notes: %1 of %2").arg(page.read).arg(page.total)
: qsTr("Looking for notes...")
color: Theme.secondaryColor
font.pixelSize: Theme.fontSizeSmall
}
Label {
visible: !page.scanning
x: Theme.paddingLarge
width: parent.width - 2 * Theme.paddingLarge
text: (page.matched === 1 ? qsTr("1 note") : qsTr("%1 notes").arg(page.matched)) +
(page.errors > 0 ? qsTr(" · %1 unreadable").arg(page.errors) : "")
color: Theme.secondaryColor
font.pixelSize: Theme.fontSizeSmall
}
}
ViewPlaceholder {
enabled: !page.scanning && results.count === 0
text: page.tagFilter !== "" ? qsTr("No note with this tag")
: qsTr("No note contains this text")
}
delegate: ListItem {
id: resultItem
contentHeight: model.snippet !== "" ? Theme.itemSizeLarge : Theme.itemSizeMedium
onClicked: pageStack.push(Qt.resolvedUrl("EditorPage.qml"),
{ dav: page.dav, notePath: model.path, noteName: model.name })
Column {
anchors.verticalCenter: parent.verticalCenter
x: Theme.paddingLarge
width: parent.width - 2 * Theme.paddingLarge
Label {
text: model.name
font.pixelSize: Theme.fontSizeMedium
truncationMode: TruncationMode.Fade
}
Label {
visible: model.snippet !== ""
text: model.snippet
color: Theme.secondaryColor
font.pixelSize: Theme.fontSizeExtraSmall
maximumLineCount: 2
truncationMode: TruncationMode.Fade
}
}
}
VerticalScrollDecorator { id: decorator }
PullDownMenu {
MenuItem {
text: qsTr("Search again")
onClicked: page.start()
}
MenuItem {
visible: page.dav && page.dav.scanning
text: qsTr("Stop")
onClicked: page.dav.cancelScan()
}
}
BusyIndicator {
anchors.centerIn: parent
size: BusyIndicatorSize.Large
running: page.scanning
}
}
onStatusChanged: {
// Leaving the page must not leave a scan running in the background:
// it would keep the network busy for the next screen.
if (status === PageStatus.Inactive && page.dav && page.dav.scanning) page.dav.cancelScan()
}
Banner { id: banner }
}
+174
View File
@@ -0,0 +1,174 @@
import QtQuick 2.2
import Sailfish.Silica 1.0
import "../components/Markdown.js" as Markdown
import "../components"
// Every tag in the vault, with how many notes carry it. Built from a scan (the
// tags live inside the notes, so the only way to know them is to read them):
// front-matter tags and inline #tags both count, case-insensitively.
Page {
id: page
property var dav
property string rootPath: "" // "" = whole vault
property bool scanning: false
property int total: 0
property int read: 0
property int errors: 0
// tag (lower case) -> { name: original case, count: n }
property var found: ({})
property int tagCount: 0
property string coverText: qsTr("Tags")
ListModel { id: tagsModel }
Component.onCompleted: start()
function start() {
if (!dav) return
tagsModel.clear()
found = ({})
tagCount = 0
total = 0
read = 0
errors = 0
scanning = true
dav.scanVault(rootPath)
}
function addTags(content) {
var d = Markdown.tagDetails(content || "")
var all = d.frontMatter.concat(d.inline)
for (var i = 0; i < all.length; i++) {
var name = all[i]
var key = name.toLowerCase()
var known = found[key]
if (known) {
known.count += 1
} else {
found[key] = { name: name, count: 1 }
tagCount += 1
}
}
}
// Most used first, then alphabetical: the list is a map of the vault.
function rebuild() {
tagsModel.clear()
var list = []
for (var key in found) {
if (found.hasOwnProperty(key)) list.push(found[key])
}
list.sort(function (a, b) {
if (a.count !== b.count) return b.count - a.count
var an = a.name.toLowerCase(), bn = b.name.toLowerCase()
return an < bn ? -1 : (an > bn ? 1 : 0)
})
for (var i = 0; i < list.length; i++) {
tagsModel.append({ tag: list[i].name, uses: list[i].count })
}
}
Connections {
target: page.dav
onScanStart: {
page.total = count
page.scanning = count > 0
}
onScanProgress: {
page.read = done
page.total = all
}
onScanFile: page.addTags(content)
onScanFinished: {
page.read = done
page.errors = errs
page.scanning = false
page.rebuild()
}
onFailed: banner.show(message, true)
}
SilicaListView {
id: listView
anchors.fill: parent
model: tagsModel
header: Column {
width: parent.width
PageHeader { title: qsTr("Tags") }
Label {
visible: page.scanning
x: Theme.paddingLarge
width: parent.width - 2 * Theme.paddingLarge
text: page.total > 0 ? qsTr("Reading notes: %1 of %2").arg(page.read).arg(page.total)
: qsTr("Looking for notes...")
color: Theme.secondaryColor
font.pixelSize: Theme.fontSizeSmall
}
Label {
visible: !page.scanning
x: Theme.paddingLarge
width: parent.width - 2 * Theme.paddingLarge
text: page.tagCount === 1 ? qsTr("1 tag in the notes")
: qsTr("%1 tags in the notes").arg(page.tagCount)
color: Theme.secondaryColor
font.pixelSize: Theme.fontSizeSmall
}
}
ViewPlaceholder {
enabled: !page.scanning && tagsModel.count === 0
text: qsTr("No tags in the notes. Write #tag in a note or add a tags: field at the top.")
}
delegate: ListItem {
contentHeight: Theme.itemSizeSmall
onClicked: pageStack.push(Qt.resolvedUrl("SearchPage.qml"),
{ dav: page.dav, tagFilter: model.tag, rootPath: "" })
Label {
x: Theme.paddingLarge
anchors.verticalCenter: parent.verticalCenter
width: parent.width - 2 * Theme.paddingLarge - usesLabel.width - Theme.paddingLarge
text: "#" + model.tag
color: Theme.highlightColor
truncationMode: TruncationMode.Fade
}
Label {
id: usesLabel
anchors.right: parent.right
anchors.rightMargin: Theme.paddingLarge
anchors.verticalCenter: parent.verticalCenter
text: model.uses
color: Theme.secondaryColor
font.pixelSize: Theme.fontSizeSmall
}
}
VerticalScrollDecorator { id: decorator }
PullDownMenu {
MenuItem {
text: qsTr("Scan again")
onClicked: page.start()
}
MenuItem {
visible: page.dav && page.dav.scanning
text: qsTr("Stop")
onClicked: page.dav.cancelScan()
}
}
BusyIndicator {
anchors.centerIn: parent
size: BusyIndicatorSize.Large
running: page.scanning
}
}
onStatusChanged: {
if (status === PageStatus.Inactive && page.dav && page.dav.scanning) page.dav.cancelScan()
}
Banner { id: banner }
}
+16 -1
View File
@@ -1,6 +1,6 @@
Name: harbour-quill
Summary: Markdown notes client (Obsidian-like) for Sailfish OS
Version: 0.2.12
Version: 0.3.0
Release: 1
Group: Applications/Office
License: GPLv3
@@ -75,6 +75,21 @@ fi
%{_datadir}/%{name}/translations/%{name}*.qm
%changelog
* Sun Nov 08 2026 Carlo Baratto <carlo@carlobaratto.it> - 0.3.0-1
- Ricerca nel testo: il caveau viene percorso ricorsivamente e le note .md
scaricate una alla volta (il WebDAV non cerca nel contenuto), con avanzamento
e possibilita' di fermare; i risultati mostrano il passaggio che contiene la
parola. La ricerca per titolo resta istantanea nel campo della lista.
- Caselle di spunta: gli elementi "- [ ]" e "- [x]" si vedono come caselle e si
toccano nell'anteprima; il tocco riscrive quella riga e salva subito la nota,
e l'editor tiene il testo allineato (altrimenti uscendo riscriverebbe la
versione vecchia).
- Tag: front-matter (tags: [a, b], lista a trattini o separati da virgola) e
#tag nel testo; le pastiglie del front-matter stanno in cima all'anteprima, i
#tag del testo sono toccabili e aprono l'elenco delle note che li portano.
Nuova schermata Tag con il conteggio per tag, dal piu' usato in giu'.
- Il blocco front-matter non viene piu' stampato come testo nell'anteprima.
* Wed Aug 19 2026 Carlo Baratto <carlo@carlobaratto.it> - 0.2.12-1
- Sandbox SailJail (Sailfish 4.4+/5.x): profilo X-Sailjail esplicito nel desktop
file (Internet, org harbour/app quill) e config in AppConfigLocation
+1 -1
View File
@@ -12,7 +12,7 @@
int main(int argc, char *argv[])
{
qDebug() << "Quill v0.2.12 build" << __DATE__ << __TIME__;
qDebug() << "Quill v0.3.0 build" << __DATE__ << __TIME__;
QGuiApplication *app = SailfishApp::application(argc, argv);
+142
View File
@@ -0,0 +1,142 @@
#!/usr/bin/env python3
"""Controllo statico della QML prima della build.
Perche' esiste: un nome sbagliato in QML non fa fallire la compilazione. Si vede
solo sul telefono, come un pulsante che non fa niente o una pagina che non si
apre. Qui si confronta quello che la QML usa con quello che i sorgenti
dichiarano, in pochi millisecondi:
1. ogni `Markdown.<nome>(...)` esiste in qml/components/Markdown.js;
2. ogni `dav.<nome>(...)` / `appSettings.<nome>` esiste in DavClient/settings;
3. ogni `Qt.resolvedUrl("X.qml")` punta a un file che esiste;
4. ogni `on<Segnale>:` di un `Connections { target: dav }` corrisponde a un
segnale dichiarato in DavClient.qml (un gestore scritto male non da' errore,
semplicemente non viene mai chiamato);
5. i parametri usati nei gestori dei segnali di scansione sono quelli
dichiarati (parametro sbagliato = ReferenceError solo a runtime).
Uso: python3 tests/qml_contract_check.py
Esce 1 se trova qualcosa, 0 se e' pulito.
"""
import pathlib
import re
import sys
APP = pathlib.Path(__file__).resolve().parent.parent
problemi = []
def qml_files():
return sorted(APP.glob("qml/**/*.qml"))
def js_functions(path):
"""Nomi delle funzioni top-level di un modulo JS esportato alla QML."""
testo = path.read_text()
return set(re.findall(r"^function\s+(\w+)\s*\(", testo, re.M))
def qml_functions(path):
return set(re.findall(r"^\s*function\s+(\w+)\s*\(", path.read_text(), re.M))
def controlla_markdown():
disponibili = js_functions(APP / "qml/components/Markdown.js")
for f in qml_files():
for nome in set(re.findall(r"\bMarkdown\.(\w+)\s*\(", f.read_text())):
if nome not in disponibili:
problemi.append(f"{f.name}: Markdown.{nome}() non esiste in Markdown.js")
def controlla_dav():
sorgente = APP / "qml/components/DavClient.qml"
dichiarati = qml_functions(sorgente)
# Un segnale si emette come una funzione: e' legittimo chiamarlo.
dichiarati |= set(re.findall(r"signal\s+(\w+)", sorgente.read_text()))
proprieta = set(re.findall(r"^\s*(?:readonly\s+)?property\s+\w+\s+(\w+)",
sorgente.read_text(), re.M))
for f in qml_files():
if f == sorgente:
continue # dentro il client le chiamate sono emissioni dei suoi segnali
testo = f.read_text()
for nome in set(re.findall(r"\bdav\.(\w+)\s*\(", testo)):
if nome not in dichiarati:
problemi.append(f"{f.name}: dav.{nome}() non esiste in DavClient.qml")
for nome in set(re.findall(r"\bdav\.(\w+)\b(?!\s*\()", testo)):
if nome not in proprieta and nome not in dichiarati and nome not in ("scanning",):
problemi.append(f"{f.name}: dav.{nome} non e' una proprieta' di DavClient.qml")
def controlla_settings():
h = APP / "src/settings.h"
if not h.exists():
return
nomi = set(re.findall(r"Q_PROPERTY\(\s*[\w:*<>]+\s+(\w+)", h.read_text()))
for f in qml_files():
for nome in set(re.findall(r"\bappSettings\.(\w+)", f.read_text())):
if nome not in nomi:
problemi.append(f"{f.name}: appSettings.{nome} non dichiarato in src/settings.h")
def controlla_url():
for f in qml_files():
for url in re.findall(r'Qt\.resolvedUrl\("([^"]+)"\)', f.read_text()):
if not (f.parent / url).resolve().exists():
problemi.append(f"{f.name}: Qt.resolvedUrl(\"{url}\") non esiste")
def controlla_segnali():
dav = (APP / "qml/components/DavClient.qml").read_text()
segnali = {}
for nome, params in re.findall(r"signal\s+(\w+)\s*\(([^)]*)\)", dav):
segnali[nome] = [p.strip().split()[-1] for p in params.split(",") if p.strip()]
for f in qml_files():
testo = f.read_text()
for blocco in re.findall(r"Connections\s*\{(.*?)\n \}", testo, re.S):
if "target: dav" not in blocco and "target: page.dav" not in blocco:
continue
for gestore in re.findall(r"\bon([A-Z]\w*)\s*:", blocco):
nome = gestore[0].lower() + gestore[1:]
if nome not in segnali:
problemi.append(f"{f.name}: on{gestore} non corrisponde a un segnale di DavClient.qml")
continue
corpo = blocco.split("on" + gestore + ":", 1)[1]
# Il corpo finisce al gestore successivo o alla chiusura.
corpo = re.split(r"\n\s*on[A-Z]\w*\s*:", corpo)[0]
for p in segnali[nome]:
# Un parametro dichiarato ma mai usato va bene; quello che
# conta e' che i nomi usati come variabili siano dichiarati.
if re.search(r"\b" + re.escape(p) + r"\b", corpo):
continue
# Se il gestore usa `message`, `content`, `path` e simili
# ma il segnale non li dichiara, e' un errore.
usati = set(re.findall(r"\b(message|content|path|entries|count|done|errs|all)\b", corpo))
falsi = usati - set(segnali[nome])
for u in sorted(falsi):
problemi.append(f"{f.name}: on{gestore} usa '{u}', che il segnale non dichiara "
f"({', '.join(segnali[nome]) or 'nessun parametro'})")
def main():
if not qml_files():
print("nessun file QML trovato", file=sys.stderr)
return 1
controlla_markdown()
controlla_dav()
controlla_settings()
controlla_url()
controlla_segnali()
print(f"file QML controllati: {len(qml_files())}")
if problemi:
for p in problemi:
print("PROBLEMA:", p)
print(f"ESITO: {len(problemi)} problemi")
return 1
print("ESITO: nessun problema di contratto fra QML, JS e C++")
return 0
if __name__ == "__main__":
sys.exit(main())
+122
View File
@@ -112,6 +112,128 @@ assert(img3.indexOf("<i>[image: x]</i>") >= 0, "default label 'image'");
console.log("Markdown tests: OK");
// ── front matter ─────────────────────────────────────────────────────────
var fm1 = Markdown.frontMatterInfo("---\ntitle: Nota\ntags: [uno, due]\n---\n\n# Titolo\n");
console.log("── front matter ── " + JSON.stringify(fm1));
assert.strictEqual(fm1.present, true, "front matter detected");
assert.strictEqual(fm1.bodyStart, 4, "body starts after the closing dashes");
assert.deepStrictEqual(fm1.tags, ["uno", "due"], "inline list tags: " + fm1.tags);
assert.strictEqual(fm1.fields.title, "Nota", "scalar field");
var fm2 = Markdown.frontMatterInfo("---\ntags:\n - alfa\n - beta\n---\ntesto");
assert.deepStrictEqual(fm2.tags, ["alfa", "beta"], "block list tags: " + fm2.tags);
var fm3 = Markdown.frontMatterInfo("---\ntags: uno, due\n---\ntesto");
assert.deepStrictEqual(fm3.tags, ["uno", "due"], "comma separated tags");
// unterminated block is NOT front matter: the dashes stay text
var fm4 = Markdown.frontMatterInfo("---\ntitle: x\n\nTesto\n");
assert.strictEqual(fm4.present, false, "unterminated block ignored");
assert.strictEqual(fm4.bodyStart, 0, "body starts at 0");
// a document with no front matter at all
var fm5 = Markdown.frontMatterInfo("# Solo titolo\n");
assert.strictEqual(fm5.present, false, "no front matter");
assert.deepStrictEqual(fm5.tags, [], "no tags");
// the block must not be rendered as body text
var rfm = Markdown.render("---\ntitle: Nota\ntags: [x]\n---\n\n# Titolo\n");
assert(rfm.indexOf("title:") < 0 && rfm.indexOf("tags:") < 0, "front matter not rendered: " + rfm);
assert(rfm.indexOf("<h1>Titolo</h1>") >= 0, "body rendered after front matter");
// a leading horizontal rule is not front matter
var rfhr = Markdown.render("---\n\nTesto\n");
assert(rfhr.indexOf("<hr/>") >= 0 && rfhr.indexOf("<p>Testo</p>") >= 0, "hr still hr: " + rfhr);
// ── tags ─────────────────────────────────────────────────────────────────
var td1 = Markdown.tagDetails("---\ntags: [progetto, idee]\n---\n\nTesto con #inline e #altro/tag\n");
assert.deepStrictEqual(td1.frontMatter, ["progetto", "idee"], "front matter tags: " + td1.frontMatter);
assert.deepStrictEqual(td1.inline, ["inline", "altro/tag"], "inline tags: " + td1.inline);
// duplicates (also with different case) collapse
var td2 = Markdown.tagDetails("---\ntags: [Idee]\n---\n#idee e #Idee");
assert.strictEqual(td2.frontMatter.length + td2.inline.length, 1, "tags deduplicated: " + JSON.stringify(td2));
// code fences are not scanned for tags; #12 is not a tag
var td3 = Markdown.tagDetails("```\n# commento\n```\n#12 e #vero");
assert.deepStrictEqual(td3.inline, ["vero"], "fence skipped, number skipped: " + td3.inline);
// hasTag is case-insensitive and works for both sources
assert.strictEqual(Markdown.hasTag("---\ntags: [Progetto]\n---\nx", "progetto"), true, "hasTag front matter");
assert.strictEqual(Markdown.hasTag("testo #progetto", "progetto"), true, "hasTag inline");
assert.strictEqual(Markdown.hasTag("testo #altro", "progetto"), false, "hasTag miss");
// tag links in the preview
var tg = Markdown.render("Vedi #progetto e #altro/tag");
assert(tg.indexOf('<a href="quill-tag://progetto">#progetto</a>') >= 0, "tag link: " + tg);
assert(tg.indexOf("quill-tag://altro%2Ftag") >= 0, "tag with slash encoded");
// a tag inside a link label must not nest anchors
var tg2 = Markdown.render("[testo #progetto](http://e.it)");
assert.strictEqual((tg2.match(/<a /g) || []).length, 1, "no nested anchors: " + tg2);
// heading markers are not tags
var tg3 = Markdown.render("## Titolo");
assert(tg3.indexOf("quill-tag") < 0, "heading is not a tag: " + tg3);
console.log("Front matter + tags tests: OK");
// ── task lists ───────────────────────────────────────────────────────────
var TASKS = "# Lista\n\n- [ ] prima\n- [x] seconda\n- normale\n\n| a | b |\n|---|---|\n| 1 | 2 |";
var rt = Markdown.render(TASKS, "", { checkOff: "#111111", checkOn: "#222222" });
console.log("── task output ──\n" + rt);
assert(rt.indexOf('<a href="quill-check://2"><font color="#111111">\u2610</font></a> prima') >= 0,
"unchecked task with source line: " + rt);
assert(rt.indexOf('<a href="quill-check://3"><font color="#222222">\u2611</font></a> seconda') >= 0,
"checked task with source line");
assert(rt.indexOf("<li>normale</li>") >= 0, "plain item untouched");
assert(rt.indexOf("\u2610") >= 0 && rt.indexOf("\u2611") >= 0, "checkbox glyphs rendered");
// the line index survives a front matter block
var rtf = Markdown.render("---\ntags: [x]\n---\n- [ ] dopo\n");
assert(rtf.indexOf('quill-check://3') >= 0, "line index absolute after front matter: " + rtf);
// toggling
var toggled = Markdown.toggleTask(TASKS, 2);
assert(toggled.indexOf("- [x] prima") >= 0, "unchecked -> checked: " + toggled.split("\n")[2]);
var toggledBack = Markdown.toggleTask(toggled, 2);
assert(toggledBack === TASKS, "round trip gives the original source");
var toggledOff = Markdown.toggleTask(TASKS, 3);
assert(toggledOff.indexOf("- [ ] seconda") >= 0, "checked -> unchecked");
assert.strictEqual(Markdown.toggleTask(TASKS, 4), null, "plain list item is not a task");
assert.strictEqual(Markdown.toggleTask(TASKS, 99), null, "line out of range");
assert.strictEqual(Markdown.toggleTask("# x", 0), null, "heading is not a task");
// CRLF files keep their line endings
var crlf = "- [ ] a\r\n- [ ] b";
var crlfOut = Markdown.toggleTask(crlf, 1);
assert(crlfOut.indexOf("\r\n") >= 0 && crlfOut.indexOf("\n\n") < 0, "CRLF preserved: " + JSON.stringify(crlfOut));
assert(crlfOut.indexOf("- [x] b") >= 0, "CRLF toggle works");
// nested indentation is preserved
var nested = " - [ ] dentro";
assert(Markdown.toggleTask(nested, 0) === " - [x] dentro", "indentation kept");
console.log("Task list tests: OK");
// ── text search ──────────────────────────────────────────────────────────
var NOTE = "---\ntags: [x]\n---\n\n# Progetto Marte\n\nLa colonia ha bisogno di **acqua** e di un\nreattore. Vedi [[Base]] per i dettagli.\n";
var s1 = Markdown.searchText(NOTE, "acquA");
console.log("── snippet ── " + (s1 && s1.snippet));
assert(s1 !== null, "case-insensitive hit");
assert(s1.index > 0, "index reported");
assert(s1.snippet.indexOf("acqua") >= 0, "snippet contains the term: " + s1.snippet);
assert(s1.snippet.indexOf("\n") < 0, "snippet is one line");
assert.strictEqual(Markdown.searchText(NOTE, "inesistente"), null, "miss returns null");
assert.strictEqual(Markdown.searchText("", "x"), null, "empty content");
assert.strictEqual(Markdown.searchText("abc", ""), null, "empty term");
// a hit far into the text is prefixed with an ellipsis
var longNote = new Array(40).join("riempitivo ") + "AGO";
var s2 = Markdown.searchText(longNote, "ago");
assert(s2.snippet.indexOf("\u2026") === 0, "ellipsis before a distant hit: " + s2.snippet);
assert(s2.snippet.indexOf("AGO") >= 0, "term kept with original case");
console.log("Search tests: OK");
// ── PropfindParser ────────────────────────────────────────────────────────
var xml = '<?xml version="1.0"?>' +
'<d:multistatus xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns">' +
+158 -52
View File
@@ -2,49 +2,42 @@
<!DOCTYPE TS>
<TS version="2.1" language="it" sourcelanguage="en">
<context>
<name>MainPage</name>
<name>DavClient</name>
<message>
<source>Notes</source>
<translation>Note</translation>
<source>Request already in progress</source>
<translation>Richiesta già in corso</translation>
</message>
<message>
<source>Search</source>
<translation>Cerca</translation>
<source>Network timeout</source>
<translation>Timeout di rete</translation>
</message>
<message>
<source>No notes yet. Create one from the pulley menu.</source>
<translation>Nessuna nota. Creala dal menu in basso.</translation>
<source>Invalid credentials (401)</source>
<translation>Credenziali non valide (401)</translation>
</message>
<message>
<source>Empty folder</source>
<translation>Cartella vuota</translation>
<source>Access denied (403)</source>
<translation>Accesso negato (403)</translation>
</message>
<message>
<source>Settings</source>
<translation>Impostazioni</translation>
<source>Folder not found (404) — check the URL</source>
<translation>Cartella non trovata (404) — verifica l&apos;URL</translation>
</message>
<message>
<source>New note</source>
<translation>Nuova nota</translation>
<source>WebDAV not available (405) — the URL must point to a DAV folder</source>
<translation>WebDAV non disponibile (405) — l&apos;URL deve puntare a una cartella DAV</translation>
</message>
<message>
<source>Refresh</source>
<translation>Aggiorna</translation>
</message>
</context>
<context>
<name>NewNoteDialog</name>
<message>
<source>New note</source>
<translation>Nuova nota</translation>
<source>Server unreachable</source>
<translation>Server non raggiungibile</translation>
</message>
<message>
<source>Name</source>
<translation>Nome</translation>
<source>Server error (%1)</source>
<translation>Errore del server (%1)</translation>
</message>
<message>
<source>e.g. Idea</source>
<translation>es. Idea</translation>
<source>HTTP error %1</source>
<translation>Errore HTTP %1</translation>
</message>
</context>
<context>
@@ -82,6 +75,60 @@
<translation>Impossibile aprire: %1</translation>
</message>
</context>
<context>
<name>MainPage</name>
<message>
<source>Notes</source>
<translation>Note</translation>
</message>
<message>
<source>No notes yet. Create one from the pulley menu.</source>
<translation>Nessuna nota. Creala dal menu in basso.</translation>
</message>
<message>
<source>Empty folder</source>
<translation>Cartella vuota</translation>
</message>
<message>
<source>Settings</source>
<translation>Impostazioni</translation>
</message>
<message>
<source>New note</source>
<translation>Nuova nota</translation>
</message>
<message>
<source>Refresh</source>
<translation>Aggiorna</translation>
</message>
<message>
<source>Filter by title</source>
<translation>Filtra per titolo</translation>
</message>
<message>
<source>Search in the text</source>
<translation>Cerca nel testo</translation>
</message>
<message>
<source>Tags</source>
<translation>Tag</translation>
</message>
</context>
<context>
<name>NewNoteDialog</name>
<message>
<source>New note</source>
<translation>Nuova nota</translation>
</message>
<message>
<source>Name</source>
<translation>Nome</translation>
</message>
<message>
<source>e.g. Idea</source>
<translation>es. Idea</translation>
</message>
</context>
<context>
<name>PreviewPage</name>
<message>
@@ -100,6 +147,69 @@
<source>Edit</source>
<translation>Modifica</translation>
</message>
<message>
<source>This line is not a task</source>
<translation>Questa riga non è una casella</translation>
</message>
<message>
<source>Save in progress, the change is kept</source>
<translation>Salvataggio in corso, la modifica resta</translation>
</message>
</context>
<context>
<name>SearchPage</name>
<message>
<source>Search</source>
<translation>Cerca</translation>
</message>
<message>
<source>Only the first notes are kept in memory</source>
<translation>Restano in memoria solo le prime note</translation>
</message>
<message>
<source>Search in the text</source>
<translation>Cerca nel testo</translation>
</message>
<message>
<source>Search the notes</source>
<translation>Cerca nelle note</translation>
</message>
<message>
<source>Reading notes: %1 of %2</source>
<translation>Leggo le note: %1 di %2</translation>
</message>
<message>
<source>Looking for notes...</source>
<translation>Cerco le note...</translation>
</message>
<message>
<source>1 note</source>
<translation>1 nota</translation>
</message>
<message>
<source>%1 notes</source>
<translation>%1 note</translation>
</message>
<message>
<source>No note with this tag</source>
<translation>Nessuna nota con questo tag</translation>
</message>
<message>
<source>No note contains this text</source>
<translation>Nessun testo trovato nelle note</translation>
</message>
<message>
<source>Search again</source>
<translation>Cerca di nuovo</translation>
</message>
<message>
<source>Stop</source>
<translation>Ferma</translation>
</message>
<message>
<source> · %1 unreadable</source>
<translation> · %1 illeggibili</translation>
</message>
</context>
<context>
<name>SettingsPage</name>
@@ -129,7 +239,7 @@
</message>
<message>
<source>Enter the folder URL</source>
<translation>Inserisci l'URL della cartella</translation>
<translation>Inserisci l&apos;URL della cartella</translation>
</message>
<message>
<source>Checking...</source>
@@ -145,11 +255,11 @@
</message>
<message>
<source>The URL is https://host/remote.php/dav/files/USER/FOLDER. </source>
<translation>L'URL è https://host/remote.php/dav/files/UTENTE/CARTELLA. </translation>
<translation>L&apos;URL è https://host/remote.php/dav/files/UTENTE/CARTELLA. </translation>
</message>
<message>
<source>The password is stored locally in the app config file.</source>
<translation>La password è salvata in locale (file di configurazione dell'app).</translation>
<translation>La password è salvata in locale (file di configurazione dell&apos;app).</translation>
</message>
<message>
<source>Notes</source>
@@ -157,7 +267,7 @@
</message>
<message>
<source>The app saves automatically when you leave a note. </source>
<translation>L'app salva automaticamente quando esci da una nota. </translation>
<translation>L&apos;app salva automaticamente quando esci da una nota. </translation>
</message>
<message>
<source>Supported: headings, bold, italic, code, lists, quotes, links, tables and rules.</source>
@@ -173,46 +283,42 @@
</message>
<message>
<source>Language will be applied after restarting the app</source>
<translation>La lingua verrà applicata al riavvio dell'app</translation>
<translation>La lingua verrà applicata al riavvio dell&apos;app</translation>
</message>
</context>
<context>
<name>DavClient</name>
<name>TagPage</name>
<message>
<source>Request already in progress</source>
<translation>Richiesta già in corso</translation>
<source>Tags</source>
<translation>Tag</translation>
</message>
<message>
<source>Network timeout</source>
<translation>Timeout di rete</translation>
<source>Reading notes: %1 of %2</source>
<translation>Leggo le note: %1 di %2</translation>
</message>
<message>
<source>Invalid credentials (401)</source>
<translation>Credenziali non valide (401)</translation>
<source>Looking for notes...</source>
<translation>Cerco le note...</translation>
</message>
<message>
<source>Access denied (403)</source>
<translation>Accesso negato (403)</translation>
<source>1 tag in the notes</source>
<translation>1 tag nelle note</translation>
</message>
<message>
<source>Folder not found (404) — check the URL</source>
<translation>Cartella non trovata (404) — verifica l'URL</translation>
<source>%1 tags in the notes</source>
<translation>%1 tag nelle note</translation>
</message>
<message>
<source>WebDAV not available (405) — the URL must point to a DAV folder</source>
<translation>WebDAV non disponibile (405) — l'URL deve puntare a una cartella DAV</translation>
<source>No tags in the notes. Write #tag in a note or add a tags: field at the top.</source>
<translation>Nessun tag. Scrivi #tag in una nota o aggiungi il campo tags: in cima.</translation>
</message>
<message>
<source>Server unreachable</source>
<translation>Server non raggiungibile</translation>
<source>Scan again</source>
<translation>Rileggi le note</translation>
</message>
<message>
<source>Server error (%1)</source>
<translation>Errore del server (%1)</translation>
</message>
<message>
<source>HTTP error %1</source>
<translation>Errore HTTP %1</translation>
<source>Stop</source>
<translation>Ferma</translation>
</message>
</context>
</TS>