diff options
| author | Peter Penz <[email protected]> | 2007-06-10 11:46:41 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2007-06-10 11:46:41 +0000 |
| commit | 293e65797afd44a530df3435a8cc5b1b024aa3bb (patch) | |
| tree | ba3fe82f6f4545d953690f9fd174d9c2751cb9cd /src/dolphinviewcontainer.cpp | |
| parent | 3e66730d284c2f4a79cc350ae209f05001d798ad (diff) | |
Remember and restore position of viewport when reloading or going back in history (worked already before the DolphinView/DolphinViewContainer split). Minor open issue: the x-position of the Column View is reset to 0...
svn path=/trunk/KDE/kdebase/apps/; revision=673498
Diffstat (limited to 'src/dolphinviewcontainer.cpp')
| -rw-r--r-- | src/dolphinviewcontainer.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index c05c4251c..01cc27896 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -133,6 +133,8 @@ DolphinViewContainer::DolphinViewContainer(DolphinMainWindow* mainWindow, this, SLOT(openContextMenu(KFileItem*, const KUrl&))); connect(m_view, SIGNAL(urlsDropped(const KUrl::List&, const KUrl&)), m_mainWindow, SLOT(dropUrls(const KUrl::List&, const KUrl&))); + connect(m_view, SIGNAL(contentsMoved(int, int)), + this, SLOT(saveContentsPos(int, int))); connect(m_view, SIGNAL(requestItemInfo(const KUrl&)), this, SLOT(showItemInfo(const KUrl&))); connect(m_view, SIGNAL(errorMessage(const QString&)), @@ -329,7 +331,7 @@ void DolphinViewContainer::updateItemCount() updateStatusBar(); - QTimer::singleShot(0, this, SLOT(restoreContentsPos())); + QTimer::singleShot(100, this, SLOT(restoreContentsPos())); } void DolphinViewContainer::showItemInfo(const KUrl& url) @@ -472,4 +474,18 @@ void DolphinViewContainer::openContextMenu(KFileItem* item, contextMenu.open(); } +void DolphinViewContainer::saveContentsPos(int x, int y) +{ + m_urlNavigator->savePosition(x, y); +} + +void DolphinViewContainer::restoreContentsPos() +{ + if (!url().isEmpty()) { + const QPoint pos = m_urlNavigator->savedPosition(); + m_view->setContentsPosition(pos.x(), pos.y()); + } +} + + #include "dolphinviewcontainer.moc" |
