KLDAP Library
KLDAP::LdapModel Class Reference
A ModelView interface to an LDAP tree. More...
#include <ldapmodel.h>
Inherits QAbstractItemModel.
Public Types | |
enum | LdapDataType { DistinguishedName = 0, Attribute } |
enum | Roles { NodeTypeRole = Qt::UserRole + 1 } |
Public Slots | |
virtual void | revert () |
virtual bool | submit () |
Signals | |
void | ready () |
Public Member Functions | |
virtual bool | canFetchMore (const QModelIndex &parent) const |
virtual int | columnCount (const QModelIndex &parent) const |
virtual QVariant | data (const QModelIndex &index, int role) const |
virtual bool | dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) |
virtual void | fetchMore (const QModelIndex &parent) |
virtual Qt::ItemFlags | flags (const QModelIndex &index) const |
virtual bool | hasChildren (const QModelIndex &parent) const |
bool | hasChildrenOfType (const QModelIndex &parent, LdapDataType type) const |
virtual QVariant | headerData (int section, Qt::Orientation orientation, int role) const |
virtual QModelIndex | index (int row, int col, const QModelIndex &parent) const |
virtual bool | insertRows (int row, int count, const QModelIndex &parent=QModelIndex()) |
LdapModel (LdapConnection &connection, QObject *parent=0) | |
LdapModel (QObject *parent=0) | |
virtual QMimeData * | mimeData (const QModelIndexList &indexes) const |
virtual QModelIndex | parent (const QModelIndex &child) const |
virtual bool | removeRows (int row, int count, const QModelIndex &parent=QModelIndex()) |
virtual int | rowCount (const QModelIndex &parent) const |
void | setConnection (LdapConnection &connection) |
virtual bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) |
virtual void | sort (int column, Qt::SortOrder order=Qt::AscendingOrder) |
virtual Qt::DropActions | supportedDropActions () const |
Detailed Description
A ModelView interface to an LDAP tree.At present the model is read only. Editing is planned for a future release.
This class is best used in conjunction with an LdapStructureProxyModel object for displaying the structure of an LDAP tree, and with LdapAttributeProxyModel for displaying the attributes of particular objects within the tree.
Definition at line 42 of file ldapmodel.h.
Constructor & Destructor Documentation
LdapModel::LdapModel | ( | QObject * | parent = 0 |
) | [explicit] |
Constructs an LdapModel.
You should set a connection for the model to use with setConnection(). Clients of this class should connect a slot to the ready() signal before setting this model onto a view.
- See also:
- setConnection()
Definition at line 31 of file ldapmodel.cpp.
LdapModel::LdapModel | ( | LdapConnection & | connection, | |
QObject * | parent = 0 | |||
) | [explicit] |
Constructs an LdapModel.
Clients of this class should connect a slot to the ready() signal before setting this model onto a view.
- See also:
- setConnection()
Definition at line 38 of file ldapmodel.cpp.
Member Function Documentation
bool LdapModel::canFetchMore | ( | const QModelIndex & | parent | ) | const [virtual] |
Reimplemented from QAbstractItemModel::canFetchMore().
Definition at line 203 of file ldapmodel.cpp.
int LdapModel::columnCount | ( | const QModelIndex & | parent | ) | const [virtual] |
QVariant LdapModel::data | ( | const QModelIndex & | index, | |
int | role | |||
) | const [virtual] |
Reimplemented from QAbstractItemModel::data().
- Todo:
- Include support for nice decorative icons dependent upon the objectClass + other role data.
- Todo:
- Include support for other roles as needed
Definition at line 98 of file ldapmodel.cpp.
bool LdapModel::dropMimeData | ( | const QMimeData * | data, | |
Qt::DropAction | action, | |||
int | row, | |||
int | column, | |||
const QModelIndex & | parent | |||
) | [virtual] |
Reimplemented from QAbstractItemModel::dropMimedata().
This is a placeholder for when LdapModel beomes writeable and always returns false.
Definition at line 259 of file ldapmodel.cpp.
void LdapModel::fetchMore | ( | const QModelIndex & | parent | ) | [virtual] |
Qt::ItemFlags LdapModel::flags | ( | const QModelIndex & | index | ) | const [virtual] |
Reimplemented from QAbstractItemModel::flags().
Read-only for now, make read-write upon request
Definition at line 157 of file ldapmodel.cpp.
bool LdapModel::hasChildren | ( | const QModelIndex & | parent | ) | const [virtual] |
bool LdapModel::hasChildrenOfType | ( | const QModelIndex & | parent, | |
LdapDataType | type | |||
) | const |
Checks to see if the item referenced by parent
has any children of the type type
.
If the item has not been populated by fetchMore() yet, then this function returns true.
- See also:
- fetchMore()
- Parameters:
-
parent Index to the item to query. type The type of child item to search for.
Definition at line 271 of file ldapmodel.cpp.
QVariant LdapModel::headerData | ( | int | section, | |
Qt::Orientation | orientation, | |||
int | role | |||
) | const [virtual] |
QModelIndex LdapModel::index | ( | int | row, | |
int | col, | |||
const QModelIndex & | parent | |||
) | const [virtual] |
bool LdapModel::insertRows | ( | int | row, | |
int | count, | |||
const QModelIndex & | parent = QModelIndex() | |||
) | [virtual] |
Reimplemented from QAbstractItemModel::insertRows().
This is a placeholder for when LdapModel beomes writeable and always returns false.
Definition at line 224 of file ldapmodel.cpp.
QMimeData * LdapModel::mimeData | ( | const QModelIndexList & | indexes | ) | const [virtual] |
Reimplemented from QAbstractItemModel::mimedata().
This is a placeholder for when LdapModel beomes writeable and always returns 0.
Definition at line 253 of file ldapmodel.cpp.
QModelIndex LdapModel::parent | ( | const QModelIndex & | child | ) | const [virtual] |
void KLDAP::LdapModel::ready | ( | ) | [signal] |
The ready() signal is emitted when the model is ready for use by other components.
When the model is first created and a connection is set, the model queries the LDAP server for its base DN and automatically creates items down to that level. This requires the event loop to be running. This signal indicates that this process has completed and the model can now be set onto views or queried directly from code.
bool LdapModel::removeRows | ( | int | row, | |
int | count, | |||
const QModelIndex & | parent = QModelIndex() | |||
) | [virtual] |
Reimplemented from QAbstractItemModel::removeRows().
This is a placeholder for when LdapModel beomes writeable and always returns false.
Definition at line 233 of file ldapmodel.cpp.
void LdapModel::revert | ( | ) | [virtual, slot] |
Reimplemented from QAbstractItemModel::revert().
This is a placeholder for when LdapModel beomes writeable. This implementation does nothing.
Definition at line 309 of file ldapmodel.cpp.
int LdapModel::rowCount | ( | const QModelIndex & | parent | ) | const [virtual] |
void LdapModel::setConnection | ( | LdapConnection & | connection | ) |
Set the connection that the model should use.
- See also:
- LdapConnection
Definition at line 53 of file ldapmodel.cpp.
bool LdapModel::setData | ( | const QModelIndex & | index, | |
const QVariant & | value, | |||
int | role = Qt::EditRole | |||
) | [virtual] |
Reimplemented from QAbstractItemModel::setData().
This is a placeholder for when LdapModel beomes writeable and always returns false.
Definition at line 134 of file ldapmodel.cpp.
void LdapModel::sort | ( | int | column, | |
Qt::SortOrder | order = Qt::AscendingOrder | |||
) | [virtual] |
Reimplemented from QAbstractItemModel::removeRows().
The default implementation does nothing.
Definition at line 242 of file ldapmodel.cpp.
bool LdapModel::submit | ( | ) | [virtual, slot] |
Reimplemented from QAbstractItemModel::revert().
This is a placeholder for when LdapModel beomes writeable. This implementation does nothing and returns false.
Definition at line 314 of file ldapmodel.cpp.
Qt::DropActions LdapModel::supportedDropActions | ( | ) | const [virtual] |
Reimplemented from QAbstractItemModel::supportedDropActions().
The default implementation returns Qt::MoveAction.
Definition at line 248 of file ldapmodel.cpp.
The documentation for this class was generated from the following files: