Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca7d4f66e4 | ||
|
|
634782a537 | ||
|
|
044d3f4b6d | ||
|
|
fb789ef823 |
No files matched your search
@@ -10,10 +10,20 @@ Page {
|
||||
property string copia: ""
|
||||
property string oggetto: ""
|
||||
property string corpo: ""
|
||||
property string mittente: ""
|
||||
|
||||
property bool inviando: false
|
||||
property string errore: ""
|
||||
|
||||
// Il "Da" si vede e si può correggere qui: se il campo in Account non è
|
||||
// stato salvato, l'invio non resta bloccato senza spiegazione.
|
||||
Component.onCompleted: {
|
||||
if (account.mittente.length > 0)
|
||||
page.mittente = account.mittente;
|
||||
else if (account.persona.indexOf("@") > 0)
|
||||
page.mittente = account.persona;
|
||||
}
|
||||
|
||||
SilicaFlickable {
|
||||
anchors.fill: parent
|
||||
contentHeight: colonna.height + Theme.paddingLarge
|
||||
@@ -27,6 +37,19 @@ Page {
|
||||
width: parent.width
|
||||
spacing: Theme.paddingMedium
|
||||
|
||||
TextField {
|
||||
id: campoDa
|
||||
width: parent.width - 2 * Theme.horizontalPageMargin
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
label: qsTr("Da")
|
||||
placeholderText: qsTr("il tuo indirizzo")
|
||||
text: page.mittente
|
||||
inputMethodHints: Qt.ImhEmailCharactersOnly | Qt.ImhNoAutoUppercase
|
||||
EnterKey.enabled: true
|
||||
EnterKey.iconSource: "image://theme/icon-m-enter-next"
|
||||
EnterKey.onClicked: campoA.forceActiveFocus()
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: campoA
|
||||
width: parent.width - 2 * Theme.horizontalPageMargin
|
||||
@@ -128,6 +151,7 @@ Page {
|
||||
function invia() {
|
||||
page.errore = "";
|
||||
const motivo = engine.sendMessage(campoA.text, campoCc.text, "",
|
||||
campoDa.text,
|
||||
campoOggetto.text, campoCorpo.text);
|
||||
if (motivo.length > 0) {
|
||||
page.errore = motivo;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Name: harbour-grumpydove
|
||||
Summary: Eudora-style mail interface, mobile prototype
|
||||
Version: 0.6.3
|
||||
Version: 0.6.7
|
||||
Release: 1
|
||||
Group: Qt/Qt
|
||||
# Codice EUPL-1.2; le icone vengono dagli sprite di Eudora, BSD 3-Clause
|
||||
@@ -27,6 +27,25 @@ 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.7-1
|
||||
- Dopo l'invio il controllo posta parte da solo: e' quello che porta sul server
|
||||
la copia del messaggio (append). Prima restava solo nella coda locale
|
||||
Local/Sent, che e' l'"Out" di Eudora
|
||||
* Wed Nov 11 2026 Carlo Baratto <carlo@carlobaratto.it> - 0.6.6-1
|
||||
- Nomi delle cartelle corrotti nel ponte: il motore restituisce la lunghezza
|
||||
del testo, non un terminatore, e leggerlo fino al primo zero si portava
|
||||
dietro i residui del precedente ("In" diventava "Incal", "Out" "Outal").
|
||||
Per questo la coda Local/Sent non si trovava e l'invio si fermava. Corretti
|
||||
anche mittente e header, che avevano lo stesso difetto
|
||||
* Wed Nov 11 2026 Carlo Baratto <carlo@carlobaratto.it> - 0.6.5-1
|
||||
- L'invio scrive nel log del motore ogni passaggio e ogni motivo di stop
|
||||
("ERR send: ..."): prima, se si fermava nel ponte, non restava traccia e non
|
||||
c'era modo di capire dall'esterno
|
||||
* Wed Nov 11 2026 Carlo Baratto <carlo@carlobaratto.it> - 0.6.4-1
|
||||
- Il mittente (From) e' un campo della pagina di composizione, precompilato da
|
||||
Account: il salvataggio del campo in Account non arrivava al file, e l'invio
|
||||
si bloccava senza che si vedesse dove metterci le mani. Scritto una volta,
|
||||
resta per le volte dopo
|
||||
* Wed Nov 11 2026 Carlo Baratto <carlo@carlobaratto.it> - 0.6.3-1
|
||||
- Se l'invio si ferma per mittente o SMTP, sotto l'errore compare "Apri
|
||||
Account": il messaggio del motore ("The From line has no address") non dice
|
||||
|
||||
+98
-34
@@ -41,6 +41,7 @@ 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;
|
||||
gd_place_fn EngineBridge::s_place = nullptr;
|
||||
gd_log_fn EngineBridge::s_log = nullptr;
|
||||
|
||||
// Colonne del motore (enum Column di qt_shim.cpp)
|
||||
enum Column { Status, Priority, Attachment, Label, Who, Date, Size, Subject, Junk };
|
||||
@@ -71,7 +72,8 @@ void EngineBridge::keepCallbacks(gd_folder_fn folder, gd_open_fn open, gd_cell_f
|
||||
gd_send_start_fn send_start,
|
||||
gd_find_poll_fn send_poll,
|
||||
gd_send_done_fn send_done,
|
||||
gd_queue_sent_fn queue_sent, gd_place_fn place)
|
||||
gd_queue_sent_fn queue_sent, gd_place_fn place,
|
||||
gd_log_fn log)
|
||||
{
|
||||
s_folder = folder;
|
||||
s_open = open;
|
||||
@@ -97,6 +99,7 @@ void EngineBridge::keepCallbacks(gd_folder_fn folder, gd_open_fn open, gd_cell_f
|
||||
s_send_done = send_done;
|
||||
s_queue_sent = queue_sent;
|
||||
s_place = place;
|
||||
s_log = log;
|
||||
if (s_instance) {
|
||||
emit s_instance->ready();
|
||||
}
|
||||
@@ -224,6 +227,15 @@ bool EngineBridge::moveToTrash(int folder, int row)
|
||||
return ok;
|
||||
}
|
||||
|
||||
// Il motore restituisce la lunghezza del testo, non un terminatore: leggere
|
||||
// il buffer fino al primo zero si porta dietro i residui del testo precedente
|
||||
// ("In" che diventa "Incal"). Si legge sempre con la lunghezza.
|
||||
static QString testoMotore(const char *buf, int n)
|
||||
{
|
||||
if (n <= 0) return QString();
|
||||
return QString::fromUtf8(buf, n);
|
||||
}
|
||||
|
||||
// L'indirizzo di chi ha scritto: il motore da' "Nome\tindirizzo".
|
||||
QString EngineBridge::senderOf(int folder, int row)
|
||||
{
|
||||
@@ -233,8 +245,7 @@ QString EngineBridge::senderOf(int folder, int row)
|
||||
char buf[1024];
|
||||
const int n = s_sender(folder, id, buf, int(sizeof buf) - 1);
|
||||
if (n <= 0) return QString();
|
||||
buf[qMin(n, int(sizeof buf) - 1)] = '\0';
|
||||
const QString tutto = QString::fromUtf8(buf);
|
||||
const QString tutto = testoMotore(buf, qMin(n, int(sizeof buf) - 1));
|
||||
const int tab = tutto.indexOf(QLatin1Char('\t'));
|
||||
const QString indirizzo = tab >= 0 ? tutto.mid(tab + 1) : tutto;
|
||||
return indirizzo.trimmed();
|
||||
@@ -250,8 +261,7 @@ QString EngineBridge::headerOf(int folder, int row, const QString &name)
|
||||
const int n = s_header(folder, id, name.toUtf8().constData(), buf,
|
||||
int(sizeof buf) - 1);
|
||||
if (n <= 0) return QString();
|
||||
buf[qMin(n, int(sizeof buf) - 1)] = '\0';
|
||||
return QString::fromUtf8(buf).trimmed();
|
||||
return testoMotore(buf, qMin(n, int(sizeof buf) - 1)).trimmed();
|
||||
}
|
||||
|
||||
// Una cella, come stringa UTF-8 letta dal motore.
|
||||
@@ -371,9 +381,10 @@ int EngineBridge::folderNamed(const QString &nome)
|
||||
int depth = 0;
|
||||
for (int i = 0; i < 500; i++) {
|
||||
buf[0] = '\0';
|
||||
if (s_folder(i, &depth, buf, int(sizeof buf) - 1) < 0) break;
|
||||
buf[sizeof buf - 1] = '\0';
|
||||
if (QString::fromUtf8(buf).compare(nome, Qt::CaseInsensitive) == 0)
|
||||
const int n = s_folder(i, &depth, buf, int(sizeof buf) - 1);
|
||||
if (n < 0) break;
|
||||
if (testoMotore(buf, qMin(n, int(sizeof buf) - 1))
|
||||
.compare(nome, Qt::CaseInsensitive) == 0)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
@@ -392,16 +403,16 @@ int EngineBridge::folderOut()
|
||||
int depth = 0;
|
||||
for (int i = 0; i < 500; i++) {
|
||||
buf[0] = '\0';
|
||||
if (s_folder(i, &depth, buf, int(sizeof buf) - 1) < 0) break;
|
||||
buf[sizeof buf - 1] = '\0';
|
||||
const QString nome = QString::fromUtf8(buf);
|
||||
const int n = s_folder(i, &depth, buf, int(sizeof buf) - 1);
|
||||
if (n < 0) break;
|
||||
const QString nome = testoMotore(buf, qMin(n, int(sizeof buf) - 1));
|
||||
|
||||
if (s_place) {
|
||||
char dove[1024];
|
||||
dove[0] = '\0';
|
||||
if (s_place(i, dove, int(sizeof dove) - 1) > 0) {
|
||||
dove[sizeof dove - 1] = '\0';
|
||||
const QString posto = QString::fromUtf8(dove);
|
||||
const int m = s_place(i, dove, int(sizeof dove) - 1);
|
||||
if (m > 0) {
|
||||
const QString posto = testoMotore(dove, qMin(m, int(sizeof dove) - 1));
|
||||
if (posto.compare(QLatin1String("Local\tSent"), Qt::CaseInsensitive) == 0)
|
||||
return i; // la coda vera
|
||||
if (posto.endsWith(QLatin1String("\tSent")))
|
||||
@@ -424,41 +435,77 @@ QString EngineBridge::cartelleViste()
|
||||
int depth = 0;
|
||||
for (int i = 0; i < 500; i++) {
|
||||
buf[0] = '\0';
|
||||
if (s_folder(i, &depth, buf, int(sizeof buf) - 1) < 0) break;
|
||||
buf[sizeof buf - 1] = '\0';
|
||||
nomi << QString::fromUtf8(buf);
|
||||
const int n = s_folder(i, &depth, buf, int(sizeof buf) - 1);
|
||||
if (n < 0) break;
|
||||
nomi << testoMotore(buf, qMin(n, int(sizeof buf) - 1));
|
||||
}
|
||||
return nomi.join(QStringLiteral(", "));
|
||||
}
|
||||
|
||||
void EngineBridge::logInvio(const QString &riga)
|
||||
{
|
||||
if (s_log) s_log(riga.toUtf8().constData());
|
||||
}
|
||||
|
||||
// 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)
|
||||
const QString &bcc, const QString &da,
|
||||
const QString &oggetto, const QString &corpo)
|
||||
{
|
||||
if (!s_compose || !s_claim || !s_send_start || !s_send_poll)
|
||||
return tr("Il motore non è pronto");
|
||||
if (!s_compose || !s_claim || !s_send_start || !s_send_poll) {
|
||||
const QString m = tr("Il motore non è pronto");
|
||||
logInvio("ERR send: " + m);
|
||||
return m;
|
||||
}
|
||||
|
||||
const int out = folderOut();
|
||||
if (out < 0)
|
||||
return tr("Manca la cartella di uscita. Il motore vede: %1").arg(cartelleViste());
|
||||
if (out < 0) {
|
||||
const QString m = tr("Manca la cartella di uscita. Il motore vede: %1")
|
||||
.arg(cartelleViste());
|
||||
logInvio("ERR send: " + m);
|
||||
return m;
|
||||
}
|
||||
|
||||
const QString config = m_settings ? m_settings->smtpLine() : QString();
|
||||
if (config.isEmpty())
|
||||
return tr("SMTP non configurato: controlla l'account");
|
||||
if (config.isEmpty()) {
|
||||
const QString m = tr("SMTP non configurato: controlla l'account");
|
||||
logInvio("ERR send: " + m);
|
||||
return m;
|
||||
}
|
||||
|
||||
if (to.trimmed().isEmpty())
|
||||
return tr("Manca il destinatario");
|
||||
if (to.trimmed().isEmpty()) {
|
||||
const QString m = tr("Manca il destinatario");
|
||||
logInvio("ERR send: " + m);
|
||||
return m;
|
||||
}
|
||||
|
||||
// Il From: senza, il messaggio parte senza mittente e il motore non
|
||||
// trova nemmeno la personalità a cui appartiene.
|
||||
QString from = m_settings ? m_settings->mittente().trimmed() : QString();
|
||||
// trova nemmeno la personalità a cui appartiene. Arriva dalla pagina di
|
||||
// composizione, che lo mostra: cosi' non dipende dal fatto che il campo
|
||||
// in Account sia stato salvato.
|
||||
QString from = da.trimmed();
|
||||
if (from.isEmpty() && m_settings)
|
||||
from = m_settings->mittente().trimmed();
|
||||
if (from.isEmpty() && m_settings && m_settings->persona().contains(QLatin1Char('@')))
|
||||
from = m_settings->persona().trimmed();
|
||||
if (from.isEmpty())
|
||||
return tr("Manca l'indirizzo del mittente: Impostazioni → Account");
|
||||
if (from.isEmpty()) {
|
||||
const QString m = tr("Manca l'indirizzo del mittente: scrivilo nel campo «Da»");
|
||||
logInvio("ERR send: " + m);
|
||||
return m;
|
||||
}
|
||||
if (from.indexOf(QLatin1Char('@')) < 1) {
|
||||
const QString m = tr("«%1» non è un indirizzo: manca la parte dopo la @").arg(from);
|
||||
logInvio("ERR send: " + m);
|
||||
return m;
|
||||
}
|
||||
|
||||
// Se l'hai scritto qui, vale anche per le prossime volte.
|
||||
if (m_settings && m_settings->mittente().compare(from, Qt::CaseInsensitive) != 0) {
|
||||
m_settings->setMittente(from);
|
||||
m_settings->save();
|
||||
}
|
||||
|
||||
// Il foglio che il motore sa leggere: campi "Nome: valore", riga vuota,
|
||||
// poi il corpo (Mail_Compose.Parse).
|
||||
@@ -482,14 +529,22 @@ QString EngineBridge::sendMessage(const QString &to, const QString &cc,
|
||||
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;
|
||||
const QString m = motivo.isEmpty() ? tr("Il motore ha rifiutato il messaggio")
|
||||
: motivo;
|
||||
logInvio("ERR send: compose: " + m);
|
||||
return m;
|
||||
}
|
||||
|
||||
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");
|
||||
if (usati <= 0) {
|
||||
const QString m = tr("Niente in coda da mandare");
|
||||
logInvio("ERR send: " + m);
|
||||
return m;
|
||||
}
|
||||
coda.truncate(usati);
|
||||
logInvio(QString("send: coda %1, %2 byte, da %3, a %4")
|
||||
.arg(out).arg(usati).arg(from).arg(to.trimmed()));
|
||||
|
||||
// Il nome della personalità serve alla copia in Sent sul server.
|
||||
QString persona = m_settings->persona().isEmpty() ? m_settings->user()
|
||||
@@ -558,6 +613,15 @@ void EngineBridge::pollSend()
|
||||
if (s_absorb) s_absorb(m_sendFolder);
|
||||
dropAllRows(); // Out e Sent sono cambiate
|
||||
if (s_rescan) s_rescan();
|
||||
|
||||
// La copia sul server (l'append di queue_sent) parte col controllo posta:
|
||||
// l'originale lo fa subito dopo l'invio, altrimenti la posta inviata resta
|
||||
// solo nella coda locale.
|
||||
if (m_sendOk > 0 && m_settings && m_settings->configured()) {
|
||||
logInvio("send: avvio il controllo per portare la copia sul server");
|
||||
QTimer::singleShot(400, this, [this] { checkMail(); });
|
||||
}
|
||||
|
||||
emit sendFinished(m_sendOk, m_sendKo, m_sendEsito);
|
||||
QTimer::singleShot(0, this, [this] { emit ready(); });
|
||||
}
|
||||
|
||||
+8
-3
@@ -44,7 +44,8 @@ public:
|
||||
gd_send_start_fn send_start,
|
||||
gd_find_poll_fn send_poll,
|
||||
gd_send_done_fn send_done,
|
||||
gd_queue_sent_fn queue_sent, gd_place_fn place);
|
||||
gd_queue_sent_fn queue_sent, gd_place_fn place,
|
||||
gd_log_fn log);
|
||||
|
||||
bool checking() const { return m_checking; }
|
||||
QString lastResult() const { return m_lastResult; }
|
||||
@@ -69,8 +70,8 @@ public:
|
||||
Q_INVOKABLE int folderOut();
|
||||
// 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);
|
||||
const QString &bcc, const QString &da,
|
||||
const QString &oggetto, const QString &corpo);
|
||||
|
||||
signals:
|
||||
void ready();
|
||||
@@ -109,6 +110,10 @@ private:
|
||||
static gd_send_done_fn s_send_done;
|
||||
static gd_queue_sent_fn s_queue_sent;
|
||||
static gd_place_fn s_place;
|
||||
static gd_log_fn s_log;
|
||||
// Un mio passaggio scritto nel log del motore: senza, quando l'invio si
|
||||
// ferma prima del motore non resta traccia di niente.
|
||||
void logInvio(const QString &riga);
|
||||
QString cartelleViste();
|
||||
|
||||
void pollSend();
|
||||
|
||||
@@ -45,7 +45,7 @@ int gd_run(gd_folder_fn folder, gd_open_fn open, gd_cell_fn cell,
|
||||
gd_can_hold_fn unread)
|
||||
{
|
||||
(void)sort; (void)mark_read; (void)id_of; (void)row_of; (void)move;
|
||||
(void)commit; (void)empty; (void)log; (void)priority; (void)label;
|
||||
(void)commit; (void)empty; (void)priority; (void)label;
|
||||
(void)decrypt; (void)key_of; (void)plain;
|
||||
(void)sheet; (void)filter; (void)last_id;
|
||||
(void)find_start; (void)find_poll; (void)find_cancel; (void)id_named;
|
||||
@@ -61,7 +61,7 @@ int gd_run(gd_folder_fn folder, gd_open_fn open, gd_cell_fn cell,
|
||||
imap_start, imap_poll, rescan, attachments, sort,
|
||||
absorb, sender, header, compose, claim,
|
||||
send_start, send_poll, send_done, queue_sent,
|
||||
place);
|
||||
place, log);
|
||||
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.6.3"));
|
||||
app->setApplicationVersion(QStringLiteral("0.6.7"));
|
||||
|
||||
qDebug() << "harbour-grumpydove v0.6.3 build" << __DATE__ << __TIME__;
|
||||
qDebug() << "harbour-grumpydove v0.6.7 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