X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/7a593fc92bf28fbdcdec0e241e18ee8ba2ad7334..2d2d55f3df09614e6b7cf267771b52a04dcb5e28:/src/views/dolphinview.cpp diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index c1f585da9..1de973bd5 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -1167,6 +1167,14 @@ bool DolphinView::itemsExpandable() const void DolphinView::restoreState(QDataStream& stream) { + // Read the version number of the view state and check if the version is supported. + quint32 version = 0; + stream >> version; + if (version != 1) { + // The version of the view state isn't supported, we can't restore it. + return; + } + // Restore the current item that had the keyboard focus stream >> m_currentItemUrl; @@ -1181,6 +1189,8 @@ void DolphinView::restoreState(QDataStream& stream) void DolphinView::saveState(QDataStream& stream) { + stream << quint32(1); // View state version + // Save the current item that has the keyboard focus const int currentIndex = m_container->controller()->selectionManager()->currentItem(); if (currentIndex != -1) { @@ -1289,11 +1299,11 @@ void DolphinView::updateViewState() m_view->scrollToItem(currentIndex); m_scrollToCurrentItem = false; } - - m_currentItemUrl = KUrl(); } else { selectionManager->setCurrentItem(0); } + + m_currentItemUrl = KUrl(); } if (!m_restoredContentsPosition.isNull()) {