From 696b61319c8351c7bebf91405aed4c887947c2aa Mon Sep 17 00:00:00 2001 From: Carlo Baratto Date: Wed, 11 Nov 2026 09:36:18 +0100 Subject: [PATCH] Prototipo interfaccia Sailfish per GrumpyDove: cartelle, lista, lettura con paginazione a tap, compose, copertina; dati finti e piano di porting --- .gitignore | 14 +++ README.md | 64 ++++++++++ documenti/piano-porting.md | 92 ++++++++++++++ harbour-grumpydove.pro | 27 ++++ icons/108x108/harbour-grumpydove.png | Bin 0 -> 795 bytes icons/128x128/harbour-grumpydove.png | Bin 0 -> 918 bytes icons/172x172/harbour-grumpydove.png | Bin 0 -> 1204 bytes icons/86x86/harbour-grumpydove.png | Bin 0 -> 656 bytes qml/cover/CoverPage.qml | 25 ++++ qml/harbour-grumpydove.qml | 14 +++ qml/js/dati.js | 143 +++++++++++++++++++++ qml/pages/ComposePage.qml | 111 ++++++++++++++++ qml/pages/MailboxesPage.qml | 128 +++++++++++++++++++ qml/pages/MessagePage.qml | 182 +++++++++++++++++++++++++++ qml/pages/MessagesPage.qml | 165 ++++++++++++++++++++++++ rpm/harbour-grumpydove.desktop | 15 +++ rpm/harbour-grumpydove.spec | 51 ++++++++ scripts/make_icons.py | 33 +++++ src/main.cpp | 34 +++++ tests/test_dati.js | 48 +++++++ 20 files changed, 1146 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 documenti/piano-porting.md create mode 100644 harbour-grumpydove.pro create mode 100644 icons/108x108/harbour-grumpydove.png create mode 100644 icons/128x128/harbour-grumpydove.png create mode 100644 icons/172x172/harbour-grumpydove.png create mode 100644 icons/86x86/harbour-grumpydove.png create mode 100644 qml/cover/CoverPage.qml create mode 100644 qml/harbour-grumpydove.qml create mode 100644 qml/js/dati.js create mode 100644 qml/pages/ComposePage.qml create mode 100644 qml/pages/MailboxesPage.qml create mode 100644 qml/pages/MessagePage.qml create mode 100644 qml/pages/MessagesPage.qml create mode 100644 rpm/harbour-grumpydove.desktop create mode 100644 rpm/harbour-grumpydove.spec create mode 100644 scripts/make_icons.py create mode 100644 src/main.cpp create mode 100644 tests/test_dati.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b313b8e --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +*.o +*.rpm +*.tar.gz +Makefile +moc_*.cpp +moc_*.h +*.qm +documentation.list +/build-*/ +/RPMS/ +/.sfdk/ +/qmltypes/ +# il binario compilato in build (shadow build di sfdk lo mette qui) +/harbour-grumpydove diff --git a/README.md b/README.md new file mode 100644 index 0000000..0bc1a94 --- /dev/null +++ b/README.md @@ -0,0 +1,64 @@ +# harbour-grumpydove — prototipo dell'interfaccia + +Schermate Sailfish (Silica/QML) per il porting di **GrumpyDove**, il client +mail in stile Eudora di LowEel (Ada + Qt 6, licenza EUPL-1.2): + + +Questo pacchetto **non è il client**: è la sola interfaccia, con dati finti in +`qml/js/dati.js`, e serve a decidere se e come portare il motore. Non fa rete, non +legge la posta, non manda nulla. + +## Perché esiste + +Il porting ha un ostacolo tecnico che non si vede dalle schermate (toolchain Ada +su ARM e tre librerie assenti dai repo Sailfish: libetpan, gpgme, jansson — vedi +`documenti/piano-porting.md`). Prima di spendere settimane su quello conviene +sapere se l'interfaccia mobile regge, perché è la parte che si può buttare via +senza rimpianti se il disegno non funziona. + +## Le schermate + +- **Cartelle** — l'albero di Eudora appiattito in lista: account in cima, + cartelle rientrate per profondità, sottocartelle sotto. Non letti in grassetto, + numero a destra; Out e Trash non si marcano mai (regola di Eudora), Junk è + marcato senza sbilanciare l'account. +- **Messaggi** — mittente sopra (grassetto se non letto, barra colorata a + sinistra), oggetto sotto, data a destra. Niente tabelle a colonne: su un + telefono non ci stanno. Menù a tendina per scaricare la posta e filtrare i non + letti, menù dal basso per l'ordinamento. +- **Lettura** — intestazioni (Da / A / data), corpo in testo, posizione + «3 di 12». **Paginazione a tap**: tocco sul lato destro = messaggio + successivo, sinistro = precedente; il centro resta scorrevole. +- **Compose** — A, Oggetto, Testo; l'invio è finto e conferma a schermo. +- **Copertina** — non letti totali. + +## Costruire e installare + +```sh +export PATH=$HOME/SailfishOS/bin:$PATH +export XDG_RUNTIME_DIR=/run/user/47446 +sfdk -c target=SailfishOS-5.1.0.11-aarch64 build -j4 +# RPM in RPMS/, poi sul telefono: +# scp RPMS/*/harbour-grumpydove-*.rpm defaultuser@: +# devel-su rpm -ivh harbour-grumpydove-*.rpm +``` + +## Controlli + +```sh +node tests/test_dati.js # ruoli e conteggi dei dati finti +qmllint qml/pages/*.qml qml/cover/*.qml # sintassi (Silica assente: filtrare i moduli mancanti) +``` + +## Debito noto (prima di ogni pubblicazione) + +- Le stringhe sono in **italiano nel QML**. Per Harbour servono in inglese con il + catalogo `.ts` italiano accanto (`sailfishapp_i18n`), come negli altri progetti + dell'archivio. +- Il prototipo non ha impostazioni, né persistenza: i non letti si azzerano + riaprendo l'app. + +## Licenza + +Le schermate sono lavoro nuovo, ma il progetto nasce da GrumpyDove (EUPL-1.2): +la licenza del porting resta la stessa. diff --git a/documenti/piano-porting.md b/documenti/piano-porting.md new file mode 100644 index 0000000..7fd1f82 --- /dev/null +++ b/documenti/piano-porting.md @@ -0,0 +1,92 @@ +# Porting di GrumpyDove su Sailfish OS + +Stato al 11 novembre 2026. Ogni numero qui sotto è stato letto dal codice o dai +repo, non stimato a memoria. + +## Cos'è GrumpyDove + +Client mail in stile Eudora Pro, di LowEel, versione 1.0.0-beta2 (10/11/2026). +Licenza **EUPL-1.2** (copyleft, compatibile con un fork pubblico). +Sorgente: + +| parte | righe | note | +|---|---|---| +| Ada (`src/*.adb`, `.ads`) | 11.079 | motore: IMAP, JMAP, MIME, Maildir, filtri, PGP/S-MIME, CardDAV, ricerca | +| C (`imap_shim.c`, `jmap_shim.c`, `smtp_bridge.c`, `carddav_shim.c`, `image_fetch.c`) | 2.220 | bridge verso libetpan, curl, libxml2 | +| C++ (`qt_shim.cpp`, `styled_edit.h`, `html_view.h`) | 9.778 | **tutta** la vista: Qt Widgets | +| litehtml (in `third_party/`) | — | rendering HTML delle mail | + +Il confine è già pulito: `src/qt_shim.h` dichiara un'API C a callback (~40 +funzioni) e `qt_bridge.ads` la rispecchia lato Ada. **Ada non sa nulla di Qt.** +È l'architettura giusta per un porting: il motore si tiene, la vista si cambia. + +## I tre ostacoli, in ordine di rischio + +### 1. Toolchain Ada (rischio alto, incognita vera) + +Sailfish SDK non include GNAT e nessuno ha mai portato Ada su Sailfish. +Debian però fornisce già il cross-compilatore: `gnat-12-aarch64-linux-gnu` +(12.2.0-14cross1, presente in bookworm). Serve: + +- compilare il motore Ada contro il **sysroot Sailfish** (non contro glibc 2.36 + dell'host: un binario compilato su glibc più nuova non parte su quella + vecchia); +- linkare **libgnat staticamente** per non trascinarsi dietro un runtime Ada + compilato contro header sbagliati; +- verificare a runtime le chiamate POSIX del runtime (pthread, file, orologio). + +Se lo spike di un giorno non passa, il porting si ferma qui: non c'è una +scorciatoia decente (riscrivere 11.000 righe di Ada in C++ non è un'opzione). + +### 2. Librerie assenti dai repo (rischio medio, lavoro noto) + +Verificato sull'indice **Chum per SailfishOS 4.6 aarch64** (2.214 pacchetti): + +| libreria | serve per | stato | +|---|---|---| +| libetpan | parsing IMAP (`imap_shim.c`) | **assente** → compilare e includere nel pacchetto | +| gpgme | OpenPGP e S/MIME | **assente** → idem (con libassuan, libgpg-error) | +| jansson | JSON di JMAP | **assente** → idem (banale) | +| curl | SMTP, JMAP, CardDAV | presente | +| gnutls | TLS | presente (`gnutls37`) | +| hunspell | correttore | dizionari presenti; l'header va verificato | +| litehtml | HTML mail | incluso nei sorgenti | + +Con librerie non-Harbour il pacchetto **non può andare su Harbour**: si +distribuisce da OpenRepos o da Gitea, come harbour-henflow. + +### 3. La vista (rischio basso, lavoro lungo) + +Il target SailfishOS 5.1.0.11 installato qui conferma **Qt 5.6.3 + QML**, e +`libQt5Widgets` non esiste: le 9.778 righe di Widgets non si compilano, si +riscrivono. Non è un trapianto ma un disegno nuovo: Eudora è multi-finestra, con +tabella a colonne, temi, editor con stile e menù a cascata — niente di tutto ciò +ha senso su un telefono. Il prototipo in questo repo è il primo passo. + +Aggiunta: l'HTML passa da litehtml che disegna su QWidget. Su Silica le strade +sono due — renderizzare in un'immagine, o convertire in testo +(`mail_text.adb` sa già farlo). Per le mail di servizio e le liste la seconda +basta e avanza; per le newsletter bisogna decidere. + +## Piano + +| fase | contenuto | stima | +|---|---|---| +| 0 | spike toolchain: «hello Ada» aarch64 nel sysroot Sailfish, eseguito sul telefono | 1-3 giorni | +| 1 | prototipo interfaccia con dati finti (questo repo) | fatto | +| 2 | bridge C++/Qt5 che implementa il contratto di `qt_shim.h` come QObject + modelli lista | 1 settimana | +| 3 | MVP: IMAP + SMTP, cartelle, lista, lettura, compose, allegati | 2-3 settimane | +| 4 | PGP, CardDAV, filtri, junk, ricerca | dopo | +| 5 | S/MIME (`gpgsm`), bogofilter, Hunspell | da valutare: su SFOS vanno portati a mano | + +Ordine obbligato: la fase 0 prima della 2. Non ha senso scrivere il bridge e +scoprire dopo che il motore non parte. + +## Alternative, per completezza + +- **Non portare il motore, riscriverlo**: si perde l'unica cosa che rende + GrumpyDove interessante (la fedeltà a Eudora nel comportamento, non + nell'aspetto) e si riparte da zero su IMAP. +- **Client nuovo nativo**: stesso lavoro del punto sopra, senza il riferimento. +- **Restare sul desktop**: GrumpyDove gira su Debian/Fedora; su Sailfish il + client integrato resta quello che c'è. diff --git a/harbour-grumpydove.pro b/harbour-grumpydove.pro new file mode 100644 index 0000000..4d6791e --- /dev/null +++ b/harbour-grumpydove.pro @@ -0,0 +1,27 @@ +TEMPLATE = app +TARGET = harbour-grumpydove + +CONFIG += sailfishapp +CONFIG += c++11 + +SOURCES += src/main.cpp + +OTHER_FILES += \ + qml/harbour-grumpydove.qml \ + qml/pages/*.qml \ + qml/cover/*.qml \ + qml/js/*.js \ + rpm/harbour-grumpydove.spec \ + rpm/harbour-grumpydove.desktop + +DISTFILES += $$OTHER_FILES + +icons86.path = /usr/share/icons/hicolor/86x86/apps +icons86.files = $$PWD/icons/86x86/harbour-grumpydove.png +icons108.path = /usr/share/icons/hicolor/108x108/apps +icons108.files = $$PWD/icons/108x108/harbour-grumpydove.png +icons128.path = /usr/share/icons/hicolor/128x128/apps +icons128.files = $$PWD/icons/128x128/harbour-grumpydove.png +icons172.path = /usr/share/icons/hicolor/172x172/apps +icons172.files = $$PWD/icons/172x172/harbour-grumpydove.png +INSTALLS += icons86 icons108 icons128 icons172 diff --git a/icons/108x108/harbour-grumpydove.png b/icons/108x108/harbour-grumpydove.png new file mode 100644 index 0000000000000000000000000000000000000000..d405f059d80283104304e9e846aec83cdd2223a2 GIT binary patch literal 795 zcmeAS@N?(olHy`uVBq!ia0vp^IUvlz1|<8_!p|}=Fg@~gaSW-L^LDOnp0uF|TYQs@ z%i38XmJU&ly{{PdId{n@yS`IU*eZQEmv4erZ`56tOs9sZ3BSGd?z^8iY0K%pR%8;B zrF$a{Xd;94hjmvR>$X=jhVbDo)Mvh{&$o6gMPF#a4k`}(S+I~?3wR-CO4 zHGJ1H^KJBOr%*%Rvd&`5x%xNfru_I7b;X4>Moi3jo6g#`zM<1*em<1s6{8s_CRz}G zW5U+0UlmUKtk^I^b?a9pErsxiGaZGmOcICU4a%{wzDLry2GfP#@y!oi= z@MoiVWZGO#Zl0xIU8WzZV#6A+zmDG5zh8glpI|;07bxsQB8BSfen%xo7;sI-8WmUt zl{IsIOrNumSCd}^6p<&mk|T4x^Zsf2^aLh`Tx;7{x!fS#$JI!)=Twd1YJ(+j56`Kb zw^v1JtzPl-@{KKP|3~x4MM@odl_ju!uIcJ)&r#U3)kWZr{9>V|JX+hrbcg zE&AE=9zSX$XCGh1Bv3d1+LKK?7+UUcU;0x=i{atz4JymuFbV9_-C3C`+VCOw)XChh z`dQW$Ui-L~{oGE>KFU54HDJjIqqj7I_)3NJDl{5vjmdNQX%A5+I-hDRC=7Fj~OytI1hK;UgbYqU*`Ncndb#+zU&A<6TG5_=Wo0a1?vaI}c-9~Bk9mYAocdxjy z=FXSs2@t*>V=wG=IL{826TW#4P(yEUS7eg&-YVdma#ccq4@MaQ4n8^{V} zwDF$qvie~4T^YvUs{JZa{P%bIsXMGVo}Ae7VDCD02aVFkRi?aaVm}3)5jl`us`KTS z@4c|Q@{GY*^4!X7?`O_tSh#n;wM6Olb|1fn3v!nemUzc?z2p?oD)p3kJ88O+596M# z(_LB%?T`KuG)R59ae>4h^AyHCca)aI*>8H-*P!X$Ec0&hle_0lHj?bWUb|lx-0DlACF_TCZ`+0{`ryn<7vC9)A3M z+V#afy3(6Y_$}jjn=|*AtGlJ^ise@f_uP*3lRWk49xE`LCH-R%aCdy6KP4(3lsi0K L{an^LB{Ts5#Cw>! literal 0 HcmV?d00001 diff --git a/icons/172x172/harbour-grumpydove.png b/icons/172x172/harbour-grumpydove.png new file mode 100644 index 0000000000000000000000000000000000000000..9ba268c6ab5252750ed4dee59f98ca03f8a59d7a GIT binary patch literal 1204 zcmeAS@N?(olHy`uVBq!ia0vp^Ye1NT4M;vSbicvCz*6n$;uumf=k0CVA`y3nwuc9w zHcyx&P{NYw@jz|AIa@^EO9Rt|;Tb`bu1D`jv>=THM-U&sJPK`6}V4SLfEf zYq-MJ=xkgz`{=>0sixDu1^*#}~>0-1;BoC7jhyhRQQJx$v1ZvC5=LHT0SG@4Yq5;~P47IBcpj4P=x zum0j(v0!IHwDp3xyZ7(@`@S{fW%i|z4VRg-UQVdG{ORWZsxQnEwLiZ6Tt0vI{@t?s z{`|cDu77E`{QW(3->$!VpVz+n_3XQHr;BGr-gwUU`tj`R`f@6zOXd_BAB>w+v>?-q zZDH$bC*km>o$Q8kYqFhWRh2IsDov1(io5~TxQJuzTdSql*Gywu)S2ME^di^xn9LQr zN3D2zV>p)`W1dyL;qm+Ir<$unmwrEg%}LgD>xST^?AH!)H-$}|T1r0!ynE+ zoT{@t-@+!ON{;hYkA7h^P zyEXG^bXT->^@_zaT5HeT`nP_1M7v@^;__*0-hMg1^tI-dz&D5dzW!MBW{v(Tz0SBB zE90(hJ03dM>gXZAxs|!qu~%1K)_HT~=Cy6#fr6F!C;~FoaukI zW$`WtYMZk4>zDtV^u)?mJ>4q$I`yv3n~>~m?JGZbMc-Jd`hUSPvyIbU7A4B>-nH*$ zZEowXo`nBfpPL?B{r~B%eL^;=r^Qq6t%^E-$S$#at7w+2*f&9u;M9jXWQ0+dY_>M7q4o#v7rdR_31mntJysqMkAPa!>z z&qrRZVu`+Ja^|>wPnbrzwBQDj)X+= z(;!;X6>t9g@9pc=wsIUiho9bqCHd5_4evI-N%TtxI$?A3)=fE?dGSD|>%pkVZ2_02 zwyJs+ZU~z;%d0wS%Z5cu+f-$D3KeuLUA)~QLi@B}nC_a4$RuC$)$3UnEj@B8Zq?Cm z-|qgF-)blJJUIKts`ZNtD%U*QT=2D=Ge&U6s=J4m6-M5!%QcPJy=Gy-?~PxL->mb$ sf5>+I-gQmw_sm)6oX!>nl@v4H=GQl^Drpy*oCe~0y85}Sb4q9e03B~b_y7O^ literal 0 HcmV?d00001 diff --git a/icons/86x86/harbour-grumpydove.png b/icons/86x86/harbour-grumpydove.png new file mode 100644 index 0000000000000000000000000000000000000000..55c7715c7813eaa6a002e44535f58ff213148e9b GIT binary patch literal 656 zcmeAS@N?(olHy`uVBq!ia0vp^VIa)G1|&nn62CJrFok=%IEGZrc{|tE@34bFtN0Pe zOUo8MV%RcG`ntzXX4c~i9`H?EaoHu)l0nq>)*Tipoi}IyRg^!kJpQBBcZ$ZnGj(+{ zx5{dowFx+Jbj`lQ`(9pdzbf~|Q`eunPh0$?_nOib*RCfg^J6v#%+_qmU(VyQGI`mL zj;^I4=7#!?8>dLAJvpvDEok|}&n7F6Pb!&{H1nEC%)S{B0^vZGO-{a#4o4TO<3)WcUaPRSDNlSt0NBulL>x zn0`aiFf(eY)Z&;mhL4Zt{#X&Y%8*;&cJk?~=aP=-@uGy%qx3lc_4${a^@P+w;U+LUHx3v IIVCg!01C$;@c;k- literal 0 HcmV?d00001 diff --git a/qml/cover/CoverPage.qml b/qml/cover/CoverPage.qml new file mode 100644 index 0000000..de1aee1 --- /dev/null +++ b/qml/cover/CoverPage.qml @@ -0,0 +1,25 @@ +import QtQuick 2.0 +import Sailfish.Silica 1.0 +import "../js/dati.js" as Dati + +CoverBackground { + Column { + anchors.centerIn: parent + spacing: Theme.paddingSmall + + Label { + anchors.horizontalCenter: parent.horizontalCenter + text: "GrumpyDove" + font.pixelSize: Theme.fontSizeMedium + color: Theme.primaryColor + } + Label { + anchors.horizontalCenter: parent.horizontalCenter + text: Dati.totalUnread() > 0 + ? qsTr("%1 non letti").arg(Dati.totalUnread()) + : qsTr("Nessun non letto") + font.pixelSize: Theme.fontSizeSmall + color: Theme.highlightColor + } + } +} diff --git a/qml/harbour-grumpydove.qml b/qml/harbour-grumpydove.qml new file mode 100644 index 0000000..f75ea27 --- /dev/null +++ b/qml/harbour-grumpydove.qml @@ -0,0 +1,14 @@ +import QtQuick 2.0 +import Sailfish.Silica 1.0 +import "pages" +import "cover" + +ApplicationWindow { + id: app + + initialPage: Component { MailboxesPage { } } + cover: Component { CoverPage { } } + + // Nessun vincolo sulla finestra: le orientazioni si dichiarano per pagina, + // altrimenti l'intersezione blocca tutto. +} diff --git a/qml/js/dati.js b/qml/js/dati.js new file mode 100644 index 0000000..78da829 --- /dev/null +++ b/qml/js/dati.js @@ -0,0 +1,143 @@ +// Dati finti per il prototipo dell'interfaccia GrumpyDove Mobile. +// Struttura ispirata a Eudora: account in cima, cartelle annidate sotto, +// conteggio dei non letti che risale fino all'account. +// ES5 puro: si puo' caricare con node per i test. + +var ACCOUNTS = [ + { name: "carlo@example.org", unread: 9 }, + { name: "progetti@example.net", unread: 2 } +]; + +// depth = livello di annidamento nella vista ad albero +var MAILBOXES = [ + { name: "carlo@example.org", depth: 0, unread: 9, kind: "account", mailbox: "" }, + { name: "In", depth: 1, unread: 7, kind: "in", mailbox: "in" }, + { name: "Out", depth: 1, unread: 0, kind: "out", mailbox: "out" }, + { name: "Draft", depth: 1, unread: 2, kind: "draft", mailbox: "draft" }, + { name: "Junk", depth: 1, unread: 3, kind: "junk", mailbox: "junk" }, + { name: "Trash", depth: 1, unread: 0, kind: "trash", mailbox: "trash" }, + { name: "Liste", depth: 1, unread: 0, kind: "folder", mailbox: "liste" }, + { name: "Sailfish", depth: 2, unread: 0, kind: "folder", mailbox: "liste-sailfish" }, + { name: "progetti@example.net", depth: 0, unread: 2, kind: "account", mailbox: "" }, + { name: "In", depth: 1, unread: 2, kind: "in", mailbox: "p-in" }, + { name: "Out", depth: 1, unread: 0, kind: "out", mailbox: "p-out" }, + { name: "Trash", depth: 1, unread: 0, kind: "trash", mailbox: "p-trash" } +]; + +var MESSAGES = { + "in": [ + { sender: "Anna Rossi", address: "anna.rossi@example.com", + subject: "Cena di sabato", + date: "11/11 09:12", unread: true, junk: false, attachment: false, + body: "Ciao,\n\nsabato siamo in sei, pensavo alle otto. Porto io il dolce.\nSe ti serve una mano per il resto dimmi pure.\n\nA presto,\nAnna" }, + { sender: "Comune di Example", address: "protocollo@example.gov.it", + subject: "Avviso scadenza TARI 2026", + date: "11/11 07:40", unread: true, junk: false, attachment: true, + body: "Si informa che il termine per il versamento della seconda rata e' fissato al 16 dicembre 2026.\n\nIl modulo precompilato e' in allegato." }, + { sender: "Banca Example", address: "avvisi@example.bank", + subject: "Movimenti del mese di ottobre", + date: "10/11 18:03", unread: true, junk: false, attachment: true, + body: "Gentile cliente,\n\nl'estratto conto di ottobre e' disponibile nell'area riservata.\n\nNon rispondere a questo messaggio." }, + { sender: "Luca Bianchi", address: "luca@example.net", + subject: "Re: preventivo tettoia", + date: "10/11 14:22", unread: false, junk: false, attachment: false, + body: "Va bene, la misura da tre metri mi torna.\nPasso in settimana a vedere il posto, ti confermo il giorno." }, + { sender: "Newsletter Example", address: "news@example.org", + subject: "Le novita' di novembre", + date: "09/11 11:00", unread: false, junk: true, attachment: false, + body: "Scopri le offerte del mese. Se non vuoi piu' ricevere queste comunicazioni, disiscriviti qui." }, + { sender: "Giulia Verdi", address: "giulia@example.com", + subject: "Foto della gita", + date: "08/11 21:47", unread: false, junk: false, attachment: true, + body: "Ecco le foto, sono venute bene quelle sul molo.\n\nFammi sapere se le vuoi a piena risoluzione." }, + { sender: "Assistenza Example", address: "support@example.io", + subject: "Il tuo ticket #4412 e' stato chiuso", + date: "07/11 16:31", unread: false, junk: false, attachment: false, + body: "Il problema segnalato e' stato risolto. Se si ripresenta rispondi a questa email entro 14 giorni." }, + { sender: "Paolo Neri", address: "paolo.neri@example.org", + subject: "Prenotazione campo giovedi'", + date: "06/11 20:15", unread: true, junk: false, attachment: false, + body: "Ho prenotato per giovedi' alle 21. Siamo in quattro, se vuoi unirti c'e' posto." } + ], + "junk": [ + { sender: "Vincite Facili", address: "promo@example.xyz", + subject: "HAI VINTO un buono spesa!", + date: "11/11 03:11", unread: true, junk: true, attachment: false, + body: "Clicca qui per riscattare il tuo premio entro 24 ore." }, + { sender: "Pharma Deal", address: "info@example.xyz", + subject: "Offerta riservata", + date: "10/11 04:02", unread: true, junk: true, attachment: false, + body: "Sconti fino all'80% solo per te." }, + { sender: "Crypto Daily", address: "news@example.xyz", + subject: "Il titolo che triplichera'", + date: "09/11 02:45", unread: true, junk: true, attachment: false, + body: "Non perdere questa occasione irripetibile." } + ], + "out": [ + { sender: "Carlo", address: "carlo@example.org", + subject: "Re: Cena di sabato", + date: "10/11 19:30", unread: false, junk: false, attachment: false, + body: "Perfetto per le otto, ci sono.\nPorto il vino." }, + { sender: "Carlo", address: "carlo@example.org", + subject: "Documenti per la pratica", + date: "08/11 10:04", unread: false, junk: false, attachment: true, + body: "In allegato i documenti firmati.\n\nCarlo" } + ], + "draft": [ + { sender: "Bozza", address: "", + subject: "Risposta al Comune", + date: "11/11 08:02", unread: true, junk: false, attachment: false, + body: "Buongiorno,\n\nin merito all'avviso ricevuto chiedo chiarimenti su..." }, + { sender: "Bozza", address: "", + subject: "Lista per la spesa", + date: "09/11 22:10", unread: true, junk: false, attachment: false, + body: "latte, pane, caffe', pastiglie" } + ], + "trash": [], + "liste": [ + { sender: "Sailfish Community", address: "list@example.org", + subject: "[SFOS] Rilascio 5.1 e SDK", + date: "05/11 12:00", unread: false, junk: false, attachment: false, + body: "E' disponibile il nuovo rilascio con note e immagini." } + ], + "liste-sailfish": [ + { sender: "Mailing list", address: "dev@example.org", + subject: "[Dev] QML e paginazione a tap", + date: "04/11 09:30", unread: false, junk: false, attachment: false, + body: "Qualcuno ha gia' provato il pattern del tap destro/sinistro?" } + ], + "p-in": [ + { sender: "Maria Conte", address: "maria@example.net", + subject: "Bozza articolo per il blog", + date: "11/11 08:50", unread: true, junk: false, attachment: true, + body: "Ti mando la bozza, manca la parte finale sulle fonti.\n\nDimmi cosa ne pensi." }, + { sender: "Dario Sala", address: "dario@example.net", + subject: "Fattura 2026/114", + date: "10/11 15:10", unread: true, junk: false, attachment: true, + body: "In allegato la fattura del mese." } + ], + "p-out": [], + "p-trash": [] +}; + +// Non letti per cartella: serve alla lista cartelle e alla copertina. +function unreadOf(mailbox) { + var list = MESSAGES[mailbox] || []; + var n = 0; + for (var i = 0; i < list.length; i++) { + if (list[i].unread) n++; + } + return n; +} + +function totalUnread() { + var n = 0; + for (var i = 0; i < MAILBOXES.length; i++) { + if (MAILBOXES[i].kind === "account") n += MAILBOXES[i].unread; + } + return n; +} + +function messagesOf(mailbox) { + return MESSAGES[mailbox] || []; +} diff --git a/qml/pages/ComposePage.qml b/qml/pages/ComposePage.qml new file mode 100644 index 0000000..d7fff4d --- /dev/null +++ b/qml/pages/ComposePage.qml @@ -0,0 +1,111 @@ +import QtQuick 2.0 +import Sailfish.Silica 1.0 + +// Composizione. Nel prototipo l'invio e' finto: mostra la conferma e torna +// indietro, per valutare il flusso dei campi su telefono. +Page { + id: page + + property string destinatario: "" + property string oggetto: "" + property string corpo: "" + + SilicaFlickable { + anchors.fill: parent + contentHeight: colonna.height + Theme.paddingLarge + + PageHeader { title: qsTr("Nuovo messaggio") } + + Column { + id: colonna + anchors.top: parent.top + anchors.topMargin: Theme.itemSizeLarge + width: parent.width + spacing: Theme.paddingMedium + + TextField { + id: campoA + width: parent.width - 2 * Theme.horizontalPageMargin + anchors.horizontalCenter: parent.horizontalCenter + label: qsTr("A") + placeholderText: qsTr("indirizzo") + text: page.destinatario + inputMethodHints: Qt.ImhEmailCharactersOnly | Qt.ImhNoAutoUppercase + EnterKey.enabled: true + EnterKey.iconSource: "image://theme/icon-m-enter-next" + EnterKey.onClicked: campoOggetto.forceActiveFocus() + } + + TextField { + id: campoOggetto + width: parent.width - 2 * Theme.horizontalPageMargin + anchors.horizontalCenter: parent.horizontalCenter + label: qsTr("Oggetto") + text: page.oggetto + EnterKey.enabled: true + EnterKey.iconSource: "image://theme/icon-m-enter-next" + EnterKey.onClicked: campoCorpo.forceActiveFocus() + } + + TextArea { + id: campoCorpo + width: parent.width - 2 * Theme.horizontalPageMargin + anchors.horizontalCenter: parent.horizontalCenter + label: qsTr("Testo") + text: page.corpo + // Il campo cresce con il testo: nessuno scroll annidato. + height: Math.max(Theme.itemSizeLarge * 4, + implicitHeight + Theme.paddingLarge) + } + + Button { + anchors.horizontalCenter: parent.horizontalCenter + text: qsTr("Invia") + preferredWidth: Theme.buttonWidthSmall + onClicked: page.invia() + } + + Label { + width: parent.width - 2 * Theme.horizontalPageMargin + anchors.horizontalCenter: parent.horizontalCenter + horizontalAlignment: Text.AlignHCenter + text: qsTr("Nel prototipo non parte nulla: i dati sono finti.") + font.pixelSize: Theme.fontSizeExtraSmall + color: Theme.secondaryColor + wrapMode: Text.Wrap + } + } + + VerticalScrollDecorator { } + } + + function invia() { + if (campoA.text.length === 0) { + avviso.text = qsTr("Manca il destinatario"); + avvisoTimer.restart(); + return; + } + avviso.text = qsTr("Messaggio inviato"); + avvisoTimer.restart(); + timerPop.restart(); + } + + Label { + id: avviso + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + anchors.bottomMargin: Theme.paddingLarge + font.pixelSize: Theme.fontSizeSmall + color: Theme.highlightColor + } + Timer { + id: avvisoTimer + interval: 1500 + onTriggered: avviso.text = "" + } + Timer { + id: timerPop + interval: 700 + onTriggered: pageStack.pop() + } +} diff --git a/qml/pages/MailboxesPage.qml b/qml/pages/MailboxesPage.qml new file mode 100644 index 0000000..c9066f4 --- /dev/null +++ b/qml/pages/MailboxesPage.qml @@ -0,0 +1,128 @@ +import QtQuick 2.0 +import Sailfish.Silica 1.0 +import "../js/dati.js" as Dati + +// Cartelle: l'albero di Eudora (account -> cartelle -> sottocartelle) +// appiattito in una lista, con i non letti che risalgono fino all'account. +Page { + id: page + + ListModel { id: cartelle } + + Component.onCompleted: { + for (var i = 0; i < Dati.MAILBOXES.length; i++) { + var m = Dati.MAILBOXES[i]; + cartelle.append({ + nome: m.name, + livello: m.depth, + nonLetti: m.unread, + tipo: m.kind, + mailbox: m.mailbox + }); + } + } + + function apriCartella(nome, box) { + if (box === "") return; // l'account non e' una cartella + pageStack.push(Qt.resolvedUrl("MessagesPage.qml"), + { cartella: box, titolo: nome }); + } + + SilicaListView { + id: lista + anchors.fill: parent + model: cartelle + + header: PageHeader { + title: qsTr("Cartelle") + description: qsTr("%1 non letti").arg(Dati.totalUnread()) + } + + PullDownMenu { + MenuItem { + text: qsTr("Scarica la posta") + onClicked: page.carica() // nel prototipo non fa nulla + } + MenuItem { + text: qsTr("Nuovo messaggio") + onClicked: pageStack.push(Qt.resolvedUrl("ComposePage.qml")) + } + } + + delegate: BackgroundItem { + id: riga + + height: Math.max(Theme.itemSizeMedium, etichetta.implicitHeight + Theme.paddingLarge) + onClicked: page.apriCartella(model.nome, model.mailbox) + + // Rientro per profondita': la gerarchia si vede, non si spiega. + Rectangle { + id: barra + x: Theme.horizontalPageMargin + model.livello * Theme.paddingLarge + width: Theme.paddingSmall / 3 + height: parent.height - Theme.paddingMedium + anchors.verticalCenter: parent.verticalCenter + color: model.tipo === "account" ? Theme.highlightColor : "transparent" + visible: model.tipo !== "account" + } + + Column { + id: etichetta + anchors.left: parent.left + anchors.leftMargin: Theme.horizontalPageMargin + model.livello * Theme.paddingLarge + anchors.right: conteggio.left + anchors.rightMargin: Theme.paddingMedium + anchors.verticalCenter: parent.verticalCenter + + Label { + width: parent.width + text: model.nome + font.bold: model.nonLetti > 0 || model.tipo === "account" + truncationMode: TruncationMode.Fade + color: riga.highlighted ? Theme.highlightColor : Theme.primaryColor + } + Label { + width: parent.width + visible: model.tipo === "account" + text: qsTr("account") + font.pixelSize: Theme.fontSizeExtraSmall + color: Theme.secondaryColor + } + } + + Label { + id: conteggio + anchors.right: parent.right + anchors.rightMargin: Theme.horizontalPageMargin + anchors.verticalCenter: parent.verticalCenter + // Out e Trash non si marcano mai: e' la regola di Eudora. + text: (model.nonLetti > 0 && model.tipo !== "out" && model.tipo !== "trash") + ? model.nonLetti : "" + font.bold: true + color: model.tipo === "junk" ? Theme.secondaryHighlightColor + : Theme.highlightColor + } + } + + VerticalScrollDecorator { } + } + + function carica() { + avviso.text = qsTr("Controllo la posta...") + avvisoTimer.restart() + } + + Label { + id: avviso + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + anchors.bottomMargin: Theme.paddingLarge + font.pixelSize: Theme.fontSizeSmall + color: Theme.highlightColor + } + Timer { + id: avvisoTimer + interval: 1500 + onTriggered: avviso.text = "" + } +} diff --git a/qml/pages/MessagePage.qml b/qml/pages/MessagePage.qml new file mode 100644 index 0000000..ea7212e --- /dev/null +++ b/qml/pages/MessagePage.qml @@ -0,0 +1,182 @@ +import QtQuick 2.0 +import Sailfish.Silica 1.0 +import "../js/dati.js" as Dati + +// Lettura di un messaggio. Paginazione a tap: un tocco sul lato destro passa +// al messaggio successivo, sul sinistro al precedente. Il corpo resta +// scorrevole al centro, cosi' i due gesti non si rubano. +Page { + id: page + + property string cartella: "in" + property int indice: 0 + property string titolo: "In" + + property var messaggio: ({}) + property int totale: 0 + + Component.onCompleted: leggi() + + function leggi() { + var lista = Dati.messagesOf(page.cartella); + page.totale = lista.length; + page.messaggio = (page.indice >= 0 && page.indice < lista.length) + ? lista[page.indice] : ({}); + avviso.text = ""; + } + + function vai(delta) { + var nuovo = page.indice + delta; + if (nuovo < 0 || nuovo >= page.totale) { + avviso.text = delta < 0 ? qsTr("Primo messaggio") + : qsTr("Ultimo messaggio"); + avvisoTimer.restart(); + return; + } + pageStack.replace(Qt.resolvedUrl("MessagePage.qml"), { + cartella: page.cartella, + indice: nuovo, + titolo: page.titolo + }); + } + + SilicaFlickable { + anchors.fill: parent + contentHeight: contenuto.height + Theme.paddingLarge + + PageHeader { + id: intestazione + title: page.messaggio.subject ? page.messaggio.subject : "" + description: qsTr("%1 di %2").arg(page.indice + 1).arg(page.totale) + } + + Column { + id: contenuto + anchors.top: intestazione.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.leftMargin: Theme.horizontalPageMargin + anchors.rightMargin: Theme.horizontalPageMargin + spacing: Theme.paddingSmall + + Label { + width: parent.width + text: qsTr("Da: %1").arg(page.messaggio.sender ? page.messaggio.sender : "") + font.pixelSize: Theme.fontSizeSmall + color: Theme.highlightColor + truncationMode: TruncationMode.Fade + } + Label { + width: parent.width + text: page.messaggio.address ? page.messaggio.address : "" + font.pixelSize: Theme.fontSizeExtraSmall + color: Theme.secondaryColor + truncationMode: TruncationMode.Fade + } + Label { + width: parent.width + text: qsTr("A: me — %1").arg(page.messaggio.date ? page.messaggio.date : "") + font.pixelSize: Theme.fontSizeExtraSmall + color: Theme.secondaryColor + } + + Item { + width: parent.width + height: Theme.paddingMedium + } + + Label { + width: parent.width + text: page.messaggio.body ? page.messaggio.body : "" + wrapMode: Text.Wrap + textFormat: Text.PlainText + font.pixelSize: Theme.fontSizeSmall + color: Theme.primaryColor + bottomPadding: Theme.paddingLarge + } + } + + PullDownMenu { + MenuItem { + text: qsTr("Rispondi") + onClicked: pageStack.push(Qt.resolvedUrl("ComposePage.qml"), + { destinatario: page.messaggio.address, + oggetto: "Re: " + page.messaggio.subject }) + } + MenuItem { + text: qsTr("Inoltra") + onClicked: pageStack.push(Qt.resolvedUrl("ComposePage.qml"), + { oggetto: "Fwd: " + page.messaggio.subject, + corpo: page.messaggio.body }) + } + } + + PushUpMenu { + MenuItem { + text: qsTr("Segna come non letto") + onClicked: { avviso.text = qsTr("Segnato non letto"); avvisoTimer.restart() } + } + MenuItem { + text: qsTr("Sposta in Trash") + onClicked: { avviso.text = qsTr("Spostato in Trash"); avvisoTimer.restart() } + } + } + + VerticalScrollDecorator { } + } + + // Zone di tap: destra avanti, sinistra indietro. + Item { + anchors.left: parent.left + anchors.top: parent.top + anchors.bottom: parent.bottom + width: Theme.itemSizeMedium + + MouseArea { + anchors.fill: parent + onClicked: page.vai(-1) + } + Label { + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: Theme.paddingSmall + text: "\u2039" + font.pixelSize: Theme.fontSizeHuge + color: Theme.rgba(Theme.primaryColor, 0.25) + } + } + + Item { + anchors.right: parent.right + anchors.top: parent.top + anchors.bottom: parent.bottom + width: Theme.itemSizeMedium + + MouseArea { + anchors.fill: parent + onClicked: page.vai(1) + } + Label { + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: Theme.paddingSmall + text: "\u203a" + font.pixelSize: Theme.fontSizeHuge + color: Theme.rgba(Theme.primaryColor, 0.25) + } + } + + Label { + id: avviso + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + anchors.bottomMargin: Theme.paddingLarge + font.pixelSize: Theme.fontSizeSmall + color: Theme.highlightColor + } + Timer { + id: avvisoTimer + interval: 1200 + onTriggered: avviso.text = "" + } +} diff --git a/qml/pages/MessagesPage.qml b/qml/pages/MessagesPage.qml new file mode 100644 index 0000000..cf949d6 --- /dev/null +++ b/qml/pages/MessagesPage.qml @@ -0,0 +1,165 @@ +import QtQuick 2.0 +import Sailfish.Silica 1.0 +import "../js/dati.js" as Dati + +// Lista messaggi della cartella. La riga non letta e' in grassetto con la +// barra a sinistra; data a destra; nessuna colonna, che su un telefono non +// ci sta: mittente sopra, oggetto sotto. +Page { + id: page + + property string cartella: "in" + property string titolo: "In" + property bool soloNonLetti: false + property string ordine: "data" + + ListModel { id: messaggi } + + Component.onCompleted: carica() + + function carica() { + messaggi.clear(); + var lista = Dati.messagesOf(page.cartella).slice(); + if (page.ordine === "mittente") { + lista.sort(function (a, b) { + return a.sender.toLowerCase() < b.sender.toLowerCase() ? -1 : 1; + }); + } + for (var i = 0; i < lista.length; i++) { + var m = lista[i]; + if (page.soloNonLetti && !m.unread) continue; + messaggi.append({ + mittente: m.sender, + oggetto: m.subject, + data: m.date, + nonLetto: m.unread, + junk: m.junk, + allegato: m.attachment, + indice: i + }); + } + } + + // La navigazione sta qui, non nel delegate: nei delegate pageStack non + // si risolve su Qt 5.6. + function apri(indice) { + pageStack.push(Qt.resolvedUrl("MessagePage.qml"), { + cartella: page.cartella, + indice: indice, + titolo: page.titolo + }); + } + + SilicaListView { + id: lista + anchors.fill: parent + model: messaggi + + header: PageHeader { + title: page.titolo + description: messaggi.count === 1 ? qsTr("1 messaggio") + : qsTr("%1 messaggi").arg(messaggi.count) + } + + PullDownMenu { + MenuItem { + text: qsTr("Scarica la posta") + onClicked: { page.carica(); avviso.text = qsTr("Aggiornato") ; avvisoTimer.restart() } + } + MenuItem { + text: page.soloNonLetti ? qsTr("Mostra tutti") : qsTr("Solo non letti") + onClicked: { page.soloNonLetti = !page.soloNonLetti; page.carica() } + } + } + + PushUpMenu { + MenuItem { + text: qsTr("Ordina per data") + onClicked: { page.ordine = "data"; page.carica() } + } + MenuItem { + text: qsTr("Ordina per mittente") + onClicked: { page.ordine = "mittente"; page.carica() } + } + } + + delegate: BackgroundItem { + id: riga + + height: Math.max(Theme.itemSizeLarge, colonna.implicitHeight + Theme.paddingLarge) + onClicked: page.apri(model.indice) + + Rectangle { + width: Theme.paddingSmall / 3 + height: parent.height - Theme.paddingMedium + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + color: Theme.highlightColor + visible: model.nonLetto + } + + Column { + id: colonna + anchors.left: parent.left + anchors.leftMargin: Theme.horizontalPageMargin + anchors.right: dataLabel.left + anchors.rightMargin: Theme.paddingMedium + anchors.verticalCenter: parent.verticalCenter + + Label { + width: parent.width + text: model.mittente + font.bold: model.nonLetto + truncationMode: TruncationMode.Fade + color: riga.highlighted ? Theme.highlightColor : Theme.primaryColor + } + Label { + width: parent.width + text: model.allegato ? model.oggetto + " \u2022" : model.oggetto + font.pixelSize: Theme.fontSizeSmall + truncationMode: TruncationMode.Fade + color: Theme.secondaryColor + } + } + + Label { + id: dataLabel + anchors.right: parent.right + anchors.rightMargin: Theme.horizontalPageMargin + anchors.top: parent.top + anchors.topMargin: Theme.paddingMedium + text: model.data + font.pixelSize: Theme.fontSizeExtraSmall + color: Theme.secondaryColor + } + } + + VerticalScrollDecorator { } + + // Messaggio di lista vuota: fratello della lista, non ancorato + // all'headerItem (trappola nota). + Label { + anchors.centerIn: parent + width: parent.width - 2 * Theme.horizontalPageMargin + horizontalAlignment: Text.AlignHCenter + visible: messaggi.count === 0 + text: page.soloNonLetti ? qsTr("Nessun messaggio non letto") + : qsTr("Cartella vuota") + color: Theme.secondaryColor + } + } + + Label { + id: avviso + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + anchors.bottomMargin: Theme.paddingLarge + font.pixelSize: Theme.fontSizeSmall + color: Theme.highlightColor + } + Timer { + id: avvisoTimer + interval: 1200 + onTriggered: avviso.text = "" + } +} diff --git a/rpm/harbour-grumpydove.desktop b/rpm/harbour-grumpydove.desktop new file mode 100644 index 0000000..ce2999b --- /dev/null +++ b/rpm/harbour-grumpydove.desktop @@ -0,0 +1,15 @@ +[Desktop Entry] +Name=GrumpyDove +Name[it_IT]=GrumpyDove +Comment=Eudora-style mail interface, mobile prototype +Comment[it_IT]=Interfaccia mail in stile Eudora, prototipo mobile +Exec=harbour-grumpydove +Icon=harbour-grumpydove +Type=Application +X-Nemo-Application-Type=silica-qt5 +Categories=Network; + +[X-Sailjail] +Permissions=Internet +OrganizationName=harbour +ApplicationName=grumpydove diff --git a/rpm/harbour-grumpydove.spec b/rpm/harbour-grumpydove.spec new file mode 100644 index 0000000..a904910 --- /dev/null +++ b/rpm/harbour-grumpydove.spec @@ -0,0 +1,51 @@ +Name: harbour-grumpydove +Summary: Eudora-style mail interface, mobile prototype +Version: 0.1.0 +Release: 1 +Group: Qt/Qt +License: EUPL-1.2 +URL: https://git.keinpfusch.net/loweel/grumpydove +Source0: %{name}-%{version}.tar.gz +Source1: %{name}.desktop + +Requires: sailfishsilica-qt5 >= 0.10.9 +BuildRequires: pkgconfig(sailfishapp) >= 1.0.2 +BuildRequires: pkgconfig(Qt5Core) +BuildRequires: pkgconfig(Qt5Qml) +BuildRequires: pkgconfig(Qt5Quick) +BuildRequires: desktop-file-utils + +%description +Interface prototype for a Sailfish OS port of GrumpyDove, the Eudora-like +mail client written in Ada and Qt 6 by LowEel (EUPL-1.2). Screens only, +with fake data: it exists to judge the mobile layout on a real phone +before investing in the engine port. + +%prep +%setup -q -n %{name}-%{version} + +%build +%qmake5 +make %{?_smp_mflags} + +%install +make install INSTALL_ROOT=%{buildroot} +mkdir -p %{buildroot}%{_datadir}/applications +DESKTOP=$(find %{_builddir}/.. -maxdepth 4 -name '%{name}.desktop' 2>/dev/null | head -1) +if [ -z "$DESKTOP" ] && [ -f %{SOURCE1} ]; then DESKTOP=%{SOURCE1}; fi +if [ -z "$DESKTOP" ]; then + echo "ERROR: %{name}.desktop not found" >&2 + exit 1 +fi +install -m 0644 "$DESKTOP" %{buildroot}%{_datadir}/applications/%{name}.desktop +desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop || true + +%files +%defattr(-,root,root,-) +%{_bindir}/%{name} +%{_datadir}/applications/%{name}.desktop +%{_datadir}/icons/hicolor/86x86/apps/%{name}.png +%{_datadir}/icons/hicolor/108x108/apps/%{name}.png +%{_datadir}/icons/hicolor/128x128/apps/%{name}.png +%{_datadir}/icons/hicolor/172x172/apps/%{name}.png +%{_datadir}/%{name}/qml diff --git a/scripts/make_icons.py b/scripts/make_icons.py new file mode 100644 index 0000000..1333712 --- /dev/null +++ b/scripts/make_icons.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +"""Icone del prototipo: busta stilizzata su sfondo scuro (palette Nord).""" +import os +from PIL import Image, ImageDraw + +BG = (46, 52, 64) +ACCENT = (136, 192, 208) +PAGE = (229, 233, 240) + +ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + + +def draw_icon(size): + img = Image.new("RGBA", (size, size), (0, 0, 0, 0)) + d = ImageDraw.Draw(img) + m = size * 0.045 + d.rounded_rectangle([m, m, size - m, size - m], radius=size * 0.16, fill=BG) + + # busta + left, right = size * 0.20, size * 0.80 + top, bot = size * 0.34, size * 0.66 + lw = max(2, int(size * 0.035)) + d.rectangle([left, top, right, bot], outline=ACCENT, width=lw) + d.line([left, top, size * 0.5, size * 0.53], fill=PAGE, width=lw) + d.line([right, top, size * 0.5, size * 0.53], fill=PAGE, width=lw) + return img + + +for s in (86, 108, 128, 172): + out = os.path.join(ROOT, "icons", "%dx%d" % (s, s)) + os.makedirs(out, exist_ok=True) + draw_icon(s).save(os.path.join(out, "harbour-grumpydove.png")) + print("scritto", out) diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..2663a6f --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,34 @@ +#include +#include +#include +#include +#include +#include +#include + +// Prototipo dell'interfaccia: nessun motore, nessuna rete. I dati sono finti +// (qml/js/dati.js). Serve a valutare le schermate su un telefono vero. +Q_DECL_EXPORT int main(int argc, char *argv[]) +{ + QGuiApplication *app = SailfishApp::application(argc, argv); + + app->setOrganizationName(QStringLiteral("harbour")); + app->setApplicationName(QStringLiteral("grumpydove")); + app->setApplicationVersion(QStringLiteral("0.1.0")); + + qDebug() << "harbour-grumpydove v0.1.0 build" << __DATE__ << __TIME__; + + QTranslator translator; + if (translator.load(QLocale(), QStringLiteral("harbour-grumpydove"), + QStringLiteral("-"), + QStringLiteral("/usr/share/harbour-grumpydove/translations"))) + app->installTranslator(&translator); + + QQuickView *view = SailfishApp::createView(); + view->rootContext()->setContextProperty(QStringLiteral("appVersion"), + QCoreApplication::applicationVersion()); + view->setSource(SailfishApp::pathTo(QStringLiteral("qml/harbour-grumpydove.qml"))); + view->show(); + + return app->exec(); +} diff --git a/tests/test_dati.js b/tests/test_dati.js new file mode 100644 index 0000000..f1e60a5 --- /dev/null +++ b/tests/test_dati.js @@ -0,0 +1,48 @@ +#!/usr/bin/env node +// Test dei dati finti del prototipo: ruoli coerenti e conteggi che tornano. +const fs = require('fs'); +const path = require('path'); + +const src = fs.readFileSync(path.join(__dirname, '..', 'qml', 'js', 'dati.js'), 'utf8'); +eval(src); + +let fail = 0; +function check(cond, msg) { + if (!cond) { console.log('FALLITO:', msg); fail++; } +} + +// ogni cartella dichiarata esiste in MESSAGES (o e' un account) +MAILBOXES.forEach(m => { + if (m.kind === 'account') return; + check(MESSAGES.hasOwnProperty(m.mailbox), 'cartella senza messaggi: ' + m.mailbox); +}); + +// i ruoli letti dai delegate devono esserci sempre: un undefined in QML e' +// una riga vuota che nessun lint vede. +const ROLE_KEYS = ['sender', 'address', 'subject', 'date', 'unread', + 'junk', 'attachment', 'body']; +for (const box in MESSAGES) { + MESSAGES[box].forEach((msg, i) => { + ROLE_KEYS.forEach(k => { + check(msg.hasOwnProperty(k), `${box}[${i}] manca il ruolo ${k}`); + }); + check(typeof msg.unread === 'boolean', `${box}[${i}] unread non booleano`); + }); +} + +// i non letti dell'account devono essere la somma delle sue cartelle +const acc1 = MAILBOXES.find(m => m.name === 'carlo@example.org'); +const somma1 = unreadOf('in') + unreadOf('draft') + unreadOf('junk'); +check(acc1.unread === somma1, `non letti account ${acc1.unread} != somma ${somma1}`); + +const acc2 = MAILBOXES.find(m => m.name === 'progetti@example.net'); +check(acc2.unread === unreadOf('p-in'), 'non letti del secondo account'); + +check(totalUnread() === acc1.unread + acc2.unread, 'totale non letti'); + +// casi limite usati dalle schermate +check(messagesOf('trash').length === 0, 'trash deve essere vuota nel prototipo'); +check(messagesOf('non-esiste').length === 0, 'cartella inesistente = lista vuota'); + +console.log(fail === 0 ? 'OK: dati coerenti' : `${fail} controlli falliti`); +process.exit(fail === 0 ? 0 : 1);