Package: dolphin
Version: 4:4.4.5-1
Severity: normal
Tags: patch

Hi,

This bugfix: http://websvn.kde.org/?view=rev&revision=1132120 seem to be not 
include in kde 4.4.x releases.

So, I created a patch properly formatted better than in my previous message.
I join it to this mail.

Best regards,

Thomas PIERSON
--- a/apps/dolphin/src/dolphincolumnviewcontainer.cpp	2010-02-26 19:31:49.000000000 +0100
+++ b/apps/dolphin/src/dolphincolumnviewcontainer.cpp	2010-08-27 14:18:36.000000000 +0200
@@ -69,7 +69,7 @@
 
     DolphinColumnView* column = new DolphinColumnView(viewport(), this, m_controller->url());
     m_columns.append(column);
-    setActiveColumnIndex(0);
+    requestActivation(column);
 
     m_emptyViewport = new QFrame(viewport());
     m_emptyViewport->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
@@ -171,12 +171,7 @@
         }
     }
 
-    // set the last column as active column without modifying the controller
-    // and hence the history
-    m_columns[m_index]->setActive(false);
-    m_index = columnIndex;
-    m_columns[m_index]->setActive(true);
-    assureVisibleActiveColumn();
+    requestActivation(m_columns[columnIndex]);
 }
 
 void DolphinColumnViewContainer::mousePressEvent(QMouseEvent* event)
@@ -188,7 +183,9 @@
 void DolphinColumnViewContainer::keyPressEvent(QKeyEvent* event)
 {
     if (event->key() == Qt::Key_Left) {
-        setActiveColumnIndex(m_index - 1);
+        if (m_index > 0) {
+            requestActivation(m_columns[m_index - 1]);
+        }
     } else {
         QScrollArea::keyPressEvent(event);
     }
@@ -246,24 +243,6 @@
     m_controller->setUrl(activeUrl);
 }
 
-void DolphinColumnViewContainer::setActiveColumnIndex(int index)
-{
-    if ((m_index == index) || (index < 0) || (index >= m_columns.count())) {
-        return;
-    }
-
-    const bool hasActiveColumn = (m_index >= 0);
-    if (hasActiveColumn) {
-        m_columns[m_index]->setActive(false);
-    }
-
-    m_index = index;
-    m_columns[m_index]->setActive(true);
-
-    assureVisibleActiveColumn();
-    m_activeUrlTimer->start(); // calls slot updateActiveUrl()
-}
-
 void DolphinColumnViewContainer::layoutColumns()
 {
     const int gap = 4;
@@ -338,18 +317,39 @@
 
 void DolphinColumnViewContainer::requestActivation(DolphinColumnView* column)
 {
-    m_controller->setItemView(column);
+    if (m_controller->itemView() != column) {
+        m_controller->setItemView(column);
+    }
+    if (focusProxy() != column) {
+        setFocusProxy(column);
+    }
+    
     if (column->isActive()) {
         assureVisibleActiveColumn();
     } else {
+        // Deactivate the currently active column
+        if (m_index >= 0) {
+            m_columns[m_index]->setActive(false);
+        }
+        
+        // Get the index of the column that should get activated
         int index = 0;
         foreach (DolphinColumnView* currColumn, m_columns) {
             if (currColumn == column) {
-                setActiveColumnIndex(index);
-                return;
+                break;
             }
             ++index;
         }
+        
+        Q_ASSERT(index != m_index);
+        Q_ASSERT(index < m_columns.count());
+
+        // Activate the requested column
+        m_index = index;
+        m_columns[m_index]->setActive(true);
+
+        assureVisibleActiveColumn();
+        m_activeUrlTimer->start(); // calls slot updateActiveUrl()
     }
 }
 
--- a/apps/dolphin/src/dolphincolumnviewcontainer.h	2010-01-31 20:30:05.000000000 +0100
+++ b/apps/dolphin/src/dolphincolumnviewcontainer.h	2010-08-27 14:18:36.000000000 +0200
@@ -87,14 +87,6 @@
     void updateActiveUrl();
 
 private:
-    /**
-     * Deactivates the currently active column and activates
-     * the new column indicated by \a index. m_index represents
-     * the active column afterwards. Also the URL of the navigator
-     * will be adjusted to reflect the column URL.
-     */
-    void setActiveColumnIndex(int index);
-
     void layoutColumns();
     void updateScrollBar();
 
--- a/apps/dolphin/src/dolphincolumnview.cpp	2010-02-26 19:31:49.000000000 +0100
+++ b/apps/dolphin/src/dolphincolumnview.cpp	2010-08-27 14:18:36.000000000 +0200
@@ -150,10 +150,6 @@
 
 void DolphinColumnView::setActive(bool active)
 {
-    if (active && (m_container->focusProxy() != this)) {
-        m_container->setFocusProxy(this);
-    }
-
     if (m_active != active) {
         m_active = active;
 
@@ -308,7 +304,6 @@
 void DolphinColumnView::keyPressEvent(QKeyEvent* event)
 {
     QListView::keyPressEvent(event);
-    requestActivation();
 
     DolphinController* controller = m_container->m_controller;
     controller->handleKeyPressEvent(event);
@@ -439,10 +434,16 @@
         disconnect(this, SIGNAL(doubleClicked(const QModelIndex&)),
                    m_container->m_controller, SLOT(triggerItem(const QModelIndex&)));
     }
-
+    // It is important to disconnect the connection to requestActivation() temporary, otherwise the internal
+    // clearing of the selection would result in activating the column again.
+    disconnect(selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
+               this, SLOT(requestActivation()));
     const QModelIndex current = selectionModel()->currentIndex();
     selectionModel()->clear();
     selectionModel()->setCurrentIndex(current, QItemSelectionModel::NoUpdate);
+    connect(selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
+            this, SLOT(requestActivation()));
+    
     updateBackground();
 }

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to