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