]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Don't show the search options again, if the user closed them and cleared the search...
authorPeter Penz <peter.penz19@gmail.com>
Tue, 26 Jan 2010 09:01:38 +0000 (09:01 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Tue, 26 Jan 2010 09:01:38 +0000 (09:01 +0000)
BUG: 218880

svn path=/trunk/KDE/kdebase/apps/; revision=1080372

src/search/dolphinsearchbox.cpp
src/search/dolphinsearchbox.h

index 1dcb381ddeea91f23f6f343842f891c902228c67..7eb7206acb850edfaccd2b50eeaa6e173093e75a 100644 (file)
@@ -251,7 +251,9 @@ DolphinSearchBox::DolphinSearchBox(QWidget* parent) :
     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()
@@ -284,7 +286,9 @@ bool DolphinSearchBox::eventFilter(QObject* watched, QEvent* event)
         if (m_completer == 0) {
             m_completer = new DolphinSearchCompleter(m_searchInput);
         }
-        emit requestSearchOptions();
+        if (m_searchInput->text().isEmpty()) {
+            emit requestSearchOptions();
+        }
     }
 
     return QWidget::eventFilter(watched, event);
@@ -296,4 +300,12 @@ void DolphinSearchBox::emitSearchSignal()
     emit search(m_searchInput->text());
 }
 
+void DolphinSearchBox::slotTextChanged(const QString& text)
+{
+    if (!text.isEmpty()) {
+        emit requestSearchOptions();
+    }
+    emit searchTextChanged(text);
+}
+
 #include "dolphinsearchbox.moc"
index ac5253d491080b1a7e845efdc4f1823b88f13b55..73e4936dfe641f2af37c233519b707b0b5980877 100644 (file)
@@ -94,15 +94,16 @@ signals:
     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;