diff options
author | Paul Gardiner <paul.gardiner@artifex.com> | 2018-01-26 16:15:23 +0000 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2018-07-05 15:32:35 +0200 |
commit | 4cebff9641f7a1b6af7310f698e2af8481929386 (patch) | |
tree | a8c820242b89a67de737195707bb3d34dc1a83dd /platform/x11/win_main.c | |
parent | 3da3d103216bf8966236621389e75943fdf08d24 (diff) | |
download | mupdf-4cebff9641f7a1b6af7310f698e2af8481929386.tar.xz |
Signature support: add signing support to the windows app
Diffstat (limited to 'platform/x11/win_main.c')
-rw-r--r-- | platform/x11/win_main.c | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/platform/x11/win_main.c b/platform/x11/win_main.c index dd406c42..7d7e79b2 100644 --- a/platform/x11/win_main.c +++ b/platform/x11/win_main.c @@ -188,6 +188,16 @@ int winsavequery(pdfapp_t *app) } } +int winquery(pdfapp_t *app, const char *query) +{ + switch(MessageBoxA(hwndframe, query, "MuPDF", MB_YESNOCANCEL)) + { + case IDYES: return QUERY_YES; + case IDNO: + default: return QUERY_NO; + } +} + int winfilename(wchar_t *buf, int len) { OPENFILENAME ofn; @@ -204,6 +214,37 @@ int winfilename(wchar_t *buf, int len) return GetOpenFileNameW(&ofn); } +int wingetcertpath(char *buf, int len) +{ + wchar_t twbuf[PATH_MAX] = {0}; + OPENFILENAME ofn; + buf[0] = 0; + memset(&ofn, 0, sizeof(OPENFILENAME)); + ofn.lStructSize = sizeof(OPENFILENAME); + ofn.hwndOwner = hwndframe; + ofn.lpstrFile = twbuf; + ofn.nMaxFile = PATH_MAX; + ofn.lpstrInitialDir = NULL; + ofn.lpstrTitle = L"MuPDF: Select certificate file"; + ofn.lpstrFilter = L"Certificates (*.pfx)\0*.pfx\0All files\0*\0\0"; + ofn.Flags = OFN_FILEMUSTEXIST; + if (GetOpenFileNameW(&ofn)) + { + int code = WideCharToMultiByte(CP_UTF8, 0, twbuf, -1, buf, MIN(PATH_MAX, len), NULL, NULL); + if (code == 0) + { + winerror(&gapp, "cannot convert filename to utf-8"); + return 0; + } + + return 1; + } + else + { + return 0; + } +} + int wingetsavepath(pdfapp_t *app, char *buf, int len) { wchar_t twbuf[PATH_MAX]; @@ -765,7 +806,7 @@ void winblit() { if (gapp.iscopying || justcopied) { - pdfapp_invert(&gapp, &gapp.selr); + pdfapp_invert(&gapp, gapp.selr); justcopied = 1; } @@ -805,7 +846,7 @@ void winblit() if (gapp.iscopying || justcopied) { - pdfapp_invert(&gapp, &gapp.selr); + pdfapp_invert(&gapp, gapp.selr); justcopied = 1; } } |