diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h --- a/src/views/dolphinview.h +++ b/src/views/dolphinview.h @@ -771,6 +771,7 @@ // tooltip may be shown when hovering an item. QUrl m_url; + QUrl m_goUpUrl; // Used to track the folder from which a go-up is done QString m_viewPropertiesContext; Mode m_mode; QList m_visibleRoles; diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -582,6 +582,7 @@ clearSelection(); + m_goUpUrl = m_url; m_url = url; hideToolTip(); @@ -1375,6 +1376,8 @@ selectionManager->beginAnchoredSelection(selectionManager->currentItem()); selectionManager->setSelectedItems(selectedItems); } + + m_goUpUrl = QUrl(); // reset } void DolphinView::hideToolTip() @@ -1448,6 +1451,13 @@ void DolphinView::slotDirectoryLoadingCompleted() { + // If there's no current or selected item, this can be about going up + // and we can mark the previous url's item to be scrolled to and selected. + if (!m_goUpUrl.isEmpty() && m_selectedUrls.isEmpty() && m_currentItemUrl.isEmpty()) { + markUrlAsCurrent(m_goUpUrl); + m_selectedUrls << m_goUpUrl; + } + // Update the view-state. This has to be done asynchronously // because the view might not be in its final state yet. QTimer::singleShot(0, this, &DolphinView::updateViewState);