Fixed Qt4 compilation for version 1.1. Works with MSVC2013. (#62)

This commit is contained in:
Evon Silvia 2018-04-23 09:02:34 -07:00
parent ca43f9d642
commit 81c652dc73

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;