新增运行截图
This commit is contained in:
67
emailtool/sendemail/mimemultipart.cpp
Normal file
67
emailtool/sendemail/mimemultipart.cpp
Normal file
@@ -0,0 +1,67 @@
|
||||
#include "mimemultipart.h"
|
||||
#include <QTime>
|
||||
#include <QCryptographicHash>
|
||||
|
||||
const QString MULTI_PART_NAMES[] = {
|
||||
"multipart/mixed", // Mixed
|
||||
"multipart/digest", // Digest
|
||||
"multipart/alternative", // Alternative
|
||||
"multipart/related", // Related
|
||||
"multipart/report", // Report
|
||||
"multipart/signed", // Signed
|
||||
"multipart/encrypted" // Encrypted
|
||||
};
|
||||
|
||||
MimeMultiPart::MimeMultiPart(MultiPartType type)
|
||||
{
|
||||
this->type = type;
|
||||
this->cType = MULTI_PART_NAMES[this->type];
|
||||
this->cEncoding = _8Bit;
|
||||
|
||||
QCryptographicHash md5(QCryptographicHash::Md5);
|
||||
md5.addData(QByteArray().append(qrand()));
|
||||
cBoundary = md5.result().toHex();
|
||||
}
|
||||
|
||||
MimeMultiPart::~MimeMultiPart()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void MimeMultiPart::addPart(MimePart *part)
|
||||
{
|
||||
parts.append(part);
|
||||
}
|
||||
|
||||
const QList<MimePart *> &MimeMultiPart::getParts() const
|
||||
{
|
||||
return parts;
|
||||
}
|
||||
|
||||
void MimeMultiPart::prepare()
|
||||
{
|
||||
QList<MimePart *>::iterator it;
|
||||
|
||||
content = "";
|
||||
|
||||
for (it = parts.begin(); it != parts.end(); it++) {
|
||||
content += "--" + cBoundary + "\r\n";
|
||||
(*it)->prepare();
|
||||
content += (*it)->toString();
|
||||
};
|
||||
|
||||
content += "--" + cBoundary + "--\r\n";
|
||||
|
||||
MimePart::prepare();
|
||||
}
|
||||
|
||||
void MimeMultiPart::setMimeType(const MultiPartType type)
|
||||
{
|
||||
this->type = type;
|
||||
this->cType = MULTI_PART_NAMES[type];
|
||||
}
|
||||
|
||||
MimeMultiPart::MultiPartType MimeMultiPart::getMimeType() const
|
||||
{
|
||||
return type;
|
||||
}
|
||||
Reference in New Issue
Block a user