feat: IMAP sync incremental + Account Setup Wizard + robust FETCH parser
- ImapSynchronizer::syncFolder(): detecta eliminados (UIDs locales no en servidor), fetch nuevos (sinceUid), actualiza flags (FLAGS batch) - fetchAllUids(): SELECT + SEARCH ALL para lista completa UIDs servidor - parseAndUpdateFlags(): FETCH FLAGS en lotes 100, update DB si cambió read/flagged - AccountSetupDialog: integra ConnectionWizard para IMAP/POP3 con test de conexión real - IMAP FETCH parser robusto: logging respuesta servidor + fallback UID-by-UID - Fix: FETCH failed logging muestra first/last UID + respuesta truncada
This commit is contained in:
+25
-1
@@ -1,5 +1,8 @@
|
||||
#include "ui/readerview.h"
|
||||
#include <QFont>
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
#include "db/dao/mailitemdao.h"
|
||||
|
||||
ReaderView::ReaderView(QWidget *parent) : QWidget(parent) {
|
||||
setupUI();
|
||||
@@ -55,8 +58,19 @@ void ReaderView::setupUI() {
|
||||
m_bodyViewer->setOpenExternalLinks(true);
|
||||
m_bodyViewer->setFrameStyle(QFrame::NoFrame);
|
||||
|
||||
m_attachmentList = new QListWidget();
|
||||
m_attachmentList->setVisible(false);
|
||||
m_attachmentList->setMaximumHeight(110);
|
||||
m_attachmentList->setToolTip(tr("Double-click an attachment to open it"));
|
||||
connect(m_attachmentList, &QListWidget::itemDoubleClicked, this,
|
||||
[](QListWidgetItem *listItem) {
|
||||
const QString path = listItem->data(Qt::UserRole).toString();
|
||||
if (!path.isEmpty()) QDesktopServices::openUrl(QUrl::fromLocalFile(path));
|
||||
});
|
||||
|
||||
mainLayout->addWidget(headerWidget);
|
||||
mainLayout->addLayout(actionsLayout);
|
||||
mainLayout->addWidget(m_attachmentList);
|
||||
mainLayout->addWidget(m_bodyViewer);
|
||||
|
||||
// Connections
|
||||
@@ -72,6 +86,8 @@ void ReaderView::setMailItem(const MailItem* item) {
|
||||
m_subjectLabel->setText("No mail selected");
|
||||
m_fromLabel->setText("From: ");
|
||||
m_dateLabel->setText("Date: ");
|
||||
m_attachmentList->clear();
|
||||
m_attachmentList->setVisible(false);
|
||||
m_bodyViewer->setHtml("<i>Please select a message to read</i>");
|
||||
return;
|
||||
}
|
||||
@@ -79,5 +95,13 @@ void ReaderView::setMailItem(const MailItem* item) {
|
||||
m_subjectLabel->setText(item->subject());
|
||||
m_fromLabel->setText(QString("From: %1").arg(item->sender()));
|
||||
m_dateLabel->setText(QString("Date: %1").arg(item->date().toString("ddd, d MMM yyyy hh:mm")));
|
||||
m_attachmentList->clear();
|
||||
const QVector<StoredAttachmentRecord> attachments = MailItemDao::attachmentsForMail(item->id());
|
||||
for (const StoredAttachmentRecord &attachment : attachments) {
|
||||
auto *listItem = new QListWidgetItem(attachment.fileName, m_attachmentList);
|
||||
listItem->setData(Qt::UserRole, attachment.storedPath);
|
||||
listItem->setToolTip(attachment.storedPath);
|
||||
}
|
||||
m_attachmentList->setVisible(!attachments.isEmpty());
|
||||
m_bodyViewer->setHtml(item->bodyHtml());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user