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_LDAPATTRIBUTEPROXYMODEL_H |
22 | #define KLDAP_LDAPATTRIBUTEPROXYMODEL_H |
23 | |
24 | #include <QSortFilterProxyModel> |
25 | |
26 | #include "kldap_export.h" |
27 | |
28 | namespace KLDAP { |
29 | |
30 | class KLDAP_EXPORT LdapAttributeProxyModel : public QSortFilterProxyModel |
31 | { |
32 | Q_OBJECT |
33 | public: |
34 | explicit LdapAttributeProxyModel( QObject *parent = 0 ); |
35 | ~LdapAttributeProxyModel(); |
36 | |
37 | virtual QVariant data( const QModelIndex &index, int role ) const; |
38 | /** |
39 | * Reimplemented from QAbstractItemModel::setData(). This is a placeholder for when |
40 | * LdapAttributeProxyModel beomes writeable and always returns false. |
41 | */ |
42 | virtual bool setData( const QModelIndex &index, |
43 | const QVariant &value, |
44 | int role = Qt::EditRole ); |
45 | virtual bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const; |
46 | virtual QVariant ( int section, Qt::Orientation orientation, int role ) const; |
47 | virtual int columnCount( const QModelIndex &parent ) const; |
48 | virtual Qt::ItemFlags flags( const QModelIndex &index ) const; |
49 | virtual bool hasChildren( const QModelIndex &parent ) const; |
50 | |
51 | virtual QModelIndex mapFromSource ( const QModelIndex & sourceIndex ) const; |
52 | virtual QModelIndex mapToSource ( const QModelIndex & proxyIndex ) const; |
53 | |
54 | /** |
55 | * Reimplemented from QAbstractItemModel::insertRows(). This is a placeholder for when |
56 | * LdapAttributeProxyModel beomes writeable and always returns false. |
57 | */ |
58 | virtual bool insertRows( int row, int count, |
59 | const QModelIndex &parent = QModelIndex() ); |
60 | /** |
61 | * Reimplemented from QAbstractItemModel::removeRows(). This is a placeholder for when |
62 | * LdapAttributeProxyModel beomes writeable and always returns false. |
63 | */ |
64 | virtual bool removeRows( int row, int count, |
65 | const QModelIndex &parent = QModelIndex() ); |
66 | /** |
67 | * Reimplemented from QAbstractItemModel::removeRows(). The default implementation |
68 | * does nothing. |
69 | */ |
70 | virtual void sort( int column, Qt::SortOrder order = Qt::AscendingOrder ); |
71 | |
72 | // |
73 | // Drag and drop support |
74 | // |
75 | /** |
76 | * Reimplemented from QAbstractItemModel::supportedDropActions(). The default |
77 | * implementation returns Qt::MoveAction. |
78 | */ |
79 | virtual Qt::DropActions supportedDropActions() const; |
80 | /** |
81 | * Reimplemented from QAbstractItemModel::mimedata(). This is a placeholder for when |
82 | * LdapAttributeProxyModel beomes writeable and always returns 0. |
83 | */ |
84 | virtual QMimeData *mimeData( const QModelIndexList &indexes ) const; |
85 | /** |
86 | * Reimplemented from QAbstractItemModel::dropMimedata(). This is a placeholder for when |
87 | * LdapAttributeProxyModel beomes writeable and always returns false. |
88 | */ |
89 | virtual bool dropMimeData( const QMimeData *data, Qt::DropAction action, |
90 | int row, int column, const QModelIndex &parent ); |
91 | |
92 | private: |
93 | class LdapAttributeProxyModelPrivate; |
94 | LdapAttributeProxyModelPrivate *const m_d; |
95 | }; |
96 | |
97 | } |
98 | #endif |
99 | |