Prototipo interfaccia Sailfish per GrumpyDove: cartelle, lista, lettura con paginazione a tap, compose, copertina; dati finti e piano di porting
This commit is contained in:
commit
696b61319c
20 files changed
+1146
No files matched your search
+14
@@ -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
|
||||
@@ -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):
|
||||
<https://git.keinpfusch.net/loweel/grumpydove>
|
||||
|
||||
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@<ip>:
|
||||
# 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.
|
||||
@@ -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: <https://git.keinpfusch.net/loweel/grumpydove>
|
||||
|
||||
| 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'è.
|
||||
@@ -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
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 795 B |
Binary file not shown.
|
After Width: | Height: | Size: 918 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 656 B |
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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.
|
||||
}
|
||||
+143
@@ -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] || [];
|
||||
}
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
@@ -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 = ""
|
||||
}
|
||||
}
|
||||
@@ -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 = ""
|
||||
}
|
||||
}
|
||||
@@ -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 = ""
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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)
|
||||
@@ -0,0 +1,34 @@
|
||||
#include <QGuiApplication>
|
||||
#include <QLocale>
|
||||
#include <QQmlContext>
|
||||
#include <QQuickView>
|
||||
#include <QDebug>
|
||||
#include <QTranslator>
|
||||
#include <sailfishapp.h>
|
||||
|
||||
// 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();
|
||||
}
|
||||
@@ -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);
|
||||
Reference in new issue
Block a user