~ubuntu-branches/ubuntu/karmic/kdepim/karmic-backports

« back to all changes in this revision

Viewing changes to akonadi/akonadi_next/descendantentitiesproxymodel.h

  • Committer: Bazaar Package Importer
  • Author(s): Christian Mangold
  • Date: 2009-07-10 06:34:50 UTC
  • mfrom: (1.1.40 upstream)
  • Revision ID: james.westby@ubuntu.com-20090710063450-neojgew2fh0n3y0u
Tags: 4:4.2.96-0ubuntu1
* New upstream release
* Bump kde build-deps to 4.2.96

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
    Copyright (c) 2009 Stephen Kelly <steveire@gmail.com>
3
 
 
4
 
    This library is free software; you can redistribute it and/or modify it
5
 
    under the terms of the GNU Library General Public License as published by
6
 
    the Free Software Foundation; either version 2 of the License, or (at your
7
 
    option) any later version.
8
 
 
9
 
    This library is distributed in the hope that it will be useful, but WITHOUT
10
 
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
 
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
12
 
    License for more details.
13
 
 
14
 
    You should have received a copy of the GNU Library General Public License
15
 
    along with this library; see the file COPYING.LIB.  If not, write to the
16
 
    Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17
 
    02110-1301, USA.
18
 
*/
19
 
 
20
 
 
21
 
#ifndef DESCENDANTENTITIESPROXYMODEL_H
22
 
#define DESCENDANTENTITIESPROXYMODEL_H
23
 
 
24
 
#include "abstractproxymodel.h"
25
 
#include "akonadi_next_export.h"
26
 
 
27
 
namespace Akonadi
28
 
{
29
 
class DescendantEntitiesProxyModelPrivate;
30
 
 
31
 
class AKONADI_NEXT_EXPORT DescendantEntitiesProxyModel : public AbstractProxyModel
32
 
{
33
 
  Q_OBJECT
34
 
 
35
 
  public:
36
 
 
37
 
    /**
38
 
     * Creates a new descendant entities proxy model.
39
 
     *
40
 
     * @param parent The parent object.
41
 
     */
42
 
    DescendantEntitiesProxyModel( QObject *parent = 0 );
43
 
 
44
 
    /**
45
 
     * Destroys the descendant entities proxy model.
46
 
     */
47
 
    virtual ~DescendantEntitiesProxyModel();
48
 
 
49
 
    /**
50
 
     * Sets the source @p model of the proxy.
51
 
     */
52
 
    virtual void setSourceModel( QAbstractItemModel *model );
53
 
 
54
 
    /**
55
 
     * Sets the root index to @p index. This is the root of the proxy model.
56
 
     *
57
 
     * @param index The root index in the *source* model which will be shown in this model.
58
 
     *              If the index is invalid, the model is empty.
59
 
     *
60
 
     * \note You must set the model before setting the root index.
61
 
     */
62
 
    void setRootIndex( const QModelIndex &index);
63
 
 
64
 
    /**
65
 
     * Set whether to show ancestor data in the model. If @p display is true, then
66
 
     * a source model which is displayed as
67
 
     *
68
 
     * @code
69
 
     *  -> "Item 0-0" (this is row-depth)
70
 
     *  -> -> "Item 0-1"
71
 
     *  -> -> "Item 1-1"
72
 
     *  -> -> -> "Item 0-2"
73
 
     *  -> -> -> "Item 1-2"
74
 
     *  -> "Item 1-0"
75
 
     * @endcode
76
 
     *
77
 
     * will be displayed as
78
 
     *
79
 
     * @code
80
 
     *  -> *Item 0-0"
81
 
     *  -> "Item 0-0 / Item 0-1"
82
 
     *  -> "Item 0-0 / Item 1-1"
83
 
     *  -> "Item 0-0 / Item 1-1 / Item 0-2"
84
 
     *  -> "Item 0-0 / Item 1-1 / Item 1-2"
85
 
     *  -> "Item 1-0"
86
 
     * @endcode
87
 
     *
88
 
     * If @p display is false, the proxy will show
89
 
     *
90
 
     * @code
91
 
     *  -> *Item 0-0"
92
 
     *  -> "Item 0-1"
93
 
     *  -> "Item 1-1"
94
 
     *  -> "Item 0-2"
95
 
     *  -> "Item 1-2"
96
 
     *  -> "Item 1-0"
97
 
     * @endcode
98
 
     *
99
 
     * Default is false.
100
 
     */
101
 
    void setDisplayAncestorData( bool display );
102
 
 
103
 
    /**
104
 
     * Whether ancestor data will be displayed.
105
 
     */
106
 
    bool displayAncestorData() const;
107
 
 
108
 
    /**
109
 
     * Sets the ancestor @p separator used between data of ancestors.
110
 
     */
111
 
    void setAncestorSeparator( const QString &separator );
112
 
 
113
 
    /**
114
 
     * Separator used between data of ancestors.
115
 
     */
116
 
    QString ancestorSeparator() const;
117
 
 
118
 
    /**
119
 
     * Returns the number of descendant entries for the given model @p index.
120
 
     */
121
 
    int descendantCount( const QModelIndex &index ) const;
122
 
 
123
 
    QModelIndex mapFromSource ( const QModelIndex & sourceIndex ) const;
124
 
    QModelIndex mapToSource ( const QModelIndex & proxyIndex ) const;
125
 
 
126
 
    virtual Qt::ItemFlags flags( const QModelIndex &index ) const;
127
 
    QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const;
128
 
    virtual int rowCount( const QModelIndex & parent = QModelIndex() ) const;
129
 
 
130
 
    virtual bool hasChildren ( const QModelIndex & parent = QModelIndex() ) const;
131
 
    virtual QModelIndex index(int, int, const QModelIndex&) const;
132
 
    virtual QModelIndex parent(const QModelIndex&) const;
133
 
    virtual int columnCount(const QModelIndex&) const;
134
 
 
135
 
private:
136
 
  Q_DECLARE_PRIVATE( DescendantEntitiesProxyModel )
137
 
  //@cond PRIVATE
138
 
  DescendantEntitiesProxyModelPrivate *d_ptr;
139
 
 
140
 
  Q_PRIVATE_SLOT(d_func(), void sourceRowsAboutToBeInserted(const QModelIndex &, int, int))
141
 
  Q_PRIVATE_SLOT(d_func(), void sourceRowsInserted(const QModelIndex &, int, int))
142
 
  Q_PRIVATE_SLOT(d_func(), void sourceRowsAboutToBeRemoved(const QModelIndex &, int, int))
143
 
  Q_PRIVATE_SLOT(d_func(), void sourceRowsRemoved(const QModelIndex &, int, int))
144
 
  Q_PRIVATE_SLOT(d_func(), void sourceRowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int))
145
 
  Q_PRIVATE_SLOT(d_func(), void sourceRowsMoved(const QModelIndex &, int, int, const QModelIndex &, int))
146
 
  Q_PRIVATE_SLOT(d_func(), void sourceModelAboutToBeReset())
147
 
  Q_PRIVATE_SLOT(d_func(), void sourceModelReset())
148
 
  Q_PRIVATE_SLOT(d_func(), void sourceLayoutAboutToBeChanged())
149
 
  Q_PRIVATE_SLOT(d_func(), void sourceLayoutChanged())
150
 
  Q_PRIVATE_SLOT(d_func(), void sourceDataChanged(const QModelIndex &, const QModelIndex &))
151
 
 
152
 
  // Make these private, they shouldn't be called by applications
153
 
//   virtual bool insertRows(int , int, const QModelIndex & = QModelIndex());
154
 
//   virtual bool insertColumns(int, int, const QModelIndex & = QModelIndex());
155
 
//   virtual bool removeRows(int, int, const QModelIndex & = QModelIndex());
156
 
//   virtual bool removeColumns(int, int, const QModelIndex & = QModelIndex());
157
 
 
158
 
 
159
 
  //@endcond
160
 
};
161
 
 
162
 
}
163
 
 
164
 
#endif