[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/utils/dolphin/src
From:       Peter Penz <peter.penz () gmx ! at>
Date:       2007-02-10 21:29:35
Message-ID: 1171142975.552957.26509.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 632370 by ppenz:

restore the x- and y-position of the view if the current view is part of the history

 M  +19 -2     dolphinview.cpp  
 M  +6 -0      dolphinview.h  


--- trunk/playground/utils/dolphin/src/dolphinview.cpp #632369:632370
@@ -319,12 +319,12 @@
 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,8 +668,25 @@
     }
 
     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)
 {
     m_statusBar->setMessage(msg, DolphinStatusBar::Information);
--- trunk/playground/utils/dolphin/src/dolphinview.h #632369:632370
@@ -406,6 +406,12 @@
      */
     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);
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic