]>
cloud.milkyroute.net Git - dolphin.git/blob - src/search/dolphinsearchbox.h
1 /***************************************************************************
2 * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
3 * Copyright (C) 2009 by Matthias Fuchs <mat69@gmx.net> *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program 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 *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
19 ***************************************************************************/
20 #ifndef DOLPHINSEARCHBOX_H
21 #define DOLPHINSEARCHBOX_H
30 class QStandardItemModel
;
33 * @brief Helper class used for completition for the DolphinSearchBox.
35 class DolphinSearchCompleter
: public QObject
40 DolphinSearchCompleter(KLineEdit
*linedit
);
43 void highlighted(const QModelIndex
& index
);
44 void slotTextEdited(const QString
&text
);
47 void addCompletionItem(const QString
& displayed
, const QString
& usedForCompletition
, const QString
& description
= QString(), const QString
& toolTip
= QString(), const KIcon
& icon
= KIcon());
49 void findText(int* wordStart
, int* wordEnd
, QString
* newWord
, int cursorPos
, const QString
&input
);
53 QCompleter
* m_completer
;
54 QStandardItemModel
* m_completionModel
;
61 * @brief Input box for searching files with Nepomuk.
63 class DolphinSearchBox
: public QWidget
68 DolphinSearchBox(QWidget
* parent
= 0);
69 virtual ~DolphinSearchBox();
72 * Returns the text that should be used as input
78 virtual bool event(QEvent
* event
);
79 virtual bool eventFilter(QObject
* watched
, QEvent
* event
);
83 * Is emitted when the user pressed Return or Enter
84 * and provides the text that should be used as input
87 void search(const QString
& text
);
90 * Is emitted when the user has changed a character of
91 * the text that should be used as input for searching.
93 void searchTextChanged(const QString
& text
);
96 * Is emitted if the search box gets the focus or the text
97 * has been changed. It requests the need for an UI that allows to
98 * adjust search options. It is up to the application to ignore
101 void requestSearchOptions();
104 void emitSearchSignal();
105 void slotTextChanged(const QString
& text
);
108 KLineEdit
* m_searchInput
;
109 DolphinSearchCompleter
* m_completer
;