1 |
/* wptKeyCacheDlg.cpp - Key caching dialog |
/* wptKeyCacheDlg.cpp - Key caching dialog |
2 |
* Copyright (C) 2000-2005 Timo Schulz |
* Copyright (C) 2000-2006 Timo Schulz |
3 |
* Copyright (C) 2005 g10 Code GmbH |
* Copyright (C) 2005, 2006 g10 Code GmbH |
4 |
* |
* |
5 |
* This file is part of WinPT. |
* This file is part of WinPT. |
6 |
* |
* |
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
* GNU General Public License for more details. |
* GNU General Public License for more details. |
|
* |
|
|
* You should have received a copy of the GNU General Public License |
|
|
* along with WinPT; if not, write to the Free Software Foundation, |
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
16 |
*/ |
*/ |
|
|
|
17 |
#ifdef HAVE_CONFIG_H |
#ifdef HAVE_CONFIG_H |
18 |
#include <config.h> |
#include <config.h> |
19 |
#endif |
#endif |
27 |
#include "wptW32API.h" |
#include "wptW32API.h" |
28 |
#include "wptVersion.h" |
#include "wptVersion.h" |
29 |
|
|
30 |
|
|
31 |
|
|
32 |
/* Dialog box procedure for starting the key cache procedure. |
/* Dialog box procedure for starting the key cache procedure. |
33 |
Actually this dialog is hidden and just kick off the real |
Actually this dialog is hidden and just kick off the real |
34 |
caching process. */ |
caching process. */ |
35 |
BOOL CALLBACK |
BOOL CALLBACK |
36 |
keycache_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) |
keycache_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) |
37 |
{ |
{ |
38 |
gpgme_error_t err; |
gpgme_error_t err = 0; |
39 |
refresh_cache_s * rcs; |
refresh_cache_s *rcs; |
40 |
char * pubring = NULL, * secring = NULL; |
char *pubring, *secring; |
41 |
|
|
42 |
switch( msg ) { |
switch (msg) { |
43 |
case WM_INITDIALOG: |
case WM_INITDIALOG: |
44 |
rcs = (refresh_cache_s *)lparam; |
rcs = (refresh_cache_s *)lparam; |
45 |
if (!rcs) |
if (!rcs) |
58 |
secring = get_gnupg_keyring (0, NO_STRICT); |
secring = get_gnupg_keyring (0, NO_STRICT); |
59 |
if (!secring) |
if (!secring) |
60 |
BUG (0); |
BUG (0); |
61 |
if (rcs->tr_update) |
if (rcs->sig_update) |
62 |
gpg_rebuild_cache (NULL); |
gpg_rebuild_cache (NULL); |
63 |
if (rcs->kr_update) { |
if (rcs->kring_update) |
|
keycache_set_reload (rcs->kr_reload); |
|
64 |
err = keycache_init (pubring, secring); |
err = keycache_init (pubring, secring); |
|
if (err) |
|
|
msg_box (dlg, gpgme_strerror (err), _("Key Cache"), MB_ERR); |
|
|
} |
|
65 |
free_if_alloc (pubring); |
free_if_alloc (pubring); |
66 |
free_if_alloc (secring); |
free_if_alloc (secring); |
67 |
EndDialog (dlg, TRUE); |
if (err) { |
68 |
|
/* XXX: should we use gpg_check_return_code() to suggest |
69 |
|
to check the config file in case of errors?? */ |
70 |
|
msg_box (dlg, gpgme_strerror (err), _("Key Cache"), MB_ERR); |
71 |
|
EndDialog (dlg, 1); |
72 |
|
} |
73 |
|
else |
74 |
|
EndDialog (dlg, 0); |
75 |
return FALSE; |
return FALSE; |
76 |
} |
} |
77 |
|
|