diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/dolphinmainwindow.h | 2 | ||||
| -rw-r--r-- | src/search/dolphinquery.cpp | 13 | ||||
| -rw-r--r-- | src/settings/dolphinsettingsdialog.h | 2 | ||||
| -rw-r--r-- | src/settings/kcm/kcmdolphingeneral.h | 2 | ||||
| -rw-r--r-- | src/settings/kcm/kcmdolphinnavigation.desktop | 2 | ||||
| -rw-r--r-- | src/settings/kcm/kcmdolphinnavigation.h | 2 | ||||
| -rw-r--r-- | src/settings/kcm/kcmdolphinservices.h | 2 | ||||
| -rw-r--r-- | src/settings/kcm/kcmdolphinviewmodes.h | 2 | ||||
| -rw-r--r-- | src/settings/services/servicessettingspage.cpp | 2 | ||||
| -rw-r--r-- | src/tests/dolphinquerytest.cpp | 9 |
10 files changed, 30 insertions, 8 deletions
diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h index dcd73c6a7..9c36c98b2 100644 --- a/src/dolphinmainwindow.h +++ b/src/dolphinmainwindow.h @@ -25,7 +25,7 @@ #include "dolphintabwidget.h" #include <config-baloo.h> #include <kio/fileundomanager.h> -#include <ksortablelist.h> +#include <KSortableList> #include <kxmlguiwindow.h> #include <QIcon> diff --git a/src/search/dolphinquery.cpp b/src/search/dolphinquery.cpp index 663ed9909..4b5499378 100644 --- a/src/search/dolphinquery.cpp +++ b/src/search/dolphinquery.cpp @@ -73,6 +73,14 @@ namespace { return textParts; } #endif + + QString trimChar(const QString& text, const QLatin1Char aChar) + { + const int start = text.startsWith(aChar) ? 1 : 0; + const int end = (text.length() > 1 && text.endsWith(aChar)) ? 1 : 0; + + return text.mid(start, text.length() - start - end); + } } @@ -83,6 +91,10 @@ DolphinQuery DolphinQuery::fromSearchUrl(const QUrl& searchUrl) if (searchUrl.scheme() == QLatin1String("baloosearch")) { model.parseBalooQuery(); + } else if (searchUrl.scheme() == QLatin1String("tags")) { + // tags can contain # symbols or slashes within the Url + QString tag = trimChar(searchUrl.toString(QUrl::RemoveScheme), QLatin1Char('/')); + model.m_searchTerms << QStringLiteral("tag:%1").arg(tag); } return model; @@ -92,6 +104,7 @@ bool DolphinQuery::supportsScheme(const QString& urlScheme) { static const QStringList supportedSchemes = { QStringLiteral("baloosearch"), + QStringLiteral("tags"), }; return supportedSchemes.contains(urlScheme); diff --git a/src/settings/dolphinsettingsdialog.h b/src/settings/dolphinsettingsdialog.h index 85871b12d..a730cc215 100644 --- a/src/settings/dolphinsettingsdialog.h +++ b/src/settings/dolphinsettingsdialog.h @@ -21,7 +21,7 @@ #ifndef DOLPHINSETTINGSDIALOG_H #define DOLPHINSETTINGSDIALOG_H -#include <kpagedialog.h> +#include <KPageDialog> class QUrl; class SettingsPageBase; diff --git a/src/settings/kcm/kcmdolphingeneral.h b/src/settings/kcm/kcmdolphingeneral.h index 2b60c7591..fe5631606 100644 --- a/src/settings/kcm/kcmdolphingeneral.h +++ b/src/settings/kcm/kcmdolphingeneral.h @@ -20,7 +20,7 @@ #ifndef KCMDOLPHINGENERAL_H #define KCMDOLPHINGENERAL_H -#include <kcmodule.h> +#include <KCModule> #include <QList> diff --git a/src/settings/kcm/kcmdolphinnavigation.desktop b/src/settings/kcm/kcmdolphinnavigation.desktop index fd649b548..62e8ca040 100644 --- a/src/settings/kcm/kcmdolphinnavigation.desktop +++ b/src/settings/kcm/kcmdolphinnavigation.desktop @@ -105,7 +105,7 @@ X-DocPath=dolphin/index.html#preferences-dialog-navigation Name=Navigation Name[ar]=التّنقّل Name[ast]=Navegación -Name[az]=Naviqasiy +Name[az]=Naviqasiya Name[ca]=Navegació Name[ca@valencia]=Navegació Name[cs]=Navigace diff --git a/src/settings/kcm/kcmdolphinnavigation.h b/src/settings/kcm/kcmdolphinnavigation.h index 7eb6b26e7..3c8d61513 100644 --- a/src/settings/kcm/kcmdolphinnavigation.h +++ b/src/settings/kcm/kcmdolphinnavigation.h @@ -20,7 +20,7 @@ #ifndef KCMDOLPHINNAVIGATION_H #define KCMDOLPHINNAVIGATION_H -#include <kcmodule.h> +#include <KCModule> class NavigationSettingsPage; diff --git a/src/settings/kcm/kcmdolphinservices.h b/src/settings/kcm/kcmdolphinservices.h index a567450ca..c7ad24605 100644 --- a/src/settings/kcm/kcmdolphinservices.h +++ b/src/settings/kcm/kcmdolphinservices.h @@ -20,7 +20,7 @@ #ifndef KCMDOLPHINSERVICES_H #define KCMDOLPHINSERVICES_H -#include <kcmodule.h> +#include <KCModule> class ServicesSettingsPage; diff --git a/src/settings/kcm/kcmdolphinviewmodes.h b/src/settings/kcm/kcmdolphinviewmodes.h index 40965b0e6..a5d01e084 100644 --- a/src/settings/kcm/kcmdolphinviewmodes.h +++ b/src/settings/kcm/kcmdolphinviewmodes.h @@ -20,7 +20,7 @@ #ifndef KCMDOLPHINVIEWMODES_H #define KCMDOLPHINVIEWMODES_H -#include <kcmodule.h> +#include <KCModule> class ViewSettingsTab; diff --git a/src/settings/services/servicessettingspage.cpp b/src/settings/services/servicessettingspage.cpp index e18bfb09e..b1a59e0f4 100644 --- a/src/settings/services/servicessettingspage.cpp +++ b/src/settings/services/servicessettingspage.cpp @@ -31,7 +31,7 @@ #include <KPluginMetaData> #include <KService> #include <KServiceTypeTrader> -#include <kdesktopfileactions.h> +#include <KDesktopFileActions> #include <QGridLayout> #include <QLabel> diff --git a/src/tests/dolphinquerytest.cpp b/src/tests/dolphinquerytest.cpp index 25bd26b81..9e1c76737 100644 --- a/src/tests/dolphinquerytest.cpp +++ b/src/tests/dolphinquerytest.cpp @@ -150,6 +150,15 @@ void DolphinSearchBoxTest::testBalooSearchParsing_data() QTest::newRow("allTerms/space") << balooQueryUrl(textS + " " + filenameS + " " + rating + " AND " + modified + " AND " + tagS) << textS + " " + filenameS << QStringList({modified, rating, tagR}) << true << true; + + // Test tags:/ URL scheme + const auto tagUrl = [](const QString &tag) { return QUrl(QStringLiteral("tags:/%1/").arg(tag)); }; + const auto tagTerms = [](const QString &tag) { return QStringList{QStringLiteral("tag:%1").arg(tag)}; }; + + QTest::newRow("tagsUrl") << tagUrl("tagA") << "" << tagTerms("tagA") << false << false; + QTest::newRow("tagsUrl/space") << tagUrl("tagB with spaces") << "" << tagTerms("tagB with spaces") << false << false; + QTest::newRow("tagsUrl/hash") << tagUrl("tagC#hash") << "" << tagTerms("tagC#hash") << false << false; + QTest::newRow("tagsUrl/slash") << tagUrl("tagD/with/slash") << "" << tagTerms("tagD/with/slash") << false << false; } /** |
