diff --git a/print/epdfview/Makefile b/print/epdfview/Makefile index ea1e1df288b..76ff8ee2f3f 100644 --- a/print/epdfview/Makefile +++ b/print/epdfview/Makefile @@ -1,9 +1,9 @@ -# $OpenBSD: Makefile,v 1.15 2009/12/22 15:54:32 ajacoutot Exp $ +# $OpenBSD: Makefile,v 1.16 2010/01/12 21:45:20 jasper Exp $ COMMENT= lightweight PDF document viewer DISTNAME= epdfview-0.1.7 -PKGNAME= ${DISTNAME}p3 +PKGNAME= ${DISTNAME}p4 CATEGORIES= print HOMEPAGE= http://trac.emma-soft.com/epdfview/ diff --git a/print/epdfview/patches/patch-src_IDocument_cxx b/print/epdfview/patches/patch-src_IDocument_cxx new file mode 100644 index 00000000000..7d3dfc07ebd --- /dev/null +++ b/print/epdfview/patches/patch-src_IDocument_cxx @@ -0,0 +1,15 @@ +$OpenBSD: patch-src_IDocument_cxx,v 1.1 2010/01/12 21:45:20 jasper Exp $ + +Better error message for failed opens, r338. + +--- src/IDocument.cxx.orig Wed Dec 30 00:38:35 2009 ++++ src/IDocument.cxx Wed Dec 30 00:39:05 2009 +@@ -82,7 +82,7 @@ IDocument::getErrorMessage (DocumentError errorCode) + errorMessage = g_strdup (_("No error.")); + break; + case DocumentErrorOpenFile: +- errorMessage = g_strdup (_("File not found.")); ++ errorMessage = g_strdup (_("Could not open file.")); + break; + case DocumentErrorBadCatalog: + errorMessage = g_strdup (_("Couldn't read the page catalog.")); diff --git a/print/epdfview/patches/patch-src_MainPter_cxx b/print/epdfview/patches/patch-src_MainPter_cxx new file mode 100644 index 00000000000..6983a6436f3 --- /dev/null +++ b/print/epdfview/patches/patch-src_MainPter_cxx @@ -0,0 +1,32 @@ +$OpenBSD: patch-src_MainPter_cxx,v 1.1 2010/01/12 21:45:20 jasper Exp $ + +MainPter now stores the current page's number when the +document is reloaded and moves to the same page once +the document is displayed. -r342 + +--- src/MainPter.cxx.orig Tue Jan 12 22:12:27 2010 ++++ src/MainPter.cxx Tue Jan 12 22:14:49 2010 +@@ -54,6 +54,7 @@ MainPter::MainPter (IDocument *document) + m_PagePter = NULL; + m_FindPter = NULL; + m_PasswordTries = 3; ++ m_ReloadPage = 1; + #if defined (DEBUG) + G_LOCK (fileLoaded); + fileLoaded = FALSE; +@@ -534,6 +535,7 @@ MainPter::reloadActivated () + g_assert ( m_Document->isLoaded () && + "Tried to reload a yet to load document."); + // Reload ++ m_ReloadPage = m_Document->getCurrentPageNum(); + setOpenState (m_Document->getFileName (), TRUE); + m_Document->reload (); + } +@@ -928,6 +930,7 @@ void + MainPter::notifyReload () + { + setInitialState (); ++ m_Document->goToPage(m_ReloadPage); + #if defined (DEBUG) + G_LOCK (fileLoaded); + fileLoaded = TRUE; diff --git a/print/epdfview/patches/patch-src_MainPter_h b/print/epdfview/patches/patch-src_MainPter_h new file mode 100644 index 00000000000..f8ce10ef4d4 --- /dev/null +++ b/print/epdfview/patches/patch-src_MainPter_h @@ -0,0 +1,17 @@ +$OpenBSD: patch-src_MainPter_h,v 1.1 2010/01/12 21:45:20 jasper Exp $ + +MainPter now stores the current page's number when the +document is reloaded and moves to the same page once +the document is displayed. -r342 + +--- src/MainPter.h.orig Tue Jan 12 22:12:36 2010 ++++ src/MainPter.h Tue Jan 12 22:14:04 2010 +@@ -102,6 +102,8 @@ namespace ePDFView + PagePter *m_PagePter; + /// The number of times the password has been tried for a document. + gint m_PasswordTries; ++ /// The page to move once the document is reloaded. ++ gint m_ReloadPage; + /// The main view. + IMainView *m_View; + diff --git a/print/epdfview/patches/patch-src_PDFDocument_cxx b/print/epdfview/patches/patch-src_PDFDocument_cxx new file mode 100644 index 00000000000..fb1b575358a --- /dev/null +++ b/print/epdfview/patches/patch-src_PDFDocument_cxx @@ -0,0 +1,47 @@ +$OpenBSD: patch-src_PDFDocument_cxx,v 1.1 2010/01/12 21:45:20 jasper Exp $ + +Fixes error handling, bogus encrypted files, r339. + +--- src/PDFDocument.cxx.orig Sat Feb 28 16:00:35 2009 ++++ src/PDFDocument.cxx Tue Dec 29 23:00:29 2009 +@@ -246,23 +246,25 @@ PDFDocument::loadFile (const gchar *filename, const gc + // Check if the document couldn't be opened successfully and why. + if ( NULL == newDocument ) + { +- // Poppler's glib wrapper passes the Poppler error code unless the +- // error is that the file is encrypted. We want to set our own +- // error code in this case. + DocumentError errorCode = DocumentErrorNone; +- if ( POPPLER_ERROR == loadError->domain ) ++ switch ( loadError->code ) + { +- errorCode = DocumentErrorEncrypted; +- } +- else +- { +- // OK, the glib's wrapper don't pass the error code directly +- // from Poppler. Instead returns G_FILE_ERROR_FAILED and a +- // non translated string. +- // Maybe I'm wrong (very probable) but that's a wrong way. +- // So I'm reading the error code from the error string... +- sscanf (loadError->message, "Failed to load document (error %d)", +- (gint *)&errorCode); ++ case POPPLER_ERROR_OPEN_FILE: ++ case POPPLER_ERROR_INVALID: ++ errorCode = DocumentErrorOpenFile; ++ break; ++ ++ case POPPLER_ERROR_BAD_CATALOG: ++ errorCode = DocumentErrorBadCatalog; ++ break; ++ ++ case POPPLER_ERROR_DAMAGED: ++ errorCode = DocumentErrorDamaged; ++ break; ++ ++ case POPPLER_ERROR_ENCRYPTED: ++ errorCode = DocumentErrorEncrypted; ++ break; + } + g_error_free (loadError); + // Get our error message.