Bug 44855

Summary: Postscript pages list shows only one page
Product: [Unmaintained] kghostview Reporter: peter
Component: generalAssignee: Wilco Greven <greven>
Status: RESOLVED FIXED    
Severity: normal CC: lomov
Priority: NOR    
Version: 0.13.1   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description peter 2002-07-08 00:10:24 UTC
(*** This bug was imported into bugs.kde.org ***)

Package:           kghostview
Version:           0.13.1 (using KDE 3.0.2 )
Severity:          normal
Installed from:    Debian testing/unstable Packages
Compiler:          Not Specified
OS:                Linux
OS/Compiler notes: Not Specified

kghostview displays only the first page of the
document at:
ftp://ftp.cwi.nl/pub/CWIreports/AP/CS-R9567.ps.Z
Only one page shows up in the Pages list at the left (although the file is 33 pages long).
The file displays fine in gv with a complete
page list.
A guess at the possible problem is that the first two pages have negative page numbers (-2 and -1) which may have confused kghostview.

(Submitted via bugs.kde.org)
Comment 1 Stephan Binner 2002-10-05 17:52:42 UTC

*** This bug has been marked as a duplicate of 45450 ***
Comment 2 Luís Pedro Coelho 2003-02-18 14:14:08 UTC
I don't know if this really is a duplicate of 
http://bugs.kde.org/show_bug.cgi?id=45450 . 
 
Here the problem is that kghostview thinks that there is only one page and only 
one page is shown in the "page selection" list on the left. Both 45450 and 47225 
(another duplicate) speak of "the left selection list" being correct. However, 
without a test case it is difficult to be sure whether the problems are related. 
 
The following patch fixes the problem for the given file. It is a patch against CVS 
HEAD ( 18 Fev 2003 ). 
 
The issue is in KDE's DSC error handling function which changes the default error 
handling strategy. I also added two explaining comments. Can anyone review this? 
 
HTH, 
Luis Pedro Coelho 
 
PATCH: 
 
Index: kdscerrordialog.cpp 
=================================================================== 
RCS file: /cvs/kde/kdegraphics/kghostview/kdscerrordialog.cpp,v 
retrieving revision 1.6 
diff -u -3 -p -r1.6 kdscerrordialog.cpp 
--- kdscerrordialog.cpp 9 Jan 2003 12:56:03 -0000       1.6 
+++ kdscerrordialog.cpp 18 Feb 2003 13:12:45 -0000 
@@ -39,7 +39,9 @@ KDSCErrorHandler::Response KDSCErrorThre 
     if( _errorHandler != 0 && err.severity() >= _threshold ) 
        return _errorHandler->error( err ); 
     else 
-       return Ok; 
+       return Cancel; 
+    // Cancel is the default handling strategy for dsc_error_fn, so we keep it. 
+    // This cancels error handling and *not* document parsing! 
 } 
 
 KDSCErrorDialog::KDSCErrorDialog( QWidget* parent ) : 
Index: kgvdocument.cpp 
=================================================================== 
RCS file: /cvs/kde/kdegraphics/kghostview/kgvdocument.cpp,v 
retrieving revision 1.2 
diff -u -3 -p -r1.2 kgvdocument.cpp 
--- kgvdocument.cpp     7 Feb 2003 00:29:16 -0000       1.2 
+++ kgvdocument.cpp     18 Feb 2003 13:12:45 -0000 
@@ -277,7 +277,9 @@ void KGVDocument::scanDSC() 
     _dsc = new KDSC(); 
 
     KDSCErrorDialog errorDialog; 
-    KDSCErrorThreshold errorHandler( 3, &errorDialog ); 
+    KDSCErrorThreshold errorHandler( KDSCError::Error + 1 , &errorDialog ); 
+    // Disable errorDialog for now while KDSCErrorDialog isn't fully 
+    // implemented 
     _dsc->setErrorHandler( &errorHandler ); 
 
     char buf[4096]; 
 
 
Comment 3 Wilco Greven 2003-02-19 12:20:21 UTC
Reopening because this bug is more descriptive than the bug this one is marked is a duplicate. 
Comment 4 Wilco Greven 2003-02-19 12:21:34 UTC
*** Bug 45450 has been marked as a duplicate of this bug. ***
Comment 5 Wilco Greven 2003-02-19 12:41:12 UTC
Subject: Re:  Postscript pages list shows only one page

Hello,

On Tuesday 18 February 2003 14:14, you wrote:
> Here the problem is that kghostview thinks that there is only one page and
> only one page is shown in the "page selection" list on the left. Both 45450
> and 47225 (another duplicate) speak of "the left selection list" being
> correct. However, without a test case it is difficult to be sure whether
> the problems are related.
>
> The following patch fixes the problem for the given file. It is a patch
> against CVS HEAD ( 18 Fev 2003 ).
>
> The issue is in KDE's DSC error handling function which changes the default
> error handling strategy. I also added two explaining comments. Can anyone
> review this?

Thanks, I'll apply the patch. The reason I originally choose to return Ok by 
default is tha GSView handles it that way. I'll completely disable the use of 
the errorhandler for now and use the parsers default error handling.

Greetings,
Wilco


Comment 6 Wilco Greven 2003-02-19 12:44:04 UTC
*** Bug has been marked as fixed ***.