remember scrollbar position for visited directories
[case] / src / filelist.cpp
index fe281b8..3cbe475 100644 (file)
@@ -20,6 +20,7 @@
 #include <QProcess>
 #include <QUrl>
 #include <QEvent>
+#include <QScrollBar>
 
 #include <hildon-mime.h>
 #include <dbus/dbus.h>
@@ -65,8 +66,10 @@ bool FileList::changePath(QString path) {
     path = unwindPath(path);
     QDir dir(fileSystemModel->rootPath());
     if (dir.cd(path)) {
+        scrollBarPosition[fileSystemModel->rootPath()] = verticalScrollBar()->value();
         setRootIndex(fileSystemModel->setRootPath(dir.absolutePath()));
         clearSelection();
+        verticalScrollBar()->setValue(scrollBarPosition[dir.absolutePath()]);
         emit pathChanged(fileSystemModel->rootPath());
         return true;
     }