[Commits] [SCM] claws branch, master, updated. 3.13.0-21-g9e163b4
claws at claws-mail.org
claws at claws-mail.org
Tue Oct 20 14:33:38 CEST 2015
The branch, master has been updated
via 9e163b4bbc668f99d9fc85b7697bbb221346e34b (commit)
from a98e7f2de2870f82295eaa691d7c2d52d90ba4eb (commit)
Summary of changes:
src/plugins/pdf_viewer/poppler_viewer.c | 10 ++++++++++
1 file changed, 10 insertions(+)
- Log -----------------------------------------------------------------
commit 9e163b4bbc668f99d9fc85b7697bbb221346e34b
Author: Paul <paul at claws-mail.org>
Date: Tue Oct 20 13:33:33 2015 +0100
implement RFE 3545, 'Support to view encrypted (password protected) PDF'
diff --git a/src/plugins/pdf_viewer/poppler_viewer.c b/src/plugins/pdf_viewer/poppler_viewer.c
index 3c782ac..eee0cb6 100644
--- a/src/plugins/pdf_viewer/poppler_viewer.c
+++ b/src/plugins/pdf_viewer/poppler_viewer.c
@@ -31,6 +31,7 @@
#include "printing.h"
#include "prefs_common.h"
#include "gtk/gtkutils.h"
+#include "gtk/inputdialog.h"
#include "mimeview.h"
#ifndef POPPLER_WITH_GDK
#include "stdbool.h"
@@ -1242,6 +1243,7 @@ static void pdf_viewer_update(MimeViewer *_viewer, gboolean reload_file, int pag
GError *error = NULL;
gchar *tmpfile = NULL;
gchar *tmp;
+ gchar *password = NULL;
debug_print("pdf_viewer_update\n");
@@ -1322,6 +1324,14 @@ static void pdf_viewer_update(MimeViewer *_viewer, gboolean reload_file, int pag
else {
viewer->pdf_doc = poppler_document_new_from_file( viewer->fsname, NULL, &error);
}
+ if (error && g_error_matches(error, POPPLER_ERROR, POPPLER_ERROR_ENCRYPTED)) {
+ g_clear_error(&error);
+ password = input_dialog_with_invisible(_("Enter password"),
+ _("This document is locked and requires a password before it can be opened."),
+ "");
+ viewer->pdf_doc = poppler_document_new_from_file(viewer->fsname, password, &error);
+ g_free(password);
+ }
viewer->num_pages = poppler_document_get_n_pages(viewer->pdf_doc);
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list