Changeset View
Changeset View
Standalone View
Standalone View
src/search/dolphinquery.h
- This file was added.
1 | /*************************************************************************** | ||||
---|---|---|---|---|---|
2 | * Copyright (C) 2019 by Ismael Asensio <isma.af@mgmail.com> * | ||||
3 | * * | ||||
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. * | ||||
8 | * * | ||||
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. * | ||||
13 | * * | ||||
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 | ***************************************************************************/ | ||||
19 | | ||||
20 | #ifndef DOLPHINQUERY_H | ||||
21 | #define DOLPHINQUERY_H | ||||
22 | | ||||
23 | #include "dolphin_export.h" | ||||
24 | | ||||
25 | #include <QString> | ||||
26 | #include <QUrl> | ||||
27 | | ||||
28 | /** | ||||
29 | * @brief Simple query model that parses a Baloo search Url and extracts its | ||||
30 | * separate components to be displayed on dolphin search box. | ||||
31 | */ | ||||
32 | class DOLPHIN_EXPORT DolphinQuery | ||||
33 | { | ||||
34 | public: | ||||
35 | /** Calls Baloo::Query::fromSearchUrl() with the given @p searchUrl | ||||
36 | * and parses the result to extract its separate components */ | ||||
37 | static DolphinQuery fromBalooSearchUrl(const QUrl& searchUrl); | ||||
38 | | ||||
39 | /** @return the \a searchUrl passed to Baloo::Query::fromSearchUrl() */ | ||||
40 | QUrl searchUrl() const; | ||||
41 | /** @return the user text part of the query, to be shown in the searchbar */ | ||||
42 | QString text() const; | ||||
43 | /** @return the first of Baloo::Query::types(), or an empty string */ | ||||
44 | QString type() const; | ||||
45 | /** @return a list of the search terms of the Baloo::Query that act as a filter, | ||||
46 | * such as \"rating>= <i>value<i>\" or \"modified>= <i>date<i>\"*/ | ||||
47 | QStringList searchTerms() const; | ||||
48 | /** @return Baloo::Query::includeFolder(), that is, the initial directory | ||||
49 | * for the query or an empty string if its a global search" */ | ||||
50 | QString includeFolder() const; | ||||
51 | | ||||
52 | private: | ||||
53 | QUrl m_searchUrl; | ||||
54 | QString m_searchText; | ||||
55 | QString m_fileType; | ||||
56 | QStringList m_searchTerms; | ||||
57 | QString m_includeFolder; | ||||
58 | }; | ||||
59 | | ||||
60 | #endif //DOLPHINQUERY_H |