Konqueror, restore the selection, the current item, the scroll
position, and the expanded folders in the Details View.
BUG: 169893
BUG: 187732
svn path=/trunk/KDE/kdebase/apps/; revision=
1056438
void DolphinView::reload()
{
void DolphinView::reload()
{
+ QByteArray viewState;
+ QDataStream saveStream(&viewState, QIODevice::WriteOnly);
+ saveState(saveStream);
+ m_selectedItems = selectedItems();
+
setUrl(url());
loadDirectory(url(), true);
setUrl(url());
loadDirectory(url(), true);
+
+ QDataStream restoreStream(viewState);
+ restoreState(restoreStream);
}
void DolphinView::refresh()
}
void DolphinView::refresh()
void DolphinView::clearSelection()
{
void DolphinView::clearSelection()
{
- QItemSelectionModel* selModel = m_viewAccessor.itemView()->selectionModel();
- const QModelIndex currentIndex = selModel->currentIndex();
- selModel->setCurrentIndex(currentIndex, QItemSelectionModel::Current |
- QItemSelectionModel::Clear);
- m_selectedItems.clear();
+ m_viewAccessor.itemView()->clearSelection();
}
void DolphinView::changeSelection(const KFileItemList& selection)
}
void DolphinView::changeSelection(const KFileItemList& selection)
m_createdItemUrl = KUrl();
}
m_createdItemUrl = KUrl();
}
-void DolphinView::restoreSelection()
-{
- disconnect(m_viewAccessor.dirLister(), SIGNAL(completed()), this, SLOT(restoreSelection()));
- changeSelection(m_selectedItems);
-}
-
void DolphinView::emitContentsMoved()
{
// TODO: If DolphinViewContainer uses DolphinView::saveState(...) to save the
void DolphinView::emitContentsMoved()
{
// TODO: If DolphinViewContainer uses DolphinView::saveState(...) to save the
+ if (!m_selectedItems.isEmpty()) {
+ changeSelection(m_selectedItems);
+ m_selectedItems.clear();
+ }
+
// Restore the contents position. This has to be done using a Qt::QueuedConnection
// because the view might not be in its final state yet.
QMetaObject::invokeMethod(this, "restoreContentsPosition", Qt::QueuedConnection);
// Restore the contents position. This has to be done using a Qt::QueuedConnection
// because the view might not be in its final state yet.
QMetaObject::invokeMethod(this, "restoreContentsPosition", Qt::QueuedConnection);
m_loadingDirectory = true;
m_expanderActive = false;
m_loadingDirectory = true;
m_expanderActive = false;
- if (reload) {
- m_selectedItems = selectedItems();
- connect(m_viewAccessor.dirLister(), SIGNAL(completed()), this, SLOT(restoreSelection()));
- }
-
m_viewAccessor.dirLister()->openUrl(url, reload ? KDirLister::Reload : KDirLister::NoFlags);
}
m_viewAccessor.dirLister()->openUrl(url, reload ? KDirLister::Reload : KDirLister::NoFlags);
}
*/
void selectAndScrollToCreatedItem();
*/
void selectAndScrollToCreatedItem();
- /**
- * Restore selection after view refresh.
- */
- void restoreSelection();
-
/**
* Called when a redirection happens.
* Testcase: fish://localhost
/**
* Called when a redirection happens.
* Testcase: fish://localhost