diff options
| author | Frank Reininghaus <[email protected]> | 2013-09-09 21:21:43 +0200 |
|---|---|---|
| committer | Frank Reininghaus <[email protected]> | 2013-09-09 21:27:22 +0200 |
| commit | 258f0f60feb76876c846294c23121d41997ddc34 (patch) | |
| tree | 7f5ad16a1e10a4418bf6dc936cadd85849b98ff7 /src/search/dolphinsearchbox.cpp | |
| parent | 7e30467679a403f953e2547894febb51e8a3d78b (diff) | |
| parent | 2d8872c3accbf4a6f07e3ce4d220c9f87057545a (diff) | |
Merge remote-tracking branch 'origin/KDE/4.11'
The most recent commit from the KDE/4.11 branch (new unit test) had to
be modified slightly due to the changed signal emission when resorting
the model changes only the groups, and not the order of the items
(groupsChaged instead of itemsMoved).
Diffstat (limited to 'src/search/dolphinsearchbox.cpp')
| -rw-r--r-- | src/search/dolphinsearchbox.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/search/dolphinsearchbox.cpp b/src/search/dolphinsearchbox.cpp index ef9c2bfcf..cf1f0c8e5 100644 --- a/src/search/dolphinsearchbox.cpp +++ b/src/search/dolphinsearchbox.cpp @@ -58,6 +58,7 @@ DolphinSearchBox::DolphinSearchBox(QWidget* parent) : QWidget(parent), m_startedSearching(false), m_readOnly(false), + m_active(true), m_topLayout(0), m_searchLabel(0), m_searchInput(0), @@ -171,6 +172,22 @@ bool DolphinSearchBox::isReadOnly() const return m_readOnly; } +void DolphinSearchBox::setActive(bool active) +{ + if (active != m_active) { + m_active = active; + + if (active) { + emit activated(); + } + } +} + +bool DolphinSearchBox::isActive() const +{ + return m_active; +} + bool DolphinSearchBox::event(QEvent* event) { if (event->type() == QEvent::Polish) { @@ -199,6 +216,21 @@ void DolphinSearchBox::keyReleaseEvent(QKeyEvent* event) } } +bool DolphinSearchBox::eventFilter(QObject* obj, QEvent* event) +{ + switch (event->type()) { + case QEvent::FocusIn: + setActive(true); + setFocus(); + break; + + default: + break; + } + + return QObject::eventFilter(obj, event); +} + void DolphinSearchBox::emitSearchRequest() { m_startSearchTimer->stop(); @@ -253,6 +285,7 @@ void DolphinSearchBox::slotFacetChanged() void DolphinSearchBox::initButton(QToolButton* button) { + button->installEventFilter(this); button->setAutoExclusive(true); button->setAutoRaise(true); button->setCheckable(true); @@ -298,6 +331,7 @@ void DolphinSearchBox::init() // Create search box m_searchInput = new KLineEdit(this); + m_searchInput->installEventFilter(this); m_searchInput->setClearButtonShown(true); m_searchInput->setFont(KGlobalSettings::generalFont()); setFocusProxy(m_searchInput); @@ -348,6 +382,7 @@ void DolphinSearchBox::init() connect(m_facetsToggleButton, SIGNAL(clicked()), this, SLOT(slotFacetsButtonToggled())); m_facetsWidget = new DolphinFacetsWidget(this); + m_facetsWidget->installEventFilter(this); m_facetsWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); connect(m_facetsWidget, SIGNAL(facetChanged()), this, SLOT(slotFacetChanged())); |
