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);
198 void 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);
239 void 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 modifies a collection in the Akonadi storage.
Definition: collectionmodifyjob.h:82
void fetchAttribute(const QByteArray &type, bool fetch=true)
Sets whether the attribute of the given type should be fetched.
Definition: itemfetchscope.cpp:80
Collection::List collections() const
Returns the list of fetched collection.
Definition: collectionfetchjob.cpp:169
Job that moves a collection in the Akonadi storage to a new parent collection.
Definition: collectionmovejob.h:50
Only list direct sub-collections of the base collection.
Definition: collectionfetchjob.h:63
CollectionFetchScope & fetchScope()
Returns the collection fetch scope.
Definition: collectionfetchjob.cpp:439
void setTargetCollection(const Collection collection)
Sets the target collection, where the item is moved to.
Definition: trashrestorejob.cpp:299
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 fetches collections from the Akonadi storage.
Definition: collectionfetchjob.h:53
int size() const
Only fetch the base collection.
Definition: collectionfetchjob.h:62
Attribute * attribute(const QByteArray &name) const
Returns the attribute of the given type name if available, 0 otherwise.
Definition: entity.cpp:167
virtual void doStart()
This method must be reimplemented in the concrete jobs.
Definition: trashrestorejob.cpp:311
void removeAttribute(const QByteArray &name)
Removes and deletes the attribute of the given type name.
Definition: entity.cpp:142
Collection parentCollection() const
Returns the parent collection of this object.
Definition: entity.cpp:185
int toInt(bool *ok) const
TrashRestoreJob(const Item &item, QObject *parent=0)
All items need to be from the same resource.
Definition: trashrestorejob.cpp:274
bool isEmpty() const
bool isEmpty() const
T & first()
QList< Key > keys() const
An Attribute that marks that an entity was marked as deleted.
Definition: entitydeletedattribute.h:49
Job that moves an item into a different collection in the Akonadi storage.
Definition: itemmovejob.h:48
Job that modifies an existing item in the Akonadi storage.
Definition: itemmodifyjob.h:97
Definition: job_p.h:31
bool isValid() const
void setCacheOnly(bool cacheOnly)
Sets whether payload data should be requested from remote sources or just from the local cache...
Definition: itemfetchscope.cpp:109
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:38:03 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:38:03 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.