116 |
BOOL CALLBACK |
BOOL CALLBACK |
117 |
sigprops_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) |
sigprops_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) |
118 |
{ |
{ |
119 |
static gpgme_key_sig_t ks; |
gpgme_key_sig_t ks; |
120 |
gpgme_key_t issuer; |
winpt_key_s issuer; |
121 |
char tmpbuf[256]; |
char tmpbuf[256]; |
122 |
struct { |
static struct { |
123 |
unsigned int exportable:1; |
unsigned int exportable:1; |
124 |
unsigned int expired:1; |
unsigned int expired:1; |
125 |
unsigned int nrev:1; |
unsigned int nrev:1; |
128 |
int _class; |
int _class; |
129 |
} ctx; |
} ctx; |
130 |
const char *fmt_templ = _("%s %s signature"); |
const char *fmt_templ = _("%s %s signature"); |
131 |
|
const char *s; |
132 |
|
|
133 |
switch (msg) { |
switch (msg) { |
134 |
case WM_SYSCOMMAND: |
case WM_SYSCOMMAND: |
146 |
SetDlgItemText (dlg, IDC_SIGPROPS_EXPSTR, _("Expire date")); |
SetDlgItemText (dlg, IDC_SIGPROPS_EXPSTR, _("Expire date")); |
147 |
SetDlgItemText (dlg, IDC_SIGPROPS_KEYINF, _("Issuer key")); |
SetDlgItemText (dlg, IDC_SIGPROPS_KEYINF, _("Issuer key")); |
148 |
SetDlgItemText (dlg, IDC_SIGPROPS_KEYIDINF, _("Issuer key ID")); |
SetDlgItemText (dlg, IDC_SIGPROPS_KEYIDINF, _("Issuer key ID")); |
149 |
|
SetDlgItemText (dlg, IDC_SIGPROPS_POLICINF, _("Policy URL")); |
150 |
ks = (gpgme_key_sig_t)lparam; |
ks = (gpgme_key_sig_t)lparam; |
151 |
if (!ks) |
if (!ks) |
152 |
BUG (0); |
BUG (0); |
166 |
ctx.exportable? _("Exportable") : _("Non-exportable"), ctx.alg); |
ctx.exportable? _("Exportable") : _("Non-exportable"), ctx.alg); |
167 |
SetDlgItemText (dlg, IDC_SIGPROPS_INFO, tmpbuf); |
SetDlgItemText (dlg, IDC_SIGPROPS_INFO, tmpbuf); |
168 |
|
|
169 |
SetDlgItemText (dlg, IDC_SIGPROPS_KEYID, ks->keyid+8); |
_snprintf (tmpbuf, DIM (tmpbuf)-1, "0x%s", ks->keyid+8); |
170 |
|
SetDlgItemText (dlg, IDC_SIGPROPS_KEYID, tmpbuf); |
171 |
SetDlgItemInt (dlg, IDC_SIGPROPS_CLASS, ctx._class, FALSE); |
SetDlgItemInt (dlg, IDC_SIGPROPS_CLASS, ctx._class, FALSE); |
172 |
if (ctx.exportable) |
if (ctx.exportable) |
173 |
CheckDlgButton (dlg, IDC_SIGPROPS_EXP, BST_CHECKED); |
CheckDlgButton (dlg, IDC_SIGPROPS_EXP, BST_CHECKED); |
174 |
if (!get_pubkey (ks->keyid+8, &issuer)) { |
memset (&issuer, 0, sizeof (issuer)); |
175 |
char *uid = utf8_to_native (issuer->uids->uid); |
if (!winpt_get_pubkey (ks->keyid+8, &issuer)) |
176 |
SetDlgItemText (dlg, IDC_SIGPROPS_ISSUER, uid); |
s = issuer.ext->uids->uid; |
|
safe_free (uid); |
|
|
} |
|
177 |
else |
else |
178 |
SetDlgItemText (dlg, IDC_SIGPROPS_ISSUER, _(" user ID not found")); |
s = _(" user ID not found"); |
179 |
|
SetDlgItemText (dlg, IDC_SIGPROPS_ISSUER, s); |
180 |
if (ks->expires == 0) { |
if (ks->expires == 0) { |
181 |
ShowWindow (GetDlgItem (dlg, IDC_SIGPROPS_EXPSTR), SW_HIDE); |
ShowWindow (GetDlgItem (dlg, IDC_SIGPROPS_EXPSTR), SW_HIDE); |
182 |
ShowWindow (GetDlgItem (dlg, IDC_SIGPROPS_EXPDATE), SW_HIDE); |
ShowWindow (GetDlgItem (dlg, IDC_SIGPROPS_EXPDATE), SW_HIDE); |
205 |
if (ctx.expired) |
if (ctx.expired) |
206 |
CheckDlgButton (dlg, IDC_SIGPROPS_EXPIRED, BST_CHECKED); |
CheckDlgButton (dlg, IDC_SIGPROPS_EXPIRED, BST_CHECKED); |
207 |
} |
} |
208 |
|
/* XXX (gpgme): \r at the end of the notation value. */ |
209 |
|
if (ks->notations && !ks->notations->name && ks->notations->value) |
210 |
|
SetDlgItemText (dlg, IDC_SIGPROPS_POLIC, ks->notations->value); |
211 |
|
|
212 |
SetDlgItemText (dlg, IDC_SIGPROPS_EXP, _("Exportable")); |
SetDlgItemText (dlg, IDC_SIGPROPS_EXP, _("Exportable")); |
213 |
SetDlgItemText (dlg, IDC_SIGPROPS_NREV, _("Non-revocably")); |
SetDlgItemText (dlg, IDC_SIGPROPS_NREV, _("Non-revocably")); |
214 |
SetDlgItemText (dlg, IDC_SIGPROPS_REV, _("Revoked")); |
SetDlgItemText (dlg, IDC_SIGPROPS_REV, _("Revoked")); |
219 |
return TRUE; |
return TRUE; |
220 |
|
|
221 |
case WM_COMMAND: |
case WM_COMMAND: |
222 |
|
if (HIWORD (wparam) == BN_CLICKED) { |
223 |
|
switch (LOWORD (wparam)) { |
224 |
|
case IDC_SIGPROPS_EXP: |
225 |
|
CheckDlgButton (dlg, IDC_SIGPROPS_EXP, |
226 |
|
ctx.exportable? BST_CHECKED : BST_UNCHECKED); |
227 |
|
return TRUE; |
228 |
|
|
229 |
|
case IDC_SIGPROPS_EXPIRED: |
230 |
|
CheckDlgButton (dlg, IDC_SIGPROPS_EXPIRED, |
231 |
|
ctx.expired? BST_CHECKED : BST_UNCHECKED); |
232 |
|
return TRUE; |
233 |
|
|
234 |
|
case IDC_SIGPROPS_REV: |
235 |
|
CheckDlgButton (dlg, IDC_SIGPROPS_REV, |
236 |
|
ctx.rev? BST_CHECKED : BST_UNCHECKED); |
237 |
|
return TRUE; |
238 |
|
|
239 |
|
case IDC_SIGPROPS_NREV: |
240 |
|
CheckDlgButton (dlg, IDC_SIGPROPS_NREV, |
241 |
|
ctx.nrev? BST_CHECKED : BST_UNCHECKED); |
242 |
|
return TRUE; |
243 |
|
} |
244 |
|
} |
245 |
|
|
246 |
switch (LOWORD (wparam)) { |
switch (LOWORD (wparam)) { |
247 |
case IDOK: |
case IDOK: |
248 |
EndDialog (dlg, TRUE); |
EndDialog (dlg, TRUE); |
375 |
do_load_keyprops (HWND dlg, listview_ctrl_t lv) |
do_load_keyprops (HWND dlg, listview_ctrl_t lv) |
376 |
{ |
{ |
377 |
winpt_key_s k; |
winpt_key_s k; |
|
gpgme_key_t key; |
|
378 |
char keyid[32] = {0}; |
char keyid[32] = {0}; |
379 |
char status[64] = {0}, creation[64] = {0}; |
char status[64] = {0}, creation[64] = {0}; |
380 |
int n = listview_get_curr_pos (lv); |
int n = listview_get_curr_pos (lv); |
391 |
return; |
return; |
392 |
} |
} |
393 |
|
|
394 |
if ((strlen (keyid) < 3 ||get_pubkey (keyid, &key))) { |
memset (&k, 0, sizeof k); |
395 |
|
if ((strlen (keyid) < 3 || winpt_get_pubkey (keyid, &k))) { |
396 |
if (strlen (creation) > 0) |
if (strlen (creation) > 0) |
397 |
msg_box (dlg, _("Key not found in keyring."), _("Key Manager"), MB_INFO); |
msg_box (dlg, _("Key not found in keyring."), _("Key Manager"), MB_INFO); |
398 |
return; |
return; |
399 |
} |
} |
|
memset (&k, 0, sizeof k); |
|
|
k.keyid = keyid; |
|
400 |
DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_KEYPROPS, dlg, |
DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_KEYPROPS, dlg, |
401 |
keyprops_dlg_proc, (LPARAM)&k); |
keyprops_dlg_proc, (LPARAM)&k); |
402 |
} |
} |
410 |
static struct winpt_key_s *k; |
static struct winpt_key_s *k; |
411 |
gpgme_key_sig_t ks; |
gpgme_key_sig_t ks; |
412 |
HWND sl; |
HWND sl; |
413 |
char inf[384], *utf8_uid; |
char inf[384]; |
414 |
int idx = 0; |
int idx = 0; |
415 |
|
|
416 |
switch (msg) { |
switch (msg) { |
418 |
k = (winpt_key_t) lparam; |
k = (winpt_key_t) lparam; |
419 |
if (!k) |
if (!k) |
420 |
BUG (0); |
BUG (0); |
421 |
if (k->uid) { |
if (k->uid) |
422 |
utf8_uid = utf8_to_native (k->uid); |
_snprintf (inf, DIM (inf)-1, _("Signature List for \"%s\""), k->uid); |
|
_snprintf (inf, DIM (inf)-1, _("Signature List for \"%s\""), utf8_uid); |
|
|
safe_free (utf8_uid); |
|
|
} |
|
423 |
SetWindowText (dlg, inf); |
SetWindowText (dlg, inf); |
424 |
SetDlgItemText (dlg, IDC_KEYSIG_RECVKEY, _("&Receive Key")); |
SetDlgItemText (dlg, IDC_KEYSIG_RECVKEY, _("&Receive Key")); |
425 |
SetDlgItemText (dlg, IDC_KEYSIG_SIGPROPS, _("&Properties")); |
SetDlgItemText (dlg, IDC_KEYSIG_SIGPROPS, _("&Properties")); |
526 |
} |
} |
527 |
return TRUE; |
return TRUE; |
528 |
|
|
529 |
|
case IDCANCEL: |
530 |
|
EndDialog (dlg, FALSE); |
531 |
|
return TRUE; |
532 |
|
|
533 |
case IDOK: |
case IDOK: |
534 |
EndDialog (dlg, TRUE); |
EndDialog (dlg, TRUE); |
535 |
return TRUE; |
return TRUE; |