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/search/dolphinsearchbox.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/search/dolphinsearchbox.cpp')
| -rw-r--r-- | src/search/dolphinsearchbox.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/search/dolphinsearchbox.cpp b/src/search/dolphinsearchbox.cpp index eb1b8dff8..c4270d383 100644 --- a/src/search/dolphinsearchbox.cpp +++ b/src/search/dolphinsearchbox.cpp @@ -196,8 +196,19 @@ void DolphinSearchBox::emitSearchSignal() emit search(m_searchInput->text()); } +void DolphinSearchBox::slotSearchLocationChanged() +{ + emit searchLocationChanged(m_fromHereButton->isChecked() ? SearchFromHere : SearchEverywhere); +} + +void DolphinSearchBox::slotSearchContextChanged() +{ + emit searchContextChanged(m_fileNameButton->isChecked() ? SearchFileName : SearchContent); +} + void DolphinSearchBox::slotConfigurationChanged() { + saveSettings(); if (m_startedSearching) { emitSearchSignal(); } @@ -220,7 +231,7 @@ void DolphinSearchBox::initButton(QPushButton* button) button->setAutoExclusive(true); button->setFlat(true); button->setCheckable(true); - connect(button, SIGNAL(toggled(bool)), this, SLOT(slotConfigurationChanged())); + connect(button, SIGNAL(clicked(bool)), this, SLOT(slotConfigurationChanged())); } void DolphinSearchBox::loadSettings() @@ -290,6 +301,8 @@ void DolphinSearchBox::init() QButtonGroup* searchWhatGroup = new QButtonGroup(this); searchWhatGroup->addButton(m_fileNameButton); searchWhatGroup->addButton(m_contentButton); + connect(m_fileNameButton, SIGNAL(clicked()), this, SLOT(slotSearchContextChanged())); + connect(m_contentButton, SIGNAL(clicked()), this, SLOT(slotSearchContextChanged())); m_separator = new KSeparator(Qt::Vertical, this); @@ -305,6 +318,8 @@ void DolphinSearchBox::init() QButtonGroup* searchLocationGroup = new QButtonGroup(this); searchLocationGroup->addButton(m_fromHereButton); searchLocationGroup->addButton(m_everywhereButton); + connect(m_fromHereButton, SIGNAL(clicked()), this, SLOT(slotSearchLocationChanged())); + connect(m_everywhereButton, SIGNAL(clicked()), this, SLOT(slotSearchLocationChanged())); // Apply layout for the options QHBoxLayout* optionsLayout = new QHBoxLayout(); |
