summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Fuchs <mat69@gmx.net>2011-05-27 16:00:00 (GMT)
committerMatthias Fuchs <mat69@gmx.net>2011-05-27 23:12:49 (GMT)
commit30011f6985c2945b0d9c1b93a90d5e70551e0b2b (patch)
tree00975f5fbd6a268bc626ef88699cc8c487fecd00
parentecbfd1c61f69d4221d2ce84bc4b3117bc588c5a0 (diff)
Backport
DolphinColumnView navigation works more intuitively. If no item is selected then pressing right moves to a column view with child url, instead of the first index. CCBUG:263110 REVIEW:101449 (cherry picked from commit 7e6fd6fba45eed0560708413802f2344c79c2e56)
-rw-r--r--dolphin/src/views/dolphincolumnview.cpp11
-rw-r--r--dolphin/src/views/dolphincolumnview.h4
2 files changed, 13 insertions, 2 deletions
diff --git a/dolphin/src/views/dolphincolumnview.cpp b/dolphin/src/views/dolphincolumnview.cpp
index 840ecf7..b3c9d7c 100644
--- a/dolphin/src/views/dolphincolumnview.cpp
+++ b/dolphin/src/views/dolphincolumnview.cpp
@@ -337,6 +337,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;
@@ -345,7 +346,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);
diff --git a/dolphin/src/views/dolphincolumnview.h b/dolphin/src/views/dolphincolumnview.h
index 72130c8..451bbfa 100644
--- a/dolphin/src/views/dolphincolumnview.h
+++ b/dolphin/src/views/dolphincolumnview.h
@@ -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;