From 81c652dc735a34bc3d3598d62f486e0e5f9cc968 Mon Sep 17 00:00:00 2001 From: Evon Silvia Date: Mon, 23 Apr 2018 09:02:34 -0700 Subject: [PATCH] Fixed Qt4 compilation for version 1.1. Works with MSVC2013. (#62) --- src/mimemessage.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/mimemessage.cpp b/src/mimemessage.cpp index 4c056d2..442faf8 100644 --- a/src/mimemessage.cpp +++ b/src/mimemessage.cpp @@ -24,7 +24,7 @@ /* [1] Constructors and Destructors */ MimeMessage::MimeMessage(bool createAutoMimeContent) : - replyTo(Q_NULLPTR), + replyTo(nullptr), hEncoding(MimePart::_8Bit) { if (createAutoMimeContent) @@ -37,8 +37,8 @@ MimeMessage::~MimeMessage() { if (this->autoMimeContentCreated) { - this->autoMimeContentCreated = false; - delete (this->content); + this->autoMimeContentCreated = false; + delete (this->content); } } @@ -53,8 +53,8 @@ MimePart& MimeMessage::getContent() { void MimeMessage::setContent(MimePart *content) { if (this->autoMimeContentCreated) { - this->autoMimeContentCreated = false; - delete (this->content); + this->autoMimeContentCreated = false; + delete (this->content); } this->content = content; } @@ -293,7 +293,12 @@ QString MimeMessage::toString() mime += "In-Reply-To: <" + mInReplyTo + ">\r\n"; mime += "References: <" + mInReplyTo + ">\r\n"; } + +#if QT_MAJOR_VERSION < 5 //Qt4 workaround since RFC2822Date isn't defined + mime += QString("Date: %1\r\n").arg(QDateTime::currentDateTime().toString("dd MMM yyyy hh:mm:ss +/-TZ")); +#elif //Qt5 supported mime += QString("Date: %1\r\n").arg(QDateTime::currentDateTime().toString(Qt::RFC2822Date)); +#endif //support RFC2822Date mime += content->toString(); return mime;