feat: move-to-folder dialog, batch actions, reader source view, Focused/Other pivot
- MoveToFolderDialog: modal folder picker per account (excludes current) - Wire 'Mover a...' in reader ⋯ menu + batch move (emit -1 -> dialog) - Connect batch delete/mark-unread/flag handlers (were unconnected) - Reader: 'Ver codigo fuente' reads .eml via MimeStorageService::readEmlFile - Reader: 'Marcar como no leido' emits markUnreadRequested - Pivot Focused/Other: EmailListModel::setShowFocusedOnly heuristic (flagged/pinned/frequent senders), reset to Focused on inbox select
This commit is contained in:
+47
-3
@@ -1,4 +1,5 @@
|
||||
#include "ui/readerview.h"
|
||||
#include "services/mimestorage.h"
|
||||
#include <QFont>
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
@@ -15,6 +16,9 @@
|
||||
#include <QDateTime>
|
||||
#include <QClipboard>
|
||||
#include <QMessageBox>
|
||||
#include <QDialog>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QScrollBar>
|
||||
#include <QShortcut>
|
||||
#include <QFileDialog>
|
||||
@@ -325,10 +329,50 @@ void ReaderView::setupUI() {
|
||||
if (item.has_value()) QApplication::clipboard()->setText(item->sender());
|
||||
}
|
||||
});
|
||||
moreMenu->addAction("Ver código fuente", [this]() { /* TODO */ });
|
||||
moreMenu->addAction("Ver código fuente", [this]() {
|
||||
if (m_currentMailId < 0) return;
|
||||
std::optional<MailItem> item = MailItemDao::findById(m_currentMailId);
|
||||
if (!item.has_value()) return;
|
||||
QByteArray raw;
|
||||
if (!item->fileId().isEmpty()) {
|
||||
MimeStorageService storage;
|
||||
raw = storage.readEmlFile(item->fileId());
|
||||
}
|
||||
if (raw.isEmpty()) raw = item->rawMime();
|
||||
if (raw.isEmpty()) {
|
||||
QMessageBox::information(this, tr("Código fuente"),
|
||||
tr("No hay código fuente disponible para este correo."));
|
||||
return;
|
||||
}
|
||||
QDialog dlg(this);
|
||||
dlg.setWindowTitle(tr("Código fuente"));
|
||||
dlg.resize(760, 560);
|
||||
QVBoxLayout *lay = new QVBoxLayout(&dlg);
|
||||
QPlainTextEdit *view = new QPlainTextEdit(&dlg);
|
||||
view->setReadOnly(true);
|
||||
view->setPlainText(QString::fromUtf8(raw));
|
||||
view->setStyleSheet("font-family: 'Consolas','Menlo',monospace; font-size: 12px;");
|
||||
lay->addWidget(view);
|
||||
QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Close, &dlg);
|
||||
connect(buttons, &QDialogButtonBox::rejected, &dlg, &QDialog::reject);
|
||||
lay->addWidget(buttons);
|
||||
dlg.exec();
|
||||
});
|
||||
moreMenu->addSeparator();
|
||||
moreMenu->addAction("Marcar como no leído", [this]() { /* TODO */ });
|
||||
moreMenu->addAction("Marcar como spam", [this]() { /* TODO */ });
|
||||
moreMenu->addAction("Marcar como no leído", [this]() {
|
||||
if (m_currentMailId < 0) return;
|
||||
auto item = MailItemDao::findById(m_currentMailId);
|
||||
if (item.has_value()) {
|
||||
item->setRead(false);
|
||||
MailItemDao::update(*item);
|
||||
emit markUnreadRequested(m_currentMailId);
|
||||
}
|
||||
});
|
||||
moreMenu->addAction("Marcar como spam", [this]() {
|
||||
if (m_currentMailId < 0) return;
|
||||
QMessageBox::information(this, tr("Marcar como spam"),
|
||||
tr("Función: mover a carpeta «Spam». Disponible en una próxima versión."));
|
||||
});
|
||||
m_moreButton->setMenu(moreMenu);
|
||||
m_moreButton->setStyleSheet(
|
||||
"QToolButton { background: transparent; border: 1px solid #d1d1d6; border-radius: 4px; font-size: 16px; }"
|
||||
|
||||
Reference in New Issue
Block a user