Fix bug 106771

BUGS: 106771

svn path=/trunk/KDE/kdegraphics/kpdf/; revision=422907
remotes/origin/kpdf
Albert Astals Cid 21 years ago
parent 5c4ae71cde
commit 3b246afb3e
  1. 18
      part.cpp
  2. 4
      part.h

@ -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

@ -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;
};

Loading…
Cancel
Save