~ubuntu-branches/ubuntu/oneiric/kdepim/oneiric-updates

« back to all changes in this revision

Viewing changes to mobile/tasks/tasksfilterproxymodel.h

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2011-06-28 19:33:24 UTC
  • mfrom: (0.2.13) (0.1.13 sid)
  • Revision ID: package-import@ubuntu.com-20110628193324-8yvjs8sdv9rdoo6c
Tags: 4:4.7.0-0ubuntu1
* New upstream release
  - update install files
  - add missing kdepim-doc package to control file
  - Fix Vcs lines
  - kontact breaks/replaces korganizer << 4:4.6.80
  - tighten the dependency of kdepim-dev on libkdepim4 to fix lintian error

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    Copyright (c) 2010 Tobias Koenig <tokoe@kde.org>
 
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
#ifndef AKONADI_TASKSFILTERPROXYMODEL_H
 
21
#define AKONADI_TASKSFILTERPROXYMODEL_H
 
22
 
 
23
#include <QtGui/QSortFilterProxyModel>
 
24
 
 
25
namespace Akonadi {
 
26
 
 
27
/**
 
28
 * @short A proxy model for \a EntityTreeModel based task models.
 
29
 *
 
30
 * This class provides a filter proxy model for an EntityTreeModel.
 
31
 * The list of shown tasks can be limited by setting a filter pattern.
 
32
 * Only tasks that contain this pattern as part of their data will be listed.
 
33
 *
 
34
 * Example:
 
35
 *
 
36
 * @code
 
37
 *
 
38
 * Akonadi::TasksFilterProxyModel *filter = new Akonadi::TasksFilterProxyModel;
 
39
 * filter->setSourceModel( model );
 
40
 *
 
41
 * Akonadi::EntityTreeView *view = new Akonadi::EntityTreeView;
 
42
 * view->setModel( filter );
 
43
 *
 
44
 * QLineEdit *filterEdit = new QLineEdit;
 
45
 * connect( filterEdit, SIGNAL( textChanged( const QString& ) ),
 
46
 *          filter, SLOT( setFilterString( const QString& ) ) );
 
47
 *
 
48
 * @endcode
 
49
 *
 
50
 * @author Tobias Koenig <tokoe@kde.org>
 
51
 */
 
52
class TasksFilterProxyModel : public QSortFilterProxyModel
 
53
{
 
54
  Q_OBJECT
 
55
 
 
56
  public:
 
57
    /**
 
58
     * Creates a new tasks filter proxy model.
 
59
     *
 
60
     * @param parent The parent object.
 
61
     */
 
62
    explicit TasksFilterProxyModel( QObject *parent = 0 );
 
63
 
 
64
    /**
 
65
     * Destroys the tasks filter proxy model.
 
66
     */
 
67
    ~TasksFilterProxyModel();
 
68
 
 
69
  public Q_SLOTS:
 
70
    /**
 
71
     * Sets the @p filter that is used to filter for matching tasks.
 
72
     */
 
73
    void setFilterString( const QString &filter );
 
74
 
 
75
  protected:
 
76
    //@cond PRIVATE
 
77
    virtual bool filterAcceptsRow( int row, const QModelIndex &parent ) const;
 
78
    //@endcond
 
79
 
 
80
  private:
 
81
    //@cond PRIVATE
 
82
    class Private;
 
83
    Private* const d;
 
84
    //@endcond
 
85
};
 
86
 
 
87
}
 
88
 
 
89
#endif