diff options
Diffstat (limited to 'src/search')
| -rw-r--r-- | src/search/dolphinsearchbox.cpp | 17 | ||||
| -rw-r--r-- | src/search/dolphinsearchbox.h | 22 |
2 files changed, 38 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(); diff --git a/src/search/dolphinsearchbox.h b/src/search/dolphinsearchbox.h index cb4806292..27561481d 100644 --- a/src/search/dolphinsearchbox.h +++ b/src/search/dolphinsearchbox.h @@ -46,6 +46,16 @@ class DolphinSearchBox : public QWidget { Q_OBJECT public: + enum SearchContext { + SearchFileName, + SearchContent + }; + + enum SearchLocation { + SearchFromHere, + SearchEverywhere + }; + explicit DolphinSearchBox(QWidget* parent = 0); virtual ~DolphinSearchBox(); @@ -106,12 +116,24 @@ signals: void returnPressed(const QString& text); /** + * Is emitted if the search location has been changed by the user. + */ + void searchLocationChanged(SearchLocation location); + + /** + * Is emitted if the search context has been changed by the user. + */ + void searchContextChanged(SearchContext context); + + /** * Emitted as soon as the search box should get closed. */ void closeRequest(); private slots: void emitSearchSignal(); + void slotSearchLocationChanged(); + void slotSearchContextChanged(); void slotConfigurationChanged(); void slotSearchTextChanged(const QString& text); void slotReturnPressed(const QString& text); |
