Bug 102869

Summary: KPDF moves view to the top of the page after document reload
Product: [Applications] kpdf Reporter: Dmitriy Morozov <kde>
Component: generalAssignee: Albert Astals Cid <aacid>
Status: RESOLVED FIXED    
Severity: normal CC: esigra
Priority: NOR    
Version: 0.4   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description Dmitriy Morozov 2005-03-30 17:53:05 UTC
Version:           0.4 (using KDE 3.4.0, Gentoo)
Compiler:          gcc version 3.3.5 (Gentoo Linux 3.3.5-r1, ssp-3.3.2-3, pie-8.7.7.1)
OS:                Linux (i686) release 2.6.7-gentoo-r9

When KPDF reloads the document (when "Watch File" is checked and the document changes), it moves the view to the top of the current page. This behavior is incredibly inconvenient when working on a document, and trying to fix a paragraph or a figure or anything else that appears somewhere other than the top of the page.
Comment 1 Albert Astals Cid 2005-03-30 19:09:12 UTC
Hi, this is already fixed in the development branch (what will be KDE 3.5) i'll see if we can backport it to the stable branch (KDE 3.4.x)
Comment 2 Dmitriy Morozov 2005-03-30 19:19:55 UTC
Excellent! Thanks.
Comment 3 Albert Astals Cid 2005-04-12 22:03:30 UTC
CVS commit by aacid: 

Fix 102869 on 3.4.x, that was already fixed on HEAD
Please keep in mind that kpdf 0.4.x has a memory leak when using watch file that we "can't" fix (it's fixed on the upcomingkpdf 0.5)
BUGS: 102869


  M +3 -3      part.cpp   1.28.2.3


--- kdegraphics/kpdf/part.cpp  #1.28.2.2:1.28.2.3
@@ -403,9 +403,9 @@ void Part::slotFileDirty( const QString&
 void Part::slotDoFileDirty()
 {
-  uint p = m_document->currentPage() + 1;
+  DocumentViewport v = m_document->viewport();
   if (openFile())
   {
-    if (p > m_document->pages()) p = m_document->pages();
-    goToPage(p);
+    if (v.pageNumber > m_document->pages()) v.pageNumber = (int)m_document->pages() - 1;
+    m_document->setViewport(v);
   }
 }
Comment 4 Dmitriy Morozov 2005-04-12 22:14:51 UTC
How bad is the leak? Also is it a global to KDE or local to KPDF, in 
other words, if I exit KPDF will the memory get reclaimed, or do I 
need to exit all of KDE to reclaim the memory?

Thanks.
Comment 5 Albert Astals Cid 2005-04-12 22:28:38 UTC
The memory comes back when closing kpdf. About numbers http://bugs.kde.org/show_bug.cgi?id=101192 has some (and the fix it you want, we can't backport because it introduces a new string and that is not good on stable branches)
Comment 6 Dmitriy Morozov 2005-04-12 22:34:07 UTC
Got you. Thanks!

On Tuesday 12 April 2005 04:28 pm, Albert Astals Cid wrote:
[bugs.kde.org quoted mail]