SVN_SILENT made messages (.desktop file)
[kdepim.git] / akonadi_next / amazingcompleter.h
blob0e858d167db2d310396513d75241f21c7d28afe9
1 /*
2 Copyright (c) 2009 Stephen Kelly <steveire@gmail.com>
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.
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.
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.
20 #ifndef AMAZING_COMPLETER_H
21 #define AMAZING_COMPLETER_H
23 #include <QObject>
24 #include <QWidget>
25 #include <QAbstractItemModel>
27 #include "akonadi_next_export.h"
29 class QAbstractItemView;
31 namespace Akonadi
34 class AmazingCompleterPrivate;
36 class AKONADI_NEXT_EXPORT AmazingCompleter : public QObject
38 Q_OBJECT
39 public:
41 enum ViewHandler { Popup, NoPopup };
43 explicit AmazingCompleter(/* QAbstractItemModel *model, */ QObject *parent = Q_NULLPTR);
44 ~AmazingCompleter();
46 void setWidget(QWidget *widget);
48 void setView(QAbstractItemView *view, ViewHandler = Popup);
50 void setModel(QAbstractItemModel *model);
52 /**
53 The data from this is put into the lineedit
55 void setCompletionRole(int role);
57 /**
58 This role is passed to match().
60 void setMatchingRole(int role);
62 void setMinimumLength(int length);
64 public Q_SLOTS:
65 void setCompletionPrefixString(const QString &matchData);
66 void setCompletionPrefix(const QVariant &matchData);
68 void sourceRowsInserted(const QModelIndex &parent, int start, int end);
70 protected:
71 virtual void connectModelToView(QAbstractItemModel *model, QAbstractItemView *view);
73 private:
74 Q_DECLARE_PRIVATE(AmazingCompleter)
76 AmazingCompleterPrivate *d_ptr;
82 #endif