Messagelib
nodehelper.cpp
59 qCDebug(MIMETREEPARSER_LOG) << "Node processed: " << node->index().toString() << node->contentType()->as7BitString();
108static void clearBodyPartMemento(QMap<QByteArray, Interface::BodyPartMemento *> &bodyPartMementoMap)
110 for (QMap<QByteArray, Interface::BodyPartMemento *>::iterator it = bodyPartMementoMap.begin(), end = bodyPartMementoMap.end(); it != end; ++it) {
128 for (QMap<KMime::Content *, QList<KMime::Content *>>::ConstIterator it = mExtraContents.constBegin(); it != end; ++it) {
144void NodeHelper::setEncryptionState(const KMime::Content *node, const KMMsgEncryptionState state)
271 auto tempFile = new QTemporaryFile(QDir::tempPath() + QLatin1StringView("/messageviewer_XXXXXX") + QLatin1StringView(".index.") + param);
279 if (!QDir().mkpath(fname) || !fFile.setPermissions(QFileDevice::WriteUser | QFileDevice::ReadUser | QFileDevice::ExeUser)) {
318 const bool parentIsMessage = cur->parent() && cur->parent()->contentType() && cur->parent()->contentType()->mimeType().toLower() == "message/rfc822";
480QList<MessagePart::Ptr> NodeHelper::messagePartsOfMailHeader(const char *header, const KMime::Content *message) const
494QList<KMime::Headers::Base *> NodeHelper::headers(const char *header, const KMime::Content *message)
504KMime::Headers::Base const *NodeHelper::mailHeaderAsBase(const char *header, const KMime::Content *message) const
517QSharedPointer<KMime::Headers::Generics::AddressList> NodeHelper::mailHeaderAsAddressList(const char *header, const KMime::Content *message) const
523 QSharedPointer<KMime::Headers::Generics::AddressList> addressList(new KMime::Headers::Generics::AddressList());
598// FIXME(Andras) review it (by Marc?) to see if I got it right. This is supposed to be the partNode::internalBodyPartMemento replacement
599Interface::BodyPartMemento *NodeHelper::bodyPartMemento(KMime::Content *node, const QByteArray &which) const
601 const QMap<QString, QMap<QByteArray, Interface::BodyPartMemento *>>::const_iterator nit = mBodyPartMementoMap.find(persistentIndex(node));
605 const QMap<QByteArray, Interface::BodyPartMemento *>::const_iterator it = nit->find(which.toLower());
609// FIXME(Andras) review it (by Marc?) to see if I got it right. This is supposed to be the partNode::internalSetBodyPartMemento replacement
610void NodeHelper::setBodyPartMemento(KMime::Content *node, const QByteArray &which, Interface::BodyPartMemento *memento)
612 QMap<QByteArray, Interface::BodyPartMemento *> &mementos = mBodyPartMementoMap[persistentIndex(node)];
615 const QMap<QByteArray, Interface::BodyPartMemento *>::iterator it = mementos.lowerBound(whichLower);
712KMime::Content *NodeHelper::contentFromIndex(KMime::Content *node, const QString &persistentIndex) const
809 const QString mimeName = (codec.isValid()) ? QString::fromLatin1(codec.name()).toLower() : (*it);
824 auto realNode = std::find_if(mExtraContents.cbegin(), mExtraContents.cend(), [node](const QList<KMime::Content *> &nodes) {
861 qCWarning(MIMETREEPARSER_LOG) << "Asked to attach extra content to a kmime::message, this does not make sense. Attaching to:" << node
938bool NodeHelper::unencryptedMessage_helper(KMime::Content *node, QByteArray &resultingData, bool addHeaders, int recursionLevel)
944 const QByteArray type = node->contentType(false) ? QByteArray(node->contentType(false)->mediaType()).toLower() : "text";
945 const QByteArray subType = node->contentType(false) ? node->contentType(false)->subType().toLower() : "plain";
949 qCDebug(MIMETREEPARSER_LOG) << "(" << recursionLevel << ") Looking at" << type << "/" << subType;
972 qCDebug(MIMETREEPARSER_LOG) << "Current node has an associated decrypted node, adding a modified header "
1007 // We can't change the nodes under the signature, as that would invalidate it. Add the signature
1015 qCDebug(MIMETREEPARSER_LOG) << "Current node is a multipart node, adding its header and then processing all children.";
1025 const bool changed = unencryptedMessage_helper(child, resultingData, true, recursionLevel + 1);
1033 qCDebug(MIMETREEPARSER_LOG) << "Current node is a message, adding the header and then processing the child.";
1038 returnValue = unencryptedMessage_helper(curNode->bodyAsMessage().data(), resultingData, true, recursionLevel + 1);
1056 const bool messageChanged = unencryptedMessage_helper(originalMessage.data(), resultingData, true);
QString encodingForName(const QString &descriptiveName) const
QStringList availableEncodingNames() const
static KCharsets * charsets()
QString toString() const
bool removeHeader()
const Headers::ContentType * contentType() const
QByteArray encodedBody() const
Content * takeContent(Content *content)
ContentIndex index() const
QList< KMime::Content * > List
Content * parent()
QByteArray head() const
void assemble()
QByteArray decodedContent() const
QSharedPointer< Message > bodyAsMessage()
Content * content(const ContentIndex &index) const
void parse()
QByteArray body() const
bool bodyIsMessage() const
const Headers::ContentTransferEncoding * contentTransferEncoding() const
void setContent(const QByteArray &s)
const Headers::ContentDisposition * contentDisposition() const
void clear()
void appendContent(Content *content)
QList< Content * > attachments()
Content * topLevel()
void setHead(const QByteArray &head)
QByteArray encodedContent(bool useCrLf=false) const
QList< Content * > contents()
const Headers::ContentDescription * contentDescription() const
QByteArray mediaType() const
QByteArray charset() const
QByteArray subType() const
bool isText() const
QByteArray as7BitString(bool withHeaderType=true) const override
bool isMultipart() const
void setMimeType(const QByteArray &mimeType)
QByteArray mimeType() const
QByteArray boundary() const
void from7BitString(QByteArrayView s) override
void from7BitString(QByteArrayView s) override
The AttachmentTemporaryFilesDirs class.
Definition attachmenttemporaryfilesdirs.h:21
interface of classes that implement status for BodyPartFormatters.
Definition bodypart.h:34
QString path(const QString &relativePath)
KGuiItem clear()
const QList< QKeySequence > & next()
const QList< QKeySequence > & end()
bool isEmpty() const const
QByteArray toLower() const const
QString tempPath()
bool open(FILE *fh, OpenMode mode, FileHandleFlags handleFlags)
Permissions permissions(const QString &fileName)
virtual bool setPermissions(Permissions permissions) override
ReadUser
virtual void close() override
QString errorString() const const
qint64 write(const QByteArray &data)
WriteOnly
ConstIterator
void append(QList< T > &&value)
const_iterator constBegin() const const
const_iterator constEnd() const const
bool empty() const const
reference front()
void push_back(parameter_type value)
qsizetype size() const const
T value(qsizetype i) const const
iterator begin()
void clear()
bool contains(const Key &key) const const
iterator end()
iterator erase(const_iterator first, const_iterator last)
iterator find(const Key &key)
iterator insert(const Key &key, const T &value)
Key key(const T &value, const Key &defaultKey) const const
iterator lowerBound(const Key &key)
T value(const Key &key, const T &defaultValue) const const
QMimeType mimeTypeForData(QIODevice *device) const const
name
QString captured(QStringView name) const const
bool hasMatch() const const
QString arg(Args &&... args) const const
bool contains(QChar ch, Qt::CaseSensitivity cs) const const
QString fromLatin1(QByteArrayView str)
bool isEmpty() const const
bool isNull() const const
qsizetype lastIndexOf(QChar ch, Qt::CaseSensitivity cs) const const
QString mid(qsizetype position, qsizetype n) const const
QString & prepend(QChar ch)
QString & replace(QChar before, QChar after, Qt::CaseSensitivity cs)
QStringList split(QChar sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const const
bool startsWith(QChar c, Qt::CaseSensitivity cs) const const
QString toLower() const const
QString toUpper() const const
QString trimmed() const const
bool isValid() const const
const char * name() const const
void sort(Qt::CaseSensitivity cs)
QStringView mid(qsizetype start, qsizetype length) const const
QStringView sliced(qsizetype pos) const const
int toInt(bool *ok, int base) const const
SkipEmptyParts
StripTrailingSlash
QUrl adjusted(FormattingOptions options) const const
QUrl fromLocalFile(const QString &localFile)
bool isEmpty() const const
bool isLocalFile() const const
QString path(ComponentFormattingOptions options) const const
QString toLocalFile() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:07:25 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:07:25 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.