akonadi
trashjob.cpp
64 //called after parent of the trashed item was fetched (needed to see in which resource the item is in)
80 bool mSetRestoreCollection; //only set restore collection when moved to trash collection (not in place)
82 QHash<Collection, Item::List> mCollectionItems; //list of trashed items sorted according to parent collection
83 QHash<Entity::Id, Collection> mParentCollections; //fetched parent collcetion of items (containing the resource name)
96 if ( !q->hasSubjobs() || ( q->subjobs().contains( static_cast<KJob*>( q->sender() ) ) && q->subjobs().size() == 1 ) ) {
113 Collection modCol( col.id() ); //really only modify attribute (forget old remote ids, etc.), otherwise we have an error because of the move
120 //TODO not sure if it is guaranteed that itemsReceived is always before result (otherwise the result is emitted before the attributes are set)
121 q->connect( itemFetchJob, SIGNAL(itemsReceived(Akonadi::Item::List)), SLOT(setAttribute(Akonadi::Item::List)) );
135 //When deleting a collection, we want to restore the deleted collection's items restored to the deleted collection's parent, not the items parent
180 CollectionFetchJob *colFetchJob = new CollectionFetchJob( mCollection, CollectionFetchJob::Recursive, q );
181 q->connect( colFetchJob, SIGNAL(collectionsReceived(Akonadi::Collection::List)), SLOT(setAttribute(Akonadi::Collection::List)) );
185 void TrashJob::TrashJobPrivate::parentCollectionReceived( const Akonadi::Collection::List &collections )
197 if ( !mKeepTrashInCollection && trashCollection.isValid() ) { //Only set the restore collection if the item is moved to trash
204 ItemMoveJob *job = new ItemMoveJob( mCollectionItems.value( parentCollection ), trashCollection, q );
206 q->connect( job, SIGNAL(result(KJob*)), SLOT(setAttribute(KJob*)) ); //Wait until the move finished to set the attirbute
233 mCollectionItems[item.parentCollection()].append( item ); //Sort by parent col ( = restore collection)
252 void TrashJob::TrashJobPrivate::collectionsReceived( const Akonadi::Collection::List &collections )
279 if ( !mKeepTrashInCollection && trashCollection.isValid() ) { //only set the restore collection if the item is moved to trash
283 mRestoreCollection.setResource( mCollection.resource() ); //The parent collection doesn't contain the resource, so we have to set it manually
352 job->fetchScope().setAncestorRetrieval( Akonadi::ItemFetchScope::Parent ); //so we have access to the resource
355 connect( job, SIGNAL(itemsReceived(Akonadi::Item::List)), this, SLOT(itemsReceived(Akonadi::Item::List)) );
358 CollectionFetchJob *job = new CollectionFetchJob( d->mCollection, CollectionFetchJob::Base, this );
360 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
void setAncestorRetrieval(AncestorRetrieval ancestorDepth)
Sets how many levels of ancestor collections should be included in the retrieval. ...
Definition: collectionfetchscope.cpp:134
Job that moves a collection in the Akonadi storage to a new parent collection.
Definition: collectionmovejob.h:50
CollectionFetchScope & fetchScope()
Returns the collection fetch scope.
Definition: collectionfetchjob.cpp:437
Job that fetches collections from the Akonadi storage.
Definition: collectionfetchjob.h:53
void keepTrashInCollection(bool enable)
Ignore configured Trash collections and keep all items local.
Definition: trashjob.cpp:333
Only retrieve the immediate parent collection.
Definition: collectionfetchscope.h:76
Only fetch the base collection.
Definition: collectionfetchjob.h:62
Job that deletes items from the Akonadi storage.
Definition: itemdeletejob.h:62
Collection parentCollection() const
Returns the parent collection of this object.
Definition: entity.cpp:186
Only retrieve the immediate parent collection.
Definition: itemfetchscope.h:77
void deleteIfInTrash(bool enable)
Delete Items which are already in trash, instead of ignoring them.
Definition: trashjob.cpp:339
Job that deletes a collection in the Akonadi storage.
Definition: collectiondeletejob.h:63
TrashJob(const Item &item, QObject *parent=0)
Creates a new trash job that marks item as trash, and moves it to the configured trash collection...
Definition: trashjob.cpp:296
void setAncestorRetrieval(AncestorRetrieval ancestorDepth)
Sets how many levels of ancestor collections should be included in the retrieval. ...
Definition: itemfetchscope.cpp:128
An Attribute that marks that an entity was marked as deleted.
Definition: entitydeletedattribute.h:49
void setIgnorePayload(bool ignore)
Sets whether the payload of the modified item shall be omitted from transmission to the Akonadi stora...
Definition: itemmodifyjob.cpp:335
Job that moves an item into a different collection in the Akonadi storage.
Definition: itemmovejob.h:48
AKONADI_EXPORT Collection getTrashCollection(const QString &resource)
Get the trash collection for the given resource.
Definition: trashsettings.cpp:32
void setTrashCollection(const Collection &trashcollection)
Moves all entities to the give collection.
Definition: trashjob.cpp:327
Job that modifies an existing item in the Akonadi storage.
Definition: itemmodifyjob.h:97
Definition: job_p.h:31
virtual void doStart()
This method must be reimplemented in the concrete jobs.
Definition: trashjob.cpp:345
void setResource(const QString &identifier)
Sets the identifier of the resource owning the collection.
Definition: collection.cpp:212
void setRestoreCollection(const Collection &col)
Sets the collection used to restore items which have been moved to trash using a TrashJob If the Reso...
Definition: entitydeletedattribute.cpp:49
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.