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:
1 parent
aab29c76cb
commit
8259297a27
15 files changed
+1280
-64
No files matched your search
@@ -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)")
|
||||
|
||||
Reference in new issue
Block a user