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/dolphinmainwindow.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/dolphinmainwindow.cpp')
| -rw-r--r-- | src/dolphinmainwindow.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 07a3bc153..ed6d0f196 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -35,6 +35,7 @@ #include "panels/folders/folderspanel.h" #include "panels/places/placespanel.h" #include "panels/information/informationpanel.h" +#include "search/dolphinsearchbox.h" #include "search/dolphinsearchinformation.h" #include "settings/dolphinsettings.h" #include "settings/dolphinsettingsdialog.h" @@ -821,6 +822,21 @@ void DolphinMainWindow::find() m_activeViewContainer->setSearchModeEnabled(true); } +void DolphinMainWindow::slotSearchLocationChanged() +{ + QDockWidget* searchDock = findChild<QDockWidget*>("searchDock"); + if (!searchDock) { + return; + } + + SearchPanel* searchPanel = qobject_cast<SearchPanel*>(searchDock->widget()); + if (searchPanel) { + searchPanel->setSearchMode(SearchSettings::location() == QLatin1String("FromHere") + ? SearchPanel::FromCurrentDir + : SearchPanel::Everywhere); + } +} + void DolphinMainWindow::updatePasteAction() { QAction* pasteAction = actionCollection()->action(KStandardAction::name(KStandardAction::Paste)); @@ -1307,9 +1323,8 @@ void DolphinMainWindow::slotWriteStateChanged(bool isFolderWritable) void DolphinMainWindow::slotSearchModeChanged(bool enabled) { #ifdef HAVE_NEPOMUK - const KUrl url = m_activeViewContainer->url(); const DolphinSearchInformation& searchInfo = DolphinSearchInformation::instance(); - if (!searchInfo.isIndexingEnabled() || !searchInfo.isPathIndexed(url)) { + if (!searchInfo.isIndexingEnabled()) { return; } @@ -2066,6 +2081,10 @@ void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container) connect(container, SIGNAL(searchModeChanged(bool)), this, SLOT(slotSearchModeChanged(bool))); + const DolphinSearchBox* searchBox = container->searchBox(); + connect(searchBox, SIGNAL(searchLocationChanged(SearchLocation)), + this, SLOT(slotSearchLocationChanged())); + DolphinView* view = container->view(); connect(view, SIGNAL(selectionChanged(KFileItemList)), this, SLOT(slotSelectionChanged(KFileItemList))); |
