void DolphinColumnView::keyPressEvent(QKeyEvent* event)
{
+ const bool hadSelection = selectionModel()->hasSelection();
DolphinTreeView::keyPressEvent(event);
DolphinViewController* controller = m_container->m_dolphinViewController;
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);
/**
* 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;