• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.14.10 API Reference
  • KDE Home
  • Contact Us
 

KLDAP Library

  • kldap
ldapmodel.h
1/*
2 This file is part of libkldap.
3 Copyright (c) 2006 Sean Harmer <sh@theharmers.co.uk>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#ifndef KLDAP_LDAPMODEL_H
22#define KLDAP_LDAPMODEL_H
23
24#include <QtCore/QAbstractItemModel>
25
26#include "ldapconnection.h"
27#include "ldapobject.h"
28#include "kldap_export.h"
29
30namespace KLDAP {
31
42class KLDAP_EXPORT LdapModel : public QAbstractItemModel
43{
44 Q_OBJECT
45 public:
46 enum Roles {
47 NodeTypeRole = Qt::UserRole + 1
48 };
49
50 enum LdapDataType {
51 DistinguishedName = 0,
52 Attribute
53 };
54
63 explicit LdapModel( QObject *parent = 0 );
72 explicit LdapModel( LdapConnection &connection, QObject *parent = 0 );
73 virtual ~LdapModel();
74
81 void setConnection( LdapConnection &connection );
82
83 //
84 // Implement the usual QAbstractItemModel interface
85 //
89 virtual QModelIndex index( int row, int col, const QModelIndex &parent ) const;
93 virtual QModelIndex parent( const QModelIndex &child ) const;
97 virtual QVariant data( const QModelIndex &index, int role ) const;
102 virtual bool setData( const QModelIndex &index,
103 const QVariant &value,
104 int role = Qt::EditRole );
108 virtual QVariant headerData( int section, Qt::Orientation orientation, int role ) const;
112 virtual Qt::ItemFlags flags( const QModelIndex &index ) const;
116 virtual int columnCount( const QModelIndex &parent ) const;
120 virtual int rowCount( const QModelIndex &parent ) const;
124 virtual bool hasChildren( const QModelIndex &parent ) const;
128 virtual bool canFetchMore( const QModelIndex &parent ) const;
132 virtual void fetchMore( const QModelIndex &parent );
137 virtual bool insertRows( int row, int count,
138 const QModelIndex &parent = QModelIndex() );
143 virtual bool removeRows( int row, int count,
144 const QModelIndex &parent = QModelIndex() );
149 virtual void sort( int column, Qt::SortOrder order = Qt::AscendingOrder );
150
151 //
152 // Drag and drop support
153 //
158 virtual Qt::DropActions supportedDropActions() const;
163 virtual QMimeData *mimeData( const QModelIndexList &indexes ) const;
168 virtual bool dropMimeData( const QMimeData *data, Qt::DropAction action,
169 int row, int column, const QModelIndex &parent );
170
171 //
172 // Other public utility functions
173 //
183 bool hasChildrenOfType( const QModelIndex &parent, LdapDataType type ) const;
184
185 public Q_SLOTS:
190 virtual void revert();
195 virtual bool submit();
196
197 Q_SIGNALS:
205 void ready();
206
207 private:
208 class LdapModelPrivate;
209 LdapModelPrivate *const m_d;
210
211 Q_PRIVATE_SLOT( m_d, void gotSearchResult( KLDAP::LdapSearch* ) )
212 Q_PRIVATE_SLOT( m_d, void gotSearchData( KLDAP::LdapSearch*, const KLDAP::LdapObject& ) )
213};
214
215}
216#endif
KLDAP::LdapConnection
This class represents a connection to an LDAP server.
Definition ldapconnection.h:37
KLDAP::LdapModel::LdapModelPrivate
Definition ldapmodel_p.h:38
KLDAP::LdapModel::index
virtual QModelIndex index(int row, int col, const QModelIndex &parent) const
Reimplemented from QAbstractItemModel::index().
Definition ldapmodel.cpp:83
KLDAP::LdapModel::canFetchMore
virtual bool canFetchMore(const QModelIndex &parent) const
Reimplemented from QAbstractItemModel::canFetchMore().
Definition ldapmodel.cpp:206
KLDAP::LdapModel::headerData
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const
Reimplemented from QAbstractItemModel::headerData().
Definition ldapmodel.cpp:147
KLDAP::LdapModel::sort
virtual void sort(int column, Qt::SortOrder order=Qt::AscendingOrder)
Reimplemented from QAbstractItemModel::removeRows().
Definition ldapmodel.cpp:245
KLDAP::LdapModel::setData
virtual bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Reimplemented from QAbstractItemModel::setData().
Definition ldapmodel.cpp:137
KLDAP::LdapModel::hasChildren
virtual bool hasChildren(const QModelIndex &parent) const
Reimplemented from QAbstractItemModel::hasChildren().
Definition ldapmodel.cpp:188
KLDAP::LdapModel::rowCount
virtual int rowCount(const QModelIndex &parent) const
Reimplemented from QAbstractItemModel::rowCount().
Definition ldapmodel.cpp:177
KLDAP::LdapModel::ready
void ready()
The ready() signal is emitted when the model is ready for use by other components.
KLDAP::LdapModel::submit
virtual bool submit()
Reimplemented from QAbstractItemModel::revert().
Definition ldapmodel.cpp:317
KLDAP::LdapModel::columnCount
virtual int columnCount(const QModelIndex &parent) const
Reimplemented from QAbstractItemModel::columnCount().
Definition ldapmodel.cpp:170
KLDAP::LdapModel::supportedDropActions
virtual Qt::DropActions supportedDropActions() const
Reimplemented from QAbstractItemModel::supportedDropActions().
Definition ldapmodel.cpp:251
KLDAP::LdapModel::revert
virtual void revert()
Reimplemented from QAbstractItemModel::revert().
Definition ldapmodel.cpp:312
KLDAP::LdapModel::removeRows
virtual bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex())
Reimplemented from QAbstractItemModel::removeRows().
Definition ldapmodel.cpp:236
KLDAP::LdapModel::setConnection
void setConnection(LdapConnection &connection)
Set the connection that the model should use.
Definition ldapmodel.cpp:56
KLDAP::LdapModel::LdapModel
LdapModel(QObject *parent=0)
Constructs an LdapModel.
Definition ldapmodel.cpp:34
KLDAP::LdapModel::fetchMore
virtual void fetchMore(const QModelIndex &parent)
Reimplemented from QAbstractItemModel::fetchMore().
Definition ldapmodel.cpp:213
KLDAP::LdapModel::mimeData
virtual QMimeData * mimeData(const QModelIndexList &indexes) const
Reimplemented from QAbstractItemModel::mimedata().
Definition ldapmodel.cpp:256
KLDAP::LdapModel::insertRows
virtual bool insertRows(int row, int count, const QModelIndex &parent=QModelIndex())
Reimplemented from QAbstractItemModel::insertRows().
Definition ldapmodel.cpp:227
KLDAP::LdapModel::data
virtual QVariant data(const QModelIndex &index, int role) const
Reimplemented from QAbstractItemModel::data().
Definition ldapmodel.cpp:101
KLDAP::LdapModel::parent
virtual QModelIndex parent(const QModelIndex &child) const
Reimplemented from QAbstractItemModel::parent().
Definition ldapmodel.cpp:67
KLDAP::LdapModel::flags
virtual Qt::ItemFlags flags(const QModelIndex &index) const
Reimplemented from QAbstractItemModel::flags().
Definition ldapmodel.cpp:160
KLDAP::LdapModel::hasChildrenOfType
bool hasChildrenOfType(const QModelIndex &parent, LdapDataType type) const
Checks to see if the item referenced by parent has any children of the type type.
Definition ldapmodel.cpp:274
KLDAP::LdapModel::dropMimeData
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
Reimplemented from QAbstractItemModel::dropMimedata().
Definition ldapmodel.cpp:262
KLDAP::LdapObject
This class represents an LDAP Object.
Definition ldapobject.h:42
KLDAP::LdapSearch
This class starts a search operation on a LDAP server and returns the search values via a Qt signal.
Definition ldapsearch.h:46
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 17 2025 00:00:00 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KLDAP Library

Skip menu "KLDAP Library"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs-4.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal