Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
655636e652 | ||
|
|
79eee96199 |
No files matched your search
@@ -21,9 +21,9 @@ mobile sono miei.
|
||||
|
||||
Il progetto originale è EUPL-1.2; anche questo porting resta EUPL-1.2.
|
||||
|
||||
## Stato: 0.5.2
|
||||
## Stato: 0.6.0
|
||||
|
||||
Installabile e usabile per leggere la posta. L'invio **non** è ancora collegato.
|
||||
Installabile e usabile: si legge e si manda la posta.
|
||||
|
||||
Funziona oggi:
|
||||
|
||||
@@ -45,14 +45,14 @@ Funziona oggi:
|
||||
- **Rispondi** (con l'indirizzo vero del mittente, non solo il nome) e
|
||||
**Rispondi a tutti** (mittente, destinatari e copie, senza te e senza
|
||||
doppioni).
|
||||
- **Invio**: il messaggio entra nella coda del motore, parte con SMTP e la
|
||||
copia resta in Sent sul server. A, Cc, Oggetto, Testo; esiti a schermo.
|
||||
- **Copertina** con i non letti totali.
|
||||
- La posta resta dopo la chiusura: il Maildir vive nella cartella dati
|
||||
dell'app, non in `~/Mail` (vedi sotto).
|
||||
|
||||
## Cosa manca
|
||||
|
||||
- **Invio**: la pagina di composizione si compila ma non manda nulla. Serve
|
||||
collegare `gd_compose_fn` e la coda di invio del motore.
|
||||
- **HTML**: le mail arrivano come testo. L'originale ha una vista senza script
|
||||
né stili remoti, con le immagini remote solo su richiesta — va portata.
|
||||
- **Ricerca**, filtri, PGP/S-MIME, rubrica CardDAV, JMAP: il motore li ha, la
|
||||
|
||||
+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 {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Name: harbour-grumpydove
|
||||
Summary: Eudora-style mail interface, mobile prototype
|
||||
Version: 0.5.4
|
||||
Version: 0.6.0
|
||||
Release: 1
|
||||
Group: Qt/Qt
|
||||
# Codice EUPL-1.2; le icone vengono dagli sprite di Eudora, BSD 3-Clause
|
||||
@@ -27,6 +27,11 @@ Icons come from the original project's Eudora bitmaps (BSD 3-Clause,
|
||||
Computer History Museum).
|
||||
|
||||
%changelog
|
||||
* Wed Nov 11 2026 Carlo Baratto <carlo@carlobaratto.it> - 0.6.0-1
|
||||
- Invio: il messaggio va nella coda Out con il foglio che il motore sa
|
||||
leggere (To/Cc/Bcc/Subject, riga vuota, corpo), poi claim, send_start con la
|
||||
riga SMTP dell'account e send_poll fino alla fine; la copia in Sent la mette
|
||||
queue_sent. Esiti a schermo, e la lista delle cartelle si aggiorna
|
||||
* Wed Nov 11 2026 Carlo Baratto <carlo@carlobaratto.it> - 0.5.4-1
|
||||
- "Letto" era considerato "stato vuoto": il motore scrive invece uno spazio
|
||||
(U = non letto, ' ' = letto, piu' Q/D/Z/S/R/F). Il confronto con "" rendeva
|
||||
|
||||
+153
-1
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
#include <QRegularExpression>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QHash>
|
||||
@@ -33,6 +34,12 @@ gd_sort_fn EngineBridge::s_sort = nullptr;
|
||||
gd_absorb_fn EngineBridge::s_absorb = nullptr;
|
||||
gd_text_fn EngineBridge::s_sender = nullptr;
|
||||
gd_header_fn EngineBridge::s_header = nullptr;
|
||||
gd_compose_fn EngineBridge::s_compose = nullptr;
|
||||
gd_claim_fn EngineBridge::s_claim = nullptr;
|
||||
gd_send_start_fn EngineBridge::s_send_start = nullptr;
|
||||
gd_find_poll_fn EngineBridge::s_send_poll = nullptr;
|
||||
gd_send_done_fn EngineBridge::s_send_done = nullptr;
|
||||
gd_queue_sent_fn EngineBridge::s_queue_sent = nullptr;
|
||||
|
||||
// Colonne del motore (enum Column di qt_shim.cpp)
|
||||
enum Column { Status, Priority, Attachment, Label, Who, Date, Size, Subject, Junk };
|
||||
@@ -58,7 +65,12 @@ void EngineBridge::keepCallbacks(gd_folder_fn folder, gd_open_fn open, gd_cell_f
|
||||
gd_find_start_fn imap_start, gd_find_poll_fn imap_poll,
|
||||
gd_rescan_fn rescan, gd_text_fn attachments,
|
||||
gd_sort_fn sort, gd_absorb_fn absorb,
|
||||
gd_text_fn sender, gd_header_fn header)
|
||||
gd_text_fn sender, gd_header_fn header,
|
||||
gd_compose_fn compose, gd_claim_fn claim,
|
||||
gd_send_start_fn send_start,
|
||||
gd_find_poll_fn send_poll,
|
||||
gd_send_done_fn send_done,
|
||||
gd_queue_sent_fn queue_sent)
|
||||
{
|
||||
s_folder = folder;
|
||||
s_open = open;
|
||||
@@ -77,6 +89,12 @@ void EngineBridge::keepCallbacks(gd_folder_fn folder, gd_open_fn open, gd_cell_f
|
||||
s_absorb = absorb;
|
||||
s_sender = sender;
|
||||
s_header = header;
|
||||
s_compose = compose;
|
||||
s_claim = claim;
|
||||
s_send_start = send_start;
|
||||
s_send_poll = send_poll;
|
||||
s_send_done = send_done;
|
||||
s_queue_sent = queue_sent;
|
||||
if (s_instance) {
|
||||
emit s_instance->ready();
|
||||
}
|
||||
@@ -341,6 +359,140 @@ QString EngineBridge::folderType(int folder)
|
||||
return QString();
|
||||
}
|
||||
|
||||
// Una cartella per nome: serve per trovare la coda di invio ("Out").
|
||||
int EngineBridge::folderNamed(const QString &nome)
|
||||
{
|
||||
const QVariantList elenco = folders();
|
||||
for (int i = 0; i < elenco.size(); i++) {
|
||||
const QVariantMap m = elenco.at(i).toMap();
|
||||
if (m.value("nome").toString().compare(nome, Qt::CaseInsensitive) == 0)
|
||||
return m.value("folder").toInt();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Il giro dell'invio, come nell'originale: compose scrive il messaggio in Out
|
||||
// con il flag di coda, claim estrae quelli da mandare, send_start parla con il
|
||||
// server SMTP e send_poll riporta un messaggio per volta.
|
||||
QString EngineBridge::sendMessage(const QString &to, const QString &cc,
|
||||
const QString &bcc, const QString &oggetto,
|
||||
const QString &corpo)
|
||||
{
|
||||
if (!s_compose || !s_claim || !s_send_start || !s_send_poll)
|
||||
return tr("Il motore non è pronto");
|
||||
|
||||
const int out = folderNamed(QStringLiteral("Out"));
|
||||
if (out < 0)
|
||||
return tr("Manca la cartella «Out», la coda di invio");
|
||||
|
||||
const QString config = m_settings ? m_settings->smtpLine() : QString();
|
||||
if (config.isEmpty())
|
||||
return tr("SMTP non configurato: controlla l'account");
|
||||
|
||||
if (to.trimmed().isEmpty())
|
||||
return tr("Manca il destinatario");
|
||||
|
||||
// Il foglio che il motore sa leggere: campi "Nome: valore", riga vuota,
|
||||
// poi il corpo (Mail_Compose.Parse).
|
||||
QString foglio;
|
||||
foglio += QLatin1String("To: ") + to.trimmed() + QLatin1Char('\n');
|
||||
if (!cc.trimmed().isEmpty())
|
||||
foglio += QLatin1String("Cc: ") + cc.trimmed() + QLatin1Char('\n');
|
||||
if (!bcc.trimmed().isEmpty())
|
||||
foglio += QLatin1String("Bcc: ") + bcc.trimmed() + QLatin1Char('\n');
|
||||
foglio += QLatin1String("Subject: ") + oggetto + QLatin1String("\n\n") + corpo;
|
||||
|
||||
const QByteArray testo = foglio.toUtf8();
|
||||
const QByteArray nessunHtml;
|
||||
char stato[1024];
|
||||
stato[0] = '\0';
|
||||
const int salvato = s_compose(out, testo.constData(), testo.size(),
|
||||
nessunHtml.constData(), 0,
|
||||
1 /* in coda */, 0 /* cifra */, 0 /* firma */,
|
||||
0 /* nessun originale */, -1, -1, -1,
|
||||
stato, int(sizeof stato) - 1);
|
||||
if (salvato < 0) {
|
||||
const QString motivo = QString::fromUtf8(stato).trimmed();
|
||||
return motivo.isEmpty() ? tr("Il motore ha rifiutato il messaggio") : motivo;
|
||||
}
|
||||
|
||||
QByteArray coda(1 << 20, '\0');
|
||||
const int usati = s_claim(out, coda.data(), coda.size());
|
||||
if (usati <= 0)
|
||||
return tr("Niente in coda da mandare");
|
||||
coda.truncate(usati);
|
||||
|
||||
// Il nome della personalità serve alla copia in Sent sul server.
|
||||
QString persona = m_settings->persona().isEmpty() ? m_settings->user()
|
||||
: m_settings->persona();
|
||||
persona.replace(QRegularExpression(QStringLiteral("[^A-Za-z0-9._-]")),
|
||||
QStringLiteral("-"));
|
||||
|
||||
m_sendFolder = out;
|
||||
m_sendOk = 0;
|
||||
m_sendKo = 0;
|
||||
m_sendEsito.clear();
|
||||
m_sendPersona = persona;
|
||||
|
||||
if (!m_sendTimer) {
|
||||
m_sendTimer = new QTimer(this);
|
||||
m_sendTimer->setInterval(200);
|
||||
connect(m_sendTimer, &QTimer::timeout, this, &EngineBridge::pollSend);
|
||||
}
|
||||
const QByteArray cfg = config.toUtf8();
|
||||
s_send_start(cfg.constData(), cfg.size(), coda.constData(), coda.size());
|
||||
m_sendTimer->start();
|
||||
return QString();
|
||||
}
|
||||
|
||||
void EngineBridge::pollSend()
|
||||
{
|
||||
if (!s_send_poll) {
|
||||
if (m_sendTimer) m_sendTimer->stop();
|
||||
return;
|
||||
}
|
||||
|
||||
QByteArray buffer(64 * 1024, '\0');
|
||||
int ancora = 0;
|
||||
const int letti = s_send_poll(buffer.data(), buffer.size(), &ancora);
|
||||
const QList<QByteArray> righe = buffer.left(letti).split('\n');
|
||||
for (int i = 0; i < righe.size(); i++) {
|
||||
const QByteArray riga = righe.at(i);
|
||||
if (riga.isEmpty()) continue;
|
||||
if (riga.at(0) == '!') {
|
||||
m_sendEsito = QString::fromUtf8(riga.mid(2)).trimmed();
|
||||
continue;
|
||||
}
|
||||
const QList<QByteArray> celle = riga.split('\t');
|
||||
if (celle.size() < 2) continue;
|
||||
const int id = celle.at(1).toInt();
|
||||
const bool inviato = riga.at(0) == '+';
|
||||
if (inviato) {
|
||||
++m_sendOk;
|
||||
// La copia che resta sul server: la mette lui nel Sent della
|
||||
// personalità, se la conosce.
|
||||
if (s_queue_sent && !m_sendPersona.isEmpty()) {
|
||||
const QByteArray p = m_sendPersona.toUtf8();
|
||||
s_queue_sent(m_sendFolder, id, p.constData(), p.size());
|
||||
}
|
||||
} else {
|
||||
++m_sendKo;
|
||||
m_sendEsito = celle.size() > 2 ? QString::fromUtf8(celle.at(2)).trimmed()
|
||||
: tr("invio non riuscito");
|
||||
}
|
||||
if (s_send_done) s_send_done(m_sendFolder, id, inviato ? 1 : 0);
|
||||
}
|
||||
|
||||
if (ancora) return;
|
||||
|
||||
m_sendTimer->stop();
|
||||
if (s_absorb) s_absorb(m_sendFolder);
|
||||
dropAllRows(); // Out e Sent sono cambiate
|
||||
if (s_rescan) s_rescan();
|
||||
emit sendFinished(m_sendOk, m_sendKo, m_sendEsito);
|
||||
QTimer::singleShot(0, this, [this] { emit ready(); });
|
||||
}
|
||||
|
||||
// Legge una cartella dal motore una volta sola e la tiene: una chiamata per
|
||||
// campo per riga, quindi rileggerla a ogni apertura era il costo vero.
|
||||
void EngineBridge::buildRows(int folder)
|
||||
|
||||
+26
-1
@@ -39,7 +39,12 @@ public:
|
||||
gd_find_start_fn imap_start, gd_find_poll_fn imap_poll,
|
||||
gd_rescan_fn rescan, gd_text_fn attachments,
|
||||
gd_sort_fn sort, gd_absorb_fn absorb,
|
||||
gd_text_fn sender, gd_header_fn header);
|
||||
gd_text_fn sender, gd_header_fn header,
|
||||
gd_compose_fn compose, gd_claim_fn claim,
|
||||
gd_send_start_fn send_start,
|
||||
gd_find_poll_fn send_poll,
|
||||
gd_send_done_fn send_done,
|
||||
gd_queue_sent_fn queue_sent);
|
||||
|
||||
bool checking() const { return m_checking; }
|
||||
QString lastResult() const { return m_lastResult; }
|
||||
@@ -60,9 +65,15 @@ public:
|
||||
// "non letto" non e' "stato vuoto": la regola sta in un posto solo.
|
||||
Q_INVOKABLE bool isUnread(int folder, int row);
|
||||
Q_INVOKABLE QString folderType(int folder);
|
||||
Q_INVOKABLE int folderNamed(const QString &nome);
|
||||
// Manda un messaggio: stringa vuota se e' partito, altrimenti il motivo.
|
||||
Q_INVOKABLE QString sendMessage(const QString &to, const QString &cc,
|
||||
const QString &bcc, const QString &oggetto,
|
||||
const QString &corpo);
|
||||
|
||||
signals:
|
||||
void ready();
|
||||
void sendFinished(int inviati, int falliti, const QString &esito);
|
||||
void checkingChanged();
|
||||
void mailChecked();
|
||||
// a ogni riga di avanzamento che il motore manda durante il controllo
|
||||
@@ -90,6 +101,20 @@ private:
|
||||
static gd_absorb_fn s_absorb;
|
||||
static gd_text_fn s_sender;
|
||||
static gd_header_fn s_header;
|
||||
static gd_compose_fn s_compose;
|
||||
static gd_claim_fn s_claim;
|
||||
static gd_send_start_fn s_send_start;
|
||||
static gd_find_poll_fn s_send_poll;
|
||||
static gd_send_done_fn s_send_done;
|
||||
static gd_queue_sent_fn s_queue_sent;
|
||||
|
||||
void pollSend();
|
||||
QTimer *m_sendTimer = nullptr;
|
||||
int m_sendFolder = -1;
|
||||
int m_sendOk = 0;
|
||||
int m_sendKo = 0;
|
||||
QString m_sendEsito;
|
||||
QString m_sendPersona;
|
||||
|
||||
AccountSettings *m_settings;
|
||||
QTimer *m_poll;
|
||||
|
||||
@@ -47,9 +47,8 @@ int gd_run(gd_folder_fn folder, gd_open_fn open, gd_cell_fn cell,
|
||||
(void)sort; (void)mark_read; (void)id_of; (void)row_of; (void)move;
|
||||
(void)commit; (void)empty; (void)log; (void)priority; (void)label;
|
||||
(void)decrypt; (void)key_of; (void)plain;
|
||||
(void)sheet; (void)compose; (void)filter; (void)last_id;
|
||||
(void)sheet; (void)filter; (void)last_id;
|
||||
(void)find_start; (void)find_poll; (void)find_cancel; (void)id_named;
|
||||
(void)claim; (void)send_done; (void)send_start; (void)send_poll;
|
||||
(void)imap_start; (void)imap_poll; (void)absorb; (void)rescan;
|
||||
(void)shown_at; (void)can_hold; (void)make_folder; (void)can_change;
|
||||
(void)change_folder; (void)forget; (void)has_box; (void)place;
|
||||
@@ -60,7 +59,8 @@ int gd_run(gd_folder_fn folder, gd_open_fn open, gd_cell_fn cell,
|
||||
EngineBridge::keepCallbacks(folder, open, cell, body, unread,
|
||||
mark_read, id_of, move, commit,
|
||||
imap_start, imap_poll, rescan, attachments, sort,
|
||||
absorb, sender, header);
|
||||
absorb, sender, header, compose, claim,
|
||||
send_start, send_poll, send_done, queue_sent);
|
||||
return QCoreApplication::exec();
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -24,9 +24,9 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
|
||||
|
||||
app->setOrganizationName(QStringLiteral("harbour"));
|
||||
app->setApplicationName(QStringLiteral("grumpydove"));
|
||||
app->setApplicationVersion(QStringLiteral("0.5.4"));
|
||||
app->setApplicationVersion(QStringLiteral("0.6.0"));
|
||||
|
||||
qDebug() << "harbour-grumpydove v0.5.4 build" << __DATE__ << __TIME__;
|
||||
qDebug() << "harbour-grumpydove v0.6.0 build" << __DATE__ << __TIME__;
|
||||
|
||||
// La sandbox di Sailfish (SailJail) non lascia vedere ~/Mail, ma il motore
|
||||
// legge il percorso del Maildir da GRUMPYDOVE_MAIL: si punta alla cartella
|
||||
|
||||
Reference in new issue
Block a user