Rendering HTML dei messaggi (0.13.0)
La parte HTML viene disegnata da Qt (Text.RichText) invece di essere ridotta a testo. Prima passa da htmlpulito.js: via script, iframe, oggetti, gestori di eventi, immagini remote (una spia: direbbero al mittente che hai aperto il messaggio) e colori che sul tema scuro sarebbero illeggibili; restano paragrafi, grassetti, elenchi, tabelle e link (solo http, https, mailto). Vedi come testo resta nel menu.
This commit is contained in:
1 parent
ca351854a3
commit
bbcb7069ec
7 files changed
+201
-7
No files matched your search
@@ -1260,6 +1260,20 @@ QVariantList EngineBridge::messages(int folder)
|
||||
return out;
|
||||
}
|
||||
|
||||
// La parte HTML del messaggio, così come l'ha scritta il mittente: la pagina
|
||||
// la ripulisce e la disegna (qml/js/htmlpulito.js). Vuota se il messaggio non
|
||||
// ha una parte HTML.
|
||||
QString EngineBridge::corpoHtml(int folder, int row)
|
||||
{
|
||||
if (!s_html || !s_id_of) return QString();
|
||||
const int id = s_id_of(folder, row);
|
||||
if (id < 0) return QString();
|
||||
QByteArray buf(1 << 20, '\0'); // 1 MiB: oltre, non vale la pena disegnarlo
|
||||
const int n = s_html(folder, id, buf.data(), buf.size() - 1);
|
||||
if (n <= 0) return QString();
|
||||
return QString::fromUtf8(buf.constData(), qMin(n, buf.size() - 1));
|
||||
}
|
||||
|
||||
QString EngineBridge::body(int folder, int row)
|
||||
{
|
||||
char buf[65536];
|
||||
|
||||
@@ -62,6 +62,7 @@ public:
|
||||
Q_INVOKABLE QVariantList folders();
|
||||
Q_INVOKABLE QVariantList messages(int folder);
|
||||
Q_INVOKABLE QString body(int folder, int row);
|
||||
Q_INVOKABLE QString corpoHtml(int folder, int row);
|
||||
Q_INVOKABLE QString cell(int folder, int row, int column);
|
||||
Q_INVOKABLE int totalUnread();
|
||||
Q_INVOKABLE void markRead(int folder, int row, bool read);
|
||||
|
||||
+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.12.0"));
|
||||
app->setApplicationVersion(QStringLiteral("0.13.0"));
|
||||
|
||||
qDebug() << "harbour-grumpydove v0.12.0 build" << __DATE__ << __TIME__;
|
||||
qDebug() << "harbour-grumpydove v0.13.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