Commit 27827abd authored by Olivier Churlaud's avatar Olivier Churlaud

Store the caldav color (if it exists) in the collection, based on...

Store the caldav color (if it exists) in the collection, based on Akonadi::CollectionColorAttribute.

Bug: 328862

Differential Revision: https://phabricator.kde.org/D7499
parent 3be9dcec
......@@ -51,6 +51,7 @@
#include <kjob.h>
#include <attributefactory.h>
#include <collectioncolorattribute.h>
#include <cachepolicy.h>
#include <changerecorder.h>
#include <collectionfetchscope.h>
......@@ -82,6 +83,7 @@ DavGroupwareResource::DavGroupwareResource(const QString &id)
AttributeFactory::registerAttribute<EntityDisplayAttribute>();
AttributeFactory::registerAttribute<DavProtocolAttribute>();
AttributeFactory::registerAttribute<CTagAttribute>();
AttributeFactory::registerAttribute<CollectionColorAttribute>();
setNeedsNetwork(true);
......@@ -700,6 +702,11 @@ void DavGroupwareResource::onRetrieveCollectionsFinished(KJob *job)
collection.setRemoteId(davCollection.url().toDisplayString());
collection.setName(collection.remoteId());
if (davCollection.color().isValid()) {
CollectionColorAttribute *colorAttr = collection.attribute<CollectionColorAttribute>(Akonadi::Collection::AddIfMissing);
colorAttr->setColor(davCollection.color());
}
if (!davCollection.displayName().isEmpty()) {
EntityDisplayAttribute *attr = collection.attribute<EntityDisplayAttribute>(Collection::AddIfMissing);
attr->setDisplayName(davCollection.displayName());
......
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