diff options
| author | Elvis Angelaccio <[email protected]> | 2019-11-28 22:36:44 +0100 |
|---|---|---|
| committer | Elvis Angelaccio <[email protected]> | 2019-11-28 22:36:44 +0100 |
| commit | 26f0e55f84b4a745d3b5e47d8703406d13107d30 (patch) | |
| tree | e1aeb8e2142f88acede9c793d65bc3f16cf846de /src | |
| parent | fc4fd11c4dc7d5ca362a2241a69a18eaf8f65787 (diff) | |
| parent | 6776fbc94760188daeca0ab30e49f645f225f008 (diff) | |
Merge branch 'release/19.12'
Diffstat (limited to 'src')
| -rw-r--r-- | src/dolphinmainwindow.cpp | 1 | ||||
| -rw-r--r-- | src/global.cpp | 2 | ||||
| -rw-r--r-- | src/search/dolphinquery.cpp | 26 | ||||
| -rw-r--r-- | src/tests/dolphinquerytest.cpp | 18 |
4 files changed, 24 insertions, 23 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index e615fbab8..54cd1f0ef 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -1959,6 +1959,7 @@ void DolphinMainWindow::createControlButton() Q_ASSERT(!m_controlButton); m_controlButton = new QToolButton(this); + m_controlButton->setAccessibleName(i18nc("@action:intoolbar", "Control")); m_controlButton->setIcon(QIcon::fromTheme(QStringLiteral("application-menu"))); m_controlButton->setToolTip(i18nc("@action", "Show menu")); m_controlButton->setAttribute(Qt::WidgetAttribute::WA_CustomWhatsThis); diff --git a/src/global.cpp b/src/global.cpp index 48e78e9ea..3b81c536a 100644 --- a/src/global.cpp +++ b/src/global.cpp @@ -82,7 +82,7 @@ bool Dolphin::attachToExistingInstance(const QList<QUrl>& inputUrls, bool openFi QSharedPointer<QDBusInterface> preferred( new QDBusInterface(preferredService, QStringLiteral("/dolphin/Dolphin_1"), - QStringLiteral("org.kde.dolphin.MainWindow")) + QString()) // #414402: use empty interface name to prevent QtDBus from caching the interface. ); if (preferred->isValid() && !preferred->lastError().isValid()) { dolphinServices.append(qMakePair(preferred, QStringList())); diff --git a/src/search/dolphinquery.cpp b/src/search/dolphinquery.cpp index 09a841859..8f8cb09ec 100644 --- a/src/search/dolphinquery.cpp +++ b/src/search/dolphinquery.cpp @@ -54,20 +54,38 @@ DolphinQuery DolphinQuery::fromBalooSearchUrl(const QUrl& searchUrl) model.m_includeFolder = query.includeFolder(); - model.m_searchText = query.searchString(); - const QStringList types = query.types(); model.m_fileType = types.isEmpty() ? QString() : types.first(); + QStringList textParts; + const QStringList subTerms = query.searchString().split(' ', QString::SkipEmptyParts); foreach (const QString& subTerm, subTerms) { + QString value; if (subTerm.startsWith(QLatin1String("filename:"))) { - const QString value = subTerm.mid(9); - model.m_searchText = value; + value = subTerm.mid(9); } else if (isSearchTerm(subTerm)) { model.m_searchTerms << subTerm; + continue; + } else if (subTerm == QLatin1String("AND") && subTerm != subTerms.at(0) && subTerm != subTerms.back()) { + continue; + } else { + value = subTerm; + } + + if (!value.isEmpty() && value.at(0) == QLatin1Char('"')) { + value = value.mid(1); + } + if (!value.isEmpty() && value.back() == QLatin1Char('"')) { + value = value.mid(0, value.size() - 1); + } + if (!value.isEmpty()) { + textParts << value; } } + + model.m_searchText = textParts.join(QLatin1Char(' ')); + #endif return model; } diff --git a/src/tests/dolphinquerytest.cpp b/src/tests/dolphinquerytest.cpp index 14eb03620..1c6b39e26 100644 --- a/src/tests/dolphinquerytest.cpp +++ b/src/tests/dolphinquerytest.cpp @@ -114,24 +114,6 @@ void DolphinSearchBoxTest::testBalooSearchParsing() QStringList searchTerms = query.searchTerms(); searchTerms.sort(); - // FIXME: Current parsing bugs - QEXPECT_FAIL("content/singleQuote", "Quotes around text are shown", Continue); - QEXPECT_FAIL("content/doubleQuote", "Quotes around text are shown", Continue); - - QEXPECT_FAIL("filename", "Quotes around text are shown", Continue); - QEXPECT_FAIL("filename/singleQuote", "Quotes around text are shown", Continue); - QEXPECT_FAIL("filename/doubleQuote", "Quotes around text are shown", Continue); - - QEXPECT_FAIL("rating" , "Text includes also search terms", Continue); - QEXPECT_FAIL("rating+content" , "Text includes also search terms", Continue); - QEXPECT_FAIL("rating+filename" , "Text includes also search terms", Continue); - QEXPECT_FAIL("modified" , "Text includes also search terms", Continue); - QEXPECT_FAIL("modified+content" , "Text includes also search terms", Continue); - QEXPECT_FAIL("modified+filename" , "Text includes also search terms", Continue); - QEXPECT_FAIL("rating+modified" , "Text includes also search terms", Continue); - QEXPECT_FAIL("rating+modified+content" , "Text includes also search terms", Continue); - QEXPECT_FAIL("rating+modified+filename", "Text includes also search terms", Continue); - // Check for parsed text (would be displayed on the input search bar) QCOMPARE(query.text(), expectedText); |
