1 |
twoaday |
2 |
/* wptKeyCacheDlg.cpp - Key caching dialog |
2 |
|
|
* Copyright (C) 2000-2005 Timo Schulz |
3 |
twoaday |
25 |
* Copyright (C) 2005 g10 Code GmbH |
4 |
twoaday |
2 |
* |
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 |
|
|
#include <windows.h> |
23 |
|
|
|
24 |
|
|
#include "../resource.h" |
25 |
|
|
#include "wptNLS.h" |
26 |
|
|
#include "wptGPG.h" |
27 |
|
|
#include "wptTypes.h" |
28 |
|
|
#include "wptW32API.h" |
29 |
|
|
#include "wptVersion.h" |
30 |
|
|
|
31 |
twoaday |
25 |
/* Dialog box procedure for starting the key cache procedure. |
32 |
|
|
Actually this dialog is hidden and just kick off the real |
33 |
|
|
caching process. */ |
34 |
twoaday |
2 |
BOOL CALLBACK |
35 |
|
|
keycache_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) |
36 |
|
|
{ |
37 |
|
|
gpgme_error_t err; |
38 |
|
|
refresh_cache_s * rcs; |
39 |
|
|
char * pubring = NULL, * secring = NULL; |
40 |
|
|
|
41 |
|
|
switch( msg ) { |
42 |
|
|
case WM_INITDIALOG: |
43 |
|
|
rcs = (refresh_cache_s *)lparam; |
44 |
|
|
if (!rcs) |
45 |
|
|
BUG (NULL); |
46 |
|
|
SetForegroundWindow (dlg); |
47 |
twoaday |
25 |
ShowWindow (dlg, SW_HIDE); |
48 |
twoaday |
23 |
center_window (dlg, NULL); |
49 |
twoaday |
25 |
#ifndef LANG_DE |
50 |
twoaday |
2 |
SetWindowText (dlg, _("WinPT Key Caching")); |
51 |
twoaday |
25 |
#endif |
52 |
twoaday |
2 |
ShowWindow (GetDlgItem (dlg, IDC_KEYCACHE_INFO), SW_SHOW); |
53 |
twoaday |
32 |
SetDlgItemText (dlg, IDC_KEYCACHE_INFO, |
54 |
|
|
_("Caching keyrings, please wait...")); |
55 |
twoaday |
2 |
|
56 |
|
|
pubring = get_gnupg_keyring (1, NO_STRICT); |
57 |
|
|
if (!pubring) |
58 |
|
|
BUG (0); |
59 |
|
|
secring = get_gnupg_keyring (0, NO_STRICT); |
60 |
|
|
if (!secring) |
61 |
|
|
BUG (0); |
62 |
|
|
if (rcs->tr_update) |
63 |
twoaday |
24 |
gpg_rebuild_cache (NULL); |
64 |
twoaday |
2 |
if (rcs->kr_update) { |
65 |
|
|
keycache_set_reload (rcs->kr_reload); |
66 |
|
|
err = keycache_init (pubring, secring); |
67 |
|
|
if (err) |
68 |
|
|
msg_box (dlg, gpgme_strerror (err), _("Key Cache"), MB_ERR); |
69 |
|
|
} |
70 |
|
|
free_if_alloc (pubring); |
71 |
|
|
free_if_alloc (secring); |
72 |
|
|
EndDialog (dlg, TRUE); |
73 |
|
|
return FALSE; |
74 |
|
|
} |
75 |
|
|
|
76 |
|
|
return FALSE; |
77 |
twoaday |
25 |
} |