akonadi
trashrestorejob.cpp
62 //Called after initial fetch of items, issues fetch of target collection or removes attributes for in place restore
83 if (!q->hasSubjobs() || (q->subjobs().contains(static_cast<KJob *>(q->sender())) && q->subjobs().size() == 1)) {
97 if (list.isEmpty() || !list.first().isValid() || list.first().hasAttribute<Akonadi::EntityDeletedAttribute>()) { //target collection is invalid/not existing
102 q->setErrorText(i18n("Could not find restore collection and restore resource is not available"));
110 CollectionFetchJob *resRootFetch = new CollectionFetchJob(Collection::root(), CollectionFetchJob::FirstLevel, q);
122 //We know where to move the entity, so remove the attributes and move them to the right location
128 //store removed attribute if destination collection is valid or the item doesn't have a restore collection
129 //TODO only remove the attribute if the move job was successful (although it is unlikely that it fails since we already fetched the collection)
139 CollectionFetchJob *collectionFetchJob = new CollectionFetchJob(mCollection, CollectionFetchJob::Recursive, q);
141 q->connect(collectionFetchJob, SIGNAL(collectionsReceived(Akonadi::Collection::List)), SLOT(removeAttribute(Akonadi::Collection::List)));
167 //If the restore collection is invalid we restore the item in place, so we don't need to know its restore resource => we can put those cases in the same list
168 restoreCollections[item.attribute<Akonadi::EntityDeletedAttribute>()->restoreCollection()].append(item);
175 const QString restoreResource = first.attribute<Akonadi::EntityDeletedAttribute>()->restoreResource();
189 CollectionFetchJob *fetchJob = new CollectionFetchJob(targetCollection, Akonadi::CollectionFetchJob::Base, q);
198void TrashRestoreJob::TrashRestoreJobPrivate::collectionsReceived(const Akonadi::Collection::List &collections)
214 const QString restoreResource = mCollection.attribute<Akonadi::EntityDeletedAttribute>()->restoreResource();
215 Collection targetCollection = mCollection.attribute<EntityDeletedAttribute>()->restoreCollection();
220 CollectionFetchJob *collectionFetchJob = new CollectionFetchJob(mCollection, CollectionFetchJob::Recursive, q);
222 q->connect(collectionFetchJob, SIGNAL(collectionsReceived(Akonadi::Collection::List)), SLOT(removeAttribute(Akonadi::Collection::List)));
232 CollectionFetchJob *fetchJob = new CollectionFetchJob(targetCollection, CollectionFetchJob::Base, q);
239void TrashRestoreJob::TrashRestoreJobPrivate::removeAttribute(const Akonadi::Collection::List &list)
253 q->connect(itemFetchJob, SIGNAL(itemsReceived(Akonadi::Item::List)), SLOT(removeAttribute(Akonadi::Item::List)));
320 connect(job, SIGNAL(itemsReceived(Akonadi::Item::List)), this, SLOT(itemsReceived(Akonadi::Item::List)));
322 CollectionFetchJob *job = new CollectionFetchJob(d->mCollection, CollectionFetchJob::Base, this);
323 connect(job, SIGNAL(collectionsReceived(Akonadi::Collection::List)), this, SLOT(collectionsReceived(Akonadi::Collection::List)));
Job that fetches collections from the Akonadi storage.
Definition collectionfetchjob.h:54
CollectionFetchScope & fetchScope()
Returns the collection fetch scope.
Definition collectionfetchjob.cpp:439
@ FirstLevel
Only list direct sub-collections of the base collection.
Definition collectionfetchjob.h:63
Collection::List collections() const
Returns the list of fetched collection.
Definition collectionfetchjob.cpp:169
void setResource(const QString &resource)
Sets a resource filter, that is only collections owned by the specified resource are retrieved.
Definition collectionfetchscope.cpp:118
Job that modifies a collection in the Akonadi storage.
Definition collectionmodifyjob.h:83
Job that moves a collection in the Akonadi storage to a new parent collection.
Definition collectionmovejob.h:51
An Attribute that marks that an entity was marked as deleted.
Definition entitydeletedattribute.h:50
void removeAttribute(const QByteArray &name)
Removes and deletes the attribute of the given type name.
Definition entity.cpp:142
Attribute * attribute(const QByteArray &name) const
Returns the attribute of the given type name if available, 0 otherwise.
Definition entity.cpp:167
void setCacheOnly(bool cacheOnly)
Sets whether payload data should be requested from remote sources or just from the local cache.
Definition itemfetchscope.cpp:109
void fetchAttribute(const QByteArray &type, bool fetch=true)
Sets whether the attribute of the given type should be fetched.
Definition itemfetchscope.cpp:80
Job that modifies an existing item in the Akonadi storage.
Definition itemmodifyjob.h:98
Job that moves an item into a different collection in the Akonadi storage.
Definition itemmovejob.h:49
Definition job_p.h:32
TrashRestoreJob(const Item &item, QObject *parent=0)
All items need to be from the same resource.
Definition trashrestorejob.cpp:274
void setTargetCollection(const Collection collection)
Sets the target collection, where the item is moved to.
Definition trashrestorejob.cpp:299
virtual void doStart()
This method must be reimplemented in the concrete jobs.
Definition trashrestorejob.cpp:311
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Wed Jan 24 2024 00:00:00 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Wed Jan 24 2024 00:00:00 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.