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