1 /***************************************************************************
2 * Copyright (C) 2010 by Peter Penz <peter.penz19@gmail.com> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
20 #ifndef DOLPHINSEARCHBOX_H
21 #define DOLPHINSEARCHBOX_H
27 class AbstractSearchFilterWidget
;
35 * @brief Input box for searching files with or without Nepomuk.
37 * The widget allows to specify:
38 * - Where to search: Everywhere or below the current directory
39 * - What to search: Filenames or content
41 * If Nepomuk is available and the current folder is indexed, further
42 * options are offered.
44 class DolphinSearchBox
: public QWidget
{
48 DolphinSearchBox(QWidget
* parent
= 0);
49 virtual ~DolphinSearchBox();
52 * Returns the text that should be used as input
58 * Sets the current path that is used as root for
59 * searching files, if "From Here" has been selected.
61 void setSearchPath(const KUrl
& url
);
62 KUrl
searchPath() const;
64 /** @return URL that will start the searching of files. */
65 KUrl
urlForSearching() const;
68 virtual bool event(QEvent
* event
);
69 virtual void showEvent(QShowEvent
* event
);
70 virtual void keyReleaseEvent(QKeyEvent
* event
);
74 * Is emitted when the user pressed Return or Enter
75 * and provides the text that should be used as input
78 void search(const QString
& text
);
81 * Is emitted when the user has changed a character of
82 * the text that should be used as input for searching.
84 void searchTextChanged(const QString
& text
);
87 * Emitted as soon as the search box should get closed.
92 void emitSearchSignal();
93 void slotConfigurationChanged();
94 void setFilterWidgetsVisible(bool visible
);
97 void initButton(QPushButton
* button
);
103 * @return True, if the complete directory tree specified by m_searchPath
104 * is indexed by Strigi.
106 bool isSearchPathIndexed() const;
109 * @return URL that represents the Nepomuk query for starting the search.
111 KUrl
nepomukUrlForSearching() const;
114 bool m_startedSearching
;
115 bool m_nepomukActivated
;
117 QVBoxLayout
* m_topLayout
;
119 KLineEdit
* m_searchInput
;
120 QPushButton
* m_fromHereButton
;
121 QPushButton
* m_everywhereButton
;
122 QPushButton
* m_fileNameButton
;
123 QPushButton
* m_contentButton
;
125 QToolButton
* m_filterButton
;
126 QFormLayout
* m_filterWidgetsLayout
;
127 QList
<AbstractSearchFilterWidget
*> m_filterWidgets
;