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