[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [okular] /: Introduce notifyCurrentPageChanged callback DocumentObserver interface
From:       Tobias Koenig <tokoe () kde ! org>
Date:       2012-09-06 6:49:15
Message-ID: 20120906064915.8CA3AA6094 () git ! kde ! org
[Download RAW message or body]

Git commit d3e0dadcacd3f11bb536968b5ebccf8377513f27 by Tobias Koenig.
Committed on 16/08/2012 at 17:37.
Pushed by tokoe into branch 'master'.

Introduce notifyCurrentPageChanged callback DocumentObserver interface

M  +1    -1    CMakeLists.txt
M  +11   -0    core/document.cpp
M  +4    -0    core/observer.cpp
M  +10   -0    core/observer.h
M  +17   -19   ui/minibar.cpp
M  +2    -4    ui/minibar.h
M  +8    -11   ui/pagesizelabel.cpp
M  +1    -2    ui/pagesizelabel.h
M  +69   -57   ui/presentationwidget.cpp
M  +2    -0    ui/presentationwidget.h
M  +4    -2    ui/side_reviews.cpp
M  +1    -1    ui/side_reviews.h
M  +5    -4    ui/thumbnaillist.cpp
M  +1    -1    ui/thumbnaillist.h
M  +2    -9    ui/toc.cpp
M  +1    -2    ui/toc.h

http://commits.kde.org/okular/d3e0dadcacd3f11bb536968b5ebccf8377513f27

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 31d0da5..e75f768 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -120,7 +120,7 @@ ENDIF(APPLE)
 
 target_link_libraries(okularcore  ${OKULAR_IOKIT} ${KDE4_KIO_LIBS} \
${KDE4_PHONON_LIBRARY} ${KDE4_KJSAPI_LIBRARY} ${MATH_LIB} \
${KDE4_THREADWEAVER_LIBRARY} )  
-set_target_properties(okularcore PROPERTIES VERSION 1.9.0 SOVERSION 1 )
+set_target_properties(okularcore PROPERTIES VERSION 2.0.0 SOVERSION 1 )
 
 install(TARGETS okularcore ${INSTALL_TARGETS_DEFAULT_ARGS} )
 
diff --git a/core/document.cpp b/core/document.cpp
index f6bf699..9d6b25c 100644
--- a/core/document.cpp
+++ b/core/document.cpp
@@ -2788,6 +2788,8 @@ void Document::setViewport( const DocumentViewport & viewport, \
int excludeId, bo  //if ( viewport == oldViewport )
     //    kDebug(OkularDebug) << "setViewport with the same viewport.";
 
+    const int oldPageNumber = oldViewport.pageNumber;
+
     // set internal viewport taking care of history
     if ( oldViewport.pageNumber == viewport.pageNumber || !oldViewport.isValid() )
     {
@@ -2807,11 +2809,20 @@ void Document::setViewport( const DocumentViewport & \
                viewport, int excludeId, bo
         d->m_viewportIterator = d->m_viewportHistory.insert( \
d->m_viewportHistory.end(), viewport );  }
 
+    const int currentViewportPage = (*d->m_viewportIterator).pageNumber;
+
+    const bool currentPageChanged = (oldPageNumber != currentViewportPage);
+
     // notify change to all other (different from id) observers
     QMap< int, DocumentObserver * >::const_iterator it = \
d->m_observers.constBegin(), end = d->m_observers.constEnd();  for ( ; it != end ; ++ \
it ) +    {
         if ( it.key() != excludeId )
             (*it)->notifyViewportChanged( smoothMove );
+
+        if ( currentPageChanged )
+            (*it)->notifyCurrentPageChanged( oldPageNumber, currentViewportPage );
+    }
 }
 
 void Document::setZoom(int factor, int excludeId)
diff --git a/core/observer.cpp b/core/observer.cpp
index 0201a1d..59bbb11 100644
--- a/core/observer.cpp
+++ b/core/observer.cpp
@@ -48,3 +48,7 @@ bool DocumentObserver::canUnloadPixmap( int ) const
 {
     return true;
 }
+
+void DocumentObserver::notifyCurrentPageChanged( int, int )
+{
+}
diff --git a/core/observer.h b/core/observer.h
index 76c096c..f7189be 100644
--- a/core/observer.h
+++ b/core/observer.h
@@ -130,6 +130,16 @@ class OKULAR_EXPORT DocumentObserver
          */
         virtual bool canUnloadPixmap( int page ) const;
 
+        /**
+         * This method is called after the current page of the document has been \
entered. +         *
+         * @param previous The number of the previous page (is @c -1 for the initial \
page change). +         * @param current The number of the current page.
+         *
+         * @since 0.16 (KDE 4.10)
+         */
+        virtual void notifyCurrentPageChanged( int previous, int current );
+
     private:
         class Private;
         const Private* d;
diff --git a/ui/minibar.cpp b/ui/minibar.cpp
index 051df72..b9e1291 100644
--- a/ui/minibar.cpp
+++ b/ui/minibar.cpp
@@ -42,7 +42,6 @@ class HoverButton : public QToolButton
 MiniBarLogic::MiniBarLogic( QObject * parent, Okular::Document * document )
  : QObject(parent)
  , m_document( document )
- , m_currentPage( -1 )
 {
 }   
 
@@ -68,7 +67,7 @@ Okular::Document *MiniBarLogic::document() const
 
 int MiniBarLogic::currentPage() const
 {
-    return m_currentPage;
+    return m_document->currentPage();
 }
 
 void MiniBarLogic::notifySetup( const QVector< Okular::Page * > & pageVector, int \
setupFlags ) @@ -81,7 +80,6 @@ void MiniBarLogic::notifySetup( const QVector< \
Okular::Page * > & pageVector, in  const int pages = pageVector.count();
     if ( pages < 1 )
     {
-        m_currentPage = -1;
         foreach ( MiniBar *miniBar, m_miniBars )
         {
             miniBar->setEnabled( false );
@@ -124,24 +122,24 @@ void MiniBarLogic::notifySetup( const QVector< Okular::Page * > \
& pageVector, in  }
 }
 
-void MiniBarLogic::notifyViewportChanged( bool /*smoothMove*/ )
+void MiniBarLogic::notifyCurrentPageChanged( int previousPage, int currentPage )
 {
+    Q_UNUSED( previousPage )
+
     // get current page number
-    const int page = m_document->viewport().pageNumber;
     const int pages = m_document->pages();
 
     // if the document is opened and page is changed
-    if ( page != m_currentPage && pages > 0 )
+    if ( pages > 0 )
     {
-        m_currentPage = page;
-        const QString pageNumber = QString::number( page + 1 );
-        const QString pageLabel = m_document->page(page)->label();
-        
+        const QString pageNumber = QString::number( currentPage + 1 );
+        const QString pageLabel = m_document->page( currentPage )->label();
+
         foreach ( MiniBar *miniBar, m_miniBars )
         {
             // update prev/next button state
-            miniBar->m_prevButton->setEnabled( page > 0 );
-            miniBar->m_nextButton->setEnabled( page < ( pages - 1 ) );
+            miniBar->m_prevButton->setEnabled( currentPage > 0 );
+            miniBar->m_nextButton->setEnabled( currentPage < ( pages - 1 ) );
             // update text on widgets
             miniBar->m_pageNumberEdit->setText( pageNumber );
             miniBar->m_pageNumberLabel->setText( pageNumber );
@@ -292,7 +290,7 @@ void MiniBar::resizeForPage( int pages )
 
 ProgressWidget::ProgressWidget( QWidget * parent, Okular::Document * document )
     : QWidget( parent ), m_document( document ),
-    m_currentPage( -1 ), m_progressPercentage( -1 )
+    m_progressPercentage( -1 )
 {
     setObjectName( QLatin1String( "progress" ) );
     setAttribute( Qt::WA_OpaquePaintEvent, true );
@@ -305,18 +303,18 @@ ProgressWidget::~ProgressWidget()
     m_document->removeObserver( this );
 }
 
-void ProgressWidget::notifyViewportChanged( bool /*smoothMove*/ )
+void ProgressWidget::notifyCurrentPageChanged( int previousPage, int currentPage )
 {
+    Q_UNUSED( previousPage )
+
     // get current page number
-    int page = m_document->viewport().pageNumber;
     int pages = m_document->pages();
 
     // if the document is opened and page is changed
-    if ( page != m_currentPage && pages > 0 )
+    if ( pages > 0 )
     {
         // update percentage
-        m_currentPage = page;
-        float percentage = pages < 2 ? 1.0 : (float)page / (float)(pages - 1);
+        const float percentage = pages < 2 ? 1.0 : (float)currentPage / \
(float)(pages - 1);  setProgress( percentage );
     }
 }
@@ -332,7 +330,7 @@ void ProgressWidget::slotGotoNormalizedPage( float index )
     // figure out page number and go to that page
     int number = (int)( index * (float)m_document->pages() );
     if ( number >= 0 && number < (int)m_document->pages() &&
-         number != m_currentPage )
+         number != (int)m_document->currentPage() )
         m_document->setViewportPage( number );
 }
 
diff --git a/ui/minibar.h b/ui/minibar.h
index acb1163..a0c0514 100644
--- a/ui/minibar.h
+++ b/ui/minibar.h
@@ -90,12 +90,11 @@ class MiniBarLogic : public QObject, public \
Okular::DocumentObserver  // [INHERITED] from DocumentObserver
         uint observerId() const { return MINIBAR_ID; }
         void notifySetup( const QVector< Okular::Page * > & pages, int setupFlags );
-        void notifyViewportChanged( bool smoothMove );
+        void notifyCurrentPageChanged( int previous, int current );
         
     private:
         QSet<MiniBar *> m_miniBars;
         Okular::Document * m_document;
-        int m_currentPage;
 };
 
 /**
@@ -147,7 +146,7 @@ class ProgressWidget : public QWidget, public \
Okular::DocumentObserver  
         // [INHERITED] from DocumentObserver
         uint observerId() const { return PROGRESSWIDGET_ID; }
-        void notifyViewportChanged( bool smoothMove );
+        void notifyCurrentPageChanged( int previous, int current );
 
         void slotGotoNormalizedPage( float index );
 
@@ -165,7 +164,6 @@ class ProgressWidget : public QWidget, public \
Okular::DocumentObserver  
     private:
         Okular::Document * m_document;
-        int m_currentPage;
         float m_progressPercentage;
 };
 
diff --git a/ui/pagesizelabel.cpp b/ui/pagesizelabel.cpp
index 4a80779..aa4a043 100644
--- a/ui/pagesizelabel.cpp
+++ b/ui/pagesizelabel.cpp
@@ -13,7 +13,7 @@
 
 PageSizeLabel::PageSizeLabel( QWidget * parent, Okular::Document * document )
     : QLabel( parent ), m_document( document ),
-    m_currentPage( -1 ), m_antiWidget( NULL )
+    m_antiWidget( NULL )
 {
 }
 
@@ -55,20 +55,17 @@ void PageSizeLabel::notifySetup( const QVector< Okular::Page * > \
& pageVector, i  }
 }
 
-void PageSizeLabel::notifyViewportChanged( bool /*smoothMove*/ )
+void PageSizeLabel::notifyCurrentPageChanged( int previousPage, int currentPage )
 {
+    Q_UNUSED( previousPage )
+
     if (isVisible())
     {
-        // get current page number
-        int page = m_document->viewport().pageNumber;
-        int pages = m_document->pages();
-
-        // if the document is opened and page is changed
-        if ( page != m_currentPage && pages > 0 )
+        // if the document is opened
+        if ( m_document->pages() > 0 )
         {
-            m_currentPage = page;
-            setText( m_document->pageSizeString(page) );
-            m_antiWidget->setFixedSize(sizeHint());
+            setText( m_document->pageSizeString( currentPage ) );
+            m_antiWidget->setFixedSize( sizeHint() );
         }
    }
 }
diff --git a/ui/pagesizelabel.h b/ui/pagesizelabel.h
index ea508b8..7c4a1e2 100644
--- a/ui/pagesizelabel.h
+++ b/ui/pagesizelabel.h
@@ -34,11 +34,10 @@ class PageSizeLabel : public QLabel, public \
Okular::DocumentObserver  // [INHERITED] from DocumentObserver
         uint observerId() const { return PAGESIZELABEL_ID; }
         void notifySetup( const QVector< Okular::Page * > & pages, int setupFlags );
-        void notifyViewportChanged( bool smoothMove );
+        void notifyCurrentPageChanged( int previous, int current );
 
     private:
         Okular::Document * m_document;
-        int m_currentPage;
         QWidget *m_antiWidget;
 };
 
diff --git a/ui/presentationwidget.cpp b/ui/presentationwidget.cpp
index 37523e8..6eca796 100644
--- a/ui/presentationwidget.cpp
+++ b/ui/presentationwidget.cpp
@@ -132,7 +132,8 @@ PresentationWidget::PresentationWidget( QWidget * parent, \
Okular::Document * doc  m_pressedLink( 0 ), m_handCursor( false ), m_drawingEngine( 0 \
),  m_parentWidget( parent ),
     m_document( doc ), m_frameIndex( -1 ), m_topBar( 0 ), m_pagesEdit( 0 ), \
                m_searchBar( 0 ),
-    m_screenSelect( 0 ), m_isSetup( false ), m_blockNotifications( false ), \
m_inBlackScreenMode( false ) +    m_screenSelect( 0 ), m_isSetup( false ), \
m_blockNotifications( false ), m_inBlackScreenMode( false ), +    m_showSummaryView( \
Okular::Settings::slidesShowSummary() )  {
     Q_UNUSED( parent )
     setAttribute( Qt::WA_DeleteOnClose );
@@ -342,10 +343,6 @@ void PresentationWidget::notifySetup( const QVector< \
Okular::Page * > & pageSet,  
 void PresentationWidget::notifyViewportChanged( bool /*smoothMove*/ )
 {
-    // discard notifications if displaying the summary
-    if ( m_frameIndex == -1 && Okular::Settings::slidesShowSummary() )
-        return;
-
     // display the current page
     changePage( m_document->viewport().pageNumber );
 
@@ -364,6 +361,64 @@ void PresentationWidget::notifyPageChanged( int pageNumber, int \
                changedFlags )
         generatePage( changedFlags & ( DocumentObserver::Annotations | \
DocumentObserver::Highlights ) );  }
 
+void PresentationWidget::notifyCurrentPageChanged( int previousPage, int currentPage \
) +{
+    if ( previousPage != -1 )
+    {
+        // remove the drawings on the old page before switching
+        clearDrawings();
+
+        // stop video playback
+        Q_FOREACH ( VideoWidget *vw, m_frames[ previousPage ]->videoWidgets )
+        {
+            vw->stop();
+            vw->pageLeft();
+        }
+
+        // stop audio playback, if any
+        Okular::AudioPlayer::instance()->stopPlaybacks();
+
+        // perform the page closing action, if any
+        if ( m_document->page( previousPage )->pageAction( Okular::Page::Closing ) )
+            m_document->processAction( m_document->page( previousPage )->pageAction( \
Okular::Page::Closing ) ); +    }
+
+    if ( currentPage != -1 )
+    {
+        m_frameIndex = currentPage;
+
+        // check if pixmap exists or else request it
+        PresentationFrame * frame = m_frames[ m_frameIndex ];
+        int pixW = frame->geometry.width();
+        int pixH = frame->geometry.height();
+
+        bool signalsBlocked = m_pagesEdit->signalsBlocked();
+        m_pagesEdit->blockSignals( true );
+        m_pagesEdit->setText( QString::number( m_frameIndex + 1 ) );
+        m_pagesEdit->blockSignals( signalsBlocked );
+
+        // if pixmap not inside the Okular::Page we request it and wait for
+        // notifyPixmapChanged call or else we can proceed to pixmap generation
+        if ( !frame->page->hasPixmap( PRESENTATION_ID, pixW, pixH ) )
+        {
+            requestPixmaps();
+        }
+        else
+        {
+            // make the background pixmap
+            generatePage();
+        }
+
+        // perform the page opening action, if any
+        if ( m_document->page( m_frameIndex )->pageAction( Okular::Page::Opening ) )
+            m_document->processAction( m_document->page( m_frameIndex )->pageAction( \
Okular::Page::Opening ) ); +
+        // start autoplay video playback
+        Q_FOREACH ( VideoWidget *vw, m_frames[ m_frameIndex ]->videoWidgets )
+            vw->pageEntered();
+    }
+}
+
 bool PresentationWidget::canUnloadPixmap( int pageNumber ) const
 {
     if ( Okular::Settings::memoryLevel() == Okular::Settings::EnumMemoryLevel::Low \
|| @@ -796,63 +851,20 @@ void PresentationWidget::overlayClick( const QPoint & \
position )  
 void PresentationWidget::changePage( int newPage )
 {
-    if ( m_frameIndex == newPage )
+    if ( m_showSummaryView ) {
+        m_showSummaryView = false;
+        m_frameIndex = -1;
         return;
-
-    // prepare to leave the current page
-    if ( m_frameIndex != -1 )
-    {
-        // remove the drawings on the old page before switching
-        clearDrawings();
-
-        // stop video playback
-        Q_FOREACH ( VideoWidget *vw, m_frames[ m_frameIndex ]->videoWidgets )
-        {
-            vw->stop();
-            vw->pageLeft();
-        }
-
-        // stop audio playback, if any
-        Okular::AudioPlayer::instance()->stopPlaybacks();
-
-        // perform the page closing action, if any
-        if ( m_document->page( m_frameIndex )->pageAction( Okular::Page::Closing ) )
-            m_document->processAction( m_document->page( m_frameIndex )->pageAction( \
Okular::Page::Closing ) );  }
 
-    // switch to newPage
-    m_frameIndex = newPage;
-    m_document->setViewportPage( m_frameIndex, PRESENTATION_ID );
-
-    // check if pixmap exists or else request it
-    PresentationFrame * frame = m_frames[ m_frameIndex ];
-    int pixW = frame->geometry.width();
-    int pixH = frame->geometry.height();
-
-    bool signalsBlocked = m_pagesEdit->signalsBlocked();
-    m_pagesEdit->blockSignals( true );
-    m_pagesEdit->setText( QString::number( m_frameIndex + 1 ) );
-    m_pagesEdit->blockSignals( signalsBlocked );
-
-    // if pixmap not inside the Okular::Page we request it and wait for
-    // notifyPixmapChanged call or else we can proceed to pixmap generation
-    if ( !frame->page->hasPixmap( PRESENTATION_ID, pixW, pixH ) )
-    {
-        requestPixmaps();
-    }
-    else
-    {
-        // make the background pixmap
-        generatePage();
-    }
+    if ( m_frameIndex == newPage )
+        return;
 
-    // perform the page opening action, if any
-    if ( m_document->page( m_frameIndex )->pageAction( Okular::Page::Opening ) )
-        m_document->processAction( m_document->page( m_frameIndex )->pageAction( \
Okular::Page::Opening ) ); +    // switch to newPage
+    m_document->setViewportPage( newPage, PRESENTATION_ID );
 
-    // start autoplay video playback
-    Q_FOREACH ( VideoWidget *vw, m_frames[ m_frameIndex ]->videoWidgets )
-        vw->pageEntered();
+    if ( (Okular::Settings::slidesShowSummary() && !m_showSummaryView) || \
m_frameIndex == -1 ) +        notifyCurrentPageChanged( -1, newPage );
 }
 
 void PresentationWidget::generatePage( bool disableTransition )
diff --git a/ui/presentationwidget.h b/ui/presentationwidget.h
index 20dbcbb..f37e6e2 100644
--- a/ui/presentationwidget.h
+++ b/ui/presentationwidget.h
@@ -53,6 +53,7 @@ class PresentationWidget : public QWidget, public \
Okular::DocumentObserver  void notifyViewportChanged( bool smoothMove );
         void notifyPageChanged( int pageNumber, int changedFlags );
         bool canUnloadPixmap( int pageNumber ) const;
+        void notifyCurrentPageChanged( int previous, int current );
 
     public slots:
         void slotFind();
@@ -133,6 +134,7 @@ class PresentationWidget : public QWidget, public \
Okular::DocumentObserver  bool m_isSetup;
         bool m_blockNotifications;
         bool m_inBlackScreenMode;
+        bool m_showSummaryView;
 
     private slots:
         void slotNextPage();
diff --git a/ui/side_reviews.cpp b/ui/side_reviews.cpp
index a036c48..a35f9ed 100644
--- a/ui/side_reviews.cpp
+++ b/ui/side_reviews.cpp
@@ -158,9 +158,11 @@ Reviews::~Reviews()
 }
 
 //BEGIN DocumentObserver Notifies 
-void Reviews::notifyViewportChanged( bool )
+void Reviews::notifyCurrentPageChanged( int previousPage, int currentPage )
 {
-    m_filterProxy->setCurrentPage( m_document->currentPage() );
+    Q_UNUSED( previousPage )
+
+    m_filterProxy->setCurrentPage( currentPage );
 }
 //END DocumentObserver Notifies 
 
diff --git a/ui/side_reviews.h b/ui/side_reviews.h
index d063b7b..bbd8324 100644
--- a/ui/side_reviews.h
+++ b/ui/side_reviews.h
@@ -42,7 +42,7 @@ class Reviews : public QWidget, public Okular::DocumentObserver
 
         // [INHERITED] from DocumentObserver
         uint observerId() const { return REVIEWS_ID; }
-        void notifyViewportChanged( bool smoothMove );
+        void notifyCurrentPageChanged( int previous, int current );
 
         void reparseConfig();
 
diff --git a/ui/thumbnaillist.cpp b/ui/thumbnaillist.cpp
index 8b23025..60288cb 100644
--- a/ui/thumbnaillist.cpp
+++ b/ui/thumbnaillist.cpp
@@ -310,11 +310,12 @@ void ThumbnailList::notifySetup( const QVector< Okular::Page * \
> & pages, int se  d->delayedRequestVisiblePixmaps( 200 );
 }
 
-void ThumbnailList::notifyViewportChanged( bool /*smoothMove*/ )
+void ThumbnailList::notifyCurrentPageChanged( int previousPage, int currentPage )
 {
+    Q_UNUSED( previousPage )
+
     // skip notifies for the current page (already selected)
-    const int newPage = d->m_document->viewport().pageNumber;
-    if ( d->m_selected && d->m_selected->pageNumber() == newPage )
+    if ( d->m_selected && d->m_selected->pageNumber() == currentPage )
         return;
 
     // deselect previous thumbnail
@@ -327,7 +328,7 @@ void ThumbnailList::notifyViewportChanged( bool /*smoothMove*/ )
     QVector<ThumbnailWidget *>::const_iterator tIt = d->m_thumbnails.constBegin(), \
tEnd = d->m_thumbnails.constEnd();  for ( ; tIt != tEnd; ++tIt )
     {
-        if ( (*tIt)->pageNumber() == newPage )
+        if ( (*tIt)->pageNumber() == currentPage )
         {
             d->m_selected = *tIt;
             d->m_selected->setSelected( true );
diff --git a/ui/thumbnaillist.h b/ui/thumbnaillist.h
index 0d7136b..20c434f 100644
--- a/ui/thumbnaillist.h
+++ b/ui/thumbnaillist.h
@@ -41,7 +41,7 @@ Q_OBJECT
         // inherited: create thumbnails ( inherited as a DocumentObserver )
         void notifySetup( const QVector< Okular::Page * > & pages, int setupFlags );
         // inherited: hilihght current thumbnail ( inherited as DocumentObserver )
-        void notifyViewportChanged( bool smoothMove );
+        void notifyCurrentPageChanged( int previous, int current );
         // inherited: redraw thumbnail ( inherited as DocumentObserver )
         void notifyPageChanged( int pageNumber, int changedFlags );
         // inherited: request all visible pixmap (due to a global shange or so..)
diff --git a/ui/toc.cpp b/ui/toc.cpp
index 3203c79..4c84b62 100644
--- a/ui/toc.cpp
+++ b/ui/toc.cpp
@@ -25,7 +25,7 @@
 #include "core/document.h"
 #include "settings.h"
 
-TOC::TOC(QWidget *parent, Okular::Document *document) : QWidget(parent), \
m_document(document), m_currentPage(-1) +TOC::TOC(QWidget *parent, Okular::Document \
*document) : QWidget(parent), m_document(document)  {
     QVBoxLayout *mainlay = new QVBoxLayout( this );
     mainlay->setMargin( 0 );
@@ -69,7 +69,6 @@ void TOC::notifySetup( const QVector< Okular::Page * > & /*pages*/, \
int setupFla  
     // clear contents
     m_model->clear();
-    m_currentPage = -1;
 
     // request synopsis description (is a dom tree)
     const Okular::DocumentSynopsis * syn = m_document->documentSynopsis();
@@ -86,14 +85,8 @@ void TOC::notifySetup( const QVector< Okular::Page * > & \
/*pages*/, int setupFla  emit hasTOC( !m_model->isEmpty() );
 }
 
-void TOC::notifyViewportChanged( bool /*smoothMove*/ )
+void TOC::notifyCurrentPageChanged( int, int )
 {
-    int newpage = m_document->viewport().pageNumber;
-    if ( m_currentPage == newpage )
-        return;
-
-    m_currentPage = newpage;
-
     m_model->setCurrentViewport( m_document->viewport() );
 }
 
diff --git a/ui/toc.h b/ui/toc.h
index 4e63ef6..eeeff98 100644
--- a/ui/toc.h
+++ b/ui/toc.h
@@ -33,7 +33,7 @@ Q_OBJECT
         // inherited from DocumentObserver
         uint observerId() const;
         void notifySetup( const QVector< Okular::Page * > & pages, int setupFlags );
-        void notifyViewportChanged( bool smoothMove );
+        void notifyCurrentPageChanged( int previous, int current );
 
         void reparseConfig();
 
@@ -49,7 +49,6 @@ Q_OBJECT
         QTreeView *m_treeView;
         KTreeViewSearchLine *m_searchLine;
         TOCModel *m_model;
-        int m_currentPage;
 };
 
 #endif


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic