Commit 2d7cfb0a authored by Christian Mollekopf's avatar Christian Mollekopf Committed by Sandro Knauß

Do not show file folder in email list.

There are folders without a share annotations but a private
annotation.
If the shared annotation is set read that, and if not try the private
annotation. Also make sure hat only the main type is used to
determine the folder type.

Original Patch by Sandro Knauss
parent 75b3b1b8
......@@ -406,13 +406,18 @@ QStringList KolabHelpers::getContentMimeTypes(Kolab::FolderType type)
Kolab::FolderType KolabHelpers::folderTypeFromString(const QByteArray &folderTypeName)
{
return Kolab::folderTypeFromString(std::string(folderTypeName.data(), folderTypeName.size()));
const QByteArray stripped = folderTypeName.split('.').first();
return Kolab::folderTypeFromString(std::string(stripped.data(), stripped.size()));
}
QByteArray KolabHelpers::getFolderTypeAnnotation(const QMap< QByteArray, QByteArray > &annotations)
{
if (annotations.contains("/shared" KOLAB_FOLDER_TYPE_ANNOTATION)) {
if (annotations.contains("/shared" KOLAB_FOLDER_TYPE_ANNOTATION)
&& !annotations.value("/shared" KOLAB_FOLDER_TYPE_ANNOTATION).isEmpty()) {
return annotations.value("/shared" KOLAB_FOLDER_TYPE_ANNOTATION);
} else if (annotations.contains("/private" KOLAB_FOLDER_TYPE_ANNOTATION)
&& !annotations.value("/private" KOLAB_FOLDER_TYPE_ANNOTATION).isEmpty()) {
return annotations.value("/private" KOLAB_FOLDER_TYPE_ANNOTATION);
}
return annotations.value(KOLAB_FOLDER_TYPE_ANNOTATION);
}
......
......@@ -474,7 +474,7 @@ void KolabRetrieveCollectionsTask::applyMetadata(QHash<QString, QMap<QByteArray,
const QMap<QByteArray, QByteArray> metadata = metadataMap.value(mailbox);
if (mMailCollections.contains(mailbox)) {
Akonadi::Collection &collection = mMailCollections[mailbox];
// qCDebug(KOLABRESOURCE_LOG) << "setting metadata: " << mailbox << metadata;
// qCDebug(KOLABRESOURCE_LOG) << mailbox << metadata << type << folderType << KolabHelpers::getContentMimeTypes(folderType);
collection.attribute<Akonadi::CollectionAnnotationsAttribute>(Akonadi::Collection::AddIfMissing)->setAnnotations(metadata);
const QByteArray type = KolabHelpers::getFolderTypeAnnotation(metadata);
const Kolab::FolderType folderType = KolabHelpers::folderTypeFromString(type);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment