Controllo automatico con notifica, Bcc, creazione cartelle (0.14.0)
- timer nella pagina delle cartelle, intervallo in Account (0 = spento); notifica Nemo solo quando i non letti aumentano davvero - campo Bcc in composizione, che il foglio del motore accettava gia' - NewFolderPage: Make_Folder con Mailbox=1 crea una Maildir vera (tmp/new/cur)
This commit is contained in:
1 parent
ee03225c3f
commit
2fece59652
9 files changed
+202
-10
No files matched your search
@@ -104,6 +104,18 @@ Page {
|
||||
inputMethodHints: Qt.ImhEmailCharactersOnly | Qt.ImhNoAutoUppercase
|
||||
EnterKey.enabled: true
|
||||
EnterKey.iconSource: "image://theme/icon-m-enter-next"
|
||||
EnterKey.onClicked: campoBcc.forceActiveFocus()
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: campoBcc
|
||||
width: parent.width - 2 * Theme.horizontalPageMargin
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
label: qsTr("Bcc")
|
||||
placeholderText: qsTr("destinatari nascosti, facoltativo")
|
||||
inputMethodHints: Qt.ImhEmailCharactersOnly | Qt.ImhNoAutoUppercase
|
||||
EnterKey.enabled: true
|
||||
EnterKey.iconSource: "image://theme/icon-m-enter-next"
|
||||
EnterKey.onClicked: campoOggetto.forceActiveFocus()
|
||||
}
|
||||
|
||||
@@ -263,7 +275,8 @@ Page {
|
||||
|
||||
function invia() {
|
||||
page.errore = "";
|
||||
const motivo = engine.sendMessage(campoA.text, campoCc.text, "",
|
||||
const motivo = engine.sendMessage(campoA.text, campoCc.text,
|
||||
campoBcc.text,
|
||||
campoDa.text,
|
||||
campoOggetto.text, campoCorpo.text,
|
||||
page.allegati);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
import Nemo.Notifications 1.0
|
||||
|
||||
// Cartelle: l'albero di Eudora (account -> cartelle -> sottocartelle)
|
||||
// appiattito in una lista, con i non letti che risalgono fino all'account.
|
||||
@@ -9,12 +10,37 @@ Page {
|
||||
|
||||
ListModel { id: cartelle }
|
||||
|
||||
Component.onCompleted: carica()
|
||||
Component.onCompleted: { minuti = engine.minutiControllo(); nonLettiPrima = engine.totalUnread(); carica() }
|
||||
|
||||
// Ogni quanti minuti guardare la posta da soli; 0 = spento. Si rilegge
|
||||
// tornando qui, così cambiare l'intervallo in Account ha effetto subito.
|
||||
property int minuti: 0
|
||||
property int nonLettiPrima: 0
|
||||
|
||||
Timer {
|
||||
interval: Math.max(1, page.minuti) * 60000
|
||||
running: page.minuti > 0
|
||||
repeat: true
|
||||
onTriggered: {
|
||||
if (engine.checking()) return;
|
||||
page.nonLettiPrima = engine.totalUnread();
|
||||
engine.checkMail();
|
||||
}
|
||||
}
|
||||
|
||||
Notification {
|
||||
id: notifica
|
||||
appName: "harbour-grumpydove"
|
||||
// Il tocco sulla notifica deve portare alla posta: l'app è una sola,
|
||||
// e il sistema la riporta davanti da sé.
|
||||
previewSummary: summary
|
||||
previewBody: body
|
||||
}
|
||||
|
||||
// Tornando indietro dopo aver letto un messaggio, i conteggi vanno
|
||||
// rifatti: la pagine sotto resta viva ma il numero accanto alla cartella
|
||||
// e' quello di quando e' stata disegnata l'ultima volta.
|
||||
onStatusChanged: if (status === PageStatus.Active) carica()
|
||||
onStatusChanged: if (status === PageStatus.Active) { carica(); minuti = engine.minutiControllo() }
|
||||
|
||||
// Le callback del motore arrivano quando il bridge le riceve: se la pagina
|
||||
// e' gia' aperta, si ricarica qui.
|
||||
@@ -38,6 +64,15 @@ Page {
|
||||
}
|
||||
}
|
||||
|
||||
// La cartella si crea sotto l'account: il primo che compare nell'albero.
|
||||
function nuovaCartella() {
|
||||
var account = 0;
|
||||
for (var i = 0; i < cartelle.count; i++) {
|
||||
if (cartelle.get(i).livello === 0) { account = cartelle.get(i).folder; break; }
|
||||
}
|
||||
pageStack.push(Qt.resolvedUrl("NewFolderPage.qml"), { "parent": account });
|
||||
}
|
||||
|
||||
function carica() {
|
||||
cartelle.clear();
|
||||
var elenco = engine.folders();
|
||||
@@ -89,7 +124,11 @@ Page {
|
||||
MenuItem {
|
||||
text: engine.checking ? qsTr("Controllo in corso…") : qsTr("Scarica la posta")
|
||||
enabled: !engine.checking
|
||||
onClicked: engine.checkMail()
|
||||
onClicked: { page.nonLettiPrima = engine.totalUnread(); engine.checkMail() }
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Nuova cartella")
|
||||
onClicked: page.nuovaCartella()
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Rileggi le cartelle")
|
||||
@@ -179,6 +218,18 @@ Page {
|
||||
onMailChecked: {
|
||||
avviso.text = engine.lastResult;
|
||||
avvisoTimer.restart();
|
||||
// Notifica solo se i non letti sono aumentati: un controllo
|
||||
// che non porta niente di nuovo non deve suonare.
|
||||
var adesso = engine.totalUnread();
|
||||
var nuovi = adesso - page.nonLettiPrima;
|
||||
if (nuovi > 0) {
|
||||
notifica.summary = nuovi === 1
|
||||
? qsTr("1 nuovo messaggio")
|
||||
: qsTr("%1 nuovi messaggi").arg(nuovi);
|
||||
notifica.body = qsTr("Tocca per leggere la posta");
|
||||
notifica.publish();
|
||||
}
|
||||
page.nonLettiPrima = adesso;
|
||||
// Con i filtri attivi, la posta appena scaricata si archivia
|
||||
// da sola: è quello che fa l'originale all'arrivo.
|
||||
if (engine.filtriAttivi()) page.filtraIn();
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
|
||||
// Creare una cartella sotto l'account. Il motore crea una Maildir vera
|
||||
// (tmp, new, cur), non un contenitore vuoto.
|
||||
Page {
|
||||
id: page
|
||||
|
||||
property int parent: 0
|
||||
property int livello: 0
|
||||
|
||||
allowedOrientations: Orientation.All
|
||||
|
||||
Column {
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: Theme.itemSizeLarge
|
||||
width: parent.width
|
||||
spacing: Theme.paddingLarge
|
||||
|
||||
PageHeader {
|
||||
title: qsTr("Nuova cartella")
|
||||
description: qsTr("Dentro l'account")
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: nome
|
||||
width: parent.width - 2 * Theme.horizontalPageMargin
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
label: qsTr("Nome")
|
||||
placeholderText: qsTr("per esempio: Progetti")
|
||||
inputMethodHints: Qt.ImhNoAutoUppercase
|
||||
EnterKey.enabled: true
|
||||
EnterKey.text: qsTr("Crea")
|
||||
EnterKey.onClicked: page.crea()
|
||||
}
|
||||
|
||||
Button {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: qsTr("Crea")
|
||||
preferredWidth: Theme.buttonWidthSmall
|
||||
onClicked: page.crea()
|
||||
}
|
||||
|
||||
Label {
|
||||
width: parent.width - 2 * Theme.horizontalPageMargin
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: page.errore
|
||||
visible: page.errore.length > 0
|
||||
wrapMode: Text.Wrap
|
||||
font.pixelSize: Theme.fontSizeExtraSmall
|
||||
color: Theme.highlightColor
|
||||
}
|
||||
}
|
||||
|
||||
property string errore: ""
|
||||
|
||||
function crea() {
|
||||
page.errore = engine.creaCartella(page.parent, nome.text);
|
||||
if (page.errore.length === 0)
|
||||
pageStack.pop();
|
||||
}
|
||||
}
|
||||
@@ -150,6 +150,21 @@ Page {
|
||||
}
|
||||
}
|
||||
|
||||
SectionHeader { text: qsTr("Controllo automatico") }
|
||||
|
||||
TextField {
|
||||
width: parent.width - 2 * Theme.horizontalPageMargin
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
label: qsTr("Ogni quanti minuti")
|
||||
description: qsTr("0 = solo quando lo chiedi tu")
|
||||
inputMethodHints: Qt.ImhDigitsOnly
|
||||
text: engine.minutiControllo()
|
||||
onTextChanged: {
|
||||
var n = parseInt(text);
|
||||
if (!isNaN(n)) engine.setMinutiControllo(n);
|
||||
}
|
||||
}
|
||||
|
||||
SectionHeader { text: qsTr("Rubrica (CardDAV)") }
|
||||
|
||||
TextField {
|
||||
|
||||
Reference in new issue
Block a user