]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphincolumnwidget.cpp
assure that a column of the column view acts as focus proxy when being active
[dolphin.git] / src / dolphincolumnwidget.cpp
index a9b0b8244573d7101e4eecd0e40b7745d6afe644..d7d8bb500a0f7959950c0936aa70c864734c5a93 100644 (file)
@@ -55,6 +55,7 @@ DolphinColumnWidget::DolphinColumnWidget(QWidget* parent,
     m_active(true),
     m_view(columnView),
     m_selectionManager(0),
+    m_autoScroller(0),
     m_url(url),
     m_childUrl(),
     m_font(),
@@ -78,7 +79,7 @@ DolphinColumnWidget::DolphinColumnWidget(QWidget* parent,
     setVerticalScrollMode(QListView::ScrollPerPixel);
     setHorizontalScrollMode(QListView::ScrollPerPixel);
 
-    new DolphinViewAutoScroller(this);
+    m_autoScroller = new DolphinViewAutoScroller(this);
 
     // apply the column mode settings to the widget
     const ColumnModeSettings* settings = DolphinSettings::instance().columnModeSettings();
@@ -177,16 +178,18 @@ void DolphinColumnWidget::setDecorationSize(const QSize& size)
 
 void DolphinColumnWidget::setActive(bool active)
 {
-    if (m_active == active) {
-        return;
+    if (active && (m_view->focusProxy() != this)) {
+        m_view->setFocusProxy(this);
     }
 
-    m_active = active;
+    if (m_active != active) {
+        m_active = active;
 
-    if (active) {
-        activate();
-    } else {
-        deactivate();
+        if (active) {
+            activate();
+        } else {
+            deactivate();
+        }
     }
 }
 
@@ -450,7 +453,7 @@ void DolphinColumnWidget::selectionChanged(const QItemSelection& selected, const
 void DolphinColumnWidget::currentChanged(const QModelIndex& current, const QModelIndex& previous)
 {
     QListView::currentChanged(current, previous);
-    if (current.isValid()) {
+    if (current.isValid() && !m_autoScroller->isActive()) {
         scrollTo(current);
     }
 }