35 lines
866 B
C++
35 lines
866 B
C++
#include "EmailDetails.hpp"
|
|
|
|
EmailDetails::EmailDetails(QWidget *parent)
|
|
: QWidget(parent), em{} {
|
|
t = new QTextEdit;
|
|
dbg = new QCheckBox("View raw message");
|
|
|
|
auto *lay = new QVBoxLayout;
|
|
|
|
lay->addWidget(dbg);
|
|
lay->addWidget(t);
|
|
setLayout(lay);
|
|
|
|
connect(dbg, &QCheckBox::checkStateChanged, this, &EmailDetails::checkStateChanged);
|
|
|
|
resize(800, 600);
|
|
}
|
|
|
|
void EmailDetails::setMail(const Email &m) {
|
|
setWindowTitle(QString::fromStdString(m.title()));
|
|
t->setPlainText(QString::fromStdString(m.message()));
|
|
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()));
|
|
}
|
|
}
|
|
}
|