From 64ef4394f97af721d364390ba00338b3a4006488 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Sat, 10 Feb 2007 21:29:29 +0000 Subject: restore the x- and y-position of the view if the current view is part of the history svn path=/trunk/playground/utils/dolphin/; revision=632370 --- src/dolphinview.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/dolphinview.cpp') diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index 9b2286c87..2b4546751 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -319,12 +319,12 @@ DolphinStatusBar* DolphinView::statusBar() const int DolphinView::contentsX() const { - return 0; //scrollView()->contentsX(); + return itemView()->horizontalScrollBar()->value(); } int DolphinView::contentsY() const { - return 0; //scrollView()->contentsY(); + return itemView()->verticalScrollBar()->value(); } void DolphinView::refreshSettings() @@ -668,6 +668,23 @@ void DolphinView::updateItemCount() } updateStatusBar(); + + QTimer::singleShot(0, this, SLOT(restoreContentsPos())); +} + +void DolphinView::restoreContentsPos() +{ + int index = 0; + const QLinkedList history = urlHistory(index); + if (!history.isEmpty()) { + QAbstractItemView* view = itemView(); + // TODO: view->setCurrentItem(history[index].currentFileName()); + + QLinkedList::const_iterator it = history.begin(); + it += index; + view->horizontalScrollBar()->setValue((*it).contentsX()); + view->verticalScrollBar()->setValue((*it).contentsY()); + } } void DolphinView::showInfoMessage(const QString& msg) -- cgit v1.3