┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/panels
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2011-04-20 20:03:51 +0200
committerPeter Penz <[email protected]>2011-04-20 20:09:08 +0200
commitae488b13186a4cb5d0bc5d7f23b07467d6638979 (patch)
treed50e891437d11d2e77ae5acafb9699bfcebe2102 /src/panels
parentf551f73ae65c1901c86bbf7d130552c4540f427f (diff)
Improve usability of Search Panel
If the Search Panel is shown outside the context of the "Find" mode it will be always enabled and does a global search. Only if the user is in the "Find" mode and the searching is restricted to the current directory the Search Panel might get disabled if the current directory is not indexed. This solves the major usability issue that it was not clear for the users whether a global or restricted search is done.
Diffstat (limited to 'src/panels')
-rw-r--r--src/panels/search/searchpanel.cpp22
-rw-r--r--src/panels/search/searchpanel.h10
2 files changed, 23 insertions, 9 deletions
diff --git a/src/panels/search/searchpanel.cpp b/src/panels/search/searchpanel.cpp
index 38c78aacb..a7226154b 100644
--- a/src/panels/search/searchpanel.cpp
+++ b/src/panels/search/searchpanel.cpp
@@ -66,6 +66,9 @@ SearchPanel::~SearchPanel()
void SearchPanel::setSearchMode(SearchMode mode)
{
m_searchMode = mode;
+ if (isVisible()) {
+ setEnabled(isFilteringPossible());
+ }
}
SearchPanel::SearchMode SearchPanel::searchMode() const
@@ -104,9 +107,7 @@ bool SearchPanel::urlChanged()
setQuery(Nepomuk::Query::Query());
}
- const DolphinSearchInformation& searchInfo = DolphinSearchInformation::instance();
- setEnabled(searchInfo.isIndexingEnabled() &&
- searchInfo.isPathIndexed(m_startedFromDir));
+ setEnabled(isFilteringPossible());
}
return true;
@@ -167,9 +168,7 @@ void SearchPanel::showEvent(QShowEvent* event)
m_initialized = true;
}
- const DolphinSearchInformation& searchInfo = DolphinSearchInformation::instance();
- setEnabled(searchInfo.isIndexingEnabled() &&
- searchInfo.isPathIndexed(url()));
+ setEnabled(isFilteringPossible());
Panel::showEvent(event);
}
@@ -190,9 +189,7 @@ void SearchPanel::slotSetUrlStatFinished(KJob* job)
{
m_lastSetUrlStatJob = 0;
- const DolphinSearchInformation& searchInfo = DolphinSearchInformation::instance();
- setEnabled(searchInfo.isIndexingEnabled() &&
- searchInfo.isPathIndexed(m_startedFromDir));
+ setEnabled(isFilteringPossible());
const KIO::UDSEntry uds = static_cast<KIO::StatJob*>(job)->statResult();
const QString nepomukQueryStr = uds.stringValue(KIO::UDSEntry::UDS_NEPOMUK_QUERY);
@@ -260,3 +257,10 @@ void SearchPanel::setQuery(const Nepomuk::Query::Query& query)
m_facetWidget->setClientQuery(query);
m_facetWidget->blockSignals(block);
}
+
+bool SearchPanel::isFilteringPossible() const
+{
+ const DolphinSearchInformation& searchInfo = DolphinSearchInformation::instance();
+ return searchInfo.isIndexingEnabled()
+ && ((m_searchMode == Everywhere) || searchInfo.isPathIndexed(m_startedFromDir));
+}
diff --git a/src/panels/search/searchpanel.h b/src/panels/search/searchpanel.h
index 700cfc84a..b92b692aa 100644
--- a/src/panels/search/searchpanel.h
+++ b/src/panels/search/searchpanel.h
@@ -79,6 +79,16 @@ private slots:
private:
void setQuery(const Nepomuk::Query::Query& query);
+ /**
+ * @return True if the facets can be applied to the given URL
+ * and hence a filtering of the content is possible.
+ * False is returned if the search-mode is set to
+ * SearchMode::FromCurrentDir and this directory is
+ * not indexed at all. Also if indexing is disabled
+ * false will be returned.
+ */
+ bool isFilteringPossible() const;
+
private:
bool m_initialized;
SearchMode m_searchMode;