From b9de2cf96f747952366da2ebc9389c1fdc238a5f Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Thu, 10 Mar 2011 23:48:43 +0100 Subject: [PATCH] Fix enabled/disabled issue for the Search Panel --- src/panels/search/searchpanel.cpp | 24 +++++++++--------------- 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); -- 2.47.3