diff options
| author | Peter Penz <[email protected]> | 2007-02-10 21:29:29 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2007-02-10 21:29:29 +0000 |
| commit | 64ef4394f97af721d364390ba00338b3a4006488 (patch) | |
| tree | 39dd812434939fdee00d89054cec6a8dd843463d /src | |
| parent | fcf8436737384a1b4483ff927faf041ba01213ea (diff) | |
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
Diffstat (limited to 'src')
| -rw-r--r-- | src/dolphinview.cpp | 21 | ||||
| -rw-r--r-- | src/dolphinview.h | 6 |
2 files changed, 25 insertions, 2 deletions
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<UrlNavigator::HistoryElem> history = urlHistory(index); + if (!history.isEmpty()) { + QAbstractItemView* view = itemView(); + // TODO: view->setCurrentItem(history[index].currentFileName()); + + QLinkedList<UrlNavigator::HistoryElem>::const_iterator it = history.begin(); + it += index; + view->horizontalScrollBar()->setValue((*it).contentsX()); + view->verticalScrollBar()->setValue((*it).contentsY()); + } } void DolphinView::showInfoMessage(const QString& msg) diff --git a/src/dolphinview.h b/src/dolphinview.h index dbd6622d7..4b740e655 100644 --- a/src/dolphinview.h +++ b/src/dolphinview.h @@ -406,6 +406,12 @@ private slots: */ void updateItemCount(); + /** + * Restores the x- and y-position of the contents if the + * current view is part of the history. + */ + void restoreContentsPos(); + /** Shows the information \a msg inside the statusbar. */ void showInfoMessage(const QString& msg); |
