1 /***************************************************************************
2 * Copyright (C) 2010 by Sebastian Trueg <trueg@kde.org> *
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 ***************************************************************************/
23 #include <Nepomuk/Query/Query>
24 #include <panels/panel.h>
35 * @brief Allows to search for files by enabling generic search patterns (= facets).
37 * For example it is possible to search for images, documents or specific tags.
38 * The search panel can be adjusted to search only from the current folder or everywhere.
40 class SearchPanel
: public Panel
51 SearchPanel(QWidget
* parent
= 0);
52 virtual ~SearchPanel();
55 * Specifies whether a searching is done in all folders (= Everywhere)
56 * or from the current directory (= FromCurrentDir). The current directory
57 * is automatically determined when setUrl() has been called.
59 void setSearchMode(SearchMode mode
);
60 SearchMode
searchMode() const;
63 void urlActivated(const KUrl
& url
);
66 /** @see Panel::urlChanged() */
67 virtual bool urlChanged();
69 /** @see QWidget::showEvent() */
70 virtual void showEvent(QShowEvent
* event
);
72 /** @see QWidget::hideEvent() */
73 virtual void hideEvent(QHideEvent
* event
);
75 /** @see QWidget::contextMenuEvent() */
76 virtual void contextMenuEvent(QContextMenuEvent
* event
);
79 void slotSetUrlStatFinished(KJob
*);
80 void slotQueryTermChanged(const Nepomuk::Query::Term
& term
);
83 void setQuery(const Nepomuk::Query::Query
& query
);
87 SearchMode m_searchMode
;
88 KJob
* m_lastSetUrlStatJob
;
90 KUrl m_startedFromDir
;
91 Nepomuk::Utils::FacetWidget
* m_facetWidget
;
92 Nepomuk::Query::Query m_unfacetedRestQuery
;
95 #endif // SEARCHPANEL_H