1 |
/* wptClipImportDlg.cpp - WinPT key import dialog |
2 |
* Copyright (C) 2001-2005 Timo Schulz |
3 |
* Copyright (C) 2005 g10 Code GmbH |
4 |
* |
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 |
#ifdef HAVE_CONFIG_H |
22 |
#include <config.h> |
23 |
#endif |
24 |
|
25 |
#include <windows.h> |
26 |
|
27 |
#include "resource.h" |
28 |
#include "wptCrypto.h" |
29 |
#include "wptGPG.h" |
30 |
#include "wptCommonCtl.h" |
31 |
#include "wptKeylist.h" |
32 |
#include "wptNLS.h" |
33 |
#include "wptErrors.h" |
34 |
#include "wptTypes.h" |
35 |
#include "wptContext.h" /* for passphrase_s */ |
36 |
#include "wptDlgs.h" |
37 |
#include "wptW32API.h" |
38 |
#include "wptVersion.h" |
39 |
#include "wptImport.h" |
40 |
#include "wptKeyManager.h" |
41 |
|
42 |
|
43 |
/* Load the import statistics dialog with the results from @res. */ |
44 |
int |
45 |
print_import_status (gpgme_import_result_t res) |
46 |
{ |
47 |
gpgme_import_status_t st; |
48 |
const char *keyid; |
49 |
int new_keys = res->considered - res->unchanged; |
50 |
|
51 |
dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_IMPORT_STAT, glob_hwnd, |
52 |
import_status_dlg_proc, (LPARAM)res, |
53 |
_("Key Import Statistics"), IDS_WINPT_IMPORT_STAT); |
54 |
if (new_keys > 0 && new_keys < KM_PRELOAD_KEYS) { |
55 |
for (st=res->imports; st; st=st->next) { |
56 |
if (st->status == 0) /* nothing changed */ |
57 |
continue; |
58 |
keyid = st->fpr; |
59 |
keyid += (strlen (st->fpr) == 32)? 24 : 32; |
60 |
keycache_update (0, keyid); |
61 |
} |
62 |
} |
63 |
return !(res->unchanged == res->considered); |
64 |
} |