[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdegraphics/kpdf
From: Albert Astals Cid <tsdgeos () terra ! es>
Date: 2005-03-09 22:08:35
Message-ID: 20050309220835.C3AA810B25 () office ! kde ! org
[Download RAW message or body]
CVS commit by aacid:
Comitting a fix for the memory leak that happens when reloading a file because it was \
beign watched. To fix it what we do is close the document, show a message telling \
that the document is beign reloaded and then open the document again when it's ready, \
that presents a big problem to a backport, because without the text it is really not \
understood that something is happening. Enrico any idea to do this in a better way so \
we can backport it?
BUGS: 101192
M +17 -4 part.cpp 1.30
M +2 -1 part.h 1.11
M +7 -0 ui/pageview.cpp 1.49
M +2 -0 ui/pageview.h 1.17
--- kdegraphics/kpdf/part.cpp #1.29:1.30
@@ -357,4 +357,6 @@ bool Part::openURL(const KURL &url)
if ( !b )
KMessageBox::error( widget(), i18n("Could not open %1").arg( url.prettyURL() \
) ); + else
+ m_viewportDirty.pageNumber = -1;
return b;
}
@@ -403,9 +405,20 @@ void Part::slotFileDirty( const QString&
void Part::slotDoFileDirty()
{
- uint p = m_document->currentPage() + 1;
- if (openFile())
+ if (m_viewportDirty.pageNumber == -1)
{
- if (p > m_document->pages()) p = m_document->pages();
- goToPage(p);
+ m_viewportDirty = m_document->viewport();
+ m_pageView->showText(i18n("Reloading the document..."), 0);
+ }
+
+ if (KParts::ReadOnlyPart::openURL(m_file))
+ {
+ if (m_viewportDirty.pageNumber > m_document->pages()) m_viewportDirty.pageNumber \
= m_document->pages(); + m_document->setViewport(m_viewportDirty);
+ m_viewportDirty.pageNumber = -1;
+ }
+ else
+ {
+ m_watcher->addFile(m_file);
+ m_dirtyHandler->start( 750, true );
}
}
--- kdegraphics/kpdf/part.h #1.10:1.11
@@ -20,4 +20,5 @@
#include <kparts/part.h>
#include <qguardedptr.h>
+#include "core/document.h"
#include "core/observer.h"
#include "dcop.h"
@@ -36,5 +37,4 @@ class KAboutData;
class KPrinter;
-class KPDFDocument;
class ThumbnailList;
class ThumbnailController;
@@ -134,4 +134,5 @@ private:
KDirWatch *m_watcher;
QTimer *m_dirtyHandler;
+ DocumentViewport m_viewportDirty;
// actions
--- kdegraphics/kpdf/ui/pageview.cpp #1.48:1.49
@@ -404,4 +404,11 @@ bool PageView::canUnloadPixmap( int page
//END DocumentObserver inherited methods
+
+void PageView::showText( const QString &text, int ms )
+{
+ d->messageWindow->display(text, PageViewMessage::Info, ms );
+}
+
+
//BEGIN widget events
void PageView::viewportPaintEvent( QPaintEvent * pe )
--- kdegraphics/kpdf/ui/pageview.h #1.16:1.17
@@ -64,4 +64,6 @@ class PageView : public QScrollView, pub
bool canUnloadPixmap( int pageNum );
+ void showText( const QString &text, int ms );
+
signals:
void urlDropped( const KURL& );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic