connect(m_searchInput, SIGNAL(returnPressed()),
this, SLOT(emitSearchSignal()));
connect(m_searchInput, SIGNAL(textChanged(QString)),
- this, SIGNAL(searchTextChanged(QString)));
+ this, SLOT(slotTextChanged(QString)));
+ connect(m_searchInput, SIGNAL(clearButtonClicked()),
+ this, SLOT(slotClearButtonClicked()));
}
DolphinSearchBox::~DolphinSearchBox()
if (m_completer == 0) {
m_completer = new DolphinSearchCompleter(m_searchInput);
}
- emit requestSearchOptions();
+ if (m_searchInput->text().isEmpty()) {
+ emit requestSearchOptions();
+ }
}
return QWidget::eventFilter(watched, event);
emit search(m_searchInput->text());
}
+void DolphinSearchBox::slotTextChanged(const QString& text)
+{
+ if (!text.isEmpty()) {
+ emit requestSearchOptions();
+ }
+ emit searchTextChanged(text);
+}
+
#include "dolphinsearchbox.moc"
void searchTextChanged(const QString& text);
/**
- * Is emitted if the search box gets the focus and
- * requests the need for a UI that allows to adjust
- * search options. It is up to the application to ignore
+ * Is emitted if the search box gets the focus or the text
+ * has been changed. It requests the need for an UI that allows to
+ * adjust search options. It is up to the application to ignore
* this request.
*/
void requestSearchOptions();
private slots:
void emitSearchSignal();
+ void slotTextChanged(const QString& text);
private:
KLineEdit* m_searchInput;