284 |
return FALSE; |
return FALSE; |
285 |
} |
} |
286 |
else { |
else { |
287 |
keycache_set_reload( 1 ); |
k->update = 1; |
288 |
msg_box( dlg, _("Photo successfully added."), _("GnuPG Status"), MB_OK ); |
msg_box (dlg, _("Photo successfully added."), _("GnuPG Status"), MB_OK); |
289 |
} |
} |
290 |
gpgme_release( ctx ); |
gpgme_release (ctx); |
291 |
EndDialog( dlg, TRUE ); |
EndDialog (dlg, TRUE); |
292 |
break; |
break; |
293 |
|
|
294 |
case IDCANCEL: |
case IDCANCEL: |
367 |
return FALSE; |
return FALSE; |
368 |
} |
} |
369 |
else { |
else { |
370 |
msg_box( dlg, _("Revoker successfully addded."), _("GnuPG Status"), MB_OK ); |
k->update = 1; |
371 |
keycache_set_reload( 1 ); |
msg_box (dlg, _("Revoker successfully addded."), _("GnuPG Status"), MB_OK); |
372 |
} |
} |
373 |
gpgme_release( ctx ); |
gpgme_release( ctx ); |
374 |
EndDialog( dlg, TRUE ); |
EndDialog( dlg, TRUE ); |
621 |
if( ec ) |
if( ec ) |
622 |
gpgme_show_error( dlg, ec, ctx, _("Add user ID"), MB_ERR ); |
gpgme_show_error( dlg, ec, ctx, _("Add user ID"), MB_ERR ); |
623 |
else { |
else { |
624 |
msg_box(dlg, _("User ID successfully added"), _("GnuPG Status"), MB_OK ); |
k->update = 1; |
625 |
keycache_set_reload( 1 ); |
msg_box (dlg, _("User ID successfully added"), _("GnuPG Status"), MB_OK); |
626 |
} |
} |
627 |
gpgme_editkey_release( ek ); |
gpgme_editkey_release( ek ); |
628 |
gpgme_release( ctx ); |
gpgme_release( ctx ); |
689 |
cb.ek = ek; |
cb.ek = ek; |
690 |
cb.pass = k->is_protected? pass : NULL; |
cb.pass = k->is_protected? pass : NULL; |
691 |
cb.opaque = &keygen; |
cb.opaque = &keygen; |
692 |
dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_KEYEDIT_ADDSUBKEY, |
dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_KEYEDIT_ADDSUBKEY, |
693 |
dlg, keyedit_addsubkey_dlg_proc, |
dlg, keyedit_addsubkey_dlg_proc, |
694 |
(LPARAM)&cb, _("Add new Subkey" ), |
(LPARAM)&cb, _("Add new Subkey"), |
695 |
IDS_WINPT_KEYEDIT_ADDSUBKEY ); |
IDS_WINPT_KEYEDIT_ADDSUBKEY ); |
696 |
if( !gpgme_editkey_is_valid( ek ) ) { |
if( !gpgme_editkey_is_valid( ek ) ) { |
697 |
free_if_alloc( pass ); |
free_if_alloc( pass ); |
716 |
msg_box (dlg, _("Subkey successfully added."), _("GnuPG Status"), MB_OK); |
msg_box (dlg, _("Subkey successfully added."), _("GnuPG Status"), MB_OK); |
717 |
if (lv) |
if (lv) |
718 |
do_add_new_subkey (lv, &keygen, k->flags); |
do_add_new_subkey (lv, &keygen, k->flags); |
719 |
keycache_set_reload (1); |
k->update = 1; |
720 |
} |
} |
721 |
free_if_alloc (pass); |
free_if_alloc (pass); |
722 |
gpgme_editkey_release (ek); |
gpgme_editkey_release (ek); |
727 |
|
|
728 |
|
|
729 |
BOOL |
BOOL |
730 |
|
keyedit_set_pref_keyserver (winpt_key_t k, HWND dlg) |
731 |
|
{ |
732 |
|
gpgme_ctx_t ctx; |
733 |
|
gpgme_editkey_t ek; |
734 |
|
gpgme_error_t err; |
735 |
|
struct URL_ctx_s *url; |
736 |
|
char *pass; |
737 |
|
|
738 |
|
url = (struct URL_ctx_s *)get_keyserver_URL_dlg (dlg); |
739 |
|
if (url->cancel == 1) { |
740 |
|
delete url; |
741 |
|
return FALSE; |
742 |
|
} |
743 |
|
|
744 |
|
pass = request_passphrase (_("Key Edit"), 1, &url->cancel); |
745 |
|
if (url->cancel) { |
746 |
|
delete url; |
747 |
|
return FALSE; |
748 |
|
} |
749 |
|
|
750 |
|
err = gpgme_new (&ctx); |
751 |
|
if (!err) |
752 |
|
err = gpgme_editkey_new (&ek); |
753 |
|
if (err) |
754 |
|
BUG (0); |
755 |
|
gpgme_editkey_keyserver_set (ek, url->url, -1, pass); |
756 |
|
gpgme_set_edit_ctx (ctx, ek, GPGME_EDITKEY_KEYSERV); |
757 |
|
|
758 |
|
err = gpgme_op_editkey (ctx, k->keyid); |
759 |
|
if (!err) |
760 |
|
msg_box (dlg, _("Preferred keyserver successfully set."), _("Key Edit"), MB_OK); |
761 |
|
|
762 |
|
gpgme_release (ctx); |
763 |
|
gpgme_editkey_release (ek); |
764 |
|
free_if_alloc (pass); |
765 |
|
delete url; |
766 |
|
return err == 0? 0 : WPTERR_GENERAL; |
767 |
|
} |
768 |
|
|
769 |
|
|
770 |
|
BOOL |
771 |
keyedit_add_photo( winpt_key_t k, HWND dlg ) |
keyedit_add_photo( winpt_key_t k, HWND dlg ) |
772 |
{ |
{ |
773 |
if( !k->key_pair ) { |
if( !k->key_pair ) { |
865 |
gpgme_set_edit_ctx( ctx, ek, GPGME_EDITKEY_PASSWD ); |
gpgme_set_edit_ctx( ctx, ek, GPGME_EDITKEY_PASSWD ); |
866 |
ec = gpgme_op_editkey( ctx, k->keyid ); |
ec = gpgme_op_editkey( ctx, k->keyid ); |
867 |
if( ec ) |
if( ec ) |
868 |
gpgme_show_error( dlg, ec, ctx, _("Change Passwd"), MB_ERR ); |
gpgme_show_error (dlg, ec, ctx, _("Change Passwd"), MB_ERR); |
869 |
else |
else |
870 |
msg_box( dlg, _("Passphrase successfully changed."), _("GnuPG status"), MB_OK ); |
msg_box (dlg, _("Passphrase successfully changed."), _("GnuPG status"), MB_OK); |
871 |
free_if_alloc( old_pass ); |
free_if_alloc (old_pass); |
872 |
free_if_alloc( new_pass ); |
free_if_alloc (new_pass); |
873 |
gpgme_editkey_release( ek ); |
gpgme_editkey_release (ek); |
874 |
gpgme_release( ctx ); |
gpgme_release (ctx); |
875 |
return TRUE; |
return TRUE; |
876 |
} /* keyedit_change_passwd */ |
} /* keyedit_change_passwd */ |
877 |
|
|
1149 |
|
|
1150 |
|
|
1151 |
static int |
static int |
1152 |
do_editkey_delkey( winpt_key_t k, HWND dlg, listview_ctrl_t lv ) |
do_editkey_delkey (winpt_key_t k, HWND dlg, listview_ctrl_t lv) |
1153 |
{ |
{ |
1154 |
int j, id; |
int j, id; |
1155 |
char tmp[64]; |
char tmp[64]; |
1157 |
gpgme_editkey_t ek; |
gpgme_editkey_t ek; |
1158 |
gpgme_ctx_t ctx; |
gpgme_ctx_t ctx; |
1159 |
|
|
1160 |
|
if (!k->key_pair) |
1161 |
|
return FALSE; /* XXX: shall we allow to modify non-secret keys?? */ |
1162 |
|
|
1163 |
if( listview_count_items( lv, 0 ) == 1 ) { |
if( listview_count_items( lv, 0 ) == 1 ) { |
1164 |
msg_box( dlg, _("Primary key can not be deleted!"), _("Key Edit"), MB_ERR); |
msg_box( dlg, _("Primary key can not be deleted!"), _("Key Edit"), MB_ERR); |
1165 |
return FALSE; |
return FALSE; |
1195 |
gpgme_show_error( dlg, ec, ctx, _("Delete Subkey"), MB_ERR ); |
gpgme_show_error( dlg, ec, ctx, _("Delete Subkey"), MB_ERR ); |
1196 |
else { |
else { |
1197 |
listview_del_item( lv, j ); |
listview_del_item( lv, j ); |
1198 |
keycache_set_reload( 1 ); |
k->update = 1; |
1199 |
status_box( dlg, _("Subkey successfully deleted."), _("GnuPG status") ); |
status_box( dlg, _("Subkey successfully deleted."), _("GnuPG status") ); |
1200 |
} |
} |
1201 |
gpgme_editkey_release( ek ); |
gpgme_editkey_release( ek ); |
1259 |
gpgme_show_error( dlg, ec, ctx, _("Expire Subkey"), MB_ERR ); |
gpgme_show_error( dlg, ec, ctx, _("Expire Subkey"), MB_ERR ); |
1260 |
else { |
else { |
1261 |
listview_add_sub_item( lv, j, 3, buf ); |
listview_add_sub_item( lv, j, 3, buf ); |
1262 |
keycache_set_reload( 1 ); |
k->update = 1; |
1263 |
msg_box( dlg, _("Subkey expire date successfully set."), _("GnuPG status"), MB_OK ); |
msg_box( dlg, _("Subkey expire date successfully set."), _("GnuPG status"), MB_OK ); |
1264 |
} |
} |
1265 |
free_if_alloc( pass ); |
free_if_alloc( pass ); |
1321 |
gpgme_show_error( dlg, ec, ctx, _("Revoke Subkey"), MB_ERR ); |
gpgme_show_error( dlg, ec, ctx, _("Revoke Subkey"), MB_ERR ); |
1322 |
else { |
else { |
1323 |
listview_add_sub_item( lv, j, 5, _("Revoked") ); |
listview_add_sub_item( lv, j, 5, _("Revoked") ); |
1324 |
keycache_set_reload( 1 ); |
k->update = 1; |
1325 |
msg_box( dlg, _("Subkey successfully revoked."), _("GnuPG Status"), MB_OK ); |
msg_box( dlg, _("Subkey successfully revoked."), _("GnuPG Status"), MB_OK ); |
1326 |
} |
} |
1327 |
free_if_alloc( pass ); |
free_if_alloc( pass ); |
1387 |
gpgme_show_error (dlg, ec, ctx, _("Revoke Signature"), MB_ERR); |
gpgme_show_error (dlg, ec, ctx, _("Revoke Signature"), MB_ERR); |
1388 |
else { |
else { |
1389 |
listview_add_sub_item (lv, j, 0, _("Revoked")); |
listview_add_sub_item (lv, j, 0, _("Revoked")); |
1390 |
keycache_set_reload (1); |
k->update = 1; |
1391 |
status_box (dlg, _("User ID successfully revoked"), _("GnuPG Status")); |
status_box (dlg, _("User ID successfully revoked"), _("GnuPG Status")); |
1392 |
} |
} |
1393 |
free_if_alloc (pass); |
free_if_alloc (pass); |
1473 |
if( ec ) |
if( ec ) |
1474 |
gpgme_show_error( dlg, ec, ctx, _("Primary"), MB_ERR ); |
gpgme_show_error( dlg, ec, ctx, _("Primary"), MB_ERR ); |
1475 |
else { |
else { |
1476 |
keycache_set_reload( 1 ); |
k->update = 1; |
1477 |
status_box( dlg, _("User ID successfully flagged"), _("GnuPG Status") ); |
status_box( dlg, _("User ID successfully flagged"), _("GnuPG Status") ); |
1478 |
} |
} |
1479 |
|
|
1548 |
msg_box (dlg, _("No preferences available."), _("Key Edit"), MB_ERR); |
msg_box (dlg, _("No preferences available."), _("Key Edit"), MB_ERR); |
1549 |
EndDialog (dlg, TRUE); |
EndDialog (dlg, TRUE); |
1550 |
} |
} |
1551 |
|
if (gpgme_editkey_get_ulong_attr (inf, GPGME_ATTR_MDC, 0)) |
1552 |
|
CheckDlgButton (dlg, IDC_SHOWPREF_MDC, BST_CHECKED); |
1553 |
} |
} |
1554 |
SetForegroundWindow (dlg); |
SetForegroundWindow (dlg); |
1555 |
break; |
break; |
1592 |
char buf[256], t[512]; |
char buf[256], t[512]; |
1593 |
int j, id = 0; |
int j, id = 0; |
1594 |
|
|
1595 |
|
if (!k->key_pair) |
1596 |
|
return FALSE; /* XXX: see do_editkey_delsubkey */ |
1597 |
|
|
1598 |
if( listview_count_items( lv, 0 ) == 1 ) { |
if( listview_count_items( lv, 0 ) == 1 ) { |
1599 |
msg_box( dlg, _("Primary user ID can not be deleted!"), _("Key Edit"), MB_ERR ); |
msg_box( dlg, _("Primary user ID can not be deleted!"), _("Key Edit"), MB_ERR ); |
1600 |
return FALSE; |
return FALSE; |
1604 |
return FALSE; |
return FALSE; |
1605 |
} |
} |
1606 |
|
|
1607 |
|
/* XXX: add a hint that also all signatures will be deleted? */ |
1608 |
listview_get_item_text( lv, j, 1, buf, DIM(buf) -1 ); |
listview_get_item_text( lv, j, 1, buf, DIM(buf) -1 ); |
1609 |
_snprintf( t, sizeof t -1, _("user ID \"%s\".\n\n" |
_snprintf( t, DIM (t)-1, _("user ID \"%s\".\n\n" |
1610 |
"Do you really want to delete this user ID?"), buf ); |
"Do you really want to delete this user ID?"), |
1611 |
|
buf); |
1612 |
if( msg_box( dlg, t, _("Key Edit"), MB_YESNO|MB_ICONWARNING ) == IDNO ) |
if( msg_box( dlg, t, _("Key Edit"), MB_YESNO|MB_ICONWARNING ) == IDNO ) |
1613 |
return FALSE; |
return FALSE; |
1614 |
|
|
1629 |
gpgme_show_error( dlg, ec, ctx, _("Delete user ID"), MB_ERR ); |
gpgme_show_error( dlg, ec, ctx, _("Delete user ID"), MB_ERR ); |
1630 |
else { |
else { |
1631 |
listview_del_item( lv, j ); |
listview_del_item( lv, j ); |
1632 |
keycache_set_reload( 1 ); |
k->update = 1; |
1633 |
status_box( dlg, _("User ID successfully deleted"), _("GnuPG Status") ); |
status_box( dlg, _("User ID successfully deleted"), _("GnuPG Status") ); |
1634 |
} |
} |
1635 |
gpgme_editkey_release( ek ); |
gpgme_editkey_release( ek ); |
1789 |
break; |
break; |
1790 |
|
|
1791 |
case IDCANCEL: |
case IDCANCEL: |
1792 |
EndDialog( dlg, FALSE ); |
if (k->update) |
1793 |
|
keycache_update (k->keyid); |
1794 |
|
EndDialog (dlg, FALSE); |
1795 |
break; |
break; |
1796 |
|
|
1797 |
case IDC_KEYEDIT_HELP: |
case IDC_KEYEDIT_HELP: |