Bug 122788 - thumbnail selection is not updated when cleaning a search
Summary: thumbnail selection is not updated when cleaning a search
Status: RESOLVED FIXED
Alias: None
Product: kpdf
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: VLO minor (vote)
Target Milestone: ---
Assignee: Albert Astals Cid
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-27 12:38 UTC by Pino Toscano
Modified: 2006-05-28 16:30 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pino Toscano 2006-02-27 12:38:16 UTC
Version:           0.5.1 (using KDE 3.5.1, Debian Package 4:3.5.1-2 (testing/unstable))
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.14-2-k7

How to reproduce:
1) start a search
2) select from the thumbnails of on the resulting search pages
3) clear the selection by clicking on the button
4) scroll down the thumbnail view and find the previous selected page
That page is not selected anymore in the thumbnail view. Scrolling a bit the page in the page view is enough to make the page in the thumbnail view selected again.
Comment 1 Pino Toscano 2006-05-28 16:30:21 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();
         }