]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/search/dolphinsearchbox.cpp
prevent a QFileInfo warning
[dolphin.git] / src / search / dolphinsearchbox.cpp
index 16f17bbcdd323c6e4b2dd3c153e2618fc0368dfc..52a495270615bebe6aa39f6079a289badcd8e3cd 100644 (file)
@@ -219,6 +219,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 +286,7 @@ void DolphinSearchBox::slotSearchTextChanged(const QString& text)
 void DolphinSearchBox::slotReturnPressed()
 {
     emitSearchRequest();
-    emit returnPressed();
+    emit focusViewRequest();
 }
 
 void DolphinSearchBox::slotFacetChanged()
@@ -477,11 +480,7 @@ QUrl DolphinSearchBox::balooUrlForSearching() const
     Baloo::Query query;
     query.addType(m_facetsWidget->facetType());
 
-    QStringList queryStrings;
-    QString ratingQuery = m_facetsWidget->ratingTerm();
-    if (!ratingQuery.isEmpty()) {
-        queryStrings << ratingQuery;
-    }
+    QStringList queryStrings = m_facetsWidget->searchTerms();
 
     if (m_contentButton->isChecked()) {
         queryStrings << text;
@@ -517,11 +516,17 @@ void DolphinSearchBox::updateFromQuery(const DolphinQuery& query)
 
     setText(query.text());
 
-    m_facetsWidget->resetOptions();
+    if (query.hasContentSearch()) {
+        m_contentButton->setChecked(true);
+    } else if (query.hasFileName())  {
+        m_fileNameButton->setChecked(true);
+    }
+
+    m_facetsWidget->resetSearchTerms();
     m_facetsWidget->setFacetType(query.type());
     const QStringList searchTerms = query.searchTerms();
     for (const QString& searchTerm : searchTerms) {
-        m_facetsWidget->setRatingTerm(searchTerm);
+        m_facetsWidget->setSearchTerm(searchTerm);
     }
 
     m_startSearchTimer->stop();
@@ -539,7 +544,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