From 37f510a31122b2a42dd3500b747b26fd870318ca Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Sat, 4 Jun 2005 10:30:55 +0000 Subject: [PATCH 1/2] Fix crash on documents like the one on 106767, we must not check for a imagelink if we found a normal link that points to another document because the imagelink does not exists anymore, this was not present on 3.4 but yes on 3.4.1, backporting on a moment Fix bug on 106767, need to relayout the pages when opening a document Enrico please check that both things are "correct" and if they are remove the TODO i added for you ;-) BUGS: 106767 CCMAIL: rosenric@dei.unipd.it svn path=/trunk/KDE/kdegraphics/kpdf/; revision=422023 --- part.rc | 1 + ui/pageview.cpp | 30 ++++++++++++++++++------------ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/part.rc b/part.rc index 92d8ed6a6..a09419e8a 100644 --- a/part.rc +++ b/part.rc @@ -15,6 +15,7 @@ + diff --git a/ui/pageview.cpp b/ui/pageview.cpp index def51773f..97aa9c6be 100644 --- a/ui/pageview.cpp +++ b/ui/pageview.cpp @@ -263,9 +263,13 @@ void PageView::notifySetup( const QValueVector< KPDFPage * > & pageSet, bool doc for ( ; setIt != setEnd; ++setIt ) d->items.push_back( new PageViewItem( *setIt ) ); - // invalidate layout so relayout/repaint will happen on next viewport change if ( pageSet.count() > 0 ) - d->dirtyLayout = true; + // TODO for Enrico: Check if doing always the slotRelayoutPages() is not + // suboptimal in some cases, i'd say it is not but a recheck will not hurt + // Need slotRelayoutPages() here instead of d->dirtyLayout = true + // because opening a pdf from another pdf will not trigger a viewportchange + // so pages are never relayouted + slotRelayoutPages(); else resizeContents( 0, 0 ); @@ -904,17 +908,19 @@ void PageView::contentsMouseReleaseEvent( QMouseEvent * e ) const KPDFLink * link = static_cast< const KPDFLink * >( linkRect->pointer() ); d->document->processLink( link ); } - - imageRect = pageItem->page()->hasObject( ObjectRect::Image, nX, nY ); - if ( imageRect ) - { - // handle click over a image - } - - if (!linkRect && !imageRect) + else { - // if not on a rect, the click selects the page - d->document->setViewportPage( pageItem->pageNumber(), PAGEVIEW_ID ); + // a link can move us to another page or even to another document, there's no point in trying to process the click on the image once we have processes the click on the link + imageRect = pageItem->page()->hasObject( ObjectRect::Image, nX, nY ); + if ( imageRect ) + { + // handle click over a image + } + else + { + // if not on a rect, the click selects the page + d->document->setViewportPage( pageItem->pageNumber(), PAGEVIEW_ID ); + } } } else if ( rightButton ) From e2cdb1ca6c4aa2b254eddfaf1f90b06f25736634 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Sat, 4 Jun 2005 10:31:47 +0000 Subject: [PATCH 2/2] This was not supposed to go in, grrrrrrr svn path=/trunk/KDE/kdegraphics/kpdf/; revision=422024 --- part.rc | 1 - 1 file changed, 1 deletion(-) diff --git a/part.rc b/part.rc index a09419e8a..92d8ed6a6 100644 --- a/part.rc +++ b/part.rc @@ -15,7 +15,6 @@ -