X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/d85a6ec6dd3a30784c07636a77ee502dd5dae4a2..ed0df8dc1fc9576e36c920882e7f4b00a2811113:/src/dolphinsearchbox.cpp diff --git a/src/dolphinsearchbox.cpp b/src/dolphinsearchbox.cpp index 4263aacf6..d27b08014 100644 --- a/src/dolphinsearchbox.cpp +++ b/src/dolphinsearchbox.cpp @@ -26,34 +26,34 @@ #include #include +#include #include #include DolphinSearchBox::DolphinSearchBox(QWidget* parent) : QWidget(parent), - m_searchButton(0), - m_searchInput(0) + m_searchInput(0), + m_searchButton(0) { QHBoxLayout* hLayout = new QHBoxLayout(this); hLayout->setMargin(0); - - m_searchButton = new QToolButton(this); - m_searchButton->setAutoRaise(true); - m_searchButton->setIcon(KIcon("nepomuk")); - m_searchButton->setToolTip(i18nc("@info:tooltip", "Search")); - hLayout->addWidget(m_searchButton); - - connect(m_searchButton, SIGNAL(clicked()), - this, SLOT(emitSearchSignal())); + 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())); + + m_searchButton = new QToolButton(this); + m_searchButton->setAutoRaise(true); + m_searchButton->setIcon(KIcon("edit-find")); + m_searchButton->setToolTip(i18nc("@info:tooltip", "Click to begin the search")); + hLayout->addWidget(m_searchButton); + connect(m_searchButton, SIGNAL(clicked()), + this, SLOT(emitSearchSignal())); } DolphinSearchBox::~DolphinSearchBox() @@ -64,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(event)->key() == Qt::Key_Escape) { + m_searchInput->clear(); + } } return QWidget::event(event); }