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:
Carlo Baratto committed 2026-11-11 09:36:41 +01:00
commit 696b61319c
20 files changed
+1146

No files matched your search

+128
View File
@@ -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 = ""
}
}