emailQt/EmailDetails.cpp

35 lines
866 B
C++
Raw Permalink Normal View History

2024-03-08 12:10:58 -05:00
#include "EmailDetails.hpp"
EmailDetails::EmailDetails(QWidget *parent)
2024-12-19 18:51:41 -05:00
: QWidget(parent), em{} {
2024-03-08 12:10:58 -05:00
t = new QTextEdit;
2024-12-19 18:51:41 -05:00
dbg = new QCheckBox("View raw message");
2024-03-08 12:10:58 -05:00
auto *lay = new QVBoxLayout;
2024-12-19 18:51:41 -05:00
lay->addWidget(dbg);
2024-03-08 12:10:58 -05:00
lay->addWidget(t);
setLayout(lay);
2024-12-19 18:51:41 -05:00
connect(dbg, &QCheckBox::checkStateChanged, this, &EmailDetails::checkStateChanged);
2024-03-08 12:10:58 -05:00
resize(800, 600);
}
void EmailDetails::setMail(const Email &m) {
setWindowTitle(QString::fromStdString(m.title()));
t->setPlainText(QString::fromStdString(m.message()));
2024-12-19 18:51:41 -05:00
delete em;
em = new Email(m);
}
void EmailDetails::checkStateChanged(Qt::CheckState state) {
if(em) {
if (state == Qt::Checked) {
t->setPlainText(QString::fromStdString(em->raw()));
} else {
t->setPlainText(QString::fromStdString(em->message()));
}
}
2024-03-08 12:10:58 -05:00
}