Changeset View
Changeset View
Standalone View
Standalone View
src/akonadi/akonaditaskrepository.cpp
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | |||||
46 | KJob *TaskRepository::createItem(const Item &item) | 46 | KJob *TaskRepository::createItem(const Item &item) | ||
47 | { | 47 | { | ||
48 | const Akonadi::Collection defaultCollection = m_storage->defaultCollection(); | 48 | const Akonadi::Collection defaultCollection = m_storage->defaultCollection(); | ||
49 | if (defaultCollection.isValid()) { | 49 | if (defaultCollection.isValid()) { | ||
50 | return m_storage->createItem(item, defaultCollection); | 50 | return m_storage->createItem(item, defaultCollection); | ||
51 | } else { | 51 | } else { | ||
52 | auto job = new CompositeJob(); | 52 | auto job = new CompositeJob(); | ||
53 | CollectionFetchJobInterface *fetchCollectionJob = m_storage->fetchCollections(Akonadi::Collection::root(), | 53 | CollectionFetchJobInterface *fetchCollectionJob = m_storage->fetchCollections(Akonadi::Collection::root(), | ||
54 | StorageInterface::Recursive); | 54 | StorageInterface::Recursive, | ||
55 | this); | ||||
55 | job->install(fetchCollectionJob->kjob(), [fetchCollectionJob, item, job, this] { | 56 | job->install(fetchCollectionJob->kjob(), [fetchCollectionJob, item, job, this] { | ||
56 | if (fetchCollectionJob->kjob()->error() != KJob::NoError) | 57 | if (fetchCollectionJob->kjob()->error() != KJob::NoError) | ||
57 | return; | 58 | return; | ||
58 | 59 | | |||
59 | Q_ASSERT(fetchCollectionJob->collections().size() > 0); | 60 | Q_ASSERT(fetchCollectionJob->collections().size() > 0); | ||
60 | const Akonadi::Collection::List collections = fetchCollectionJob->collections(); | 61 | const Akonadi::Collection::List collections = fetchCollectionJob->collections(); | ||
61 | auto it = std::find_if(collections.constBegin(), collections.constEnd(), | 62 | auto it = std::find_if(collections.constBegin(), collections.constEnd(), | ||
62 | [] (const Akonadi::Collection &c) { | 63 | [] (const Akonadi::Collection &c) { | ||
▲ Show 20 Lines • Show All 241 Lines • Show Last 20 Lines |