1 |
/* wptKeyImportStatusDlg.cpp - Key Import status dialog |
2 |
* Copyright (C) 2002, 2003, 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 |
|
22 |
#ifdef HAVE_CONFIG_H |
23 |
#include <config.h> |
24 |
#endif |
25 |
|
26 |
#include <windows.h> |
27 |
|
28 |
#include "resource.h" |
29 |
#include "wptW32API.h" |
30 |
#include "wptGPG.h" |
31 |
#include "wptCommonCtl.h" |
32 |
#include "wptContext.h" |
33 |
#include "wptDlgs.h" |
34 |
#include "wptNLS.h" |
35 |
#include "wptTypes.h" |
36 |
|
37 |
|
38 |
/* Dialog procedure to display key import statistics. */ |
39 |
BOOL CALLBACK |
40 |
import_status_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) |
41 |
{ |
42 |
static gpgme_import_result_t res; |
43 |
|
44 |
switch (msg) { |
45 |
case WM_INITDIALOG: |
46 |
res = (gpgme_import_result_t)lparam; |
47 |
if (!res) |
48 |
dlg_fatal_error (dlg, "Could not get dialog param"); |
49 |
SetDlgItemInt (dlg, IDC_IMPSTAT_NPKEYS, res->considered, FALSE); |
50 |
SetDlgItemInt (dlg, IDC_IMPSTAT_IPKEYS, res->imported, FALSE); |
51 |
SetDlgItemInt (dlg, IDC_IMPSTAT_NSKEYS, res->secret_read, FALSE); |
52 |
SetDlgItemInt (dlg, IDC_IMPSTAT_ISKEYS, res->secret_imported, FALSE); |
53 |
SetDlgItemInt (dlg, IDC_IMPSTAT_NREV, res->new_revocations, FALSE); |
54 |
SetDlgItemInt (dlg, IDC_IMPSTAT_NOUID, res->no_user_id, FALSE); |
55 |
SetDlgItemInt (dlg, IDC_IMPSTAT_NUID, res->new_user_ids, FALSE); |
56 |
SetDlgItemInt (dlg, IDC_IMPSTAT_NSUBK, res->new_sub_keys, FALSE); |
57 |
SetDlgItemInt (dlg, IDC_IMPSTAT_NSIG, res->new_signatures, FALSE); |
58 |
if (res->new_revocations > 0) |
59 |
SetDlgItemText (dlg, IDC_IMPSTAT_INFO, _("Revocation certifcate(s) imported.")); |
60 |
else if (res->secret_imported > 0) |
61 |
SetDlgItemText (dlg, IDC_IMPSTAT_INFO, _("Secret key(s) imported.")); |
62 |
else if(res->imported == 0 |
63 |
&& res->secret_imported == 0 |
64 |
&& res->new_user_ids == 0 |
65 |
&& res->new_sub_keys == 0 |
66 |
&& res->new_signatures == 0) |
67 |
SetDlgItemText (dlg, IDC_IMPSTAT_INFO, _("No keys updated.")); |
68 |
SetWindowText (dlg, _("Key Import Statistics")); |
69 |
center_window (dlg, NULL); |
70 |
SetForegroundWindow (dlg); |
71 |
return TRUE; |
72 |
|
73 |
case WM_COMMAND: |
74 |
switch (LOWORD (wparam)) { |
75 |
case IDOK: |
76 |
EndDialog (dlg, TRUE); |
77 |
break; |
78 |
} |
79 |
break; |
80 |
} |
81 |
|
82 |
return FALSE; |
83 |
} |