From aaa1dce1c3e36f8df58cbcb5d8c4ade41b64f8d7 Mon Sep 17 00:00:00 2001 From: Paul Gardiner Date: Thu, 20 Sep 2012 17:01:14 +0100 Subject: Forms: show warning for use of app.execDialog app.execDialog looks very difficult to support. Hopefully we wont have to --- apps/pdfapp.c | 4 ++++ fitz/fitz.h | 3 ++- pdf/mupdf-internal.h | 1 + pdf/pdf_event.c | 10 ++++++++++ pdf/pdf_js.c | 4 ++++ 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/apps/pdfapp.c b/apps/pdfapp.c index 2c5d90a3..608db8b8 100644 --- a/apps/pdfapp.c +++ b/apps/pdfapp.c @@ -129,6 +129,10 @@ static void event_cb(fz_doc_event *event, void *data) pdfapp_warn(app, "The document attempted to execute menu item: %s. (Not supported)", item); } break; + + case FZ_DOCUMENT_EVENT_EXEC_DIALOG: + pdfapp_warn(app, "The document attempted to open a dialog box. (Not supported)"); + break; } } diff --git a/fitz/fitz.h b/fitz/fitz.h index fb9facc1..cb71418a 100644 --- a/fitz/fitz.h +++ b/fitz/fitz.h @@ -2576,7 +2576,8 @@ enum FZ_DOCUMENT_EVENT_LAUNCH_URL, FZ_DOCUMENT_EVENT_MAIL_DOC, FZ_DOCUMENT_EVENT_SUBMIT, - FZ_DOCUMENT_EVENT_EXEC_MENU_ITEM + FZ_DOCUMENT_EVENT_EXEC_MENU_ITEM, + FZ_DOCUMENT_EVENT_EXEC_DIALOG }; /* diff --git a/pdf/mupdf-internal.h b/pdf/mupdf-internal.h index a069e236..8c058195 100644 --- a/pdf/mupdf-internal.h +++ b/pdf/mupdf-internal.h @@ -635,6 +635,7 @@ void pdf_set_doc_event_callback(pdf_document *doc, fz_doc_event_cb *event_cb, vo void pdf_event_issue_alert(pdf_document *doc, fz_alert_event *event); void pdf_event_issue_print(pdf_document *doc); void pdf_event_issue_exec_menu_item(pdf_document *doc, char *item); +void pdf_event_issue_exec_dialog(pdf_document *doc); /* * Javascript handler diff --git a/pdf/pdf_event.c b/pdf/pdf_event.c index eeaa5dfb..61af6a29 100644 --- a/pdf/pdf_event.c +++ b/pdf/pdf_event.c @@ -69,6 +69,16 @@ void pdf_event_issue_exec_menu_item(pdf_document *doc, char *item) } } +void pdf_event_issue_exec_dialog(pdf_document *doc) +{ + fz_doc_event e; + + e.type = FZ_DOCUMENT_EVENT_EXEC_DIALOG; + + if (doc->event_cb) + doc->event_cb(&e, doc->event_cb_data); +} + void pdf_set_doc_event_callback(pdf_document *doc, fz_doc_event_cb *fn, void *data) { doc->event_cb = fn; diff --git a/pdf/pdf_js.c b/pdf/pdf_js.c index 441f49d4..d401b3a2 100644 --- a/pdf/pdf_js.c +++ b/pdf/pdf_js.c @@ -101,6 +101,10 @@ static pdf_jsimp_obj *app_alert(void *jsctx, void *obj, int argc, pdf_jsimp_obj static pdf_jsimp_obj *app_execDialog(void *jsctx, void *obj, int argc, pdf_jsimp_obj *args[]) { + pdf_js *js = (pdf_js *)jsctx; + + pdf_event_issue_exec_dialog(js->doc); + return NULL; } -- cgit v1.2.3