1 |
werner |
36 |
/* wptKeyCacheDlg.cpp - Key caching dialog |
2 |
|
|
* Copyright (C) 2000-2005 Timo Schulz |
3 |
|
|
* Copyright (C) 2005 g10 Code GmbH |
4 |
|
|
* |
5 |
|
|
* This file is part of WinPT. |
6 |
|
|
* |
7 |
|
|
* WinPT is free software; you can redistribute it and/or modify |
8 |
|
|
* it under the terms of the GNU General Public License as published by |
9 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
10 |
|
|
* (at your option) any later version. |
11 |
|
|
* |
12 |
|
|
* WinPT is distributed in the hope that it will be useful, |
13 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
|
|
* GNU General Public License for more details. |
16 |
|
|
* |
17 |
|
|
* You should have received a copy of the GNU General Public License |
18 |
|
|
* along with WinPT; if not, write to the Free Software Foundation, |
19 |
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
20 |
|
|
*/ |
21 |
|
|
|
22 |
|
|
#ifdef HAVE_CONFIG_H |
23 |
|
|
#include <config.h> |
24 |
|
|
#endif |
25 |
|
|
|
26 |
|
|
#include <windows.h> |
27 |
|
|
|
28 |
werner |
47 |
#include "resource.h" |
29 |
werner |
36 |
#include "wptNLS.h" |
30 |
|
|
#include "wptGPG.h" |
31 |
|
|
#include "wptTypes.h" |
32 |
|
|
#include "wptW32API.h" |
33 |
|
|
#include "wptVersion.h" |
34 |
|
|
|
35 |
|
|
/* Dialog box procedure for starting the key cache procedure. |
36 |
|
|
Actually this dialog is hidden and just kick off the real |
37 |
|
|
caching process. */ |
38 |
|
|
BOOL CALLBACK |
39 |
|
|
keycache_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) |
40 |
|
|
{ |
41 |
|
|
gpgme_error_t err; |
42 |
|
|
refresh_cache_s * rcs; |
43 |
|
|
char * pubring = NULL, * secring = NULL; |
44 |
|
|
|
45 |
|
|
switch( msg ) { |
46 |
|
|
case WM_INITDIALOG: |
47 |
|
|
rcs = (refresh_cache_s *)lparam; |
48 |
|
|
if (!rcs) |
49 |
|
|
BUG (NULL); |
50 |
|
|
SetForegroundWindow (dlg); |
51 |
|
|
ShowWindow (dlg, SW_HIDE); |
52 |
|
|
center_window (dlg, NULL); |
53 |
|
|
#ifndef LANG_DE |
54 |
|
|
SetWindowText (dlg, _("WinPT Key Caching")); |
55 |
|
|
#endif |
56 |
|
|
ShowWindow (GetDlgItem (dlg, IDC_KEYCACHE_INFO), SW_SHOW); |
57 |
|
|
SetDlgItemText (dlg, IDC_KEYCACHE_INFO, |
58 |
|
|
_("Caching keyrings, please wait...")); |
59 |
|
|
|
60 |
|
|
pubring = get_gnupg_keyring (1, NO_STRICT); |
61 |
|
|
if (!pubring) |
62 |
|
|
BUG (0); |
63 |
|
|
secring = get_gnupg_keyring (0, NO_STRICT); |
64 |
|
|
if (!secring) |
65 |
|
|
BUG (0); |
66 |
|
|
if (rcs->tr_update) |
67 |
|
|
gpg_rebuild_cache (NULL); |
68 |
|
|
if (rcs->kr_update) { |
69 |
|
|
keycache_set_reload (rcs->kr_reload); |
70 |
|
|
err = keycache_init (pubring, secring); |
71 |
|
|
if (err) |
72 |
|
|
msg_box (dlg, gpgme_strerror (err), _("Key Cache"), MB_ERR); |
73 |
|
|
} |
74 |
|
|
free_if_alloc (pubring); |
75 |
|
|
free_if_alloc (secring); |
76 |
|
|
EndDialog (dlg, TRUE); |
77 |
|
|
return FALSE; |
78 |
|
|
} |
79 |
|
|
|
80 |
|
|
return FALSE; |
81 |
|
|
} |