this, SLOT(setNameFilter(QString)));
connect(m_filterBar, SIGNAL(closeRequest()),
this, SLOT(closeFilterBar()));
+ connect(m_filterBar, SIGNAL(focusViewRequest()),
+ this, SLOT(focusView()));
connect(m_view, SIGNAL(urlChanged(KUrl)),
m_filterBar, SLOT(clear()));
}
}
+void DolphinViewContainer::focusView()
+{
+ Q_ASSERT(m_view);
+ m_view->setFocus();
+}
+
void DolphinViewContainer::delayedStatusBarUpdate()
{
if (m_statusBarTimer->isActive() && (m_statusBarTimestamp.elapsed() > 2000)) {
void FilterBar::keyReleaseEvent(QKeyEvent* event)
{
QWidget::keyReleaseEvent(event);
- if (event->key() == Qt::Key_Escape) {
+
+ switch (event->key()) {
+ case Qt::Key_Escape:
if (m_filterInput->text().isEmpty()) {
emit closeRequest();
} else {
m_filterInput->clear();
}
+ break;
+
+ case Qt::Key_Enter:
+ case Qt::Key_Return:
+ emit focusViewRequest();
+ break;
+
+ default:
+ break;
}
}
*/
void closeRequest();
+ /*
+ * Emitted as soon as the focus should be returned back to the view.
+ */
+ void focusViewRequest();
+
protected:
virtual void showEvent(QShowEvent* event);
virtual void keyReleaseEvent(QKeyEvent* event);