diff options
| author | Peter Penz <[email protected]> | 2011-03-10 23:48:43 +0100 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2011-03-10 23:49:39 +0100 |
| commit | b9de2cf96f747952366da2ebc9389c1fdc238a5f (patch) | |
| tree | 9167bd1f74a2886dfc259f4aa52603d30849a5d9 /src/panels | |
| parent | 65b23942242ab0bba5deaa66af4114f1dc8cf2c7 (diff) | |
Fix enabled/disabled issue for the Search Panel
Diffstat (limited to 'src/panels')
| -rw-r--r-- | src/panels/search/searchpanel.cpp | 24 | ||||
| -rw-r--r-- | src/panels/search/searchpanel.h | 3 |
2 files changed, 9 insertions, 18 deletions
diff --git a/src/panels/search/searchpanel.cpp b/src/panels/search/searchpanel.cpp index 21057f388..4fb78c581 100644 --- a/src/panels/search/searchpanel.cpp +++ b/src/panels/search/searchpanel.cpp @@ -81,13 +81,9 @@ bool SearchPanel::urlChanged() // This is required to restore the directory in case that all facets // have been reset by the user (see slotQueryTermChanged()). m_startedFromDir = url(); - - const DolphinSearchInformation& searchInfo = DolphinSearchInformation::instance(); - setEnabled(searchInfo.isIndexingEnabled() && - searchInfo.isPathIndexed(m_startedFromDir)); } - if (isVisible() && DolphinSearchInformation::instance().isIndexingEnabled()) { + if (isVisible() && DolphinSearchInformation::instance().isIndexingEnabled()) { const Nepomuk::Query::FileQuery query(m_unfacetedRestQuery && m_facetWidget->queryTerm()); if (query.toSearchUrl() == url()) { // The new URL has been triggered by the SearchPanel itself in @@ -103,11 +99,14 @@ bool SearchPanel::urlChanged() m_lastSetUrlStatJob = KIO::stat(url(), KIO::HideProgressInfo); connect(m_lastSetUrlStatJob, SIGNAL(result(KJob*)), this, SLOT(slotSetUrlStatFinished(KJob*))); - setEnabled(false); } else { // Reset the search panel because a "normal" directory is shown. setQuery(Nepomuk::Query::Query()); } + + const DolphinSearchInformation& searchInfo = DolphinSearchInformation::instance(); + setEnabled(searchInfo.isIndexingEnabled() && + searchInfo.isPathIndexed(m_startedFromDir)); } return true; @@ -168,16 +167,11 @@ void SearchPanel::showEvent(QShowEvent* event) m_initialized = true; } - Panel::showEvent(event); -} - -void SearchPanel::hideEvent(QHideEvent* event) -{ - if (!event->spontaneous()) { - setEnabled(false); - } + const DolphinSearchInformation& searchInfo = DolphinSearchInformation::instance(); + setEnabled(searchInfo.isIndexingEnabled() && + searchInfo.isPathIndexed(url())); - Panel::hideEvent(event); + Panel::showEvent(event); } void SearchPanel::contextMenuEvent(QContextMenuEvent* event) diff --git a/src/panels/search/searchpanel.h b/src/panels/search/searchpanel.h index 9404b4f8c..700cfc84a 100644 --- a/src/panels/search/searchpanel.h +++ b/src/panels/search/searchpanel.h @@ -69,9 +69,6 @@ protected: /** @see QWidget::showEvent() */ virtual void showEvent(QShowEvent* event); - /** @see QWidget::hideEvent() */ - virtual void hideEvent(QHideEvent* event); - /** @see QWidget::contextMenuEvent() */ virtual void contextMenuEvent(QContextMenuEvent* event); |
