diff --git a/core/document.cpp b/core/document.cpp index e652ef92d..0c4b5c3c0 100644 --- a/core/document.cpp +++ b/core/document.cpp @@ -442,7 +442,7 @@ void KPDFDocument::setPrevPage() setViewport( DocumentViewport( (*d->viewportIterator).pageNumber - 1 ) ); } */ -void KPDFDocument::setViewportPage( int page, int excludeId ) +void KPDFDocument::setViewportPage( int page, int excludeId, bool smoothMove ) { // clamp page in range [0 ... numPages-1] if ( page < 0 ) @@ -451,10 +451,10 @@ void KPDFDocument::setViewportPage( int page, int excludeId ) page = pages_vector.count() - 1; // make a viewport from the page and broadcast it - setViewport( DocumentViewport( page ), excludeId ); + setViewport( DocumentViewport( page ), excludeId, smoothMove ); } -void KPDFDocument::setViewport( const DocumentViewport & viewport, int excludeId ) +void KPDFDocument::setViewport( const DocumentViewport & viewport, int excludeId, bool smoothMove ) { // if already broadcasted, don't redo it DocumentViewport & oldViewport = *d->viewportIterator; @@ -484,7 +484,7 @@ void KPDFDocument::setViewport( const DocumentViewport & viewport, int excludeId QMap< int, DocumentObserver * >::iterator it = d->observers.begin(), end = d->observers.end(); for ( ; it != end ; ++ it ) if ( it.key() != excludeId ) - (*it)->notifyViewportChanged(); + (*it)->notifyViewportChanged( smoothMove ); // [MEM] raise position of currently viewed page in allocation queue if ( d->allocatedPixmapsFifo.count() > 1 ) @@ -515,7 +515,7 @@ void KPDFDocument::setPrevViewport() { // restore previous viewport and notify it to observers --d->viewportIterator; - foreachObserver( notifyViewportChanged() ); + foreachObserver( notifyViewportChanged( true ) ); } } @@ -528,7 +528,7 @@ void KPDFDocument::setNextViewport() { // restore next viewport and notify it to observers ++d->viewportIterator; - foreachObserver( notifyViewportChanged() ); + foreachObserver( notifyViewportChanged( true ) ); } } @@ -592,7 +592,7 @@ bool KPDFDocument::findText( const QString & string, bool keepCase, bool findAhe searchViewport.reCenter.enabled = true; searchViewport.reCenter.normalizedCenterX = (double)center.x() / foundPage->width(); searchViewport.reCenter.normalizedCenterY = (double)center.y() / foundPage->height(); - setViewport( searchViewport ); + setViewport( searchViewport, -1, true ); // notify all observers about hilighting chages foreachObserver( notifyPageChanged( pageNumber, DocumentObserver::Highlights ) ); } diff --git a/core/document.h b/core/document.h index a61f7a23a..6c4eb00b8 100644 --- a/core/document.h +++ b/core/document.h @@ -43,7 +43,7 @@ class KPrinter; * For a better understanding of hieracies @see README.internals.png * @see DocumentObserver, KPDFPage */ -class KPDFDocument : public QObject // only for a private slot.. +class KPDFDocument : public QObject { Q_OBJECT public: @@ -73,8 +73,8 @@ class KPDFDocument : public QObject // only for a private slot.. QString getMetaData( const QString & key, const QString & option = QString() ) const; // perform actions on document / pages - void setViewportPage( int page, int excludeId = -1 ); - void setViewport( const DocumentViewport & viewport, int excludeId = -1 ); + void setViewportPage( int page, int excludeId = -1, bool smoothMove = false ); + void setViewport( const DocumentViewport & viewport, int excludeId = -1, bool smoothMove = false ); void setPrevViewport(); void setNextViewport(); void requestPixmaps( const QValueList< PixmapRequest * > & requests ); diff --git a/core/observer.h b/core/observer.h index 215b34c0a..fabe4ff7d 100644 --- a/core/observer.h +++ b/core/observer.h @@ -46,7 +46,7 @@ class DocumentObserver // commands from the Document to all observers enum ChangedFlags { Pixmap = 1, Bookmark = 2, Highlights = 4 }; virtual void notifySetup( const QValueVector< KPDFPage * > & /*pages*/, bool /*documentChanged*/ ) {}; - virtual void notifyViewportChanged() {}; + virtual void notifyViewportChanged( bool /*smoothMove*/ ) {}; virtual void notifyPageChanged( int /*pageNumber*/, int /*changedFlags*/ ) {}; virtual void notifyContentsCleared( int /*changedFlags*/ ) {}; diff --git a/part.cpp b/part.cpp index a179cc2b2..15d84edeb 100644 --- a/part.cpp +++ b/part.cpp @@ -215,7 +215,8 @@ Part::Part(QWidget *parentWidget, const char *widgetName, m_saveAs = KStdAction::saveAs( this, SLOT( slotSaveFileAs() ), ac, "save" ); m_saveAs->setEnabled( false ); - KStdAction::preferences( this, SLOT( slotPreferences() ), ac, "preferences" ); + KAction * prefs = KStdAction::preferences( this, SLOT( slotPreferences() ), ac, "preferences" ); + prefs->setText( i18n( "Configure PDF Viewer..." ) ); m_printPreview = KStdAction::printPreview( this, SLOT( slotPrintPreview() ), ac ); m_printPreview->setEnabled( false ); @@ -270,7 +271,7 @@ Part::~Part() delete globalParams; } -void Part::notifyViewportChanged() +void Part::notifyViewportChanged( bool /*smoothMove*/ ) { // update actions if the page is changed static int lastPage = -1; @@ -341,6 +342,10 @@ bool Part::openFile() bool Part::openURL(const KURL &url) { + // 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 + // KTar and proceed with the URL of the temporary file + // this calls the above 'openURL' method bool b = KParts::ReadOnlyPart::openURL(url); if ( !b ) diff --git a/part.h b/part.h index 0f2dca5cc..df7585d8c 100644 --- a/part.h +++ b/part.h @@ -68,7 +68,7 @@ public: // inherited from DocumentObserver uint observerId() const { return PART_ID; } - void notifyViewportChanged(); + void notifyViewportChanged( bool smoothMove ); static KAboutData* createAboutData(); diff --git a/ui/minibar.cpp b/ui/minibar.cpp index d5eebb2c1..63c4762c4 100644 --- a/ui/minibar.cpp +++ b/ui/minibar.cpp @@ -170,7 +170,7 @@ void MiniBar::notifySetup( const QValueVector< KPDFPage * > & pageVector, bool c static_cast( parent() )->show(); } -void MiniBar::notifyViewportChanged() +void MiniBar::notifyViewportChanged( bool /*smoothMove*/ ) { // get current page number int page = m_document->viewport().pageNumber; diff --git a/ui/minibar.h b/ui/minibar.h index c74863cc8..afdc01c31 100644 --- a/ui/minibar.h +++ b/ui/minibar.h @@ -30,7 +30,7 @@ class MiniBar : public QFrame, public DocumentObserver // [INHERITED] from DocumentObserver uint observerId() const { return MINIBAR_ID; } void notifySetup( const QValueVector< KPDFPage * > & pages, bool ); - void notifyViewportChanged(); + void notifyViewportChanged( bool smoothMove ); signals: void gotoPage(); diff --git a/ui/pageview.cpp b/ui/pageview.cpp index e053a457f..96126381f 100644 --- a/ui/pageview.cpp +++ b/ui/pageview.cpp @@ -275,7 +275,7 @@ void PageView::notifySetup( const QValueVector< KPDFPage * > & pageSet, bool doc PageViewMessage::Info, 4000 ); } -void PageView::notifyViewportChanged() +void PageView::notifyViewportChanged( bool /*smoothMove*/ ) { // if we are the one changing viewport, skip this nofity if ( d->blockViewport ) diff --git a/ui/pageview.h b/ui/pageview.h index ef46f2f1b..043bb82ee 100644 --- a/ui/pageview.h +++ b/ui/pageview.h @@ -58,7 +58,7 @@ class PageView : public QScrollView, public DocumentObserver // inherited from DocumentObserver uint observerId() const { return PAGEVIEW_ID; } void notifySetup( const QValueVector< KPDFPage * > & pages, bool documentChanged ); - void notifyViewportChanged(); + void notifyViewportChanged( bool smoothMove ); void notifyPageChanged( int pageNumber, int changedFlags ); void notifyContentsCleared( int changedFlags ); bool canUnloadPixmap( int pageNum ); diff --git a/ui/presentationwidget.cpp b/ui/presentationwidget.cpp index 6a1009a54..d6de01536 100644 --- a/ui/presentationwidget.cpp +++ b/ui/presentationwidget.cpp @@ -160,7 +160,7 @@ void PresentationWidget::notifySetup( const QValueVector< KPDFPage * > & pageSet m_metaStrings += i18n( "Click to begin" ); } -void PresentationWidget::notifyViewportChanged() +void PresentationWidget::notifyViewportChanged( bool /*smoothMove*/ ) { changePage( m_document->viewport().pageNumber ); } diff --git a/ui/presentationwidget.h b/ui/presentationwidget.h index d7c1b9312..22323f45b 100644 --- a/ui/presentationwidget.h +++ b/ui/presentationwidget.h @@ -39,7 +39,7 @@ class PresentationWidget : public QWidget, public DocumentObserver // inherited from DocumentObserver uint observerId() const { return PRESENTATION_ID; } void notifySetup( const QValueVector< KPDFPage * > & pages, bool documentChanged ); - void notifyViewportChanged(); + void notifyViewportChanged( bool smoothMove ); void notifyPageChanged( int pageNumber, int changedFlags ); bool canUnloadPixmap( int pageNumber ); diff --git a/ui/thumbnaillist.cpp b/ui/thumbnaillist.cpp index 0c45309d3..5d595e599 100644 --- a/ui/thumbnaillist.cpp +++ b/ui/thumbnaillist.cpp @@ -141,7 +141,7 @@ void ThumbnailList::notifySetup( const QValueVector< KPDFPage * > & pages, bool delayedRequestVisiblePixmaps( 200 ); } -void ThumbnailList::notifyViewportChanged() +void ThumbnailList::notifyViewportChanged( bool /*smoothMove*/ ) { // skip notifies for the current page (already selected) int newPage = m_document->viewport().pageNumber; diff --git a/ui/thumbnaillist.h b/ui/thumbnaillist.h index 35467c1d2..e0f846101 100644 --- a/ui/thumbnaillist.h +++ b/ui/thumbnaillist.h @@ -39,7 +39,7 @@ Q_OBJECT // inherited: create thumbnails ( inherited as a DocumentObserver ) void notifySetup( const QValueVector< KPDFPage * > & pages, bool documentChanged ); // inherited: hilihght current thumbnail ( inherited as DocumentObserver ) - void notifyViewportChanged(); + void notifyViewportChanged( bool smoothMove ); // inherited: redraw thumbnail ( inherited as DocumentObserver ) void notifyPageChanged( int pageNumber, int changedFlags ); // inherited: request all visible pixmap (due to a global shange or so..)