]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinsearchbox.cpp
Fixed regression when refactoring the Information Panel: Don't forget to give a visua...
[dolphin.git] / src / dolphinsearchbox.cpp
index 438944362e6d99c61bfb7d072a545745a43ff3e1..d27b080148e1e3138e00f2e70823a87e9c7cb66b 100644 (file)
@@ -26,6 +26,7 @@
 #include <kiconloader.h>
 
 #include <QEvent>
+#include <QKeyEvent>
 #include <QHBoxLayout>
 #include <QToolButton>
 
@@ -39,9 +40,9 @@ DolphinSearchBox::DolphinSearchBox(QWidget* parent) :
     hLayout->setSpacing(0);
 
     m_searchInput = new KLineEdit(this);
-    m_searchInput->setLayoutDirection(Qt::LeftToRight);
     m_searchInput->setClearButtonShown(true);
     m_searchInput->setMinimumWidth(150);
+    m_searchInput->setClickMessage(i18nc("@label:textbox", "Search..."));
     hLayout->addWidget(m_searchInput);
     connect(m_searchInput, SIGNAL(returnPressed()),
             this, SLOT(emitSearchSignal()));
@@ -49,7 +50,7 @@ DolphinSearchBox::DolphinSearchBox(QWidget* parent) :
     m_searchButton = new QToolButton(this);
     m_searchButton->setAutoRaise(true);
     m_searchButton->setIcon(KIcon("edit-find"));
-    m_searchButton->setToolTip(i18nc("@info:tooltip", "Search"));
+    m_searchButton->setToolTip(i18nc("@info:tooltip", "Click to begin the search"));
     hLayout->addWidget(m_searchButton);
     connect(m_searchButton, SIGNAL(clicked()),
             this, SLOT(emitSearchSignal()));
@@ -63,6 +64,10 @@ bool DolphinSearchBox::event(QEvent* event)
 {
     if (event->type() == QEvent::Polish) {
         m_searchInput->setFont(KGlobalSettings::generalFont());
+    } else if (event->type() == QEvent::KeyPress) {
+        if (static_cast<QKeyEvent *>(event)->key() == Qt::Key_Escape) {
+            m_searchInput->clear();
+        }
     }
     return QWidget::event(event);
 }