From 3b246afb3ef3c1ef72ee5ee7039d330aa8025d87 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Mon, 6 Jun 2005 21:06:58 +0000 Subject: [PATCH] Fix bug 106771 BUGS: 106771 svn path=/trunk/KDE/kdegraphics/kpdf/; revision=422907 --- part.cpp | 18 +++++++++++++++--- part.h | 4 ++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/part.cpp b/part.cpp index 728543a83..907ba8bbc 100644 --- a/part.cpp +++ b/part.cpp @@ -80,13 +80,13 @@ Part::Part(QWidget *parentWidget, const char *widgetName, QObject *parent, const char *name, const QStringList & /*args*/ ) : DCOPObject("kpdf"), KParts::ReadOnlyPart(parent, name), m_showMenuBarAction(0), m_showFullScreenAction(0), - m_actionsSearched(false), m_searchStarted(false) + m_actionsSearched(false), m_searchStarted(false), m_notifyOpening(false) { // load catalog for translation KGlobal::locale()->insertCatalogue("kpdf"); // create browser extension (for printing when embedded into browser) - new BrowserExtension(this); + m_bExtension = new BrowserExtension(this); // xpdf 'extern' global class (m_count is a static instance counter) //if ( m_count ) TODO check if we need to insert these lines.. @@ -102,7 +102,7 @@ Part::Part(QWidget *parentWidget, const char *widgetName, m_document = new KPDFDocument(); connect( m_document, SIGNAL( linkFind() ), this, SLOT( slotFind() ) ); connect( m_document, SIGNAL( linkGoToPage() ), this, SLOT( slotGoToPage() ) ); - connect( m_document, SIGNAL( openURL(const KURL &) ), this, SLOT( openURL(const KURL &) ) ); + connect( m_document, SIGNAL( openURL(const KURL &) ), this, SLOT( openURLFromDocument(const KURL &) ) ); // widgets: ^searchbar (toolbar containing label and SearchWidget) // m_searchToolBar = new KToolBar( parentWidget, "searchBar" ); @@ -367,6 +367,12 @@ bool Part::openFile() return true; } +void Part::openURLFromDocument(const KURL &url) +{ + m_notifyOpening = true; + openURL(url); +} + bool Part::openURL(const KURL &url) { // note: this can be the right place to check the file for gz or bz2 extension @@ -375,6 +381,12 @@ bool Part::openURL(const KURL &url) // this calls the above 'openURL' method bool b = KParts::ReadOnlyPart::openURL(url); + if (m_notifyOpening) + { + m_bExtension->openURLNotify(); + m_bExtension->setLocationBarURL(url.prettyURL()); + m_notifyOpening = false; + } if ( !b ) KMessageBox::error( widget(), i18n("Could not open %1").arg( url.prettyURL() ) ); else diff --git a/part.h b/part.h index 74e221101..f05ebdcb5 100644 --- a/part.h +++ b/part.h @@ -106,6 +106,8 @@ protected slots: // can be connected to widget elements void updateViewActions(); void enableTOC(bool enable); + + void openURLFromDocument(const KURL &url); public slots: // connected to Shell action (and browserExtension), not local one @@ -156,6 +158,8 @@ private: KToggleAction* m_showFullScreenAction; bool m_actionsSearched; bool m_searchStarted; + BrowserExtension *m_bExtension; + bool m_notifyOpening; };