akonadi
entitytreemodel.cpp
61EntityTreeModel::EntityTreeModel(ChangeRecorder *monitor, EntityTreeModelPrivate *d, QObject *parent)
255 const HeaderGroup headerGroup = static_cast<HeaderGroup>((role / static_cast<int>(TerminalUserRole)));
314 return d->m_pendingCollectionRetrieveJobs.contains(collection.id()) ? FetchingState : IdleState;
428 if (rights & (Collection::CanCreateCollection | Collection::CanCreateItem | Collection::CanLinkItem)) {
433 // dragging is always possible, even for read-only objects, but they can only be copied, not moved.
459 // dragging is always possible, even for read-only objects, but they can only be copied, not moved.
474 // TODO: Should this return the mimetypes that the items provide? Allow dragging a contact from here for example.
478bool EntityTreeModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
551 kDebug() << "unwanted collection" << mimeChecker.wantedMimeTypes() << collection.contentMimeTypes();
560 KMessageBox::error(0, i18n("The target collection '%1' contains already\na collection with name '%2'.",
675 const int row = d->indexOf<Node::Collection>(d->m_childEntities.value(collection.parentCollection().id()), collection.id());
730QVariant EntityTreeModel::entityHeaderData(int section, Qt::Orientation orientation, int role, HeaderGroup headerGroup) const
750 const HeaderGroup headerGroup = static_cast<HeaderGroup>((role / static_cast<int>(TerminalUserRole)));
854 EntityDisplayAttribute *eda = collection.attribute<EntityDisplayAttribute>(Entity::AddIfMissing);
877 EntityDisplayAttribute *displayAttribute = item.attribute<EntityDisplayAttribute>(Entity::AddIfMissing);
977bool EntityTreeModel::entityMatch(const Item &item, const QVariant &value, Qt::MatchFlags flags) const
985bool EntityTreeModel::entityMatch(const Collection &collection, const QVariant &value, Qt::MatchFlags flags) const
993QModelIndexList EntityTreeModel::match(const QModelIndex &start, int role, const QVariant &value, int hits, Qt::MatchFlags flags) const
1134 disconnect(d->m_monitor, SIGNAL(itemMoved(Akonadi::Item,Akonadi::Collection,Akonadi::Collection)),
1198 this, SLOT(monitoredCollectionMoved(Akonadi::Collection,Akonadi::Collection,Akonadi::Collection)));
1213static QPair<QList<const QAbstractProxyModel *>, const EntityTreeModel *> proxiesAndModel(const QAbstractItemModel *model)
1228static QModelIndex proxiedIndex(const QModelIndex &idx, QList<const QAbstractProxyModel *> proxyChain)
1238QModelIndex EntityTreeModel::modelIndexForCollection(const QAbstractItemModel *model, const Collection &collection)
1240 QPair<QList<const QAbstractProxyModel *>, const EntityTreeModel *> pair = proxiesAndModel(model);
1247QModelIndexList EntityTreeModel::modelIndexesForItem(const QAbstractItemModel *model, const Item &item)
1249 QPair<QList<const QAbstractProxyModel *>, const EntityTreeModel *> pair = proxiesAndModel(model);
@ Enabled
Only retrieve enabled collections, ignoring the local preference. This is the same as setIncludeUnsub...
Definition collectionfetchscope.h:137
Job that modifies a collection in the Akonadi storage.
Definition collectionmodifyjob.h:83
Provides statistics information of a Collection.
Definition collectionstatistics.h:70
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
static Collection fromUrl(const KUrl &url)
Creates a collection from the given url.
Definition collection.cpp:172
@ CanLinkItem
Can create links to existing items in this virtual collection.
Definition collection.h:94
Attribute that stores the properties that are used to display an entity.
Definition entitydisplayattribute.h:40
void setBackgroundColor(const QColor &color)
Sets the backgroundColor to color.
Definition entitydisplayattribute.cpp:162
QColor backgroundColor() const
Returns the backgroundColor or an invalid color if none is set.
Definition entitydisplayattribute.cpp:157
QString displayName() const
Returns the name that should be used for display.
Definition entitydisplayattribute.cpp:52
void setDisplayName(const QString &name)
Sets the name that should be used for display.
Definition entitydisplayattribute.cpp:57
QString iconName() const
Returns the icon name of the icon returned by icon().
Definition entitydisplayattribute.cpp:67
QStringList childCollectionNames(const Collection &collection) const
Returns the list of names of the child collections of collection.
QModelIndexList indexesForItem(const Item &item) const
Returns the model indexes for the given item.
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
QModelIndex indexForCollection(const Collection &collection) const
Returns the model index for the given collection.
Akonadi::CollectionFetchScope::ListFilter listFilter() const
Returns the currently used listfilter.
Definition entitytreemodel.cpp:99
bool systemEntitiesShown() const
Returns true if internal system entities are shown, and false otherwise.
Definition entitytreemodel.cpp:143
void setShowSystemEntities(bool show)
Some Entities are hidden in the model, but exist for internal purposes, for example,...
Definition entitytreemodel.cpp:149
void setRootCollectionDisplayName(const QString &name)
Sets the display name of the root collection of the model.
Definition entitytreemodel.cpp:1168
ItemPopulationStrategy
Describes how the model should populated its items.
Definition entitytreemodel.h:408
@ ImmediatePopulation
Retrieve items immediately when their parent is in the model. This is the default.
Definition entitytreemodel.h:410
@ LazyPopulation
Fetch items only when requested (using canFetchMore/fetchMore)
Definition entitytreemodel.h:411
virtual QVariant entityData(const Item &item, int column, int role=Qt::DisplayRole) const
Provided for convenience of subclasses.
Definition entitytreemodel.cpp:173
bool includeRootCollection() const
Returns whether the root collection is provided by the model.
Definition entitytreemodel.cpp:1162
bool isCollectionPopulated(Akonadi::Collection::Id) const
Returns whether the collection has been populated.
Definition entitytreemodel.cpp:965
AKONADI_DEPRECATED bool includeUnsubscribed() const
Returns whether unsubscribed entities will be included in the listing.
Definition entitytreemodel.cpp:85
@ FetchingState
There is a fetch of items in this collection in progress.
Definition entitytreemodel.h:376
@ IdleState
There is no fetch of items in this collection in progress.
Definition entitytreemodel.h:375
QString rootCollectionDisplayName() const
Returns the display name of the root collection.
Definition entitytreemodel.cpp:1176
void setCollectionFetchStrategy(CollectionFetchStrategy strategy)
Sets the collection fetch strategy of the model.
Definition entitytreemodel.cpp:1182
HeaderGroup
Describes what header information the model shall return.
Definition entitytreemodel.h:383
@ CollectionTreeHeaders
Header information for a collection-only tree.
Definition entitytreemodel.h:385
void setCollectionsMonitored(const Akonadi::Collection::List &collections)
Monitors the specified collections and resets the model.
Definition entitytreemodel.cpp:114
void setCollectionReferenced(const Akonadi::Collection &col, bool referenced=true)
References a collection and starts to monitor it.
Definition entitytreemodel.cpp:133
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:977
ItemPopulationStrategy itemPopulationStrategy() const
Returns the item population strategy of the model.
Definition entitytreemodel.cpp:1148
AKONADI_DEPRECATED void setIncludeUnsubscribed(bool show)
Sets whether unsubscribed entities will be included in the listing.
Definition entitytreemodel.cpp:90
CollectionFetchStrategy
Describes what collections shall be fetched by and represent in the model.
Definition entitytreemodel.h:527
@ InvisibleCollectionFetch
Fetches collections, but does not put them in the model. This can be used to create a list of items i...
Definition entitytreemodel.h:531
EntityTreeModel(ChangeRecorder *monitor, QObject *parent=0)
Creates a new entity tree model.
Definition entitytreemodel.cpp:53
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:993
void setListFilter(Akonadi::CollectionFetchScope::ListFilter filter)
Sets the currently used listfilter.
Definition entitytreemodel.cpp:105
CollectionFetchStrategy collectionFetchStrategy() const
Returns the collection fetch strategy of the model.
Definition entitytreemodel.cpp:1207
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
void setItemPopulationStrategy(ItemPopulationStrategy strategy)
Sets the item population strategy of the model.
Definition entitytreemodel.cpp:1121
void setIncludeRootCollection(bool include)
Sets whether the root collection shall be provided by the model.
Definition entitytreemodel.cpp:1154
static QModelIndexList modelIndexesForItem(const QAbstractItemModel *model, const Item &item)
Returns a QModelIndex in model which points to item.
Definition entitytreemodel.cpp:1247
static QModelIndex modelIndexForCollection(const QAbstractItemModel *model, const Collection &collection)
Returns a QModelIndex in model which points to collection.
Definition entitytreemodel.cpp:1238
bool isFullyPopulated() const
Returns whether the model is fully populated.
Definition entitytreemodel.cpp:971
bool isCollectionTreeFetched() const
Returns whether the collection tree has been fetched at initialisation.
Definition entitytreemodel.cpp:958
@ AvailablePartsRole
Parts available in the Akonadi server for the item.
Definition entitytreemodel.h:344
@ TerminalUserRole
Last role for user extensions. Don't use a role beyond this or headerData will break.
Definition entitytreemodel.h:356
@ CollectionSyncProgressRole
Returns the progress of synchronization in percent for a particular collection.
Definition entitytreemodel.h:352
@ EntityUrlRole
The akonadi:/ Url of the entity as a string. Item urls will contain the mimetype.
Definition entitytreemodel.h:349
@ UnreadCountRole
Returns the number of unread items in a collection.
Definition entitytreemodel.h:350
@ IsPopulatedRole
Returns whether a Collection has been populated, i.e. whether its items have been fetched.
Definition entitytreemodel.h:353
virtual QVariant entityHeaderData(int section, Qt::Orientation orientation, int role, HeaderGroup headerGroup) const
Reimplement this to provide different header data.
Definition entitytreemodel.cpp:730
Job that modifies an existing item in the Akonadi storage.
Definition itemmodifyjob.h:98
Helper for checking MIME types of Collections and Items.
Definition mimetypechecker.h:110
bool isWantedItem(const Item &item) const
Checks whether a given item has one of the wanted MIME types.
Definition mimetypechecker.cpp:72
bool isWantedCollection(const Collection &collection) const
Checks whether a given collection has one of the wanted MIME types.
Definition mimetypechecker.cpp:86
QStringList wantedMimeTypes() const
Returns the list of wanted MIME types this instance checks against.
Definition mimetypechecker.cpp:52
void setWantedMimeTypes(const QStringList &mimeTypes)
Sets the list of wanted MIME types this instance checks against.
Definition mimetypechecker.cpp:57
Session * session() const
Returns the Session used by the monitor to communicate with Akonadi.
Definition monitor.cpp:365
Collection::List collectionsMonitored() const
Returns the list of collections being monitored.
Definition monitor.cpp:273
void setAllMonitored(bool monitored=true)
Sets whether all items shall be monitored.
Definition monitor.cpp:186
void setCollectionMonitored(const Collection &collection, bool monitored=true)
Sets whether the specified collection shall be monitored for changes.
Definition monitor.cpp:66
void fetchCollection(bool enable)
Enables automatic fetching of changed collections from the Akonadi storage.
Definition monitor.cpp:219
KJob * pasteUriList(const QMimeData *mimeData, const Collection &collection, Qt::DropAction action, Session *session=0)
URI list paste/drop.
Definition pastehelper.cpp:307
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Wed Jan 24 2024 00:00:00 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Wed Jan 24 2024 00:00:00 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.