Merge pull request #69 from esilvia/v1.1

Fixed Qt4 compilation for version 1.1. Works with MSVC2013. (#62)
This commit is contained in:
Attila Tőkés 2018-04-24 07:28:33 +03:00 committed by GitHub
commit 3d87c6306e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,7 +24,7 @@
/* [1] Constructors and Destructors */ /* [1] Constructors and Destructors */
MimeMessage::MimeMessage(bool createAutoMimeContent) : MimeMessage::MimeMessage(bool createAutoMimeContent) :
replyTo(Q_NULLPTR), replyTo(nullptr),
hEncoding(MimePart::_8Bit) hEncoding(MimePart::_8Bit)
{ {
if (createAutoMimeContent) if (createAutoMimeContent)
@ -37,8 +37,8 @@ MimeMessage::~MimeMessage()
{ {
if (this->autoMimeContentCreated) if (this->autoMimeContentCreated)
{ {
this->autoMimeContentCreated = false; this->autoMimeContentCreated = false;
delete (this->content); delete (this->content);
} }
} }
@ -53,8 +53,8 @@ MimePart& MimeMessage::getContent() {
void MimeMessage::setContent(MimePart *content) { void MimeMessage::setContent(MimePart *content) {
if (this->autoMimeContentCreated) if (this->autoMimeContentCreated)
{ {
this->autoMimeContentCreated = false; this->autoMimeContentCreated = false;
delete (this->content); delete (this->content);
} }
this->content = content; this->content = content;
} }
@ -293,7 +293,12 @@ QString MimeMessage::toString()
mime += "In-Reply-To: <" + mInReplyTo + ">\r\n"; mime += "In-Reply-To: <" + mInReplyTo + ">\r\n";
mime += "References: <" + 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)); mime += QString("Date: %1\r\n").arg(QDateTime::currentDateTime().toString(Qt::RFC2822Date));
#endif //support RFC2822Date
mime += content->toString(); mime += content->toString();
return mime; return mime;