1 |
/* wptKeysigDlg.cpp - Key signature listing |
/* wptKeysigDlg.cpp - Key signature listing |
2 |
* Copyright (C) 2001-2006 Timo Schulz |
* Copyright (C) 2001-2006, 2008 Timo Schulz |
3 |
* |
* |
4 |
* This file is part of WinPT. |
* This file is part of WinPT. |
5 |
* |
* |
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
* GNU General Public License for more details. |
* GNU General Public License for more details. |
|
* |
|
|
* You should have received a copy of the GNU General Public License |
|
|
* along with WinPT; if not, write to the Free Software Foundation, |
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
15 |
*/ |
*/ |
16 |
#ifdef HAVE_CONFIG_H |
#ifdef HAVE_CONFIG_H |
17 |
#include <config.h> |
#include <config.h> |
155 |
SetDlgItemText (dlg, IDC_SIGPROPS_KEYINF, _("Issuer key")); |
SetDlgItemText (dlg, IDC_SIGPROPS_KEYINF, _("Issuer key")); |
156 |
SetDlgItemText (dlg, IDC_SIGPROPS_KEYIDINF, _("Issuer key ID")); |
SetDlgItemText (dlg, IDC_SIGPROPS_KEYIDINF, _("Issuer key ID")); |
157 |
SetDlgItemText (dlg, IDC_SIGPROPS_POLICINF, _("Policy URL")); |
SetDlgItemText (dlg, IDC_SIGPROPS_POLICINF, _("Policy URL")); |
158 |
|
SetDlgItemText (dlg, IDC_SIGPROPS_FRAME, _("Signature Info")); |
159 |
SetWindowText (dlg, _("Signature Properties")); |
SetWindowText (dlg, _("Signature Properties")); |
160 |
|
|
161 |
memset (&ctx, 0, sizeof ctx); |
memset (&ctx, 0, sizeof ctx); |
286 |
static int |
static int |
287 |
check_for_missing_keys (listview_ctrl_t lv) |
check_for_missing_keys (listview_ctrl_t lv) |
288 |
{ |
{ |
289 |
int i, n; |
int n; |
290 |
char id[128]; |
char id[128]; |
291 |
|
const char *txt = _("NOKEY"); |
292 |
|
|
293 |
n = listview_count_items (lv, 0); |
n = listview_count_items (lv, 0); |
294 |
for (i = 0; i < n; i++) { |
for (int i = 0; i < n; i++) { |
295 |
listview_get_item_text (lv, i, SL_COL_VALID, id, sizeof (id) - 1); |
listview_get_item_text (lv, i, SL_COL_VALID, id, DIM (id) - 1); |
296 |
if (!strncmp (id, "NOKEY", 5)) |
if (!strncmp (id, txt, strlen (txt))) |
297 |
return 1; |
return 1; |
298 |
} |
} |
299 |
|
|
305 |
static int |
static int |
306 |
recv_missing_keys (HWND dlg, listview_ctrl_t lv) |
recv_missing_keys (HWND dlg, listview_ctrl_t lv) |
307 |
{ |
{ |
308 |
|
const char *txt = _("NOKEY"); |
309 |
char id[128], keyid[18+1]; |
char id[128], keyid[18+1]; |
310 |
int i, n, cnt=0; |
int n, cnt=0; |
311 |
|
|
312 |
i = msg_box (dlg, _("Really receive all missing keys?"), |
if (msg_box (dlg, _("Really receive all missing keys?"), |
313 |
_("Key Manager"), MB_YESNO|MB_INFO); |
_("Key Manager"), MB_YESNO|MB_INFO) == IDNO) |
|
if (i == IDNO) |
|
314 |
return 0; |
return 0; |
315 |
|
|
316 |
n = listview_count_items (lv, 0); |
n = listview_count_items (lv, 0); |
317 |
for (i = 0; i < n; i++) { |
for (int i = 0; i < n; i++) { |
318 |
listview_get_item_text (lv, i, SL_COL_VALID, id, sizeof (id) - 1); |
listview_get_item_text (lv, i, SL_COL_VALID, id, DIM (id) - 1); |
319 |
if (!strncmp (id, "NOKEY", 5)) { |
if (!strncmp (id, txt, strlen (txt))) { |
320 |
listview_get_item_text (lv, i, SL_COL_KEYID, |
listview_get_item_text (lv, i, SL_COL_KEYID, |
321 |
keyid, sizeof (keyid) -1); |
keyid, DIM (keyid) -1); |
322 |
if (!hkp_recv_key (dlg, default_keyserver, |
if (!hkp_recv_key (dlg, default_keyserver, |
323 |
default_keyserver_port, keyid, 0, 0)) { |
default_keyserver_port, keyid, 0, 0)) { |
324 |
keycache_update (0, keyid); |
keycache_update (0, keyid); |
370 |
/* Load the key property dialog with the selected key from @lv. */ |
/* Load the key property dialog with the selected key from @lv. */ |
371 |
static void |
static void |
372 |
do_load_keyprops (HWND dlg, listview_ctrl_t lv) |
do_load_keyprops (HWND dlg, listview_ctrl_t lv) |
373 |
{ |
{ |
374 |
winpt_key_s k; |
winpt_key_s k; |
375 |
char keyid[32] = {0}; |
char keyid[32] = {0}; |
376 |
char status[64] = {0}, creation[64] = {0}; |
char status[64] = {0}, creation[64] = {0}; |
379 |
listview_get_item_text (lv, n, SL_COL_VALID, status, DIM (status)-1); |
listview_get_item_text (lv, n, SL_COL_VALID, status, DIM (status)-1); |
380 |
listview_get_item_text (lv, n, SL_COL_CREATE, creation, DIM (creation)-1); |
listview_get_item_text (lv, n, SL_COL_CREATE, creation, DIM (creation)-1); |
381 |
listview_get_item_text (lv, n, SL_COL_KEYID, keyid, DIM (keyid)-1); |
listview_get_item_text (lv, n, SL_COL_KEYID, keyid, DIM (keyid)-1); |
382 |
if (!strcmp (status, "NOKEY")) { |
if (!strcmp (status, _("NOKEY"))) { |
383 |
int id = msg_box (dlg, _("Key not found in keyring, do you want to fetch it from the keyserver?"), |
int id = msg_box (dlg, _("Key not found in keyring, do you want to fetch it from the keyserver?"), |
384 |
_("Key Manager"), MB_QUEST_ASK); |
_("Key Manager"), MB_QUEST_ASK); |
385 |
if (id == IDNO) |
if (id == IDNO) |
467 |
idx = listview_get_curr_pos (lv); |
idx = listview_get_curr_pos (lv); |
468 |
listview_get_item_text (lv, idx, SL_COL_VALID, inf, DIM (inf)-1); |
listview_get_item_text (lv, idx, SL_COL_VALID, inf, DIM (inf)-1); |
469 |
EnableWindow (GetDlgItem (dlg, IDC_KEYSIG_RECVKEY), |
EnableWindow (GetDlgItem (dlg, IDC_KEYSIG_RECVKEY), |
470 |
strcmp (inf, "NOKEY") == 0? TRUE: FALSE); |
strcmp (inf, _("NOKEY")) == 0? TRUE: FALSE); |
471 |
EnableWindow (GetDlgItem (dlg, IDC_KEYSIG_SIGPROPS), |
EnableWindow (GetDlgItem (dlg, IDC_KEYSIG_SIGPROPS), |
472 |
is_sig (lv, -1)? TRUE : FALSE); |
is_sig (lv, -1)? TRUE : FALSE); |
473 |
} |
} |
512 |
|
|
513 |
case IDC_KEYSIG_SIGPROPS: |
case IDC_KEYSIG_SIGPROPS: |
514 |
if (is_sig (lv, -1)) { |
if (is_sig (lv, -1)) { |
515 |
ks = ks = (gpgme_key_sig_t)listview_get_item2 (lv, listview_get_curr_pos (lv)); |
ks = (gpgme_key_sig_t)listview_get_item2 (lv, listview_get_curr_pos (lv)); |
516 |
DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_SIGPROPS, dlg, |
DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_SIGPROPS, dlg, |
517 |
sigprops_dlg_proc, (LPARAM)ks); |
sigprops_dlg_proc, (LPARAM)ks); |
518 |
} |
} |