Skip to content

Commit

Permalink
Merge pull request #58 from nemomobile-packages/inlineMessages
Browse files Browse the repository at this point in the history
[qmf] Add QMailMessagePartContainer::findInlinePartLocations()
  • Loading branch information
VDVsx committed Oct 16, 2014
2 parents a9e4765 + 44da611 commit b0ef284
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
26 changes: 24 additions & 2 deletions qmf/src/libraries/qmfclient/qmailmessage.cpp
Expand Up @@ -914,6 +914,7 @@ namespace findBody
QMailMessagePartContainer *alternateParent;
QList<QMailMessagePart::Location> htmlImageLoc;
QList<const QMailMessagePart *> htmlImageParts;
QList<QMailMessagePart::Location> htmlExtraPartsLoc;
QByteArray contentType;
QByteArray contentSubtype;
};
Expand Down Expand Up @@ -1019,9 +1020,13 @@ namespace findBody
for (int i = (int)container.partCount() - 1; i >= 0; i--) {
if (i != bodyPart) {
const QMailMessagePart &part = container.partAt(i);
if (imageContentType == part.contentType().type().toLower())
if (imageContentType == part.contentType().type().toLower()) {
ctx.htmlImageLoc << part.location();
ctx.htmlImageParts << &part;
} else if (!part.contentID().isEmpty()) {
// Adding extra inline part
ctx.htmlExtraPartsLoc << part.location();
}
}
}

Expand Down Expand Up @@ -5096,7 +5101,10 @@ QList<QMailMessagePart::Location> QMailMessagePartContainer::findAttachmentLocat
}

/*!
Returns the locations of the attachments in a container, dealing with a range of different message structures and exceptions.
Returns the locations of the inline images in a HTML body container, only parts with content type "image" will be returned.
Note that sometimes inline images content type is not defined or is other than "image".
\sa findInlinePartLocations()
*/
QList<QMailMessagePart::Location> QMailMessagePartContainer::findInlineImageLocations() const
{
Expand All @@ -5109,6 +5117,20 @@ QList<QMailMessagePart::Location> QMailMessagePartContainer::findInlineImageLoca
}
}

/*!
Returns the locations of the inline parts in a HTML body container, only parts with a content id reference will be returned.
*/
QList<QMailMessagePart::Location> QMailMessagePartContainer::findInlinePartLocations() const
{
findBody::Context ctx;
ctx.contentSubtype = htmlContentSubtype;
if (findBody::inPartContainer(*this, ctx)) {
return ctx.htmlImageLoc << ctx.htmlExtraPartsLoc;
} else {
return QList<QMailMessagePart::Location>();
}
}

/*!
Returns true if a plain text body is present in the container.
*/
Expand Down
1 change: 1 addition & 0 deletions qmf/src/libraries/qmfclient/qmailmessage.h
Expand Up @@ -386,6 +386,7 @@ class QMF_EXPORT QMailMessagePartContainer : public QPrivatelyImplemented<QMailM
QMailMessagePartContainer* findHtmlContainer() const;
QList<QMailMessagePartContainer::Location> findAttachmentLocations() const;
QList<QMailMessagePartContainer::Location> findInlineImageLocations() const;
QList<QMailMessagePartContainer::Location> findInlinePartLocations() const;
bool hasPlainTextBody() const;
bool hasHtmlBody() const;
bool hasAttachments() const;
Expand Down
2 changes: 1 addition & 1 deletion rpm/qmf-qt5.spec
@@ -1,6 +1,6 @@
Name: qmf-qt5
Summary: Qt Messaging Framework (QMF) Qt5
Version: 4.0.4+git32
Version: 4.0.4+git33
Release: 1
Group: System/Libraries
License: LGPLv2.1 with exception or GPLv3
Expand Down

0 comments on commit b0ef284

Please sign in to comment.