Don't open multiple presentation widgets when slotShowPresentation() is called

multiple times (e.g. when the watched PDF has changed)

svn path=/trunk/kdegraphics/kpdf/; revision=383178
This commit is contained in:
Tobias Koenig 2005-01-28 11:04:03 +00:00
parent 93c1d3845d
commit 0cc0b192cd
2 changed files with 7 additions and 1 deletions

View file

@ -687,7 +687,10 @@ void Part::slotShowProperties()
void Part::slotShowPresentation()
{
new PresentationWidget( m_document );
if ( m_presentationWidget )
delete (PresentationWidget*) m_presentationWidget;
m_presentationWidget = new PresentationWidget( m_document );
}
void Part::slotPrint()

3
part.h
View file

@ -18,6 +18,7 @@
#include <kparts/browserextension.h>
#include <kparts/part.h>
#include <qguardedptr.h>
#include "core/observer.h"
#include "dcop.h"
@ -38,6 +39,7 @@ class KPDFDocument;
class ThumbnailList;
class ThumbnailController;
class PageView;
class PresentationWidget;
class SearchWidget;
namespace KPDF {
@ -123,6 +125,7 @@ private:
SearchWidget *m_searchWidget;
ThumbnailList *m_thumbnailList;
PageView *m_pageView;
QGuardedPtr<PresentationWidget> m_presentationWidget;
// static instances counter
static unsigned int m_count;