diff options
| author | Peter Penz <[email protected]> | 2011-02-02 19:36:08 +0100 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2011-02-02 19:36:08 +0100 |
| commit | 7045a25e3abaedab0d128f03702eaf48ffe6e0b7 (patch) | |
| tree | 66a3deaa0c15c353895f5d42301bd27b2241f7b5 /src/panels | |
| parent | 28f00f36d74572510aee58111f1a9f884e148f6b (diff) | |
Fix visibility- and enabled-issues for the filter-panel
The filter-panel should be disabled if the current folder is not indexed at all. Also when triggering a "Find" the filter-panel should stay invisible per default when the current folder is not indexed.
CCBUG: 264969
Diffstat (limited to 'src/panels')
| -rw-r--r-- | src/panels/filter/filterpanel.cpp | 27 | ||||
| -rw-r--r-- | src/panels/filter/filterpanel.h | 4 |
2 files changed, 24 insertions, 7 deletions
diff --git a/src/panels/filter/filterpanel.cpp b/src/panels/filter/filterpanel.cpp index 453c12729..97389e08f 100644 --- a/src/panels/filter/filterpanel.cpp +++ b/src/panels/filter/filterpanel.cpp @@ -36,6 +36,8 @@ #include <Nepomuk/Vocabulary/NMM> #include <Nepomuk/Vocabulary/NIE> +#include <search/dolphinsearchinformation.h> + #include <kfileitem.h> #include <kio/jobclasses.h> #include <kio/job.h> @@ -49,12 +51,12 @@ FilterPanel::FilterPanel(QWidget* parent) : Panel(parent), m_initialized(false), - m_nepomukEnabled(false), m_lastSetUrlStatJob(0), m_startedFromDir(), m_facetWidget(0), m_unfacetedRestQuery() { + setEnabled(false); } FilterPanel::~FilterPanel() @@ -70,7 +72,7 @@ bool FilterPanel::urlChanged() m_startedFromDir = url(); } - if (isVisible() && m_nepomukEnabled) { + if (isVisible() && DolphinSearchInformation::instance().isIndexingEnabled()) { setQuery(Nepomuk::Query::Query()); delete m_lastSetUrlStatJob; @@ -140,15 +142,25 @@ void FilterPanel::showEvent(QShowEvent* event) connect(m_facetWidget, SIGNAL(queryTermChanged(Nepomuk::Query::Term)), this, SLOT(slotQueryTermChanged(Nepomuk::Query::Term))); - m_nepomukEnabled = (Nepomuk::ResourceManager::instance()->init() == 0); - m_facetWidget->setEnabled(m_nepomukEnabled); - m_initialized = true; } + const DolphinSearchInformation& searchInfo = DolphinSearchInformation::instance(); + setEnabled(searchInfo.isIndexingEnabled() && + searchInfo.isPathIndexed(m_startedFromDir)); + Panel::showEvent(event); } +void FilterPanel::hideEvent(QHideEvent* event) +{ + if (!event->spontaneous()) { + setEnabled(false); + } + + Panel::hideEvent(event); +} + void FilterPanel::contextMenuEvent(QContextMenuEvent* event) { Panel::contextMenuEvent(event); @@ -218,7 +230,10 @@ void FilterPanel::setQuery(const Nepomuk::Query::Query& query) m_unfacetedRestQuery = m_facetWidget->extractFacetsFromQuery(query); m_facetWidget->setClientQuery(query); - setEnabled(true); + + const DolphinSearchInformation& searchInfo = DolphinSearchInformation::instance(); + setEnabled(searchInfo.isIndexingEnabled() && + searchInfo.isPathIndexed(m_startedFromDir)); m_facetWidget->blockSignals(block); } else { diff --git a/src/panels/filter/filterpanel.h b/src/panels/filter/filterpanel.h index 20d4e9cbf..8ccc62d63 100644 --- a/src/panels/filter/filterpanel.h +++ b/src/panels/filter/filterpanel.h @@ -52,6 +52,9 @@ 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); @@ -64,7 +67,6 @@ private: private: bool m_initialized; - bool m_nepomukEnabled; KJob* m_lastSetUrlStatJob; KUrl m_startedFromDir; |
