40 |
static subclass_s siglist_proc; |
static subclass_s siglist_proc; |
41 |
|
|
42 |
|
|
43 |
static int inline |
static int |
44 |
is_sig (listview_ctrl_t lv, int pos) |
is_sig (listview_ctrl_t lv, int pos) |
45 |
{ |
{ |
46 |
char tmpbuf[256]; |
char tmpbuf[256]; |
47 |
|
|
48 |
if (pos == -1) |
if (pos == -1) |
49 |
pos = listview_get_curr_pos (lv); |
pos = listview_get_curr_pos (lv); |
50 |
|
if (pos == -1) |
51 |
|
return 0; |
52 |
listview_get_item_text (lv, pos, 0, tmpbuf, 200); |
listview_get_item_text (lv, pos, 0, tmpbuf, 200); |
53 |
if (*tmpbuf == ' ') |
if (*tmpbuf == ' ') |
54 |
return -1; |
return -1; |
56 |
} |
} |
57 |
|
|
58 |
|
|
59 |
|
/* Delete the selected signature from list view @lv. The |
60 |
|
key is given in @key. */ |
61 |
static int |
static int |
62 |
do_delsig (HWND dlg, listview_ctrl_t lv, winpt_key_t key) |
do_delsig (HWND dlg, listview_ctrl_t lv, winpt_key_t key) |
63 |
{ |
{ |
98 |
listview_del_item (lv, pos); |
listview_del_item (lv, pos); |
99 |
delete ke; |
delete ke; |
100 |
key->update = 1; /*update*/ |
key->update = 1; /*update*/ |
101 |
return 0; |
return err? -1 : 0; |
102 |
} |
} |
103 |
|
|
104 |
|
|
105 |
|
/* Dialog box procedure to display the signature properties. */ |
106 |
static BOOL CALLBACK |
static BOOL CALLBACK |
107 |
sigprops_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) |
sigprops_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) |
108 |
{ |
{ |
117 |
const char * alg; |
const char * alg; |
118 |
int _class; |
int _class; |
119 |
} ctx; |
} ctx; |
120 |
const char *fmt_templ = "%s %s signature"; |
const char *fmt_templ = _("%s %s signature"); |
121 |
|
|
122 |
switch (msg) { |
switch (msg) { |
123 |
case WM_SYSCOMMAND: |
case WM_SYSCOMMAND: |
146 |
ctx.alg = "RSA"; |
ctx.alg = "RSA"; |
147 |
else |
else |
148 |
ctx.alg = "ELG"; |
ctx.alg = "ELG"; |
149 |
_snprintf (tmpbuf, DIM (tmpbuf)-1, fmt_templ, |
_snprintf (tmpbuf, DIM (tmpbuf)-1, fmt_templ, |
150 |
ctx.exportable? "Exportable" : "Non-exportable", ctx.alg); |
ctx.exportable? _("Exportable") : _("Non-exportable"), ctx.alg); |
151 |
SetDlgItemText (dlg, IDC_SIGPROPS_INFO, tmpbuf); |
SetDlgItemText (dlg, IDC_SIGPROPS_INFO, tmpbuf); |
152 |
listview_get_item_text (lv, n, 4, tmpbuf, DIM (tmpbuf)-1); |
listview_get_item_text (lv, n, 4, tmpbuf, DIM (tmpbuf)-1); |
153 |
SetDlgItemText (dlg, IDC_SIGPROPS_KEYID, tmpbuf); |
SetDlgItemText (dlg, IDC_SIGPROPS_KEYID, tmpbuf); |
188 |
SetDlgItemText (dlg, IDC_SIGPROPS_NREV, _("Non-revocably")); |
SetDlgItemText (dlg, IDC_SIGPROPS_NREV, _("Non-revocably")); |
189 |
SetDlgItemText (dlg, IDC_SIGPROPS_REV, _("Revoked")); |
SetDlgItemText (dlg, IDC_SIGPROPS_REV, _("Revoked")); |
190 |
SetDlgItemText (dlg, IDC_SIGPROPS_EXPIRED, _("Expired")); |
SetDlgItemText (dlg, IDC_SIGPROPS_EXPIRED, _("Expired")); |
191 |
|
SetWindowText (dlg, _("Signature Properties")); |
192 |
SetForegroundWindow (dlg); |
SetForegroundWindow (dlg); |
193 |
center_window (dlg, NULL); |
center_window (dlg, NULL); |
194 |
return TRUE; |
return TRUE; |
229 |
} |
} |
230 |
|
|
231 |
|
|
232 |
|
/* Return 1 if the list view @lv contains non-available keys. */ |
233 |
static int |
static int |
234 |
check_for_missing_keys (listview_ctrl_t lv) |
check_for_missing_keys (listview_ctrl_t lv) |
235 |
{ |
{ |
244 |
} |
} |
245 |
|
|
246 |
return 0; |
return 0; |
247 |
} /* check_for_missing_keys */ |
} |
248 |
|
|
249 |
|
|
250 |
|
/* Receive all missing keys marked in the list @lv. */ |
251 |
static int |
static int |
252 |
recv_missing_keys (HWND dlg, listview_ctrl_t lv) |
recv_missing_keys (HWND dlg, listview_ctrl_t lv) |
253 |
{ |
{ |
266 |
} |
} |
267 |
|
|
268 |
return rc; |
return rc; |
269 |
} /* recv_missing_keys */ |
} |
270 |
|
|
271 |
|
|
272 |
|
/* Create a mini popup with available choices. */ |
273 |
static void |
static void |
274 |
do_create_popup (HWND dlg) |
do_create_popup (HWND dlg) |
275 |
{ |
{ |
280 |
hm = LoadMenu (glob_hinst, MAKEINTRESOURCE (IDR_WINPT_KEYSIG_CTX)); |
hm = LoadMenu (glob_hinst, MAKEINTRESOURCE (IDR_WINPT_KEYSIG_CTX)); |
281 |
sm = GetSubMenu (hm, 0); |
sm = GetSubMenu (hm, 0); |
282 |
|
|
283 |
|
set_menu_text (sm, ID_SIGCTX_PROPS, _("Signature &Properties")); |
284 |
|
set_menu_text (sm, ID_SIGCTX_KEYPROPS, _("Signing &Key Properties")); |
285 |
|
|
286 |
TrackPopupMenu (sm, TPM_RIGHTALIGN, p.x, p.y, 0, dlg, NULL); |
TrackPopupMenu (sm, TPM_RIGHTALIGN, p.x, p.y, 0, dlg, NULL); |
287 |
|
|
288 |
DestroyMenu (hm); |
DestroyMenu (hm); |
290 |
} |
} |
291 |
|
|
292 |
|
|
293 |
|
/* Load the key property dialog with the selected key from @lv. */ |
294 |
static void |
static void |
295 |
do_load_keyprops (HWND dlg, listview_ctrl_t lv) |
do_load_keyprops (HWND dlg, listview_ctrl_t lv) |
296 |
{ |
{ |
320 |
keyprops_dlg_proc, (LPARAM)&k); |
keyprops_dlg_proc, (LPARAM)&k); |
321 |
} |
} |
322 |
|
|
323 |
|
|
324 |
|
/* Dialog box procedure to list signatures. */ |
325 |
BOOL CALLBACK |
BOOL CALLBACK |
326 |
keysig_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) |
keysig_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) |
327 |
{ |
{ |
354 |
siglist_proc.old = (WNDPROC)GetWindowLong (sl, GWL_WNDPROC); |
siglist_proc.old = (WNDPROC)GetWindowLong (sl, GWL_WNDPROC); |
355 |
if (siglist_proc.old) { |
if (siglist_proc.old) { |
356 |
if (!SetWindowLong (sl, GWL_WNDPROC, (LONG)siglist_proc.current)) { |
if (!SetWindowLong (sl, GWL_WNDPROC, (LONG)siglist_proc.current)) { |
357 |
msg_box (dlg, _("Could not set keylist window procedure."), _("Key Manager"), MB_ERR); |
msg_box (dlg, _("Could not set keylist window procedure."), |
358 |
|
_("Key Manager"), MB_ERR); |
359 |
BUG (0); |
BUG (0); |
360 |
} |
} |
361 |
} |
} |
440 |
break; |
break; |
441 |
} |
} |
442 |
return FALSE; |
return FALSE; |
443 |
} /* keysig_dlg_proc */ |
} |