┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/search/dolphinsearchbox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/search/dolphinsearchbox.cpp')
-rw-r--r--src/search/dolphinsearchbox.cpp33
1 files changed, 21 insertions, 12 deletions
diff --git a/src/search/dolphinsearchbox.cpp b/src/search/dolphinsearchbox.cpp
index 23f520de1..f0d8c5416 100644
--- a/src/search/dolphinsearchbox.cpp
+++ b/src/search/dolphinsearchbox.cpp
@@ -136,6 +136,7 @@ QUrl DolphinSearchBox::urlForSearching() const
}
query.addQueryItem(QStringLiteral("url"), searchPath().url());
+ query.addQueryItem(QStringLiteral("title"), queryTitle(m_searchInput->text()));
url.setQuery(query);
}
@@ -219,6 +220,9 @@ void DolphinSearchBox::keyReleaseEvent(QKeyEvent* event)
m_searchInput->clear();
}
}
+ else if (event->key() == Qt::Key_Down) {
+ emit focusViewRequest();
+ }
}
bool DolphinSearchBox::eventFilter(QObject* obj, QEvent* event)
@@ -283,7 +287,7 @@ void DolphinSearchBox::slotSearchTextChanged(const QString& text)
void DolphinSearchBox::slotReturnPressed()
{
emitSearchRequest();
- emit returnPressed();
+ emit focusViewRequest();
}
void DolphinSearchBox::slotFacetChanged()
@@ -340,13 +344,6 @@ void DolphinSearchBox::saveSettings()
void DolphinSearchBox::init()
{
- // Create close button
- QToolButton* closeButton = new QToolButton(this);
- closeButton->setAutoRaise(true);
- closeButton->setIcon(QIcon::fromTheme(QStringLiteral("dialog-close")));
- closeButton->setToolTip(i18nc("@info:tooltip", "Quit searching"));
- connect(closeButton, &QToolButton::clicked, this, &DolphinSearchBox::emitCloseRequest);
-
// Create search box
m_searchInput = new QLineEdit(this);
m_searchInput->setPlaceholderText(i18n("Search..."));
@@ -367,11 +364,18 @@ void DolphinSearchBox::init()
m_searchInput->addAction(m_saveSearchAction, QLineEdit::TrailingPosition);
connect(m_saveSearchAction, &QAction::triggered, this, &DolphinSearchBox::slotSearchSaved);
+ // Create close button
+ QToolButton* closeButton = new QToolButton(this);
+ closeButton->setAutoRaise(true);
+ closeButton->setIcon(QIcon::fromTheme(QStringLiteral("dialog-close")));
+ closeButton->setToolTip(i18nc("@info:tooltip", "Quit searching"));
+ connect(closeButton, &QToolButton::clicked, this, &DolphinSearchBox::emitCloseRequest);
+
// Apply layout for the search input
QHBoxLayout* searchInputLayout = new QHBoxLayout();
searchInputLayout->setContentsMargins(0, 0, 0, 0);
- searchInputLayout->addWidget(closeButton);
searchInputLayout->addWidget(m_searchInput);
+ searchInputLayout->addWidget(closeButton);
// Create "Filename" and "Content" button
m_fileNameButton = new QToolButton(this);
@@ -469,6 +473,12 @@ void DolphinSearchBox::init()
connect(m_startSearchTimer, &QTimer::timeout, this, &DolphinSearchBox::emitSearchRequest);
}
+QString DolphinSearchBox::queryTitle(const QString& text) const
+{
+ return i18nc("@title UDS_DISPLAY_NAME for a KIO directory listing. %1 is the query the user entered.",
+ "Query Results from '%1'", text);
+}
+
QUrl DolphinSearchBox::balooUrlForSearching() const
{
#ifdef HAVE_BALOO
@@ -491,8 +501,7 @@ QUrl DolphinSearchBox::balooUrlForSearching() const
query.setSearchString(queryStrings.join(QLatin1Char(' ')));
- return query.toSearchUrl(i18nc("@title UDS_DISPLAY_NAME for a KIO directory listing. %1 is the query the user entered.",
- "Query Results from '%1'", text));
+ return query.toSearchUrl(queryTitle(text));
#else
return QUrl();
#endif
@@ -541,7 +550,7 @@ bool DolphinSearchBox::isIndexingEnabled() const
{
#ifdef HAVE_BALOO
const Baloo::IndexerConfig searchInfo;
- return searchInfo.fileIndexingEnabled() && searchInfo.shouldBeIndexed(searchPath().toLocalFile());
+ return searchInfo.fileIndexingEnabled() && !searchPath().isEmpty() && searchInfo.shouldBeIndexed(searchPath().toLocalFile());
#else
return false;
#endif