akonadi
trashrestorejob.cpp
61 //Called after initial fetch of items, issues fetch of target collection or removes attributes for in place restore
82 if ( !q->hasSubjobs() || ( q->subjobs().contains( static_cast<KJob*>( q->sender() ) ) && q->subjobs().size() == 1 ) ) {
96 if ( list.isEmpty() || !list.first().isValid() || list.first().hasAttribute<Akonadi::EntityDeletedAttribute>() ) { //target collection is invalid/not existing
101 q->setErrorText( i18n( "Could not find restore collection and restore resource is not available" ) );
109 CollectionFetchJob *resRootFetch = new CollectionFetchJob( Collection::root(), CollectionFetchJob::FirstLevel, q );
121 //We know where to move the entity, so remove the attributes and move them to the right location
127 //store removed attribute if destination collection is valid or the item doesn't have a restore collection
128 //TODO only remove the attribute if the move job was successful (although it is unlikely that it fails since we already fetched the collection)
138 CollectionFetchJob *collectionFetchJob = new CollectionFetchJob( mCollection, CollectionFetchJob::Recursive, q );
140 q->connect( collectionFetchJob, SIGNAL(collectionsReceived(Akonadi::Collection::List)), SLOT(removeAttribute(Akonadi::Collection::List)) );
166 //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
167 restoreCollections[item.attribute<Akonadi::EntityDeletedAttribute>()->restoreCollection()].append( item );
174 const QString restoreResource = first.attribute<Akonadi::EntityDeletedAttribute>()->restoreResource();
188 CollectionFetchJob *fetchJob = new CollectionFetchJob( targetCollection, Akonadi::CollectionFetchJob::Base, q );
197 void TrashRestoreJob::TrashRestoreJobPrivate::collectionsReceived( const Akonadi::Collection::List &collections )
213 const QString restoreResource = mCollection.attribute<Akonadi::EntityDeletedAttribute>()->restoreResource();
214 Collection targetCollection = mCollection.attribute<EntityDeletedAttribute>()->restoreCollection();
219 CollectionFetchJob *collectionFetchJob = new CollectionFetchJob( mCollection, CollectionFetchJob::Recursive, q );
221 q->connect( collectionFetchJob, SIGNAL(collectionsReceived(Akonadi::Collection::List)), SLOT(removeAttribute(Akonadi::Collection::List)) );
231 CollectionFetchJob *fetchJob = new CollectionFetchJob( targetCollection, CollectionFetchJob::Base, q );
238 void TrashRestoreJob::TrashRestoreJobPrivate::removeAttribute( const Akonadi::Collection::List &list )
252 q->connect( itemFetchJob, SIGNAL(itemsReceived(Akonadi::Item::List)), SLOT(removeAttribute(Akonadi::Item::List)) );
256 void TrashRestoreJob::TrashRestoreJobPrivate::removeAttribute( const Akonadi::Item::List &list )
319 connect( job, SIGNAL(itemsReceived(Akonadi::Item::List)), this, SLOT(itemsReceived(Akonadi::Item::List)) );
321 CollectionFetchJob *job = new CollectionFetchJob( d->mCollection, CollectionFetchJob::Base, this );
322 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:78
Collection::List collections() const
Returns the list of fetched collection.
Definition: collectionfetchjob.cpp:175
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:437
void setTargetCollection(const Collection collection)
Sets the target collection, where the item is moved to.
Definition: trashrestorejob.cpp:298
void setResource(const QString &resource)
Sets a resource filter, that is only collections owned by the specified resource are retrieved...
Definition: collectionfetchscope.cpp:114
Job that fetches collections from the Akonadi storage.
Definition: collectionfetchjob.h:53
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:165
virtual void doStart()
This method must be reimplemented in the concrete jobs.
Definition: trashrestorejob.cpp:310
void removeAttribute(const QByteArray &name)
Removes and deletes the attribute of the given type name.
Definition: entity.cpp:140
Collection parentCollection() const
Returns the parent collection of this object.
Definition: entity.cpp:186
TrashRestoreJob(const Item &item, QObject *parent=0)
All items need to be from the same resource.
Definition: trashrestorejob.cpp:273
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
void setCacheOnly(bool cacheOnly)
Sets whether payload data should be requested from remote sources or just from the local cache...
Definition: itemfetchscope.cpp:106
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:28 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:28 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.