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
@@ -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 = ""
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user