]>
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
31 class QStandardItemModel
;
35 * @brief used for completition for the DolphinSearchBox
37 class DolphinSearchCompleter
: public QObject
42 DolphinSearchCompleter(KLineEdit
*linedit
);
45 void highlighted(const QModelIndex
& index
);
46 void activated(const QModelIndex
& index
);
47 void slotTextEdited(const QString
&text
);
50 void addCompletionItem(const QString
& displayed
, const QString
& usedForCompletition
, const QString
& description
= QString(), const QString
& toolTip
= QString(), const KIcon
& icon
= KIcon());
52 void findText(int* wordStart
, int* wordEnd
, QString
* newWord
, int cursorPos
, const QString
&input
);
56 QCompleter
* m_completer
;
57 QStandardItemModel
* m_completionModel
;
64 * @brief Input box for searching files with Nepomuk.
66 class DolphinSearchBox
: public QWidget
71 DolphinSearchBox(QWidget
* parent
= 0);
72 virtual ~DolphinSearchBox();
75 virtual bool event(QEvent
* event
);
76 virtual bool eventFilter(QObject
* watched
, QEvent
* event
);
80 * Is emitted when the user pressed Return or Enter
81 * and provides the Nepomuk URL that should be used
84 void search(const KUrl
& url
);
87 * Is emitted if the text of the searchbox has been changed.
89 void textChanged(const QString
& text
);
92 void emitSearchSignal();
95 KLineEdit
* m_searchInput
;
96 QToolButton
* m_searchButton
;
98 DolphinSearchCompleter
* m_completer
;