85 |
|
|
86 |
unsigned int enable_groups:1; |
unsigned int enable_groups:1; |
87 |
}; |
}; |
88 |
|
typedef struct km_info_s *km_info_t; |
89 |
|
|
90 |
/* Toolbar button structure. */ |
/* Toolbar button structure. */ |
91 |
struct mybuttons { |
struct mybuttons { |
689 |
} |
} |
690 |
|
|
691 |
/* Disable all secret-key functions when no secret key is available. */ |
/* Disable all secret-key functions when no secret key is available. */ |
692 |
{ |
if (!secret_key_available ()) { |
693 |
gpg_keycache_t sec = keycache_get_ctx (0); |
enable_button (tb_hwnd, ID_KEYMISC_SIGN, FALSE); |
694 |
if (gpg_keycache_get_size (sec) == 0) { |
set_menu_state (hmenu, ID_KEYMISC_SIGN, MF_GRAYED); |
|
enable_button (tb_hwnd, ID_KEYMISC_SIGN, FALSE); |
|
|
set_menu_state (hmenu, ID_KEYMISC_SIGN, MF_GRAYED); |
|
|
} |
|
695 |
} |
} |
696 |
} |
} |
697 |
|
|
1069 |
} |
} |
1070 |
|
|
1071 |
|
|
1072 |
|
/* Reload the key cache. */ |
1073 |
|
static void |
1074 |
|
keycache_reload (HWND dlg) |
1075 |
|
{ |
1076 |
|
refresh_cache_s rcs; |
1077 |
|
|
1078 |
|
memset (&rcs, 0, sizeof rcs); |
1079 |
|
rcs.kr_reload = rcs.kr_update = 1; |
1080 |
|
rcs.tr_update = 0; |
1081 |
|
DialogBoxParam (glob_hinst, (LPCSTR)IDD_WINPT_KEYCACHE, dlg, |
1082 |
|
keycache_dlg_proc, (LPARAM)&rcs); |
1083 |
|
} |
1084 |
|
|
1085 |
|
|
1086 |
|
/* Check if the secret keyring contains at least one |
1087 |
|
key with ultimate trust. |
1088 |
|
Return value: 0 on success. */ |
1089 |
|
int |
1090 |
|
check_ultimate_trusted_key (gpg_keycache_t _sec) |
1091 |
|
{ |
1092 |
|
struct keycache_s *n; |
1093 |
|
int nkeys = 0; |
1094 |
|
|
1095 |
|
for (n = _sec->item; n; n = n->next) { |
1096 |
|
if (n->pubpart && |
1097 |
|
n->pubpart->key->owner_trust == GPGME_VALIDITY_ULTIMATE) |
1098 |
|
return 0; |
1099 |
|
nkeys++; |
1100 |
|
} |
1101 |
|
|
1102 |
|
/* if we do not have any secret keys, it does not make sense |
1103 |
|
to return an error. */ |
1104 |
|
if (nkeys == 0) |
1105 |
|
return 0; |
1106 |
|
return -1; |
1107 |
|
} |
1108 |
|
|
1109 |
|
|
1110 |
static void |
static void |
1111 |
reload_keylist (struct km_info_s *kmi) |
reload_keylist (struct km_info_s *kmi) |
1112 |
{ |
{ |
1177 |
BOOL CALLBACK |
BOOL CALLBACK |
1178 |
keymanager_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) |
keymanager_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) |
1179 |
{ |
{ |
|
struct km_info_s *kmi = NULL; |
|
1180 |
HWND kl; |
HWND kl; |
1181 |
HMENU hm; |
HMENU hm; |
|
struct keycache_s *kci; |
|
1182 |
gpg_keycache_t c; |
gpg_keycache_t c; |
1183 |
gpgme_key_t key; |
gpgme_key_t key; |
1184 |
|
struct keycache_s *kci; |
1185 |
|
km_info_t kmi = NULL; |
1186 |
struct genkey_s genkey; |
struct genkey_s genkey; |
1187 |
struct winpt_key_s k = {0}; |
struct winpt_key_s k = {0}; |
1188 |
struct URL_ctx_s *url; |
struct URL_ctx_s *url; |
1192 |
int l_idx = 0, i=0, rc; |
int l_idx = 0, i=0, rc; |
1193 |
|
|
1194 |
if ((msg != WM_INITDIALOG) |
if ((msg != WM_INITDIALOG) |
1195 |
&& ((kmi = (struct km_info_s*)GetWindowLong (dlg, GWL_USERDATA)) == NULL)) |
&& ((kmi = (km_info_t)GetWindowLong (dlg, GWL_USERDATA)) == NULL)) |
1196 |
return FALSE; |
return FALSE; |
1197 |
|
|
1198 |
/* handle dynamic popup items in the keyserver menu. */ |
/* handle dynamic popup items in the keyserver menu. */ |
1225 |
Header_SetImageList(ListView_GetHeader (kl), glob_imagelist); |
Header_SetImageList(ListView_GetHeader (kl), glob_imagelist); |
1226 |
kmi->lv = keylist_load (GetDlgItem (dlg, IDC_KEYMISC_KEYLIST), c, |
kmi->lv = keylist_load (GetDlgItem (dlg, IDC_KEYMISC_KEYLIST), c, |
1227 |
NULL, KEYLIST_LIST, kmi->keylist_sortby); |
NULL, KEYLIST_LIST, kmi->keylist_sortby); |
1228 |
if (check_ultimate_trusted_key ()) { |
if (check_ultimate_trusted_key (keycache_get_ctx (0))) { |
1229 |
msg_box (dlg, _("No ultimately trusted key found.\n" |
msg_box (dlg, _("No ultimately trusted key found.\n" |
1230 |
"Please set at least one secret key to ultimate trust."), |
"Please set at least one secret key to ultimate trust."), |
1231 |
_("Key Manager"), MB_WARN); |
_("Key Manager"), MB_WARN); |
1447 |
set_menu_state (popup, ID_KEYCTX_PASTE, MF_DISABLED|MF_GRAYED); |
set_menu_state (popup, ID_KEYCTX_PASTE, MF_DISABLED|MF_GRAYED); |
1448 |
if (mapi_init ()) |
if (mapi_init ()) |
1449 |
set_menu_state (popup, ID_KEYCTX_SENDMAIL, MF_DISABLED|MF_GRAYED); |
set_menu_state (popup, ID_KEYCTX_SENDMAIL, MF_DISABLED|MF_GRAYED); |
1450 |
|
if (!secret_key_available ()) |
1451 |
|
set_menu_state (popup, ID_KEYCTX_SIGN, MF_DISABLED|MF_GRAYED); |
1452 |
|
|
1453 |
/* Override 'Default Keyserver' with the actual name. */ |
/* Override 'Default Keyserver' with the actual name. */ |
1454 |
host = kserver_get_hostname (0, -1, &port); |
host = kserver_get_hostname (0, -1, &port); |
1999 |
/* XXX: Implement group manager. */ |
/* XXX: Implement group manager. */ |
2000 |
return TRUE; |
return TRUE; |
2001 |
|
|
2002 |
|
/* |
2003 |
case IDCANCEL: |
case IDCANCEL: |
2004 |
EndDialog (dlg, TRUE); |
EndDialog (dlg, TRUE); |
2005 |
return TRUE; |
return TRUE; |
2006 |
|
*/ |
2007 |
} |
} |
2008 |
|
|
2009 |
break; |
break; |