m_container = new DolphinItemListContainer(m_dirLister, this);
m_container->setVisibleRoles(QList<QByteArray>() << "name");
+ m_container->installEventFilter(this);
KItemListController* controller = m_container->controller();
controller->setSelectionBehavior(KItemListController::MultiSelection);
emit categorizedSortingChanged(categorized);
}
-void DolphinView::mouseReleaseEvent(QMouseEvent* event)
+bool DolphinView::eventFilter(QObject* watched, QEvent* event)
{
- QWidget::mouseReleaseEvent(event);
- setActive(true);
+ switch (event->type()) {
+ case QEvent::FocusIn:
+ if (watched == m_container) {
+ setActive(true);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return QWidget::eventFilter(watched, event);
}
void DolphinView::activate()
*/
void setCategorizedSorting(bool categorized);
+ /** Activates the view if the item list container gets focus. */
+ virtual bool eventFilter(QObject* watched, QEvent* event);
+
signals:
/**
* Is emitted if the view has been activated by e. g. a mouse click.
*/
void writeStateChanged(bool isFolderWritable);
-protected:
- virtual void mouseReleaseEvent(QMouseEvent* event);
-
private slots:
/**
* Marks the view as active (DolphinView:isActive() will return true)