[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-i18n-doc
Subject: KDE_3_4_BRANCH: kdegraphics/kpdf
From: Albert Astals Cid <tsdgeos () terra ! es>
Date: 2005-04-16 23:17:51
Message-ID: 20050416231751.6F9013CA () office ! kde ! org
[Download RAW message or body]
CVS commit by aacid:
Fix a memory leak when reloading documents, it introduces a new string but i asked on \
kde-i18n-doc five days ago about it and got 1 Ok 0 No so i'm commiting \
CCMAIL:kde-i18n-doc@kde.org
M +17 -4 part.cpp 1.28.2.4
M +2 -0 part.h 1.10.4.1
M +5 -0 ui/pageview.cpp 1.44.2.5
M +2 -0 ui/pageview.h 1.16.2.1
--- kdegraphics/kpdf/part.cpp #1.28.2.3:1.28.2.4
@@ -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()
{
- DocumentViewport v = m_document->viewport();
- if (openFile())
+ if (m_viewportDirty.pageNumber == -1)
{
- if (v.pageNumber > m_document->pages()) v.pageNumber = (int)m_document->pages() \
- 1;
- m_document->setViewport(v);
+ m_viewportDirty = m_document->viewport();
+ m_pageView->showText(i18n("Reloading the document..."), 0);
+ }
+
+ if (KParts::ReadOnlyPart::openURL(m_file))
+ {
+ if (m_viewportDirty.pageNumber >= (int)m_document->pages()) \
m_viewportDirty.pageNumber = (int)m_document->pages() - 1; + \
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.10.4.1
@@ -20,4 +20,5 @@
#include <kparts/part.h>
#include <qguardedptr.h>
+#include "core/document.h"
#include "core/observer.h"
#include "dcop.h"
@@ -134,4 +135,5 @@ private:
KDirWatch *m_watcher;
QTimer *m_dirtyHandler;
+ DocumentViewport m_viewportDirty;
// actions
--- kdegraphics/kpdf/ui/pageview.cpp #1.44.2.4:1.44.2.5
@@ -404,4 +404,9 @@ 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.16.2.1
@@ -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