112 lines
3.6 KiB
QML
112 lines
3.6 KiB
QML
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()
|
|
}
|
|
}
|