akonadi
entitytreemodel.cpp
61 EntityTreeModel::EntityTreeModel(ChangeRecorder *monitor, EntityTreeModelPrivate *d, QObject *parent)
139 //We have to use the same session as the monitor, so the monitor can fetch the collection afterwards
255 const HeaderGroup headerGroup = static_cast<HeaderGroup>((role / static_cast<int>(TerminalUserRole)));
314 return d->m_pendingCollectionRetrieveJobs.contains(collection.id()) ? FetchingState : IdleState;
425 if (rights & (Collection::CanCreateCollection | Collection::CanCreateItem | Collection::CanLinkItem)) {
430 // dragging is always possible, even for read-only objects, but they can only be copied, not moved.
456 // dragging is always possible, even for read-only objects, but they can only be copied, not moved.
471 // TODO: Should this return the mimetypes that the items provide? Allow dragging a contact from here for example.
475 bool EntityTreeModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
548 kDebug() << "unwanted collection" << mimeChecker.wantedMimeTypes() << collection.contentMimeTypes();
557 KMessageBox::error(0, i18n("The target collection '%1' contains already\na collection with name '%2'.",
672 const int row = d->indexOf<Node::Collection>(d->m_childEntities.value(collection.parentCollection().id()), collection.id());
727 QVariant EntityTreeModel::entityHeaderData(int section, Qt::Orientation orientation, int role, HeaderGroup headerGroup) const
747 const HeaderGroup headerGroup = static_cast<HeaderGroup>((role / static_cast<int>(TerminalUserRole)));
851 EntityDisplayAttribute *eda = collection.attribute<EntityDisplayAttribute>(Entity::AddIfMissing);
874 EntityDisplayAttribute *displayAttribute = item.attribute<EntityDisplayAttribute>(Entity::AddIfMissing);
974 bool EntityTreeModel::entityMatch(const Item &item, const QVariant &value, Qt::MatchFlags flags) const
982 bool EntityTreeModel::entityMatch(const Collection &collection, const QVariant &value, Qt::MatchFlags flags) const
990 QModelIndexList EntityTreeModel::match(const QModelIndex &start, int role, const QVariant &value, int hits, Qt::MatchFlags flags) const
1131 disconnect(d->m_monitor, SIGNAL(itemMoved(Akonadi::Item,Akonadi::Collection,Akonadi::Collection)),
1195 this, SLOT(monitoredCollectionMoved(Akonadi::Collection,Akonadi::Collection,Akonadi::Collection)));
1210 static QPair<QList<const QAbstractProxyModel *>, const EntityTreeModel *> proxiesAndModel(const QAbstractItemModel *model)
1225 static QModelIndex proxiedIndex(const QModelIndex &idx, QList<const QAbstractProxyModel *> proxyChain)
1235 QModelIndex EntityTreeModel::modelIndexForCollection(const QAbstractItemModel *model, const Collection &collection)
1237 QPair<QList<const QAbstractProxyModel *>, const EntityTreeModel *> pair = proxiesAndModel(model);
1244 QModelIndexList EntityTreeModel::modelIndexesForItem(const QAbstractItemModel *model, const Item &item)
1246 QPair<QList<const QAbstractProxyModel *>, const EntityTreeModel *> pair = proxiesAndModel(model);
void setAllMonitored(bool monitored=true)
Sets whether all items shall be monitored.
Definition: monitor.cpp:186
virtual bool entityMatch(const Item &item, const QVariant &value, Qt::MatchFlags flags) const
Reimplement this in a subclass to return true if item matches value with flags in the AmazingCompleti...
Definition: entitytreemodel.cpp:974
Job that modifies a collection in the Akonadi storage.
Definition: collectionmodifyjob.h:82
void setIncludeRootCollection(bool include)
Sets whether the root collection shall be provided by the model.
Definition: entitytreemodel.cpp:1151
Parts available in the model for the item.
Definition: entitytreemodel.h:343
bool systemEntitiesShown() const
Returns true if internal system entities are shown, and false otherwise.
Definition: entitytreemodel.cpp:143
Session * session() const
Returns the Session used by the monitor to communicate with Akonadi.
Definition: monitor.cpp:365
QString iconName() const
Returns the icon name of the icon returned by icon().
Definition: entitydisplayattribute.cpp:67
Returns the number of unread items in a collection.
Definition: entitytreemodel.h:350
QString displayName() const
Returns the display name (EntityDisplayAttribute::displayName()) if set, and Collection::name() other...
Definition: collection.cpp:86
virtual QVariant entityData(const Item &item, int column, int role=Qt::DisplayRole) const
Provided for convenience of subclasses.
Definition: entitytreemodel.cpp:173
Last role for user extensions. Don't use a role beyond this or headerData will break.
Definition: entitytreemodel.h:355
Provides statistics information of a Collection.
Definition: collectionstatistics.h:69
Returns the FetchState of a particular item.
Definition: entitytreemodel.h:351
QModelIndex indexForCollection(const Collection &collection) const
Returns the model index for the given collection.
Fetches collections, but does not put them in the model. This can be used to create a list of items i...
Definition: entitytreemodel.h:530
void setCollectionMonitored(const Collection &collection, bool monitored=true)
Sets whether the specified collection shall be monitored for changes.
Definition: monitor.cpp:66
ItemPopulationStrategy
Describes how the model should populated its items.
Definition: entitytreemodel.h:407
int indexOf(const QList< Node * > &nodes, Entity::Id id) const
Returns the index of the node in list with the id id.
Definition: entitytreemodel_p.h:178
QString displayName() const
Returns the name that should be used for display.
Definition: entitydisplayattribute.cpp:52
Do not include items in the model.
Definition: entitytreemodel.h:408
Can create new subcollections in this collection.
Definition: collection.h:92
KJob * pasteUriList(const QMimeData *mimeData, const Collection &collection, Qt::DropAction action, Session *session=0)
URI list paste/drop.
Definition: pastehelper.cpp:307
Helper for checking MIME types of Collections and Items.
Definition: mimetypechecker.h:109
void setCollectionsMonitored(const Akonadi::Collection::List &collections)
Monitors the specified collections and resets the model.
Definition: entitytreemodel.cpp:114
void setCollectionMonitored(const Akonadi::Collection &col, bool monitored=true)
Adds or removes a specific collection from the monitored set without resetting the model...
Definition: entitytreemodel.cpp:127
virtual QVariant entityHeaderData(int section, Qt::Orientation orientation, int role, HeaderGroup headerGroup) const
Reimplement this to provide different header data.
Definition: entitytreemodel.cpp:727
There is no fetch of items in this collection in progress.
Definition: entitytreemodel.h:374
bool isCollectionPopulated(Akonadi::Collection::Id) const
Returns whether the collection has been populated.
Definition: entitytreemodel.cpp:962
void setName(const QString &name)
Sets the i18n'ed name of the collection.
Definition: collection.cpp:93
Returns the progress of synchronization in percent for a particular collection.
Definition: entitytreemodel.h:352
Header information for a collection-only tree.
Definition: entitytreemodel.h:384
HeaderGroup
Describes what header information the model shall return.
Definition: entitytreemodel.h:382
Fetch items only when requested (using canFetchMore/fetchMore)
Definition: entitytreemodel.h:410
Returns whether a Collection has been populated, i.e. whether its items have been fetched...
Definition: entitytreemodel.h:353
Attribute * attribute(const QByteArray &name) const
Returns the attribute of the given type name if available, 0 otherwise.
Definition: entity.cpp:166
Collection::List collectionsMonitored() const
Returns the list of collections being monitored.
Definition: monitor.cpp:273
void setCollectionFetchStrategy(CollectionFetchStrategy strategy)
Sets the collection fetch strategy of the model.
Definition: entitytreemodel.cpp:1179
Can create links to existing items in this virtual collection.
Definition: collection.h:94
Collection parentCollection() const
Returns the parent collection of this object.
Definition: entity.cpp:187
ItemPopulationStrategy itemPopulationStrategy() const
Returns the item population strategy of the model.
Definition: entitytreemodel.cpp:1145
Role used to implement amazing completion.
Definition: entitytreemodel.h:340
QModelIndexList indexesForItem(const Item &item) const
Returns the model indexes for the given item.
QStringList wantedMimeTypes() const
Returns the list of wanted MIME types this instance checks against.
Definition: mimetypechecker.cpp:52
void setBackgroundColor(const QColor &color)
Sets the backgroundColor to color.
Definition: entitydisplayattribute.cpp:162
Akonadi::CollectionFetchScope::ListFilter listFilter() const
Returns the currently used listfilter.
Definition: entitytreemodel.cpp:99
Can create new items in this collection.
Definition: collection.h:89
The parent collection of the entity.
Definition: entitytreemodel.h:341
QString rootCollectionDisplayName() const
Returns the display name of the root collection.
Definition: entitytreemodel.cpp:1173
void setDisplayName(const QString &name)
Sets the name that should be used for display.
Definition: entitydisplayattribute.cpp:57
void fetchCollection(bool enable)
Enables automatic fetching of changed collections from the Akonadi storage.
Definition: monitor.cpp:219
bool isFullyPopulated() const
Returns whether the model is fully populated.
Definition: entitytreemodel.cpp:968
void setListFilter(Akonadi::CollectionFetchScope::ListFilter filter)
Sets the currently used listfilter.
Definition: entitytreemodel.cpp:105
Retrieve items immediately when their parent is in the model. This is the default.
Definition: entitytreemodel.h:409
bool isWantedCollection(const Collection &collection) const
Checks whether a given collection has one of the wanted MIME types.
Definition: mimetypechecker.cpp:86
Rights rights() const
Returns the rights the user has on the collection.
Definition: collection.cpp:99
static QModelIndex modelIndexForCollection(const QAbstractItemModel *model, const Collection &collection)
Returns a QModelIndex in model which points to collection.
Definition: entitytreemodel.cpp:1235
void setRootCollectionDisplayName(const QString &name)
Sets the display name of the root collection of the model.
Definition: entitytreemodel.cpp:1165
No filtering, retrieve all collections.
Definition: collectionfetchscope.h:133
void setItemPopulationStrategy(ItemPopulationStrategy strategy)
Sets the item population strategy of the model.
Definition: entitytreemodel.cpp:1118
Fetches nothing. This creates an empty model.
Definition: entitytreemodel.h:527
Header information for a list of items.
Definition: entitytreemodel.h:385
QColor backgroundColor() const
Returns the backgroundColor or an invalid color if none is set.
Definition: entitydisplayattribute.cpp:157
Parts available in the Akonadi server for the item.
Definition: entitytreemodel.h:344
void setWantedMimeTypes(const QStringList &mimeTypes)
Sets the list of wanted MIME types this instance checks against.
Definition: mimetypechecker.cpp:57
QStringList childCollectionNames(const Collection &collection) const
Returns the list of names of the child collections of collection.
CollectionFetchStrategy collectionFetchStrategy() const
Returns the collection fetch strategy of the model.
Definition: entitytreemodel.cpp:1204
void setShowSystemEntities(bool show)
Some Entities are hidden in the model, but exist for internal purposes, for example, custom object directories in groupware resources.
Definition: entitytreemodel.cpp:149
bool isWantedItem(const Item &item) const
Checks whether a given item has one of the wanted MIME types.
Definition: mimetypechecker.cpp:72
bool hasAttribute(const QByteArray &name) const
Returns true if the entity has an attribute of the given type name, false otherwise.
Definition: entity.cpp:147
A model for collections and items together.
Definition: entitytreemodel.h:318
Job that modifies an existing item in the Akonadi storage.
Definition: itemmodifyjob.h:97
There is a fetch of items in this collection in progress.
Definition: entitytreemodel.h:375
qint64 unreadCount() const
Returns the number of unread items in this collection or -1 if this information is not available...
Definition: collectionstatistics.cpp:77
QStringList contentMimeTypes() const
Returns a list of possible content mimetypes, e.g.
Definition: collection.cpp:115
bool isCollectionTreeFetched() const
Returns whether the collection tree has been fetched at initialisation.
Definition: entitytreemodel.cpp:955
Only retrieve enabled collections, ignoring the local preference. This is the same as setIncludeUnsub...
Definition: collectionfetchscope.h:137
static QModelIndexList modelIndexesForItem(const QAbstractItemModel *model, const Item &item)
Returns a QModelIndex in model which points to item.
Definition: entitytreemodel.cpp:1244
virtual QModelIndexList match(const QModelIndex &start, int role, const QVariant &value, int hits=1, Qt::MatchFlags flags=Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const
Reimplemented to handle the AmazingCompletionRole.
Definition: entitytreemodel.cpp:990
The akonadi:/ Url of the entity as a string. Item urls will contain the mimetype. ...
Definition: entitytreemodel.h:349
CollectionFetchStrategy
Describes what collections shall be fetched by and represent in the model.
Definition: entitytreemodel.h:526
AKONADI_DEPRECATED bool includeUnsubscribed() const
Returns whether unsubscribed entities will be included in the listing.
Definition: entitytreemodel.cpp:85
static Collection fromUrl(const KUrl &url)
Creates a collection from the given url.
Definition: collection.cpp:172
void setReferenced(bool referenced)
Sets a collection to be referenced.
Definition: collection.cpp:338
CollectionStatistics statistics() const
Returns the collection statistics of the collection.
Definition: collection.cpp:238
bool includeRootCollection() const
Returns whether the root collection is provided by the model.
Definition: entitytreemodel.cpp:1159
Attribute that stores the properties that are used to display an entity.
Definition: entitydisplayattribute.h:39
AKONADI_DEPRECATED void setIncludeUnsubscribed(bool show)
Sets whether unsubscribed entities will be included in the listing.
Definition: entitytreemodel.cpp:90
void setCollectionReferenced(const Akonadi::Collection &col, bool referenced=true)
References a collection and starts to monitor it.
Definition: entitytreemodel.cpp:133
This file is part of the KDE documentation.
Documentation copyright © 1996-2015 The KDE developers.
Generated on Fri Apr 10 2015 18:50:15 by doxygen 1.8.9.1 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2015 The KDE developers.
Generated on Fri Apr 10 2015 18:50:15 by doxygen 1.8.9.1 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.