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 |
20 |
|
|
21 |
#include <windows.h> |
#include <windows.h> |
|
#include <windows.h> |
|
22 |
|
|
23 |
#include "../resource.h" |
#include "resource.h" |
24 |
#include "wptNLS.h" |
#include "wptNLS.h" |
25 |
#include "wptGPG.h" |
#include "wptGPG.h" |
26 |
#include "wptTypes.h" |
#include "wptTypes.h" |
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) |
47 |
SetForegroundWindow (dlg); |
SetForegroundWindow (dlg); |
48 |
ShowWindow (dlg, SW_HIDE); |
ShowWindow (dlg, SW_HIDE); |
49 |
center_window (dlg, NULL); |
center_window (dlg, NULL); |
|
#ifndef LANG_DE |
|
50 |
SetWindowText (dlg, _("WinPT Key Caching")); |
SetWindowText (dlg, _("WinPT Key Caching")); |
|
#endif |
|
51 |
ShowWindow (GetDlgItem (dlg, IDC_KEYCACHE_INFO), SW_SHOW); |
ShowWindow (GetDlgItem (dlg, IDC_KEYCACHE_INFO), SW_SHOW); |
52 |
SetDlgItemText (dlg, IDC_KEYCACHE_INFO, |
SetDlgItemText (dlg, IDC_KEYCACHE_INFO, |
53 |
_("Caching keyrings, please wait...")); |
_("Caching keyrings, please wait...")); |
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 |
|
|