[PATCH] Dolphin - Save/ Restore File View Position in Konqueror
David Faure
faure at kde.org
Fri Aug 8 15:59:28 BST 2008
On Monday 21 July 2008, Peter Penz wrote:
> I did not have the time yet to try your patch and hopefully David Faure can
> comment on whether this is the correct way to do it (Dolphin itself uses the
> URL navigator, which remembers the position for each history state).
Hi Simon,
I double-checked the kde3 code for saving/restoring the scrolling position,
and I found out that for X and Y offset there is higher-level support in KParts than
requiring the part to reimplement saveState/restoreState and to have a member variable.
The kde3 code did:
void KonqKfmIconView::slotCompleted()
{
[....]
if ( m_bUpdateContentsPosAfterListing ) {
m_pIconView->setContentsPos( extension()->urlArgs().xOffset,
extension()->urlArgs().yOffset );
// kde4 code would be like arguments().xOffset(), arguments().yOffset()
}
m_bUpdateContentsPosAfterListing = false;
}
That bool was set to false in the ctor, and to true in openUrl.
I guess it should check for xOffset/yOffset not being 0 though, in case the user
started scrolling and we have no specific offset to restore anyway (e.g. listing a new directory).
For the "save" code, you only need to reimplement xOffset and yOffset from BrowserExtension.
This allows to implement "keeping the scrolling position on reload", too, using code like
KParts::URLArgs args = m_extension->urlArgs();
if ( args.reload )
{
args.xOffset = m_pIconView->contentsX();
args.yOffset = m_pIconView->contentsY();
m_extension->setURLArgs( args );
[ had also code for remembering which files to select ]
}
[sorry, no clue about the dolphin-specific layouting issue, I'll let you and Peter handle that part]
Moving this to kfm-devel, since I don't monitor kde-devel.
--
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
More information about the kfm-devel
mailing list