| Summary: | thumbnail selection is not updated when cleaning a search | ||
|---|---|---|---|
| Product: | [Unmaintained] kpdf | Reporter: | Pino Toscano <pino> | 
| Component: | general | Assignee: | Albert Astals Cid <aacid> | 
| Status: | RESOLVED FIXED | ||
| Severity: | minor | ||
| Priority: | VLO | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | unspecified | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
| 
        
          Description
        
        
          Pino Toscano
        
        
        
        
          2006-02-27 12:38:16 UTC
        
       SVN commit 545855 by pino:
Keep (if possible) the selected page really selected in the thumbnail view when toggling a search.
BUG: 122788
 M  +14 -1     thumbnaillist.cpp  
--- branches/KDE/3.5/kdegraphics/kpdf/ui/thumbnaillist.cpp #545854:545855
@@ -95,8 +95,16 @@
 }
 
 //BEGIN DocumentObserver inherited methods 
-void ThumbnailList::notifySetup( const QValueVector< KPDFPage * > & pages, bool /*documentChanged*/ )
+void ThumbnailList::notifySetup( const QValueVector< KPDFPage * > & pages, bool documentChanged )
 {
+	// if there was a widget selected, save its pagenumber to restore
+	// its selection (if available in the new set of pages)
+	int prevPage = -1;
+	if ( !documentChanged && m_selected )
+	{
+		prevPage = m_selected->page()->number();
+	}
+
 	// delete all the Thumbnails
 	QValueVector<ThumbnailWidget *>::iterator tIt = m_thumbnails.begin(), tEnd = m_thumbnails.end();
 	for ( ; tIt != tEnd; ++tIt )
@@ -138,6 +146,11 @@
             // update total height (asking widget its own height)
             t->resizeFitWidth( width );
             totalHeight += t->heightHint() + 4;
+            if ( (*pIt)->number() == prevPage )
+            {
+                m_selected = t;
+                m_selected->setSelected( true );
+            }
             t->show();
         }
 
 |