]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/search/dolphinquery.h
Apply 1 suggestion(s) to 1 file(s)
[dolphin.git] / src / search / dolphinquery.h
index 736abf66f5603e45c2b072e21499eb56a2757e8e..1334958f153953ff2902e966b61d1f282c8b548c 100644 (file)
@@ -1,21 +1,8 @@
-/***************************************************************************
- *   Copyright (C) 2019 by Ismael Asensio <isma.af@mgmail.com>             *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- *   This program is distributed in the hope that it will be useful,       *
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
- *   GNU General Public License for more details.                          *
- *                                                                         *
- *   You should have received a copy of the GNU General Public License     *
- *   along with this program; if not, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
- ***************************************************************************/
+/*
+ * SPDX-FileCopyrightText: 2019 Ismael Asensio <isma.af@mgmail.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
 
 #ifndef DOLPHINQUERY_H
 #define DOLPHINQUERY_H
  * @brief Simple query model that parses a Baloo search Url and extracts its
  * separate components to be displayed on dolphin search box.
  */
-class DOLPHIN_EXPORT DolphinQuery
+class DolphinQuery
 {
 public:
-    /** Calls Baloo::Query::fromSearchUrl() with the given @p searchUrl
-     * and parses the result to extract its separate components */
-    static DolphinQuery fromBalooSearchUrl(const QUrl& searchUrl);
+    /** Parses the components of @p searchUrl for the supported schemes */
+    static DolphinQuery fromSearchUrl(const QUrl &searchUrl);
+    /** Checks whether the DolphinQuery supports the given @p urlScheme */
+    static bool supportsScheme(const QString &urlScheme);
 
     /** @return the \a searchUrl passed to Baloo::Query::fromSearchUrl() */
     QUrl searchUrl() const;
@@ -48,6 +36,15 @@ public:
     /** @return Baloo::Query::includeFolder(), that is, the initial directory
      * for the query or an empty string if its a global search" */
     QString includeFolder() const;
+    /** @return whether the query includes search in file content */
+    bool hasContentSearch() const;
+    /** @return whether the query includes a filter by fileName */
+    bool hasFileName() const;
+
+private:
+    /** Calls Baloo::Query::fromSearchUrl() on the current searchUrl
+     * and parses the result to extract its separate components */
+    void parseBalooQuery();
 
 private:
     QUrl m_searchUrl;
@@ -55,6 +52,8 @@ private:
     QString m_fileType;
     QStringList m_searchTerms;
     QString m_includeFolder;
+    bool m_hasContentSearch = false;
+    bool m_hasFileName = false;
 };
 
 #endif //DOLPHINQUERY_H