Invio dei messaggi (0.6.0)
compose -> claim -> send_start -> send_poll, poi queue_sent per la copia in Sent. Il foglio e' To/Cc/Bcc/Subject, riga vuota, corpo (Mail_Compose.Parse); la riga SMTP viene da AccountSettings::smtpLine. ComposePage ha Cc, il pulsante Invia e gli esiti.
This commit is contained in:
1 parent
ce0f9bfa66
commit
79eee96199
6 files changed
+238
-20
No files matched your search
+48
-12
@@ -1,15 +1,19 @@
|
||||
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.
|
||||
// Composizione e invio. Il motore mette il messaggio nella coda (Out), lo
|
||||
// manda con SMTP e lascia la copia in Sent; qui si segue l'esito.
|
||||
Page {
|
||||
id: page
|
||||
|
||||
property string destinatario: ""
|
||||
property string copia: ""
|
||||
property string oggetto: ""
|
||||
property string corpo: ""
|
||||
|
||||
property bool inviando: false
|
||||
property string errore: ""
|
||||
|
||||
SilicaFlickable {
|
||||
anchors.fill: parent
|
||||
contentHeight: colonna.height + Theme.paddingLarge
|
||||
@@ -28,11 +32,24 @@ Page {
|
||||
width: parent.width - 2 * Theme.horizontalPageMargin
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
label: qsTr("A")
|
||||
placeholderText: qsTr("indirizzo")
|
||||
placeholderText: qsTr("indirizzo, anche piu' di uno")
|
||||
text: page.destinatario
|
||||
inputMethodHints: Qt.ImhEmailCharactersOnly | Qt.ImhNoAutoUppercase
|
||||
EnterKey.enabled: true
|
||||
EnterKey.iconSource: "image://theme/icon-m-enter-next"
|
||||
EnterKey.onClicked: campoCc.forceActiveFocus()
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: campoCc
|
||||
width: parent.width - 2 * Theme.horizontalPageMargin
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
label: qsTr("Cc")
|
||||
placeholderText: qsTr("facoltativo")
|
||||
text: page.copia
|
||||
inputMethodHints: Qt.ImhEmailCharactersOnly | Qt.ImhNoAutoUppercase
|
||||
EnterKey.enabled: true
|
||||
EnterKey.iconSource: "image://theme/icon-m-enter-next"
|
||||
EnterKey.onClicked: campoOggetto.forceActiveFocus()
|
||||
}
|
||||
|
||||
@@ -59,9 +76,11 @@ Page {
|
||||
}
|
||||
|
||||
Button {
|
||||
id: pulsanteInvia
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: qsTr("Invia")
|
||||
text: page.inviando ? qsTr("Invio in corso…") : qsTr("Invia")
|
||||
preferredWidth: Theme.buttonWidthSmall
|
||||
enabled: !page.inviando
|
||||
onClicked: page.invia()
|
||||
}
|
||||
|
||||
@@ -69,9 +88,10 @@ Page {
|
||||
width: parent.width - 2 * Theme.horizontalPageMargin
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: qsTr("Nel prototipo non parte nulla: i dati sono finti.")
|
||||
text: page.errore
|
||||
visible: page.errore.length > 0
|
||||
font.pixelSize: Theme.fontSizeExtraSmall
|
||||
color: Theme.secondaryColor
|
||||
color: Theme.highlightColor
|
||||
wrapMode: Text.Wrap
|
||||
}
|
||||
}
|
||||
@@ -79,15 +99,31 @@ Page {
|
||||
VerticalScrollDecorator { }
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: engine
|
||||
onSendFinished: {
|
||||
page.inviando = false;
|
||||
if (falliti === 0) {
|
||||
avviso.text = inviati === 1 ? qsTr("Messaggio inviato")
|
||||
: qsTr("%1 messaggi inviati").arg(inviati);
|
||||
avvisoTimer.restart();
|
||||
timerPop.restart();
|
||||
} else {
|
||||
page.errore = esito.length > 0 ? esito
|
||||
: qsTr("Invio non riuscito");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function invia() {
|
||||
if (campoA.text.length === 0) {
|
||||
avviso.text = qsTr("Manca il destinatario");
|
||||
avvisoTimer.restart();
|
||||
page.errore = "";
|
||||
const motivo = engine.sendMessage(campoA.text, campoCc.text, "",
|
||||
campoOggetto.text, campoCorpo.text);
|
||||
if (motivo.length > 0) {
|
||||
page.errore = motivo;
|
||||
return;
|
||||
}
|
||||
avviso.text = qsTr("Messaggio inviato");
|
||||
avvisoTimer.restart();
|
||||
timerPop.restart();
|
||||
page.inviando = true;
|
||||
}
|
||||
|
||||
Label {
|
||||
|
||||
Reference in new issue
Block a user