diff --git a/src/core/models/entitytreemodel.h b/src/core/models/entitytreemodel.h --- a/src/core/models/entitytreemodel.h +++ b/src/core/models/entitytreemodel.h @@ -342,7 +342,7 @@ SessionRole, ///< @internal The Session used by this model CollectionRefRole, ///< @internal Used to increase the reference count on a Collection CollectionDerefRole, ///< @internal Used to decrease the reference count on a Collection - PendingCutRole, ///< @internal Used to indicate items which are to be cut + PendingCutRole, ///< Used to indicate items which are to be cut EntityUrlRole, ///< The akonadi:/ Url of the entity as a string. Item urls will contain the mimetype. UnreadCountRole, ///< Returns the number of unread items in a collection. @since 4.5 FetchStateRole, ///< Returns the FetchState of a particular item. @since 4.5 diff --git a/src/core/models/entitytreemodel.cpp b/src/core/models/entitytreemodel.cpp --- a/src/core/models/entitytreemodel.cpp +++ b/src/core/models/entitytreemodel.cpp @@ -315,6 +315,8 @@ case OriginalCollectionNameRole: { return entityData(collection, index.column(), Qt::DisplayRole); } + case PendingCutRole: + return d->m_pendingCutCollections.contains(node->id); case Qt::BackgroundRole: { if (collection.hasAttribute()) { EntityDisplayAttribute *eda = collection.attribute(); @@ -364,6 +366,8 @@ case EntityUrlRole: return item.url(Akonadi::Item::UrlWithMimeType).url(); break; + case PendingCutRole: + return d->m_pendingCutItems.contains(node->id); case Qt::BackgroundRole: { if (item.hasAttribute()) { EntityDisplayAttribute *eda = item.attribute(); @@ -397,11 +401,6 @@ const Node *node = reinterpret_cast(index.internalPointer()); if (Node::Collection == node->type) { - // cut out entities will be shown as inactive - if (d->m_pendingCutCollections.contains(node->id)) { - return Qt::ItemIsSelectable; - } - const Collection collection = d->m_collections.value(node->id); if (collection.isValid()) { @@ -430,6 +429,9 @@ } } else if (Node::Item == node->type) { + // cut out entities are shown as disabled + // TODO: Not sure this is wanted, it prevents any interaction with them, better + // solution would be to move this to the delegate, as was done for collections. if (d->m_pendingCutItems.contains(node->id)) { return Qt::ItemIsSelectable; } diff --git a/src/widgets/collectionstatisticsdelegate.cpp b/src/widgets/collectionstatisticsdelegate.cpp --- a/src/widgets/collectionstatisticsdelegate.cpp +++ b/src/widgets/collectionstatisticsdelegate.cpp @@ -223,7 +223,9 @@ QTreeView *treeView = qobject_cast(d->parent); bool expanded = treeView && treeView->isExpanded(firstColumn); - if (option.state & QStyle::State_Selected) { + if (index.data(EntityTreeModel::PendingCutRole).toBool()) { + painter->setPen(option.palette.color(QPalette::Disabled, QPalette::Text)); + } else if (option.state & QStyle::State_Selected) { painter->setPen(textColor.isValid() ? textColor : option.palette.highlightedText().color()); } else { painter->setPen(textColor.isValid() ? textColor : option.palette.text().color());