20 #include "selectionproxymodel.h"
22 #include "entitytreemodel.h"
24 using namespace Akonadi;
29 class SelectionProxyModelPrivate
32 SelectionProxyModelPrivate( SelectionProxyModel *selectionProxyModel )
33 : q_ptr( selectionProxyModel )
35 Q_Q( SelectionProxyModel );
36 foreach (
const QModelIndex &rootIndex, q->sourceRootIndexes() ) {
37 rootIndexAdded( rootIndex );
38 q->sourceModel()->fetchMore( rootIndex );
45 void rootIndexAdded(
const QModelIndex &newRootIndex )
47 Q_Q( SelectionProxyModel );
49 q->sourceModel()->setData( newRootIndex, QVariant(), EntityTreeModel::CollectionRefRole );
50 q->sourceModel()->fetchMore( newRootIndex );
56 void rootIndexAboutToBeRemoved(
const QModelIndex &removedRootIndex )
58 Q_Q( SelectionProxyModel );
59 q->sourceModel()->setData( removedRootIndex, QVariant(), EntityTreeModel::CollectionDerefRole );
62 Q_DECLARE_PUBLIC( SelectionProxyModel )
63 SelectionProxyModel *q_ptr;
69 : KSelectionProxyModel( selectionModel, parent ), d_ptr( new SelectionProxyModelPrivate( this ) )
71 connect(
this, SIGNAL(rootIndexAdded(QModelIndex)), SLOT(rootIndexAdded(QModelIndex)) );
72 connect(
this, SIGNAL(rootIndexAboutToBeRemoved(QModelIndex)), SLOT(rootIndexAboutToBeRemoved(QModelIndex)) );
75 SelectionProxyModel::~SelectionProxyModel()
80 #include "selectionproxymodel.moc"