Akonadi
entitytreemodel.cpp
163 if (const auto *attr = item.attribute<EntityDisplayAttribute>(); attr && !attr->displayName().isEmpty()) {
170 if (const auto *attr = item.attribute<EntityDisplayAttribute>(); attr && !attr->iconName().isEmpty()) {
212 if (const auto *const attr = collection.attribute<EntityDisplayAttribute>(); attr && !attr->iconName().isEmpty()) {
279 return d->m_pendingCollectionRetrieveJobs.contains(collection.id()) ? FetchingState : IdleState;
287 if (const auto *const attr = collection.attribute<EntityDisplayAttribute>(); attr && attr->backgroundColor().isValid()) {
323 if (const auto *const attr = item.attribute<EntityDisplayAttribute>(); attr && attr->backgroundColor().isValid()) {
365 if (rights & (Collection::CanCreateCollection | Collection::CanCreateItem | Collection::CanLinkItem)) {
370 // dragging is always possible, even for read-only objects, but they can only be copied, not moved.
397 // dragging is always possible, even for read-only objects, but they can only be copied, not moved.
412 // TODO: Should this return the mimetypes that the items provide? Allow dragging a contact from here for example.
416bool EntityTreeModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
487 qCDebug(AKONADICORE_LOG) << "unwanted collection" << mimeChecker.wantedMimeTypes() << collection.contentMimeTypes();
500 i18n("The target collection '%1' contains already\na collection with name '%2'.", destCollection.name(), collection.name()));
513 qCDebug(AKONADICORE_LOG) << "unwanted item" << mimeChecker.wantedMimeTypes() << item.mimeType();
582 if (d->m_collectionFetchStrategy == InvisibleCollectionFetch || d->m_collectionFetchStrategy == FetchNoCollections) {
607 const int row = d->indexOf<Node::Collection>(d->m_childEntities.value(collection.parentCollection().id()), collection.id());
619 if (d->m_collectionFetchStrategy == InvisibleCollectionFetch || d->m_collectionFetchStrategy == FetchNoCollections) {
661QVariant EntityTreeModel::entityHeaderData(int section, Qt::Orientation orientation, int role, HeaderGroup headerGroup) const
667 if (section == 0 && orientation == Qt::Horizontal && (role == Qt::DisplayRole || role == EntityTreeModel::DisplayNameRole)) {
741 if (index.isValid() && node->type == Node::Collection && (role == CollectionRefRole || role == CollectionDerefRole)) {
852 if (d->m_collectionFetchStrategy == InvisibleCollectionFetch || d->m_collectionFetchStrategy == FetchNoCollections) {
860 return ((rowCount(parent) > 0) || (d->canFetchMore(parent) && d->m_itemPopulation == LazyPopulation));
881QModelIndexList EntityTreeModel::match(const QModelIndex &start, int role, const QVariant &value, int hits, Qt::MatchFlags flags) const
938bool EntityTreeModel::insertColumns(int /*column*/, int /*count*/, const QModelIndex & /*parent*/)
948bool EntityTreeModel::removeColumns(int /*column*/, int /*count*/, const QModelIndex & /*parent*/)
960 disconnect(d->m_monitor, SIGNAL(itemAdded(Akonadi::Item, Akonadi::Collection)), this, SLOT(monitoredItemAdded(Akonadi::Item, Akonadi::Collection)));
961 disconnect(d->m_monitor, SIGNAL(itemChanged(Akonadi::Item, QSet<QByteArray>)), this, SLOT(monitoredItemChanged(Akonadi::Item, QSet<QByteArray>)));
962 disconnect(d->m_monitor, SIGNAL(itemRemoved(Akonadi::Item)), this, SLOT(monitoredItemRemoved(Akonadi::Item)));
968 disconnect(d->m_monitor, SIGNAL(itemLinked(Akonadi::Item, Akonadi::Collection)), this, SLOT(monitoredItemLinked(Akonadi::Item, Akonadi::Collection)));
1021 disconnect(d->m_monitor, SIGNAL(collectionChanged(Akonadi::Collection)), this, SLOT(monitoredCollectionChanged(Akonadi::Collection)));
1026 disconnect(d->m_monitor, SIGNAL(collectionRemoved(Akonadi::Collection)), this, SLOT(monitoredCollectionRemoved(Akonadi::Collection)));
1030 SLOT(monitoredCollectionMoved(Akonadi::Collection, Akonadi::Collection, Akonadi::Collection)));
1045static QPair<QList<const QAbstractProxyModel *>, const EntityTreeModel *> proxiesAndModel(const QAbstractItemModel *model)
1060static QModelIndex proxiedIndex(const QModelIndex &idx, const QList<const QAbstractProxyModel *> &proxyChain)
1069QModelIndex EntityTreeModel::modelIndexForCollection(const QAbstractItemModel *model, const Collection &collection)
1081QModelIndexList EntityTreeModel::modelIndexesForItem(const QAbstractItemModel *model, const Item &item)
1101Collection EntityTreeModel::updatedCollection(const QAbstractItemModel *model, qint64 collectionId)
1118Collection EntityTreeModel::updatedCollection(const QAbstractItemModel *model, const Collection &collection)
Job that modifies a collection in the Akonadi storage.
Definition collectionmodifyjob.h:62
qint64 unreadCount() const
Returns the number of unread items in this collection or -1 if this information is not available.
Definition core/collectionstatistics.cpp:47
CollectionStatistics statistics() const
Returns the collection statistics of the collection.
Definition collection.cpp:326
bool hasAttribute(const QByteArray &name) const
Returns true if the collection has an attribute of the given type name, false otherwise.
Definition collection.cpp:161
void setName(const QString &name)
Sets the i18n'ed name of the collection.
Definition collection.cpp:221
static Collection fromUrl(const QUrl &url)
Creates a collection from the given url.
Definition collection.cpp:267
@ CanLinkItem
Can create links to existing items in this virtual collection.
Definition collection.h:97
Collection parentCollection() const
Returns the parent collection of this object.
Definition collection.cpp:195
Attribute * attribute(const QByteArray &name)
Returns the attribute of the given type name if available, 0 otherwise.
Definition collection.cpp:176
QUrl url(UrlType type=UrlShort) const
Returns the url of the collection.
Definition collection.cpp:253
Attribute that stores the properties that are used to display an entity.
Definition entitydisplayattribute.h:30
void setBackgroundColor(const QColor &color)
Sets the backgroundColor to color.
Definition entitydisplayattribute.cpp:139
QColor backgroundColor() const
Returns the backgroundColor or an invalid color if none is set.
Definition entitydisplayattribute.cpp:134
QString displayName() const
Returns the name that should be used for display.
Definition entitydisplayattribute.cpp:29
void setDisplayName(const QString &name)
Sets the name that should be used for display.
Definition entitydisplayattribute.cpp:34
QString iconName() const
Returns the icon name of the icon returned by icon().
Definition entitydisplayattribute.cpp:44
Akonadi::CollectionFetchScope::ListFilter listFilter() const
Returns the currently used listfilter.
Definition entitytreemodel.cpp:61
bool systemEntitiesShown() const
Returns true if internal system entities are shown, and false otherwise.
Definition entitytreemodel.cpp:96
void setShowSystemEntities(bool show)
Some Entities are hidden in the model, but exist for internal purposes, for example,...
Definition entitytreemodel.cpp:102
void setRootCollectionDisplayName(const QString &name)
Sets the display name of the root collection of the model.
Definition entitytreemodel.cpp:1000
ItemPopulationStrategy
Describes how the model should populated its items.
Definition entitytreemodel.h:395
@ ImmediatePopulation
Retrieve items immediately when their parent is in the model. This is the default.
Definition entitytreemodel.h:397
@ LazyPopulation
Fetch items only when requested (using canFetchMore/fetchMore)
Definition entitytreemodel.h:398
virtual QVariant entityData(const Item &item, int column, int role=Qt::DisplayRole) const
Provided for convenience of subclasses.
Definition entitytreemodel.cpp:154
bool includeRootCollection() const
Returns whether the root collection is provided by the model.
Definition entitytreemodel.cpp:994
EntityTreeModel(Monitor *monitor, QObject *parent=nullptr)
Creates a new entity tree model.
Definition entitytreemodel.cpp:37
bool isCollectionPopulated(Akonadi::Collection::Id) const
Returns whether the collection has been populated.
Definition entitytreemodel.cpp:869
QModelIndexList match(const QModelIndex &start, int role, const QVariant &value, int hits=1, Qt::MatchFlags flags=Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const override
Reimplemented to handle the AmazingCompletionRole.
Definition entitytreemodel.cpp:881
@ FetchingState
There is a fetch of items in this collection in progress.
Definition entitytreemodel.h:362
@ IdleState
There is no fetch of items in this collection in progress.
Definition entitytreemodel.h:361
QString rootCollectionDisplayName() const
Returns the display name of the root collection.
Definition entitytreemodel.cpp:1008
void setCollectionFetchStrategy(CollectionFetchStrategy strategy)
Sets the collection fetch strategy of the model.
Definition entitytreemodel.cpp:1014
HeaderGroup
Describes what header information the model shall return.
Definition entitytreemodel.h:370
@ CollectionTreeHeaders
Header information for a collection-only tree.
Definition entitytreemodel.h:372
void setCollectionsMonitored(const Akonadi::Collection::List &collections)
Monitors the specified collections and resets the model.
Definition entitytreemodel.cpp:76
ItemPopulationStrategy itemPopulationStrategy() const
Returns the item population strategy of the model.
Definition entitytreemodel.cpp:980
CollectionFetchStrategy
Describes what collections shall be fetched by and represent in the model.
Definition entitytreemodel.h:484
@ InvisibleCollectionFetch
Fetches collections, but does not put them in the model.
Definition entitytreemodel.h:488
void setListFilter(Akonadi::CollectionFetchScope::ListFilter filter)
Sets the currently used listfilter.
Definition entitytreemodel.cpp:67
CollectionFetchStrategy collectionFetchStrategy() const
Returns the collection fetch strategy of the model.
Definition entitytreemodel.cpp:1039
static Collection updatedCollection(const QAbstractItemModel *model, qint64 collectionId)
Returns an Akonadi::Collection from the model based on given collectionId.
Definition entitytreemodel.cpp:1101
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:90
void setItemPopulationStrategy(ItemPopulationStrategy strategy)
Sets the item population strategy of the model.
Definition entitytreemodel.cpp:953
void setIncludeRootCollection(bool include)
Sets whether the root collection shall be provided by the model.
Definition entitytreemodel.cpp:986
static QModelIndexList modelIndexesForItem(const QAbstractItemModel *model, const Item &item)
Returns a QModelIndex in model which points to item.
Definition entitytreemodel.cpp:1081
static QModelIndex modelIndexForCollection(const QAbstractItemModel *model, const Collection &collection)
Returns a QModelIndex in model which points to collection.
Definition entitytreemodel.cpp:1069
bool isFullyPopulated() const
Returns whether the model is fully populated.
Definition entitytreemodel.cpp:875
bool isCollectionTreeFetched() const
Returns whether the collection tree has been fetched at initialisation.
Definition entitytreemodel.cpp:863
@ AvailablePartsRole
Parts available in the Akonadi server for the item.
Definition entitytreemodel.h:330
@ TerminalUserRole
Last role for user extensions. Don't use a role beyond this or headerData will break.
Definition entitytreemodel.h:342
@ EntityUrlRole
The akonadi:/ Url of the entity as a string. Item urls will contain the mimetype.
Definition entitytreemodel.h:335
@ UnreadCountRole
Returns the number of unread items in a collection.
Definition entitytreemodel.h:336
@ IsPopulatedRole
Returns whether a Collection has been populated, i.e. whether its items have been fetched.
Definition entitytreemodel.h:338
virtual QVariant entityHeaderData(int section, Qt::Orientation orientation, int role, HeaderGroup headerGroup) const
Reimplement this to provide different header data.
Definition entitytreemodel.cpp:661
Job that modifies an existing item in the Akonadi storage.
Definition itemmodifyjob.h:82
Attribute * attribute(const QByteArray &name)
Returns the attribute of the given type name if available, 0 otherwise.
Helper for checking MIME types of Collections and Items.
Definition mimetypechecker.h:97
bool isWantedItem(const Item &item) const
Checks whether a given item has one of the wanted MIME types.
Definition mimetypechecker.cpp:64
bool isWantedCollection(const Collection &collection) const
Checks whether a given collection has one of the wanted MIME types.
Definition mimetypechecker.cpp:78
QStringList wantedMimeTypes() const
Returns the list of wanted MIME types this instance checks against.
Definition mimetypechecker.cpp:39
void setWantedMimeTypes(const QStringList &mimeTypes)
Sets the list of wanted MIME types this instance checks against.
Definition mimetypechecker.cpp:49
Q_SCRIPTABLE Q_NOREPLY void start()
QString i18nc(const char *context, const char *text, const TYPE &arg...)
QString i18n(const char *text, const TYPE &arg...)
Helper integration between Akonadi and Qt.
KSERVICE_EXPORT KService::List query(FilterFunc filterFunc)
QModelIndex createIndex(int row, int column, const void *ptr) const const
virtual Qt::ItemFlags flags(const QModelIndex &index) const const
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const const
virtual bool insertColumns(int column, int count, const QModelIndex &parent)
virtual bool insertRows(int row, int count, const QModelIndex &parent)
virtual QModelIndexList match(const QModelIndex &start, int role, const QVariant &value, int hits, Qt::MatchFlags flags) const const
virtual bool removeColumns(int column, int count, const QModelIndex &parent)
virtual bool removeRows(int row, int count, const QModelIndex &parent)
virtual bool setData(const QModelIndex &index, const QVariant &value, int role)
bool isValid() const const
const_reference at(qsizetype i) const const
void prepend(parameter_type value)
qsizetype size() const const
T value(qsizetype i) const const
StandardButton critical(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons, StandardButton defaultButton)
virtual bool hasFormat(const QString &mimeType) const const
void setUrls(const QList< QUrl > &urls)
QList< QUrl > urls() const const
int column() const const
QVariant data(int role) const const
void * internalPointer() const const
bool isValid() const const
QModelIndex parent() const const
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
bool disconnect(const QMetaObject::Connection &connection)
QObject * parent() const const
T qobject_cast(QObject *object)
virtual bool contains(const QPointF &point) const const
bool isEmpty() const const
QString number(double n, char format, int precision)
bool contains(QLatin1StringView str, Qt::CaseSensitivity cs) const const
typedef DropActions
DecorationRole
typedef ItemFlags
typedef MatchFlags
Orientation
void setQuery(const QString &query, ParsingMode mode)
QString url(FormattingOptions options) const const
QVariant fromValue(T &&value)
bool isValid() const const
bool toBool() const const
qlonglong toLongLong(bool *ok) const const
QString toString() const const
T value() const const
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:08:29 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:08:29 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.