diff options
| author | Peter Penz <[email protected]> | 2011-04-20 20:03:51 +0200 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2011-04-20 20:09:08 +0200 |
| commit | ae488b13186a4cb5d0bc5d7f23b07467d6638979 (patch) | |
| tree | d50e891437d11d2e77ae5acafb9699bfcebe2102 /src/panels/search/searchpanel.cpp | |
| parent | f551f73ae65c1901c86bbf7d130552c4540f427f (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/search/searchpanel.cpp')
| -rw-r--r-- | src/panels/search/searchpanel.cpp | 22 |
1 files changed, 13 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)); +} |
