]> cloud.milkyroute.net Git - dolphin.git/commitdiff
DolphinColumnView navigation works more intuitively.
authorMatthias Fuchs <mat69@gmx.net>
Fri, 27 May 2011 16:00:00 +0000 (18:00 +0200)
committerMatthias Fuchs <mat69@gmx.net>
Fri, 27 May 2011 23:10:37 +0000 (01:10 +0200)
If no item is selected then pressing right moves to a column view with child url, instead of the first index.
BUG:263110
REVIEW:101449

src/views/dolphincolumnview.cpp
src/views/dolphincolumnview.h

index fa1f620e411fe1dcd08688914fa265e3d6a3a1fe..3425c460ba600cc7b0d65693872b6a2527ab49c7 100644 (file)
@@ -338,6 +338,7 @@ void DolphinColumnView::mousePressEvent(QMouseEvent* event)
 
 void DolphinColumnView::keyPressEvent(QKeyEvent* event)
 {
+    const bool hadSelection = selectionModel()->hasSelection();
     DolphinTreeView::keyPressEvent(event);
 
     DolphinViewController* controller = m_container->m_dolphinViewController;
@@ -346,7 +347,15 @@ void DolphinColumnView::keyPressEvent(QKeyEvent* event)
     case Qt::Key_Right: {
         // Special key handling for the column: A Key_Right should
         // open a new column for the currently selected folder.
-        const QModelIndex dolphinModelIndex = m_proxyModel->mapToSource(currentIndex());
+        QModelIndex dolphinModelIndex = m_proxyModel->mapToSource(currentIndex());
+
+        // If there is no selection we automatically move to the child url
+        // instead of the first directory.
+        // See BUG:263110
+        if (!hadSelection && !childUrl().isEmpty()) {
+            dolphinModelIndex = m_dolphinModel->indexForUrl(childUrl());
+        }
+
         const KFileItem item = m_dolphinModel->itemForIndex(dolphinModelIndex);
         if (!item.isNull() && item.isDir()) {
             controller->emitItemTriggered(item);
index be50ea32442204962c23594337cae38f6a62fc84..2a4726afc2ecc19c4e253971e6cc17f9d3d7b8e3 100644 (file)
@@ -61,8 +61,10 @@ public:
 
     /**
      * Sets the directory URL of the child column that is shown next to
-     * this column. This property is only used for a visual indication
+     * this column. This property is used for a visual indication
      * of the shown directory, it does not trigger a loading of the model.
+     * When no url is selected and the user presses right, then child
+     * url will be used as column.
      */
     void setChildUrl(const KUrl& url);
     KUrl childUrl() const;