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

List:       kde-commits
Subject:    KDE/kdegraphics/okular/ui
From:       Enrico Ros <rosenric () dei ! unipd ! it>
Date:       2008-11-13 19:23:50
Message-ID: 1226604230.423845.5407.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 883890 by eros:

Keep the Thumbnails list to a clever position when changing the filtering
keyword (instead of going to the top). This way the Tl is closer and more
'in sync' with the current page.

Applied a patch by Luca Burelli.

CCBUG: 175046



 M  +9 -1      thumbnaillist.cpp  


--- trunk/KDE/kdegraphics/okular/ui/thumbnaillist.cpp #883889:883890
@@ -216,7 +216,8 @@
     if ( !( setupFlags & Okular::DocumentObserver::DocumentChanged ) && \
d->m_selected )  {
         prevPage = d->m_selected->page()->number();
-    }
+    } else 
+        prevPage = d->m_document->viewport().pageNumber;
 
     // delete all the Thumbnails
     QVector<ThumbnailWidget *>::const_iterator tIt = d->m_thumbnails.constBegin(), \
tEnd = d->m_thumbnails.constEnd(); @@ -247,6 +248,7 @@
     // generate Thumbnails for the given set of pages
     int width = viewport()->width();
     int height = 0;
+    int centerHeight = 0;
     for ( pIt = pages.constBegin(); pIt != pEnd ; ++pIt )
         //if ( skipCheck || (*pIt)->attributes() & flags )
         if ( skipCheck || (*pIt)->hasHighlights( SW_SEARCH_ID ) )
@@ -258,10 +260,15 @@
             // update total height (asking widget its own height)
             t->resizeFitWidth( width );
             // restoring the previous selected page, if any
+            if ( (*pIt)->number() < prevPage )
+            {
+                centerHeight = height + t->height() + KDialog::spacingHint()/2;
+            }
             if ( (*pIt)->number() == prevPage )
             {
                 d->m_selected = t;
                 d->m_selected->setSelected( true );
+                centerHeight = height + t->height() / 2;
             }
             height += t->height() + KDialog::spacingHint();
         }
@@ -272,6 +279,7 @@
 
     // enable scrollbar when there's something to scroll
     verticalScrollBar()->setEnabled( viewport()->height() < height );
+    verticalScrollBar()->setValue(centerHeight - viewport()->height() / 2);
 
     // request for thumbnail generation
     d->delayedRequestVisiblePixmaps( 200 );


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

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