[Kde-pim] note format
Kevin Krammer
krammer at kde.org
Tue Mar 18 11:13:32 GMT 2014
On Tuesday, 2014-03-18, 11:20:38, Patrick Ohly wrote:
> However, Collection::getContentMimeTypes() returns an empty list in this
> code:
>
> m_collection = Collection::fromUrl(KUrl(id.c_str()));
> m_contentMimeType = "";
> QStringList collectionMimeTypes = m_collection.contentMimeTypes();
> foreach (const QString &mimeType, m_mimeTypes) {
> if (collectionMimeTypes.contains(mimeType)) {
> m_contentMimeType = mimeType;
> break;
> }
> }
> if (m_contentMimeType.isEmpty()) {
> SE_THROW(StringPrintf("Resource %s cannot store items of type(s) %s.
> It can only store %s.", id.c_str(),
> m_mimeTypes.join(",").toUtf8().constData(),
>
> collectionMimeTypes.join(",").toUtf8().constData())); }
>
> Why is that? The collection is found by a CollectionFetchJob with a
> scope including the m_mimeTypes list, so the URL is right.
Whatever was in m_collection is overwritten by Collection::fromUrl()
From then on it only contains the collection id.
Unless your code snippet is missing the colleciton fetch job between line two
an three?
Cheers,
Kevin
--
Kevin Krammer, KDE developer, xdg-utils developer
KDE user support, developer mentoring
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20140318/6b8eac91/attachment.sig>
-------------- next part --------------
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/
More information about the kde-pim
mailing list