21 #include "ldapattributeproxymodel.h"
22 #include "ldapmodel.h"
23 #include "ldapmodelnode_p.h"
26 #include <klocalizedstring.h>
28 using namespace KLDAP;
30 class LdapAttributeProxyModel::LdapAttributeProxyModelPrivate
33 LdapAttributeProxyModelPrivate();
37 LdapAttributeProxyModel::LdapAttributeProxyModelPrivate::LdapAttributeProxyModelPrivate()
42 LdapAttributeProxyModel::LdapAttributeProxyModel(
QObject *parent )
44 m_d( new LdapAttributeProxyModelPrivate() )
49 LdapAttributeProxyModel::~LdapAttributeProxyModel()
59 return sourceModel()->data( mapToSource( index ), role );
62 bool LdapAttributeProxyModel::setData(
const QModelIndex &index,
72 bool LdapAttributeProxyModel::filterAcceptsRow(
int sourceRow,
75 QModelIndex idx = sourceModel()->index( sourceRow, 0, sourceParent );
76 LdapModelNode::NodeType nodeType =
77 static_cast<LdapModelNode::NodeType
>(
78 sourceModel()->data( idx, LdapModel::NodeTypeRole ).toUInt() );
79 return nodeType == LdapModelNode::Attr;
82 QVariant LdapAttributeProxyModel::headerData(
int section,
83 Qt::Orientation orientation,
86 if ( orientation == Qt::Horizontal && role == Qt::DisplayRole ) {
88 return QVariant( i18n(
"Attribute" ) );
89 }
else if ( section == 1 ) {
97 int LdapAttributeProxyModel::columnCount(
const QModelIndex & )
const
105 return sourceModel()->flags( mapToSource( index ) );
108 bool LdapAttributeProxyModel::hasChildren(
const QModelIndex &parent )
const
126 bool LdapAttributeProxyModel::insertRows(
int row,
int count,
135 bool LdapAttributeProxyModel::removeRows(
int row,
int count,
144 void LdapAttributeProxyModel::sort(
int column, Qt::SortOrder order )
152 return Qt::MoveAction;
155 QMimeData *LdapAttributeProxyModel::mimeData(
const QModelIndexList &indexes )
const
161 bool LdapAttributeProxyModel::dropMimeData(
const QMimeData *data, Qt::DropAction action,
bool hasChildrenOfType(const QModelIndex &parent, LdapDataType type) const
Checks to see if the item referenced by parent has any children of the type type. ...
A ModelView interface to an LDAP tree.
virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const
virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const