diff options
| author | Matthias Fuchs <[email protected]> | 2011-05-27 18:00:00 +0200 |
|---|---|---|
| committer | Matthias Fuchs <[email protected]> | 2011-05-28 01:10:37 +0200 |
| commit | e508685bae6a2171b0a681dbbe4764bfd16071e5 (patch) | |
| tree | a37bf16d52f5ca423d546611fe66a1224ff4fd5d /src | |
| parent | 009535d910180ae7293d784d37543e5e1a1782fe (diff) | |
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.
BUG:263110
REVIEW:101449
Diffstat (limited to 'src')
| -rw-r--r-- | src/views/dolphincolumnview.cpp | 11 | ||||
| -rw-r--r-- | src/views/dolphincolumnview.h | 4 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/views/dolphincolumnview.cpp b/src/views/dolphincolumnview.cpp index fa1f620e4..3425c460b 100644 --- a/src/views/dolphincolumnview.cpp +++ b/src/views/dolphincolumnview.cpp @@ -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); diff --git a/src/views/dolphincolumnview.h b/src/views/dolphincolumnview.h index be50ea324..2a4726afc 100644 --- a/src/views/dolphincolumnview.h +++ b/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; |
