From 11bd26dd8639d25220b90e397e56ee11c7fc4a70 Mon Sep 17 00:00:00 2001 From: Carlo Baratto Date: Thu, 19 Nov 2026 20:44:37 +0100 Subject: [PATCH] Sottoscrizioni: il segno locale si aggiorna subito (0.23.3) Il ramo SUBSCRIBE parlava col server ma lasciava il file .grumpydove-unsubscribed nella cartella: la nota restava. Patch al motore per crearlo/toglierlo subito. Aggiunto UNSUBSCRIBE. --- engine/patch_engine.py | 37 +++++++++++++++++++++++++++++++++++++ qml/pages/NewFolderPage.qml | 14 ++++++++++++++ rpm/harbour-grumpydove.spec | 8 +++++++- src/enginebridge.cpp | 5 +++++ src/enginebridge.h | 1 + src/main.cpp | 4 ++-- 6 files changed, 66 insertions(+), 3 deletions(-) diff --git a/engine/patch_engine.py b/engine/patch_engine.py index 8153c02..48666ba 100644 --- a/engine/patch_engine.py +++ b/engine/patch_engine.py @@ -252,6 +252,43 @@ with Mail_Log;''', end; elsif Kind = "delete" then''', "ramo mkdir nel Flush"), + + # Dopo SUBSCRIBE/UNSUBSCRIBE il segno locale va aggiornato subito: il + # motore marca le cartelle non sottoscritte con un file nella loro + # directory, e senza questo la cartella resta "(unsubscribed)" finche' un + # controllo completo non riscarica la lista dal server. + ("mail_imap.adb", + ''' begin + Check (Done, Name); + Free (Box); + end; + end if; + end Server_Op;''', + ''' begin + Check (Done, Name); + Free (Box); + if Done /= 0 and then Ada.Directories.Exists (Dir) then + declare + Mark : constant String := Dir & "/.grumpydove-unsubscribed"; + Fd : GNAT.OS_Lib.File_Descriptor; + Gone : Boolean; + begin + if Op = "SUBSCRIBE" then + if Ada.Directories.Exists (Mark) then + GNAT.OS_Lib.Delete_File (Mark, Gone); + end if; + elsif not Ada.Directories.Exists (Mark) then + Fd := GNAT.OS_Lib.Create_File (Mark, GNAT.OS_Lib.Binary); + if Fd /= GNAT.OS_Lib.Invalid_FD then + GNAT.OS_Lib.Close (Fd); + end if; + end if; + end; + end if; + end; + end if; + end Server_Op;''', + "segno non sottoscritta aggiornato dopo SUBSCRIBE"), ] diff --git a/qml/pages/NewFolderPage.qml b/qml/pages/NewFolderPage.qml index 3d612ad..27bdf38 100644 --- a/qml/pages/NewFolderPage.qml +++ b/qml/pages/NewFolderPage.qml @@ -68,6 +68,14 @@ Page { onClicked: page.sottoscrivi() } + Button { + anchors.horizontalCenter: parent.horizontalCenter + visible: page.rinomina >= 0 + text: qsTr("Annulla la sottoscrizione") + preferredWidth: Theme.buttonWidthMedium + onClicked: page.annullaSottoscrizione() + } + Button { anchors.horizontalCenter: parent.horizontalCenter visible: page.rinomina >= 0 @@ -114,6 +122,12 @@ Page { pageStack.pop(); } + function annullaSottoscrizione() { + page.errore = engine.annullaSottoscrizione(page.rinomina); + if (page.errore.length === 0) + pageStack.pop(); + } + function elimina() { if (!page.confermaElimina) { page.confermaElimina = true; diff --git a/rpm/harbour-grumpydove.spec b/rpm/harbour-grumpydove.spec index 4955bf7..7721f77 100644 --- a/rpm/harbour-grumpydove.spec +++ b/rpm/harbour-grumpydove.spec @@ -1,6 +1,6 @@ Name: harbour-grumpydove Summary: Eudora-style mail interface, mobile prototype -Version: 0.23.2 +Version: 0.23.3 Release: 1 Group: Qt/Qt # Codice EUPL-1.2; le icone vengono dagli sprite di Eudora, BSD 3-Clause @@ -27,6 +27,12 @@ Icons come from the original project's Eudora bitmaps (BSD 3-Clause, Computer History Museum). %changelog +* Tue Nov 17 2026 Carlo Baratto - 0.23.3-1 +- Sottoscrivere non cambiava niente a schermo: il motore aggiornava il server + ma non il segno locale ".grumpydove-unsubscribed", quindi la cartella restava + marcata finche' un controllo completo non riscaricava la lista +- Aggiunta "Annulla la sottoscrizione" (UNSUBSCRIBE), cosi' la prova si puo' + fare e disfare * Tue Nov 17 2026 Carlo Baratto - 0.23.2-1 - Marcatori: si lavora sulla stringa invece di insert(). Sul componente di Sailfish insert() non produceva niente e i pulsanti sembravano morti diff --git a/src/enginebridge.cpp b/src/enginebridge.cpp index b3079c2..ec71899 100644 --- a/src/enginebridge.cpp +++ b/src/enginebridge.cpp @@ -663,6 +663,11 @@ QString EngineBridge::sottoscrivi(int folder) return comandoServer(QStringLiteral("SUBSCRIBE"), folder, QString()); } +QString EngineBridge::annullaSottoscrizione(int folder) +{ + return comandoServer(QStringLiteral("UNSUBSCRIBE"), folder, QString()); +} + // Se una cartella è un cestino, chiesto direttamente al motore. Non passa per // folders(): quella è la vista, e se per un attimo nasconde una cartella la // voce "Svuota il cestino" sparisce senza che sia cambiato niente. diff --git a/src/enginebridge.h b/src/enginebridge.h index fdd35cf..c153e7f 100644 --- a/src/enginebridge.h +++ b/src/enginebridge.h @@ -120,6 +120,7 @@ public: Q_INVOKABLE QString comandoServer(const QString &op, int folder, const QString &argomento); Q_INVOKABLE QString sottoscrivi(int folder); + Q_INVOKABLE QString annullaSottoscrizione(int folder); // Controllo automatico della posta: ogni quanti minuti (0 = spento). // Dimensione del testo in lettura (pinch): 0,8 - 2,4. Q_INVOKABLE qreal zoomLettura() const; diff --git a/src/main.cpp b/src/main.cpp index 62a6c1a..5fe8e38 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -32,9 +32,9 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) app->setOrganizationName(QStringLiteral("harbour")); app->setApplicationName(QStringLiteral("grumpydove")); - app->setApplicationVersion(QStringLiteral("0.23.2")); + app->setApplicationVersion(QStringLiteral("0.23.3")); - qDebug() << "harbour-grumpydove v0.23.2 build" << __DATE__ << __TIME__; + qDebug() << "harbour-grumpydove v0.23.3 build" << __DATE__ << __TIME__; // Maildir, log, rubrica e liste dei filtri nella cartella dati dell'app: // la sandbox non lascia vedere ~/Mail né scrivere sotto HOME, e cambiare