0.3.1: la nota nasce nella cartella aperta, navigazione senza voci fantasma
- NewNoteDialog riceve la cartella corrente: il file va dove sei, non nella radice del caveau. Un nome gia' presente viene rifiutato (la PUT avrebbe sovrascritto la nota senza chiedere) e il nome non puo' contenere "/". - PropfindParser.listing(): scarta la collezione stessa (il PROPFIND Depth:1 la include, e dentro una cartella sembrava di non essere entrati) e le voci nascoste (.obsidian/, .trash/), anche nella scansione di ricerca e tag: le note nel cestino non finiscono piu' nei risultati. - MainPage: se il client e' occupato la navigazione va in coda invece di essere persa, e l'elenco precedente viene svuotato subito (non resta sotto l'intestazione nuova). - Test del filtro con la risposta reale di Libro/; verificatore aggiornato per i segnali di cambio proprieta' (onBusyChanged).
This commit is contained in:
1 parent
8259297a27
commit
82d85ab30b
9 files changed
+179
-25
No files matched your search
+28
-10
@@ -12,6 +12,9 @@ Page {
|
||||
property var pendingEditor: null
|
||||
property var allEntries: []
|
||||
property string filterText: ""
|
||||
// Una navigazione chiesta mentre il client è occupato non va persa: senza
|
||||
// questa coda l'intestazione cambiava e la lista restava quella di prima.
|
||||
property bool pendingReload: false
|
||||
|
||||
onFilterTextChanged: page.applyFilter()
|
||||
|
||||
@@ -37,11 +40,26 @@ Page {
|
||||
Component.onCompleted: reload()
|
||||
|
||||
function reload() {
|
||||
if (!dav || dav.busy) return
|
||||
if (!dav) return
|
||||
if (dav.busy || dav.scanning) {
|
||||
pendingReload = true
|
||||
return
|
||||
}
|
||||
pendingReload = false
|
||||
loading = true
|
||||
dav.listDir(currentPath)
|
||||
}
|
||||
|
||||
function enterFolder(path) {
|
||||
filterText = ""
|
||||
currentPath = path
|
||||
// L'elenco vecchio non deve restare sotto l'intestazione nuova mentre
|
||||
// arriva la risposta: si vedrebbe la cartella di prima.
|
||||
allEntries = []
|
||||
notesModel.clear()
|
||||
reload()
|
||||
}
|
||||
|
||||
function applyFilter() {
|
||||
notesModel.clear()
|
||||
var f = page.filterText.trim().toLowerCase()
|
||||
@@ -59,6 +77,9 @@ Page {
|
||||
|
||||
Connections {
|
||||
target: dav
|
||||
onBusyChanged: {
|
||||
if (!dav.busy && !dav.scanning && page.pendingReload) page.reload()
|
||||
}
|
||||
onListReady: {
|
||||
loading = false
|
||||
allEntries = entries
|
||||
@@ -97,11 +118,7 @@ Page {
|
||||
ListItem {
|
||||
visible: page.currentPath !== ""
|
||||
contentHeight: Theme.itemSizeSmall
|
||||
onClicked: {
|
||||
page.filterText = ""
|
||||
page.currentPath = ""
|
||||
page.reload()
|
||||
}
|
||||
onClicked: page.enterFolder("")
|
||||
Label {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
x: Theme.paddingLarge
|
||||
@@ -124,9 +141,7 @@ Page {
|
||||
contentHeight: Theme.itemSizeMedium
|
||||
onClicked: {
|
||||
if (model.isDir) {
|
||||
page.filterText = ""
|
||||
page.currentPath = model.path
|
||||
page.reload()
|
||||
page.enterFolder(model.path)
|
||||
} else {
|
||||
pageStack.push(Qt.resolvedUrl("EditorPage.qml"),
|
||||
{ dav: page.dav, notePath: model.path, noteName: model.name })
|
||||
@@ -162,7 +177,10 @@ Page {
|
||||
MenuItem {
|
||||
text: qsTr("New note")
|
||||
onClicked: {
|
||||
var dlg = pageStack.push(Qt.resolvedUrl("NewNoteDialog.qml"), { dav: page.dav })
|
||||
var names = []
|
||||
for (var i = 0; i < page.allEntries.length; i++) names.push(page.allEntries[i].name)
|
||||
var dlg = pageStack.push(Qt.resolvedUrl("NewNoteDialog.qml"),
|
||||
{ dav: page.dav, folder: page.currentPath, existingNames: names })
|
||||
dlg.accepted.connect(function () {
|
||||
if (dlg.resultPath) {
|
||||
page.pendingEditor = { path: dlg.resultPath, name: dlg.resultName }
|
||||
|
||||
Reference in new issue
Block a user