Version: (using KDE KDE 3.5.4) Installed from: Gentoo Packages When restoring KPDF with a local file being loaded, KPDF doesn't restore its size, but opens as small window in the top left of the screen. When restoring a KPDF loading a file from a remote location (e.g. via http), KPDF doesn't opens the file, but doesn't jump to the page, I had open when closing the previous session.
when you say "KPDF doesn't opens the file, but doesn't jump to the page", you mean "KPDF opens the file, but doesn't jump to the page", right?
Oh, sorry. Of course that was what I meant. I tend to overlook such stupid errors, when not writing in my mother language. I think KPDF would not only need to store the url and page number, but also checksum and size to ensure the document has not been modified in between.
SVN commit 582561 by aacid: Fix restoring the correct viewport on session restore when the document is non local. Seems it also fixes the small-window-on-local-files behaviour BUGS: 133507 M +5 -0 core/document.cpp M +1 -0 core/document.h M +9 -3 part.cpp M +1 -1 part.h M +2 -3 shell/shell.cpp M +1 -1 shell/shell.h --- branches/KDE/3.5/kdegraphics/kpdf/core/document.cpp #582560:582561 @@ -614,7 +614,12 @@ } } +void KPDFDocument::setNextDocumentViewport( const DocumentViewport & viewport ) +{ + d->nextDocumentViewport = viewport; +} + bool KPDFDocument::searchText( int searchID, const QString & text, bool fromStart, bool caseSensitive, SearchType type, bool moveViewport, const QColor & color, bool noDialogs ) { --- branches/KDE/3.5/kdegraphics/kpdf/core/document.h #582560:582561 @@ -88,6 +88,7 @@ void setViewport( const DocumentViewport & viewport, int excludeId = -1, bool smoothMove = false ); void setPrevViewport(); void setNextViewport(); + void setNextDocumentViewport( const DocumentViewport & viewport ); void requestPixmaps( const QValueList< PixmapRequest * > & requests ); void requestTextPage( uint page ); --- branches/KDE/3.5/kdegraphics/kpdf/part.cpp #582560:582561 @@ -955,15 +955,21 @@ } } -void Part::restoreDocument(const KURL &url, int page) +void Part::restoreDocument(KConfig* config) { - if (openURL(url)) goToPage(page); + KURL url ( config->readPathEntry( "URL" ) ); + if ( url.isValid() ) + { + QString viewport = config->readEntry( "Viewport" ); + if (!viewport.isEmpty()) m_document->setNextDocumentViewport( DocumentViewport( viewport ) ); + openURL( url ); + } } void Part::saveDocumentRestoreInfo(KConfig* config) { config->writePathEntry( "URL", url().url() ); - if (m_document->pages() > 0) config->writeEntry( "Page", m_document->currentPage() + 1 ); + config->writeEntry( "Viewport", m_document->viewport().toString() ); } /* --- branches/KDE/3.5/kdegraphics/kpdf/part.h #582560:582561 @@ -124,7 +124,7 @@ public slots: // connected to Shell action (and browserExtension), not local one void slotPrint(); - void restoreDocument(const KURL &url, int page); + void restoreDocument(KConfig* config); void saveDocumentRestoreInfo(KConfig* config); void slotFileDirty( const QString& ); void slotDoFileDirty(); --- branches/KDE/3.5/kdegraphics/kpdf/shell/shell.cpp #582560:582561 @@ -86,7 +86,7 @@ m_part = 0; return; } - connect( this, SIGNAL( restoreDocument(const KURL &, int) ),m_part, SLOT( restoreDocument(const KURL &, int))); + connect( this, SIGNAL( restoreDocument(KConfig*) ),m_part, SLOT( restoreDocument(KConfig*))); connect( this, SIGNAL( saveDocumentRestoreInfo(KConfig*) ), m_part, SLOT( saveDocumentRestoreInfo(KConfig*))); connect( m_part, SIGNAL( enablePrintAction(bool) ), m_printAction, SLOT( setEnabled(bool))); @@ -174,8 +174,7 @@ // in 'saveProperties' if(m_part) { - KURL url ( config->readPathEntry( "URL" ) ); - if ( url.isValid() ) emit restoreDocument(url, config->readNumEntry( "Page", 1 )); + emit restoreDocument(config); } } --- branches/KDE/3.5/kdegraphics/kpdf/shell/shell.h #582560:582561 @@ -85,7 +85,7 @@ void delayedOpen(); signals: - void restoreDocument(const KURL &url, int page); + void restoreDocument(KConfig* config); void saveDocumentRestoreInfo(KConfig* config);
I still have the problem with the small window on session restore! My version is 0.5.5.