mirror of
https://invent.kde.org/graphics/okular
synced 2024-09-17 23:11:48 +00:00
URL -> url renaming to reimplement the correct KPart::openUrl()...
svn path=/trunk/playground/graphics/okular/; revision=578859
This commit is contained in:
parent
69a72ebbe8
commit
5bfa5435a8
|
@ -1646,7 +1646,7 @@ bool KPDFDocument::openRelativeFile( const QString & fileName )
|
||||||
|
|
||||||
kDebug() << "openDocument: '" << absFileName << "'" << endl;
|
kDebug() << "openDocument: '" << absFileName << "'" << endl;
|
||||||
|
|
||||||
emit openURL( absFileName );
|
emit openUrl( absFileName );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -158,7 +158,7 @@ class OKULAR_EXPORT KPDFDocument : public QObject
|
||||||
void linkGoToPage();
|
void linkGoToPage();
|
||||||
void linkPresentation();
|
void linkPresentation();
|
||||||
void linkEndPresentation();
|
void linkEndPresentation();
|
||||||
void openURL(const KUrl &url);
|
void openUrl(const KUrl &url);
|
||||||
void error(const QString & string, int duration);
|
void error(const QString & string, int duration);
|
||||||
void warning(const QString & string, int duration);
|
void warning(const QString & string, int duration);
|
||||||
void notice(const QString & string, int duration);
|
void notice(const QString & string, int duration);
|
||||||
|
|
32
part.cpp
32
part.cpp
|
@ -104,7 +104,7 @@ Part::Part(QWidget *parentWidget,
|
||||||
connect( m_document, SIGNAL( linkGoToPage() ), this, SLOT( slotGoToPage() ) );
|
connect( m_document, SIGNAL( linkGoToPage() ), this, SLOT( slotGoToPage() ) );
|
||||||
connect( m_document, SIGNAL( linkPresentation() ), this, SLOT( slotShowPresentation() ) );
|
connect( m_document, SIGNAL( linkPresentation() ), this, SLOT( slotShowPresentation() ) );
|
||||||
connect( m_document, SIGNAL( linkEndPresentation() ), this, SLOT( slotHidePresentation() ) );
|
connect( m_document, SIGNAL( linkEndPresentation() ), this, SLOT( slotHidePresentation() ) );
|
||||||
connect( m_document, SIGNAL( openURL(const KUrl &) ), this, SLOT( openURLFromDocument(const KUrl &) ) );
|
connect( m_document, SIGNAL( openUrl(const KUrl &) ), this, SLOT( openUrlFromDocument(const KUrl &) ) );
|
||||||
connect( m_document, SIGNAL( close() ), this, SLOT( close() ) );
|
connect( m_document, SIGNAL( close() ), this, SLOT( close() ) );
|
||||||
|
|
||||||
if ( parent && parent->metaObject()->indexOfSlot( SLOT( slotQuit() ) ) != -1 )
|
if ( parent && parent->metaObject()->indexOfSlot( SLOT( slotQuit() ) ) != -1 )
|
||||||
|
@ -151,7 +151,7 @@ Part::Part(QWidget *parentWidget,
|
||||||
m_searchWidget = new SearchWidget( thumbsBox, m_document );
|
m_searchWidget = new SearchWidget( thumbsBox, m_document );
|
||||||
m_thumbnailList = new ThumbnailList( thumbsBox, m_document );
|
m_thumbnailList = new ThumbnailList( thumbsBox, m_document );
|
||||||
// ThumbnailController * m_tc = new ThumbnailController( thumbsBox, m_thumbnailList );
|
// ThumbnailController * m_tc = new ThumbnailController( thumbsBox, m_thumbnailList );
|
||||||
connect( m_thumbnailList, SIGNAL( urlDropped( const KUrl& ) ), SLOT( openURLFromDocument( const KUrl & )) );
|
connect( m_thumbnailList, SIGNAL( urlDropped( const KUrl& ) ), SLOT( openUrlFromDocument( const KUrl & )) );
|
||||||
connect( m_thumbnailList, SIGNAL( rightClick(const KPDFPage *, const QPoint &) ), this, SLOT( slotShowMenu(const KPDFPage *, const QPoint &) ) );
|
connect( m_thumbnailList, SIGNAL( rightClick(const KPDFPage *, const QPoint &) ), this, SLOT( slotShowMenu(const KPDFPage *, const QPoint &) ) );
|
||||||
tbIndex = m_toolBox->addItem( thumbsBox, SmallIconSet("thumbnail"), i18n("Thumbnails") );
|
tbIndex = m_toolBox->addItem( thumbsBox, SmallIconSet("thumbnail"), i18n("Thumbnails") );
|
||||||
m_toolBox->setItemToolTip( tbIndex, i18n("Thumbnails") );
|
m_toolBox->setItemToolTip( tbIndex, i18n("Thumbnails") );
|
||||||
|
@ -181,7 +181,7 @@ Part::Part(QWidget *parentWidget,
|
||||||
// rightLayout->addWidget( rtb );
|
// rightLayout->addWidget( rtb );
|
||||||
m_pageView = new PageView( m_splitter, m_document );
|
m_pageView = new PageView( m_splitter, m_document );
|
||||||
m_pageView->setFocus(); //usability setting
|
m_pageView->setFocus(); //usability setting
|
||||||
connect( m_pageView, SIGNAL( urlDropped( const KUrl& ) ), SLOT( openURLFromDocument( const KUrl & )));
|
connect( m_pageView, SIGNAL( urlDropped( const KUrl& ) ), SLOT( openUrlFromDocument( const KUrl & )));
|
||||||
connect( m_pageView, SIGNAL( rightClick(const KPDFPage *, const QPoint &) ), this, SLOT( slotShowMenu(const KPDFPage *, const QPoint &) ) );
|
connect( m_pageView, SIGNAL( rightClick(const KPDFPage *, const QPoint &) ), this, SLOT( slotShowMenu(const KPDFPage *, const QPoint &) ) );
|
||||||
connect( m_document, SIGNAL( error( const QString&, int ) ), m_pageView, SLOT( errorMessage( const QString&, int ) ) );
|
connect( m_document, SIGNAL( error( const QString&, int ) ), m_pageView, SLOT( errorMessage( const QString&, int ) ) );
|
||||||
connect( m_document, SIGNAL( warning( const QString&, int ) ), m_pageView, SLOT( warningMessage( const QString&, int ) ) );
|
connect( m_document, SIGNAL( warning( const QString&, int ) ), m_pageView, SLOT( warningMessage( const QString&, int ) ) );
|
||||||
|
@ -347,7 +347,7 @@ Part::~Part()
|
||||||
delete m_document;
|
delete m_document;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Part::openURLFromDocument(const KUrl &url)
|
void Part::openUrlFromDocument(const KUrl &url)
|
||||||
{
|
{
|
||||||
m_bExtension->openUrlNotify();
|
m_bExtension->openUrlNotify();
|
||||||
m_bExtension->setLocationBarUrl(url.prettyUrl());
|
m_bExtension->setLocationBarUrl(url.prettyUrl());
|
||||||
|
@ -471,7 +471,7 @@ void Part::goToPage(uint i)
|
||||||
|
|
||||||
void Part::openDocument(KUrl doc)
|
void Part::openDocument(KUrl doc)
|
||||||
{
|
{
|
||||||
openURL(doc);
|
openUrl(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint Part::pages()
|
uint Part::pages()
|
||||||
|
@ -601,13 +601,13 @@ bool Part::openFile()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Part::openURL(const KUrl &url)
|
bool Part::openUrl(const KUrl &url)
|
||||||
{
|
{
|
||||||
// note: this can be the right place to check the file for gz or bz2 extension
|
// note: this can be the right place to check the file for gz or bz2 extension
|
||||||
// if it matches then: download it (if not local) extract to a temp file using
|
// if it matches then: download it (if not local) extract to a temp file using
|
||||||
// KTar and proceed with the URL of the temporary file
|
// KTar and proceed with the URL of the temporary file
|
||||||
|
|
||||||
// this calls in sequence the 'closeURL' and 'openFile' methods
|
// this calls in sequence the 'closeUrl' and 'openFile' methods
|
||||||
bool openOk = KParts::ReadOnlyPart::openUrl(url);
|
bool openOk = KParts::ReadOnlyPart::openUrl(url);
|
||||||
|
|
||||||
if ( openOk )
|
if ( openOk )
|
||||||
|
@ -627,7 +627,7 @@ bool Part::openURL(const KUrl &url)
|
||||||
return openOk;
|
return openOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Part::closeURL()
|
bool Part::closeUrl()
|
||||||
{
|
{
|
||||||
if (!m_temporaryLocalFile.isNull())
|
if (!m_temporaryLocalFile.isNull())
|
||||||
{
|
{
|
||||||
|
@ -667,7 +667,7 @@ void Part::close()
|
||||||
{
|
{
|
||||||
if (parent() && (parent()->objectName() == QLatin1String("okular::Shell")))
|
if (parent() && (parent()->objectName() == QLatin1String("okular::Shell")))
|
||||||
{
|
{
|
||||||
closeURL();
|
closeUrl();
|
||||||
}
|
}
|
||||||
else KMessageBox::information(widget(), i18n("This link points to a close document action that does not work when using the embedded viewer."), QString::null, "warnNoCloseIfNotInKPDF");
|
else KMessageBox::information(widget(), i18n("This link points to a close document action that does not work when using the embedded viewer."), QString::null, "warnNoCloseIfNotInKPDF");
|
||||||
}
|
}
|
||||||
|
@ -919,17 +919,17 @@ void Part::slotFindNext()
|
||||||
|
|
||||||
void Part::slotSaveFileAs()
|
void Part::slotSaveFileAs()
|
||||||
{
|
{
|
||||||
KUrl saveURL = KFileDialog::getSaveUrl( url().isLocalFile() ? url().url() : url().fileName(), QString::null, widget() );
|
KUrl saveUrl = KFileDialog::getSaveUrl( url().isLocalFile() ? url().url() : url().fileName(), QString::null, widget() );
|
||||||
if ( saveURL.isValid() && !saveURL.isEmpty() )
|
if ( saveUrl.isValid() && !saveUrl.isEmpty() )
|
||||||
{
|
{
|
||||||
if ( KIO::NetAccess::exists( saveURL, false, widget() ) )
|
if ( KIO::NetAccess::exists( saveUrl, false, widget() ) )
|
||||||
{
|
{
|
||||||
if (KMessageBox::warningContinueCancel( widget(), i18n("A file named \"%1\" already exists. Are you sure you want to overwrite it?", saveURL.fileName()), QString::null, i18n("Overwrite")) != KMessageBox::Continue)
|
if (KMessageBox::warningContinueCancel( widget(), i18n("A file named \"%1\" already exists. Are you sure you want to overwrite it?", saveUrl.fileName()), QString::null, i18n("Overwrite")) != KMessageBox::Continue)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !KIO::NetAccess::file_copy( url(), saveURL, -1, true ) )
|
if ( !KIO::NetAccess::file_copy( url(), saveUrl, -1, true ) )
|
||||||
KMessageBox::information( widget(), i18n("File could not be saved in '%1'. Try to save it to another location.", saveURL.prettyUrl() ) );
|
KMessageBox::information( widget(), i18n("File could not be saved in '%1'. Try to save it to another location.", saveUrl.prettyUrl() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1197,7 +1197,7 @@ void Part::doPrint(KPrinter &printer)
|
||||||
|
|
||||||
void Part::restoreDocument(const KUrl &url, int page)
|
void Part::restoreDocument(const KUrl &url, int page)
|
||||||
{
|
{
|
||||||
if (openURL(url)) goToPage(page);
|
if (openUrl(url)) goToPage(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Part::saveDocumentRestoreInfo(KConfig* config)
|
void Part::saveDocumentRestoreInfo(KConfig* config)
|
||||||
|
|
6
part.h
6
part.h
|
@ -100,15 +100,15 @@ signals:
|
||||||
protected:
|
protected:
|
||||||
// reimplemented from KParts::ReadOnlyPart
|
// reimplemented from KParts::ReadOnlyPart
|
||||||
bool openFile();
|
bool openFile();
|
||||||
bool openURL(const KUrl &url);
|
bool openUrl(const KUrl &url);
|
||||||
bool closeURL();
|
bool closeUrl();
|
||||||
// filter that watches for splitter size changes
|
// filter that watches for splitter size changes
|
||||||
bool eventFilter( QObject * watched, QEvent * e );
|
bool eventFilter( QObject * watched, QEvent * e );
|
||||||
void supportedMimetypes();
|
void supportedMimetypes();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
// connected to actions
|
// connected to actions
|
||||||
void openURLFromDocument(const KUrl &url);
|
void openUrlFromDocument(const KUrl &url);
|
||||||
void slotGoToPage();
|
void slotGoToPage();
|
||||||
void slotHistoryBack();
|
void slotHistoryBack();
|
||||||
void slotHistoryNext();
|
void slotHistoryNext();
|
||||||
|
|
|
@ -114,7 +114,7 @@ void Shell::init()
|
||||||
|
|
||||||
void Shell::delayedOpen()
|
void Shell::delayedOpen()
|
||||||
{
|
{
|
||||||
openURL(m_openUrl);
|
openUrl(m_openUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
Shell::~Shell()
|
Shell::~Shell()
|
||||||
|
@ -124,7 +124,7 @@ Shell::~Shell()
|
||||||
if ( m_tempfile ) delete m_tempfile;
|
if ( m_tempfile ) delete m_tempfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shell::openURL( const KUrl & url )
|
void Shell::openUrl( const KUrl & url )
|
||||||
{
|
{
|
||||||
if ( m_part )
|
if ( m_part )
|
||||||
{
|
{
|
||||||
|
@ -157,9 +157,9 @@ void Shell::writeSettings()
|
||||||
void Shell::setupActions()
|
void Shell::setupActions()
|
||||||
{
|
{
|
||||||
KAction * openAction = KStdAction::open(this, SLOT(fileOpen()), actionCollection());
|
KAction * openAction = KStdAction::open(this, SLOT(fileOpen()), actionCollection());
|
||||||
m_recent = KStdAction::openRecent( this, SLOT( openURL( const KUrl& ) ), actionCollection() );
|
m_recent = KStdAction::openRecent( this, SLOT( openUrl( const KUrl& ) ), actionCollection() );
|
||||||
m_recent->setToolBarMode( KRecentFilesAction::MenuMode );
|
m_recent->setToolBarMode( KRecentFilesAction::MenuMode );
|
||||||
connect( m_recent, SIGNAL( urlSelected( const KUrl& ) ), this, SLOT( openURL( const KUrl& ) ) );
|
connect( m_recent, SIGNAL( urlSelected( const KUrl& ) ), this, SLOT( openUrl( const KUrl& ) ) );
|
||||||
connect( m_recent, SIGNAL( triggered() ), this, SLOT( fileOpen() ) );
|
connect( m_recent, SIGNAL( triggered() ), this, SLOT( fileOpen() ) );
|
||||||
m_recent->setWhatsThis( i18n( "<b>Click</b> to open a file or <b>Click and hold</b> to select a recent file" ) );
|
m_recent->setWhatsThis( i18n( "<b>Click</b> to open a file or <b>Click and hold</b> to select a recent file" ) );
|
||||||
m_printAction = KStdAction::print( m_part, SLOT( slotPrint() ), actionCollection() );
|
m_printAction = KStdAction::print( m_part, SLOT( slotPrint() ), actionCollection() );
|
||||||
|
@ -374,7 +374,7 @@ void Shell::fileOpen()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (reallyOpen)
|
if (reallyOpen)
|
||||||
openURL(url);
|
openUrl(url);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -85,7 +85,7 @@ class Part;
|
||||||
void slotUpdateFullScreen();
|
void slotUpdateFullScreen();
|
||||||
void slotShowMenubar();
|
void slotShowMenubar();
|
||||||
|
|
||||||
void openURL( const KUrl & url );
|
void openUrl( const KUrl & url );
|
||||||
void delayedOpen();
|
void delayedOpen();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
Loading…
Reference in a new issue