Bug 106767 - when open pdf by hyperlink from another pdf it's not displayed in the main window
Summary: when open pdf by hyperlink from another pdf it's not displayed in the main wi...
Status: RESOLVED FIXED
Alias: None
Product: kpdf
Classification: Unmaintained
Component: general (show other bugs)
Version: 0.4
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Albert Astals Cid
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-04 11:31 UTC by Ilia K.
Modified: 2005-06-04 12:31 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ilia K. 2005-06-04 11:31:51 UTC
Version:           0.4 (using KDE 3.4.0%2C%2520ALT%2520Linux)
Compiler:          gcc%2520version%25203.4.3%252020050314%2520%28ALT%2520Linux%2C%2520build%25203.4.3-alt6%29
OS:                Linux%2520%28i686%29%2520release%25202.6.11-std26-up-alt6

Discovered, when I've read pdf presentations from
http://www.math.uakron.edu/~dpstory/e-calculus.html#starteCalculus

1. On the above page click on "e-Calculus" logo to open pdf file, or just open it with URL:
http://www.math.uakron.edu/~dpstory/tutorial/mainmenu.pdf

2. On the first slide click on the "e-Calculus" logo (2nd bullet), which is hyperlink to another pdf:
http://www.math.uakron.edu/~dpstory/tutorial/maintut.pdf
Or try the same with the 3rd bullet.

This last pdf is opened, but only thumbnails are displayed, nothing is displayed at the main window. However, if I change any property in the "View" menu, it begins to display.


There are a lot of files in the AcroTeX project ( http://www.math.uakron.edu/~dpstory/acrotex.html ), which uses advanced pdf features, which may not work in current kpdf, such as pdf forms (6th slide on the mainmenu.pdf, mentioned above). 
Should I open separated bugs on each one, which I'll (probably) found, or you already have a list of Acrobat features, kpdf still lacks?
Comment 1 Ilia K. 2005-06-04 12:04:06 UTC
Some additions: 
as opposite to hyperlinks inside the same file, when jumping by
hyperlink to another file, "Back" (or "Previous") arrow is not
available (looks grey)
Comment 2 Albert Astals Cid 2005-06-04 12:11:54 UTC
Answer to bug:
 I'm looking at it, it's strange since it was working, but i supose a fix to fix other bug made this not work.
 About other bugs obviously report them to bugzilla but PLEASE check that they are not already filled (like the forms support).

About comment #1:
  This is a completely different thing, and i don't even think it is a bug but a wish.
Comment 3 Albert Astals Cid 2005-06-04 12:31:26 UTC
SVN commit 422023 by aacid:

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


 M  +1 -0      part.rc  
 M  +18 -12    ui/pageview.cpp  


--- trunk/KDE/kdegraphics/kpdf/part.rc #422022:422023
@@ -15,6 +15,7 @@
     <Action name="presentation"/>
     <Separator/>
     <Action name="zoom_in"/>
+<Action name="zoom_to" />
     <Action name="zoom_out"/>
     <Action name="zoom_fit_width"/>
     <Action name="zoom_fit_page"/>
--- trunk/KDE/kdegraphics/kpdf/ui/pageview.cpp #422022:422023
@@ -263,9 +263,13 @@
     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,18 +908,20 @@
                     const KPDFLink * link = static_cast< const KPDFLink * >( linkRect->pointer() );
                     d->document->processLink( link );
                 }
-
-                imageRect = pageItem->page()->hasObject( ObjectRect::Image, nX, nY );
-                if ( imageRect )
+                else
                 {
-                    // handle click over a image
+                    // 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 );
+                    }
                 }
-
-                if (!linkRect && !imageRect)
-                {
-                    // if not on a rect, the click selects the page
-                    d->document->setViewportPage( pageItem->pageNumber(), PAGEVIEW_ID );
-                }
             }
             else if ( rightButton )
             {