akonadi
trashjob.cpp
65 //called after parent of the trashed item was fetched (needed to see in which resource the item is in)
81 bool mSetRestoreCollection; //only set restore collection when moved to trash collection (not in place)
83 QHash<Collection, Item::List> mCollectionItems; //list of trashed items sorted according to parent collection
84 QHash<Entity::Id, Collection> mParentCollections; //fetched parent collcetion of items (containing the resource name)
97 if (!q->hasSubjobs() || (q->subjobs().contains(static_cast<KJob *>(q->sender())) && q->subjobs().size() == 1)) {
114 Collection modCol(col.id()); //really only modify attribute (forget old remote ids, etc.), otherwise we have an error because of the move
121 //TODO not sure if it is guaranteed that itemsReceived is always before result (otherwise the result is emitted before the attributes are set)
122 q->connect(itemFetchJob, SIGNAL(itemsReceived(Akonadi::Item::List)), SLOT(setAttribute(Akonadi::Item::List)));
136 //When deleting a collection, we want to restore the deleted collection's items restored to the deleted collection's parent, not the items parent
181 CollectionFetchJob *colFetchJob = new CollectionFetchJob(mCollection, CollectionFetchJob::Recursive, q);
182 q->connect(colFetchJob, SIGNAL(collectionsReceived(Akonadi::Collection::List)), SLOT(setAttribute(Akonadi::Collection::List)));
186 void TrashJob::TrashJobPrivate::parentCollectionReceived(const Akonadi::Collection::List &collections)
198 if (!mKeepTrashInCollection && trashCollection.isValid()) { //Only set the restore collection if the item is moved to trash
205 ItemMoveJob *job = new ItemMoveJob(mCollectionItems.value(parentCollection), trashCollection, q);
207 q->connect(job, SIGNAL(result(KJob*)), SLOT(setAttribute(KJob*))); //Wait until the move finished to set the attirbute
234 mCollectionItems[item.parentCollection()].append(item); //Sort by parent col ( = restore collection)
253 void TrashJob::TrashJobPrivate::collectionsReceived(const Akonadi::Collection::List &collections)
280 if (!mKeepTrashInCollection && trashCollection.isValid()) { //only set the restore collection if the item is moved to trash
284 mRestoreCollection.setResource(mCollection.resource()); //The parent collection doesn't contain the resource, so we have to set it manually
353 job->fetchScope().setAncestorRetrieval(Akonadi::ItemFetchScope::Parent); //so we have access to the resource
356 connect(job, SIGNAL(itemsReceived(Akonadi::Item::List)), this, SLOT(itemsReceived(Akonadi::Item::List)));
359 CollectionFetchJob *job = new CollectionFetchJob(d->mCollection, CollectionFetchJob::Base, this);
361 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
void setAncestorRetrieval(AncestorRetrieval ancestorDepth)
Sets how many levels of ancestor collections should be included in the retrieval. ...
Definition: collectionfetchscope.cpp:138
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:439
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:334
Only retrieve the immediate parent collection.
Definition: collectionfetchscope.h:76
int size() const
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:185
int toInt(bool *ok) const
Only retrieve the immediate parent collection.
Definition: itemfetchscope.h:78
bool isEmpty() const
void deleteIfInTrash(bool enable)
Delete Items which are already in trash, instead of ignoring them.
Definition: trashjob.cpp:340
Job that deletes a collection in the Akonadi storage.
Definition: collectiondeletejob.h:63
T & first()
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:297
void setAncestorRetrieval(AncestorRetrieval ancestorDepth)
Sets how many levels of ancestor collections should be included in the retrieval. ...
Definition: itemfetchscope.cpp:132
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:411
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:30
void setTrashCollection(const Collection &trashcollection)
Moves all entities to the give collection.
Definition: trashjob.cpp:328
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:346
bool isValid() const
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-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.