]> cloud.milkyroute.net Git - dolphin.git/commitdiff
restore the x- and y-position of the view if the current view is part of the history
authorPeter Penz <peter.penz19@gmail.com>
Sat, 10 Feb 2007 21:29:29 +0000 (21:29 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Sat, 10 Feb 2007 21:29:29 +0000 (21:29 +0000)
svn path=/trunk/playground/utils/dolphin/; revision=632370

src/dolphinview.cpp
src/dolphinview.h

index 9b2286c8756953988f87f58d2a5f74b143b81db3..2b454675101e541dcaa38f06e5590859feb9d928 100644 (file)
@@ -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)
index dbd6622d72c985a0498a02d53a072426f247e549..4b740e655725b94a16003f212125f1a551a6902e 100644 (file)
@@ -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);