Commit b36568ad authored by Shashwat Jolly's avatar Shashwat Jolly

Update cache on adding collection

parent 34d38977
......@@ -211,7 +211,7 @@ void CalendarTaskBaseHandler::collectionAdded(const Akonadi::Collection &collect
EteSyncJournalPtr journal = etesync_journal_new(journalUid, ETESYNC_CURRENT_VERSION);
/// TODO: Description?
EteSyncCollectionInfoPtr info = etesync_collection_info_new(etesyncCollectionType(), collection.displayName(), QString(), EteSyncDEFAULT_COLOR);
EteSyncCollectionInfoPtr info = etesync_collection_info_new(etesyncCollectionType(), collection.displayName(), QString(), ETESYNC_COLLECTION_DEFAULT_COLOR);
EteSyncCryptoManagerPtr cryptoManager = etesync_journal_get_crypto_manager(journal.get(), mClientState->derived(), mClientState->keypair());
......@@ -225,6 +225,7 @@ void CalendarTaskBaseHandler::collectionAdded(const Akonadi::Collection &collect
Collection newCollection(collection);
mResource->setupCollection(newCollection, journal.get());
mResource->mJournalsCache[newCollection.remoteId()] = std::move(journal);
mResource->changeCommitted(newCollection);
}
......@@ -233,7 +234,7 @@ void CalendarTaskBaseHandler::collectionChanged(const Akonadi::Collection &colle
const QString journalUid = collection.remoteId();
const EteSyncJournalPtr &journal = mResource->getJournal(journalUid);
auto journalColor = EteSyncDEFAULT_COLOR;
auto journalColor = ETESYNC_COLLECTION_DEFAULT_COLOR;
if (collection.hasAttribute<CollectionColorAttribute>()) {
const CollectionColorAttribute *colorAttr = collection.attribute<CollectionColorAttribute>();
if (colorAttr) {
......
......@@ -210,7 +210,7 @@ void ContactHandler::collectionAdded(const Akonadi::Collection &collection, cons
const QString journalUid = QStringFromCharPtr(CharPtr(etesync_gen_uid()));
EteSyncJournalPtr journal = etesync_journal_new(journalUid, ETESYNC_CURRENT_VERSION);
EteSyncCollectionInfoPtr info = etesync_collection_info_new(etesyncCollectionType(), collection.displayName(), QString(), EteSyncDEFAULT_COLOR);
EteSyncCollectionInfoPtr info = etesync_collection_info_new(etesyncCollectionType(), collection.displayName(), QString(), ETESYNC_COLLECTION_DEFAULT_COLOR);
EteSyncCryptoManagerPtr cryptoManager = etesync_journal_get_crypto_manager(journal.get(), mClientState->derived(), mClientState->keypair());
......@@ -224,6 +224,7 @@ void ContactHandler::collectionAdded(const Akonadi::Collection &collection, cons
Collection newCollection(collection);
mResource->setupCollection(newCollection, journal.get());
mResource->mJournalsCache[newCollection.remoteId()] = std::move(journal);
mResource->changeCommitted(newCollection);
}
......
......@@ -160,8 +160,10 @@ void EteSyncResource::slotCollectionsRetrieved(KJob *job)
Collection collection;
collection.setParentCollection(rootCollection);
setupCollection(collection, *iter);
mJournalsCache[collection.remoteId()] = EteSyncJournalPtr(*iter);
list.push_back(collection);
}
mJournalsCacheUpdateTime = QDateTime::currentDateTime();
free(journals);
collectionsRetrieved(list);
collectionsRetrievalDone();
......@@ -221,9 +223,6 @@ void EteSyncResource::setupCollection(Collection &collection, EteSyncJournal *jo
collection.setRemoteId(journalUid);
collection.setName(journalUid);
collection.setContentMimeTypes(mimeTypes);
mJournalsCache[journalUid] = EteSyncJournalPtr(journal);
mJournalsCacheUpdateTime = QDateTime::currentDateTime();
}
BaseHandler *EteSyncResource::fetchHandlerForMimeType(const QString &mimeType)
......
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