/[winpt]/trunk/Src/wptKeyEditDlgs.cpp
ViewVC logotype

Diff of /trunk/Src/wptKeyEditDlgs.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 211 by twoaday, Sun May 7 12:36:48 2006 UTC revision 225 by twoaday, Tue Jun 6 13:37:59 2006 UTC
# Line 120  enum uid_col_t { Line 120  enum uid_col_t {
120    
121  /* Key edit callback context. */  /* Key edit callback context. */
122  struct keyedit_cb_s {  struct keyedit_cb_s {
123      const char     *keyid;      HWND            parent; /* parent window handle. */
124      const char     *pass;      const char     *keyid;  /* key ID of the key. */
125        const char     *pass;   /* pointer to the passphrase. */
126      listview_ctrl_t lv;      listview_ctrl_t lv;
127      int             lv_pos;      int             lv_pos;
128      void           *opaque;      void           *opaque;
# Line 150  static subclass_s keyedit_subkey_proc; Line 151  static subclass_s keyedit_subkey_proc;
151  static subclass_s keyedit_uid_proc;  static subclass_s keyedit_uid_proc;
152    
153  int keygen_check_date (SYSTEMTIME *st);  int keygen_check_date (SYSTEMTIME *st);
154  void get_userid_preflist (char **r_prefs, int * r_flags);  void get_userid_preflist (char **r_prefs, int *r_flags);
155  char* get_subkey_keyid (const char *keyid);  char* get_subkey_keyid (const char *keyid);
   
156  void ComboBox_AddString_utf8 (HWND cb, const char *txt);  void ComboBox_AddString_utf8 (HWND cb, const char *txt);
157    
158    
159    /* Safe wrapper for allocation. */
160  static GpgKeyEdit*  static GpgKeyEdit*
161  create_GpgKeyEdit (const char *keyid)  create_GpgKeyEdit (const char *keyid)
162  {  {
# Line 178  do_init_keylist (HWND dlg, const char *k Line 180  do_init_keylist (HWND dlg, const char *k
180      int i, n;      int i, n;
181    
182      pub = keycache_get_ctx (1);      pub = keycache_get_ctx (1);
     if (!pub)  
         BUG (0);  
   
183      gpg_keycache_rewind (pub);      gpg_keycache_rewind (pub);
184      while( !gpg_keycache_next_key (pub, 0, &key)) {      while (!gpg_keycache_next_key (pub, 0, &key)) {
185          if (key->expired || key->revoked ||          if (key->expired || key->revoked ||
186              key->disabled || key->invalid)              key->disabled || key->invalid)
187              continue;              continue;
# Line 209  do_add_new_userid (listview_ctrl_t lv, Line 208  do_add_new_userid (listview_ctrl_t lv,
208                     const char *utf8_name, const char *email,                     const char *utf8_name, const char *email,
209                     const char *utf8_comment)                     const char *utf8_comment)
210  {  {
211      char *p;      char *p, *native;
212      size_t n;      size_t n;
213            
214      n = strlen (utf8_name) + strlen (email) + 16;      n = strlen (utf8_name) + strlen (email) + 16;
# Line 218  do_add_new_userid (listview_ctrl_t lv, Line 217  do_add_new_userid (listview_ctrl_t lv,
217      p = new char[n+1];      p = new char[n+1];
218      if (!p)      if (!p)
219          BUG (NULL);          BUG (NULL);
220      if (utf8_comment) {      if (utf8_comment)
221          sprintf (p, "%s (%s)", utf8_name, utf8_comment);          sprintf (p, "%s (%s)", utf8_name, utf8_comment);
     }  
222      else      else
223          sprintf (p, "%s", utf8_name);          sprintf (p, "%s", utf8_name);
224        native = utf8_to_native (p);
225        free_if_alloc (p);
226    
227      listview_add_item (lv, "");      listview_add_item (lv, "");
228      listview_add_sub_item (lv, 0, 0, _("Ultimate" ));      listview_add_sub_item (lv, 0, UID_COL_VALID, _("Ultimate" ));
229      listview_add_sub_item (lv, 0, 1, p);      listview_add_sub_item (lv, 0, UID_COL_NAME, native);
230      listview_add_sub_item (lv, 0, 2, email && *email? email : "");      listview_add_sub_item (lv, 0, UID_COL_EMAIL, email && *email? email : "");
231      listview_add_sub_item (lv, 0, 3, get_key_created (time (NULL)));      listview_add_sub_item (lv, 0, UID_COL_CREATION, get_key_created (time (NULL)));
232      free_if_alloc (p);      free_if_alloc (native);
233  }  }
234    
235    
# Line 241  do_add_new_subkey (listview_ctrl_t lv, k Line 241  do_add_new_subkey (listview_ctrl_t lv, k
241      int n;      int n;
242            
243      expdate = keygen->expire? get_key_expire_date (keygen->expire) : _("Never");      expdate = keygen->expire? get_key_expire_date (keygen->expire) : _("Never");
244      _snprintf (info, sizeof info-1, "%d-bit %s",      _snprintf (info, sizeof (info)-1, "%d-bit %s",
245                 keygen->bits,                 keygen->bits,
246                 get_key_pubalgo ((gpgme_pubkey_algo_t)keygen->algo));                 get_key_pubalgo ((gpgme_pubkey_algo_t)keygen->algo));
247      _snprintf (keyid, sizeof keyid-1, "0x%s", keygen->fpr+8);      _snprintf (keyid, sizeof (keyid)-1, "0x%s", keygen->fpr+8);
248      s = get_key_created (time (NULL));      s = get_key_created (time (NULL));
249      n = listview_count_items (lv, 0);      n = listview_count_items (lv, 0);
250      listview_add_item_pos (lv, n);      listview_add_item_pos (lv, n);
# Line 280  do_find_userid (const char *keyid, const Line 280  do_find_userid (const char *keyid, const
280      delete ke;      delete ke;
281      if (err) {      if (err) {
282          log_box (_("user ID"), MB_ERR,          log_box (_("user ID"), MB_ERR,
283                  _("Could not get key information for: \"%s\":\n%s"),                   _("Could not get key information for: \"%s\":\n%s"),
284                  name, gpgme_strerror (err));                   name, gpgme_strerror (err));
285          return -1;          return -1;
286      }      }
287    
# Line 360  keyedit_addphoto_dlg_proc (HWND dlg, UIN Line 360  keyedit_addphoto_dlg_proc (HWND dlg, UIN
360          SetForegroundWindow (dlg);          SetForegroundWindow (dlg);
361          break;          break;
362    
     case WM_DESTROY:  
         break;  
   
     case WM_SYSCOMMAND:  
         if (LOWORD (wparam) == SC_CLOSE)  
             EndDialog (dlg, TRUE);  
         break;  
   
363      case WM_COMMAND:      case WM_COMMAND:
364          switch( LOWORD (wparam)) {          switch( LOWORD (wparam)) {
365          case IDC_ADDPHOTO_SELFILE:          case IDC_ADDPHOTO_SELFILE:
# Line 385  keyedit_addphoto_dlg_proc (HWND dlg, UIN Line 377  keyedit_addphoto_dlg_proc (HWND dlg, UIN
377    
378          case IDOK:          case IDOK:
379              if (!GetDlgItemText (dlg, IDC_ADDPHOTO_FILE, file, sizeof (file)-1)){              if (!GetDlgItemText (dlg, IDC_ADDPHOTO_FILE, file, sizeof (file)-1)){
380                  msg_box( dlg, _("Please enter a file name."), _("Add Photo"), MB_ERR);                  msg_box (dlg, _("Please enter a file name."),
381                             _("Add Photo"), MB_ERR);
382                  return FALSE;                  return FALSE;
383              }              }
384              if (get_file_size (file) == 0 || get_file_size (file) > 6144 ) {              if (get_file_size (file) == 0 || get_file_size (file) > 6144) {
385                  id = msg_box (dlg, _("The JPEG is really large.\n"                  id = msg_box (dlg, _("The JPEG is really large.\n"
386                                       "Are you sure you want to use it?"),                                       "Are you sure you want to use it?"),
387                                       _("Add Photo"), MB_YESNO|MB_INFO);                                       _("Add Photo"), MB_YESNO|MB_INFO);
# Line 446  keyedit_addrevoker_dlg_proc (HWND dlg, U Line 439  keyedit_addrevoker_dlg_proc (HWND dlg, U
439          SetDlgItemText (dlg, IDCANCEL, _("&Cancel"));          SetDlgItemText (dlg, IDCANCEL, _("&Cancel"));
440          SetWindowText (dlg, _("Add Revoker"));          SetWindowText (dlg, _("Add Revoker"));
441          SetForegroundWindow (dlg);          SetForegroundWindow (dlg);
442          break;          center_window (dlg, cb->parent);
   
     case WM_SYSCOMMAND:  
         if (LOWORD (wparam) == SC_CLOSE)  
             EndDialog (dlg, FALSE);  
443          break;          break;
444    
445      case WM_COMMAND:      case WM_COMMAND:
# Line 515  keyedit_adduid_dlg_proc (HWND dlg, UINT Line 504  keyedit_adduid_dlg_proc (HWND dlg, UINT
504          SetDlgItemText (dlg, IDC_ADDUID_INFCOMMENT, _("&Comment"));          SetDlgItemText (dlg, IDC_ADDUID_INFCOMMENT, _("&Comment"));
505          SetDlgItemText (dlg, IDCANCEL, _("&Cancel"));          SetDlgItemText (dlg, IDCANCEL, _("&Cancel"));
506          SetForegroundWindow (dlg);          SetForegroundWindow (dlg);
507          return FALSE;          center_window (dlg, ctx->parent);
           
     case WM_SYSCOMMAND:  
         if (LOWORD (wparam) == SC_CLOSE)  
             EndDialog(dlg, TRUE);  
508          return FALSE;          return FALSE;
509                    
510      case WM_COMMAND:      case WM_COMMAND:
# Line 536  keyedit_adduid_dlg_proc (HWND dlg, UINT Line 521  keyedit_adduid_dlg_proc (HWND dlg, UINT
521              if (strchr (utf8_name, '@')) {              if (strchr (utf8_name, '@')) {
522                  msg_box (dlg, _("Please enter the email address in the email field and not in the name field"),                  msg_box (dlg, _("Please enter the email address in the email field and not in the name field"),
523                           _("UserID"), MB_INFO);                           _("UserID"), MB_INFO);
524                    free_if_alloc (utf8_name);
525                  return FALSE;                  return FALSE;
526              }              }
527    
528              if( !GetDlgItemText (dlg, IDC_ADDUID_EMAIL, email, sizeof (email) -1)) {              if( !GetDlgItemText (dlg, IDC_ADDUID_EMAIL, email, sizeof (email) -1)) {
529                  msg_box( dlg, _("Please enter an email address."), _("UserID"), MB_ERR );                  msg_box (dlg, _("Please enter an email address."), _("UserID"), MB_ERR);
530                    free_if_alloc (utf8_name);
531                  return FALSE;                  return FALSE;
532              }              }
533              if (check_email_address (email)) {              if (check_email_address (email)) {
534                  msg_box (dlg, _("Invalid email address."), _("UserID"), MB_ERR);                  msg_box (dlg, _("Invalid email address."), _("UserID"), MB_ERR);
535                    free_if_alloc (utf8_name);
536                  return FALSE;                  return FALSE;
537              }              }
538                            
# Line 561  keyedit_adduid_dlg_proc (HWND dlg, UINT Line 549  keyedit_adduid_dlg_proc (HWND dlg, UINT
549              else {              else {
550                  msg_box (dlg, _("user ID successfully added."), _("GnuPG Status"), MB_OK);                  msg_box (dlg, _("user ID successfully added."), _("GnuPG Status"), MB_OK);
551                  ctx->finished = 1;                  ctx->finished = 1;
552                    /* The caller releases this items later. */
553                  keygen->name = utf8_name;                  keygen->name = utf8_name;
554                  keygen->comment = utf8_comment;                  keygen->comment = utf8_comment;
555                  keygen->email = m_strdup (email);                  keygen->email = m_strdup (email);
# Line 580  keyedit_adduid_dlg_proc (HWND dlg, UINT Line 569  keyedit_adduid_dlg_proc (HWND dlg, UINT
569  }  }
570    
571    
572    /* Initalize a combo box with default key sizes (1024-4096). */
573  static void  static void
574  init_keysize_box (HWND dlg, int ctlid)  init_keysize_box (HWND dlg, int ctlid)
575  {  {
# Line 640  keyedit_addsubkey_dlg_proc (HWND dlg, UI Line 630  keyedit_addsubkey_dlg_proc (HWND dlg, UI
630      switch (msg) {      switch (msg) {
631      case WM_INITDIALOG:      case WM_INITDIALOG:
632          ctx = (keyedit_cb_t)lparam;          ctx = (keyedit_cb_t)lparam;
633          if (!ctx)          if (!ctx)
634              dlg_fatal_error (dlg, "Could not get dialog param!");              BUG (0);
   
635          SetWindowText (dlg, _("Add new Subkey"));          SetWindowText (dlg, _("Add new Subkey"));
636          SetDlgItemText (dlg, IDC_ADDSUBKEY_INFALGO, _("Key type"));          SetDlgItemText (dlg, IDC_ADDSUBKEY_INFALGO, _("Key type"));
637          SetDlgItemText (dlg, IDC_ADDSUBKEY_INFSIZE, _("Size in bits"));          SetDlgItemText (dlg, IDC_ADDSUBKEY_INFSIZE, _("Size in bits"));
# Line 659  keyedit_addsubkey_dlg_proc (HWND dlg, UI Line 648  keyedit_addsubkey_dlg_proc (HWND dlg, UI
648          EnableWindow (GetDlgItem (dlg, IDC_ADDSUBKEY_EXPDATE), FALSE);          EnableWindow (GetDlgItem (dlg, IDC_ADDSUBKEY_EXPDATE), FALSE);
649          init_keysize_box (dlg, IDC_ADDSUBKEY_SIZE);          init_keysize_box (dlg, IDC_ADDSUBKEY_SIZE);
650          SetForegroundWindow (dlg);          SetForegroundWindow (dlg);
651          return FALSE;          center_window (dlg, ctx->parent);
           
     case WM_SYSCOMMAND:  
         if (LOWORD (wparam) == SC_CLOSE)  
             EndDialog (dlg, TRUE);  
652          return FALSE;          return FALSE;
653                    
654      case WM_COMMAND:      case WM_COMMAND:
# Line 766  keyedit_add_userid (winpt_key_t k, HWND Line 751  keyedit_add_userid (winpt_key_t k, HWND
751      }      }
752    
753      if (k->is_protected) {      if (k->is_protected) {
754          pass = request_passphrase (_("Key Edit"), 1, &cancel);          pass = request_key_passphrase (k->ctx, _("Key Edit"), &cancel);
755          if (cancel)          if (cancel)
756              return FALSE;              return FALSE;
757      }      }
758    
759      memset (&keygen, 0, sizeof (keygen));      memset (&keygen, 0, sizeof (keygen));
760      memset (&cb, 0, sizeof cb);      memset (&cb, 0, sizeof cb);
761        cb.parent = dlg;
762      cb.opaque = &keygen;      cb.opaque = &keygen;
763      cb.is_protected = k->is_protected;      cb.is_protected = k->is_protected;
764      cb.pass = pass;      cb.pass = pass;
# Line 833  keyedit_add_subkey (winpt_key_t k, HWND Line 819  keyedit_add_subkey (winpt_key_t k, HWND
819          return FALSE;          return FALSE;
820      }      }
821      if (k->is_protected) {      if (k->is_protected) {
822          pass = request_passphrase (_("Key Edit"), 1, &cancel);          pass = request_key_passphrase (k->ctx, _("Key Edit"), &cancel);
823          if (cancel)          if (cancel)
824              return FALSE;              return FALSE;
825      }      }
# Line 859  keyedit_add_subkey (winpt_key_t k, HWND Line 845  keyedit_add_subkey (winpt_key_t k, HWND
845  }  }
846    
847    
848    /* Set the preferred keyserver of the given key @k. */
849  BOOL  BOOL
850  keyedit_set_pref_keyserver (winpt_key_t k, HWND dlg)  keyedit_set_pref_keyserver (winpt_key_t k, HWND dlg)
851  {  {
# Line 873  keyedit_set_pref_keyserver (winpt_key_t Line 860  keyedit_set_pref_keyserver (winpt_key_t
860          return FALSE;          return FALSE;
861      }      }
862    
863      pass = request_passphrase (_("Key Edit"), 1, &url->cancel);      pass = request_key_passphrase (k->ctx, _("Key Edit"), &url->cancel);
864      if (url->cancel) {      if (url->cancel) {
865          delete url;          delete url;
866          return FALSE;          return FALSE;
# Line 914  keyedit_add_photo (winpt_key_t k, HWND d Line 901  keyedit_add_photo (winpt_key_t k, HWND d
901    
902      memset (&cb, 0, sizeof (cb));      memset (&cb, 0, sizeof (cb));
903      if (k->is_protected) {      if (k->is_protected) {
904          pass = request_passphrase (_("Key Edit"), 1, &cancel);          pass = request_key_passphrase (k->ctx, _("Key Edit"), &cancel);
905          if (cancel)          if (cancel)
906              return FALSE;              return FALSE;
907      }      }
908        cb.parent = dlg;
909      cb.pass = pass;      cb.pass = pass;
910      cb.keyid = k->keyid;      cb.keyid = k->keyid;
   
911      DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_KEYEDIT_ADDPHOTO, dlg,      DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_KEYEDIT_ADDPHOTO, dlg,
912                      keyedit_addphoto_dlg_proc, (LPARAM)&cb);                      keyedit_addphoto_dlg_proc, (LPARAM)&cb);
913    
# Line 944  keyedit_add_revoker (winpt_key_t k, HWND Line 931  keyedit_add_revoker (winpt_key_t k, HWND
931      }      }
932    
933      if (k->is_protected) {      if (k->is_protected) {
934          pass = request_passphrase (_("Key Edit"), 1, &cancel);          pass = request_key_passphrase (k->ctx, _("Key Edit"), &cancel);
935          if (cancel)          if (cancel)
936              return FALSE;              return FALSE;
937      }      }
938    
939      memset (&cb, 0, sizeof (cb));      memset (&cb, 0, sizeof (cb));
940        cb.parent = dlg;
941      cb.is_protected = k->is_protected;      cb.is_protected = k->is_protected;
942      cb.keyid = k->keyid;      cb.keyid = k->keyid;
943      cb.pass = pass;      cb.pass = pass;
# Line 1038  keyedit_change_passwd (winpt_key_t k, HW Line 1026  keyedit_change_passwd (winpt_key_t k, HW
1026      }      }
1027      new_pass = request_passphrase2 (_("New Passphrase" ), 1, &cancel);      new_pass = request_passphrase2 (_("New Passphrase" ), 1, &cancel);
1028      if (cancel) {      if (cancel) {
1029          free_if_alloc (old_pass);          sfree_if_alloc (old_pass);
1030          return FALSE;          return FALSE;
1031      }      }
1032    
1033        if (strlen (new_pass) == 0) {
1034            cancel = msg_box (dlg, _("Are you sure that you really don't want a passphrase?\n"
1035                                     "This is propably a bad idea, still proceed?"),
1036                                _("Key Edit"), MB_WARN_ASK);
1037            if (cancel != IDYES) {
1038                sfree_if_alloc (old_pass);
1039                sfree_if_alloc (new_pass);
1040                return FALSE;
1041            }
1042        }
1043    
1044      if (is_8bit_string (new_pass)) {      if (is_8bit_string (new_pass)) {
1045          msg_box (dlg, _("The passphrase contains 8-bit characters.\n"          msg_box (dlg, _("The passphrase contains 8-bit characters.\n"
1046                           "It is not suggested to use charset specific characters."),                           "It is not suggested to use charset specific characters."),
1047                           _("Key Edit"), MB_ERR);                           _("Key Edit"), MB_ERR);
1048          free_if_alloc (old_pass);          sfree_if_alloc (old_pass);
1049          free_if_alloc (new_pass);          sfree_if_alloc (new_pass);
1050          return FALSE;          return FALSE;
1051      }      }
1052    
1053      ke = create_GpgKeyEdit (k->keyid);      ke = create_GpgKeyEdit (k->keyid);
1054      ke->setPassphrase (k->is_protected? old_pass : NULL);      ke->setPassphrase (k->is_protected? old_pass : NULL);
1055      err = ke->changePassphrase (new_pass, 0);      if (!k->is_protected)
1056            ke->setNoPassphrase (true);
1057        err = ke->changePassphrase (new_pass, 1);
1058      if (err)      if (err)
1059          msg_box (dlg, gpgme_strerror (err), _("Change Passwd"), MB_ERR);          msg_box (dlg, gpgme_strerror (err), _("Change Passwd"), MB_ERR);
1060      else      else
# Line 1090  subkey_list_init (HWND dlg, winpt_key_t Line 1091  subkey_list_init (HWND dlg, winpt_key_t
1091      int nkeys = 0, i, bits;      int nkeys = 0, i, bits;
1092    
1093      nkeys = count_subkeys (k->ctx);      nkeys = count_subkeys (k->ctx);
1094      if( !nkeys ) {      if (!nkeys)
1095          msg_box (dlg, _("No subkey(s) found."), _("Key Edit"), MB_ERR);          BUG (0); /* should never happen. */
         return NULL;  
     }  
1096                    
1097      listview_new (&lv, GetDlgItem (dlg, IDC_KEYEDIT_KEYLIST));      listview_new (&lv, GetDlgItem (dlg, IDC_KEYEDIT_KEYLIST));
1098      for (i = 0; cols[i].fieldname != NULL; i++)      for (i = 0; cols[i].fieldname != NULL; i++)
1099          listview_add_column (lv, &cols[i]);          listview_add_column (lv, &cols[i]);
1100                    
1101      for( i = 0; i < nkeys; i++ ) {      for (i = 0; i < nkeys; i++) {
1102          listview_add_item( lv, "" );          listview_add_item (lv, "");
1103          listview_add_sub_item( lv, 0, 1, "" );          listview_add_sub_item (lv, 0, 1, "");
1104          memset( &lvi, 0, sizeof lvi );          memset (&lvi, 0, sizeof (lvi));
1105          lvi.mask = LVIF_PARAM;            lvi.mask = LVIF_PARAM;  
1106          lvi.lParam = (LPARAM)k->ctx;          lvi.lParam = (LPARAM)k->ext;
1107          if( ListView_SetItem( lv->ctrl, &lvi ) == FALSE )          if (ListView_SetItem (lv->ctrl, &lvi) == FALSE)
1108              return NULL;              BUG (0);
1109      }      }
1110                    
1111      listview_set_ext_style( lv );      listview_set_ext_style( lv );
# Line 1177  userid_list_init (HWND dlg, winpt_key_t Line 1176  userid_list_init (HWND dlg, winpt_key_t
1176      const char *attr;      const char *attr;
1177            
1178      nuids = count_userids (k->ctx);      nuids = count_userids (k->ctx);
1179      if (!nuids) {      if (!nuids)
1180          msg_box (dlg, _("No user ID(s) found."), _("Key Edit"), MB_ERR);          BUG (0); /* should never happen. */
         return NULL;  
     }  
1181                    
1182      listview_new (&lv, GetDlgItem (dlg, IDC_KEYEDIT_UIDLIST));      listview_new (&lv, GetDlgItem (dlg, IDC_KEYEDIT_UIDLIST));
1183      for( j = 0; cols[j].fieldname != NULL; j++ )      for (j = 0; cols[j].fieldname != NULL; j++)
1184          listview_add_column (lv, &cols[j]);          listview_add_column (lv, &cols[j]);
1185                    
1186      for (j = 0; j < nuids; j++) {      for (j = 0; j < nuids; j++) {
# Line 1211  userid_list_init (HWND dlg, winpt_key_t Line 1208  userid_list_init (HWND dlg, winpt_key_t
1208              listview_add_sub_item (lv, j, UID_COL_CREATION,              listview_add_sub_item (lv, j, UID_COL_CREATION,
1209                                     get_key_created (ks->timestamp));                                     get_key_created (ks->timestamp));
1210      }      }
1211      if( !k->key_pair ) {      if (!k->key_pair) {
1212          CheckDlgButton (dlg, IDC_KEYUID_ADD, BST_INDETERMINATE);          CheckDlgButton (dlg, IDC_KEYUID_ADD, BST_INDETERMINATE);
1213          CheckDlgButton (dlg, IDC_KEYUID_REVOKE, BST_INDETERMINATE);          CheckDlgButton (dlg, IDC_KEYUID_REVOKE, BST_INDETERMINATE);
1214      }      }
# Line 1291  do_editkey_delkey (winpt_key_t k, HWND d Line 1288  do_editkey_delkey (winpt_key_t k, HWND d
1288  {  {
1289      gpgme_error_t err;      gpgme_error_t err;
1290      GpgKeyEdit *ke;      GpgKeyEdit *ke;
1291      int j, id;      int pos, id;
1292      char tmp[64];      char tmp[64];
1293    
1294      if (!k->key_pair)      if (!k->key_pair)
1295          return FALSE; /* XXX: shall we allow to modify non-secret keys?? */          return FALSE;
1296    
1297      if( listview_count_items( lv, 0 ) == 1 ) {      if (listview_count_items (lv, 0) == 1) {
1298          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);
1299          return FALSE;          return FALSE;
1300      }      }
1301      if( (j = listview_get_curr_pos( lv )) == -1 ) {      pos = listview_get_curr_pos (lv);
1302          msg_box( dlg, _("Please select a key."), _("Key Edit"), MB_ERR );      if (pos == -1) {
1303            msg_box (dlg, _("Please select a key."), _("Key Edit"), MB_ERR);
1304          return FALSE;          return FALSE;
1305      }      }
1306      if( j == 0 ) {      if (pos == 0) {
1307          msg_box( dlg, _("Primary subkey can not be deleted!"), _("Key Edit"), MB_ERR );          msg_box (dlg, _("Primary key can not be deleted!"), _("Key Edit"), MB_ERR);
1308          return FALSE;          return FALSE;
1309      }      }
1310            
1311      /* XXX: change the warning to make clear that verification won't work      /* XXX: change the warning to make clear that verification won't work
1312              any longer if this is a sign-only key. */              any longer if this is a sign-only key. */
1313      listview_get_item_text (lv, j, 0, tmp, sizeof (tmp) -1);      listview_get_item_text (lv, pos, 0, tmp, sizeof (tmp) -1);
1314      id = log_box (_("Key Edit"), MB_YESNO|MB_ICONWARNING,      id = log_box (_("Key Edit"), MB_YESNO|MB_ICONWARNING,
1315                      _("\"Subkey %s.\"\n\n"                      _("\"Subkey %s.\"\n\n"
1316                        "Anything encrypted to the selected subkey will no longer\n"                        "Anything encrypted to the selected subkey will no longer\n"
# Line 1321  do_editkey_delkey (winpt_key_t k, HWND d Line 1319  do_editkey_delkey (winpt_key_t k, HWND d
1319      if (id == IDNO)      if (id == IDNO)
1320          return FALSE;          return FALSE;
1321    
1322      ke = new GpgKeyEdit (k->keyid);      ke = create_GpgKeyEdit (k->keyid);
1323      if (!ke)      err = ke->delKey (pos);
         BUG (NULL);  
     err = ke->delKey (j);  
1324      if (err)      if (err)
1325          msg_box (dlg, gpgme_strerror (err), _("Delete Subkey"), MB_ERR);          msg_box (dlg, gpgme_strerror (err), _("Delete Subkey"), MB_ERR);
1326      else {      else {
1327          listview_del_item (lv, j);          listview_del_item (lv, pos);
1328          k->update = 1;          k->update = 1;
1329          status_box (dlg, _("Subkey successfully deleted."), _("GnuPG status"));          status_box (dlg, _("Subkey successfully deleted."), _("GnuPG status"));
1330      }      }
# Line 1346  do_editkey_expire (winpt_key_t k, HWND d Line 1342  do_editkey_expire (winpt_key_t k, HWND d
1342      GpgKeyEdit *ke;      GpgKeyEdit *ke;
1343      date_s udd = {0};      date_s udd = {0};
1344      char buf[256], * pass = NULL;      char buf[256], * pass = NULL;
1345      int j, cancel = 0;      int pos, cancel = 0;
1346    
1347      if (!k->key_pair) {      if (!k->key_pair) {
1348          msg_box (dlg, _("There is no secret key available!"), _("Key Edit"), MB_ERR);          msg_box (dlg, _("There is no secret key available!"), _("Key Edit"), MB_ERR);
1349          return FALSE;          return FALSE;
1350      }      }
1351      if ((j = listview_get_curr_pos (lv)) == -1) {      pos = listview_get_curr_pos (lv);
1352          msg_box( dlg, _("Please select a key."), _("Key Edit"), MB_ERR );      if (pos == -1) {
1353            msg_box (dlg, _("Please select a key."), _("Key Edit"), MB_ERR);
1354          return FALSE;          return FALSE;
1355      }      }
1356    
1357      /* If a key already expired, it is possible the user wants to      /* If a key already expired, it is possible the user wants to
1358         set a new expiration date.. */           set a new expiration date.. */
1359      listview_get_item_text (lv, j, SUBK_COL_STATUS, buf, sizeof buf -1);      listview_get_item_text (lv, pos, SUBK_COL_STATUS, buf, sizeof (buf)-1);
1360      if (!strcmp (buf, _("Expired"))) {      if (!strcmp (buf, _("Expired"))) {
1361          cancel = msg_box (dlg, _("Key already expired.\n\n"          cancel = msg_box (dlg, _("Key already expired.\n\n"
1362                            "Do you want to change the expiration date?"),                            "Do you want to change the expiration date?"),
# Line 1381  do_editkey_expire (winpt_key_t k, HWND d Line 1378  do_editkey_expire (winpt_key_t k, HWND d
1378                   _("Key Edit"), MB_ERR);                   _("Key Edit"), MB_ERR);
1379          return FALSE;          return FALSE;
1380      }      }
1381      if( k->is_protected ) {      if (k->is_protected) {
1382          pass = request_passphrase (_("Key Edit"), 1, &cancel);          pass = request_key_passphrase (k->ctx, _("Key Edit"), &cancel);
1383          if (cancel)          if (cancel)
1384              return FALSE;              return FALSE;
1385      }      }
1386    
1387      ke = new GpgKeyEdit (k->keyid);      ke = create_GpgKeyEdit (k->keyid);
     if (!ke)  
         BUG (NULL);  
1388      if (k->is_protected)      if (k->is_protected)
1389          ke->setPassphrase (pass);          ke->setPassphrase (pass);
1390      else      else
1391          ke->setNoPassphrase (true);          ke->setNoPassphrase (true);
1392      err = ke->setKeyExpireDate (j, w32_mktime (&udd.st), false);      err = ke->setKeyExpireDate (pos, w32_mktime (&udd.st), false);
1393      if (err)      if (err)
1394          msg_box (dlg, gpgme_strerror (err), _("Expire Subkey"), MB_ERR);          msg_box (dlg, gpgme_strerror (err), _("Expire Subkey"), MB_ERR);
1395      else {      else {
1396          _snprintf (buf, sizeof buf - 1, "%04d-%02d-%02d",                _snprintf (buf, sizeof (buf)-1, "%04d-%02d-%02d",
1397                     udd.st.wYear, udd.st.wMonth, udd.st.wDay);                     udd.st.wYear, udd.st.wMonth, udd.st.wDay);
1398          listview_add_sub_item (lv, j, SUBK_COL_EXPIRES, buf);          listview_add_sub_item (lv, pos, SUBK_COL_EXPIRES, buf);
1399          k->update = 1;          k->update = 1;
1400          msg_box (dlg, _("Subkey expire date successfully set."),          msg_box (dlg, _("Subkey expire date successfully set."),
1401                   _("GnuPG status"), MB_OK);                   _("GnuPG status"), MB_OK);
# Line 1447  do_editkey_revoke (winpt_key_t k, HWND d Line 1442  do_editkey_revoke (winpt_key_t k, HWND d
1442      }      }
1443            
1444      if (k->is_protected) {      if (k->is_protected) {
1445          pass = request_passphrase (_("Key Edit"), 1, &cancel);          pass = request_key_passphrase (k->ctx, _("Key Edit"), &cancel);
1446          if (cancel)          if (cancel)
1447              return FALSE;                        return FALSE;          
1448      }      }
1449    
1450      ke = new GpgKeyEdit (k->keyid);      ke = create_GpgKeyEdit (k->keyid);
     if (!ke)  
         BUG (NULL);  
1451      if (k->is_protected)      if (k->is_protected)
1452          ke->setPassphrase (pass);          ke->setPassphrase (pass);
1453      else      else
# Line 1514  do_editkey_revuid (winpt_key_t k, HWND d Line 1507  do_editkey_revuid (winpt_key_t k, HWND d
1507      if (msg_box (dlg, inf, _("Key Edit"), MB_WARN_ASK) == IDNO)      if (msg_box (dlg, inf, _("Key Edit"), MB_WARN_ASK) == IDNO)
1508          return FALSE;          return FALSE;
1509      if (k->is_protected) {      if (k->is_protected) {
1510          pass = request_passphrase (_("Key Edit"), 1, &cancel);          pass = request_key_passphrase (k->ctx, _("Key Edit"), &cancel);
1511          if (cancel)          if (cancel)
1512              return FALSE;                        return FALSE;          
1513      }      }
# Line 1524  do_editkey_revuid (winpt_key_t k, HWND d Line 1517  do_editkey_revuid (winpt_key_t k, HWND d
1517      if (id == -1)      if (id == -1)
1518          BUG (NULL);          BUG (NULL);
1519    
1520      ke = new GpgKeyEdit (k->keyid);      ke = create_GpgKeyEdit (k->keyid);
     if (!ke)  
         BUG (NULL);  
1521      if (k->is_protected)      if (k->is_protected)
1522          ke->setPassphrase (pass);          ke->setPassphrase (pass);
1523      else      else
# Line 1560  do_editkey_setpref (winpt_key_t k, HWND Line 1551  do_editkey_setpref (winpt_key_t k, HWND
1551      listview_get_item_text (lv, j, 2, buf, sizeof buf-1);      listview_get_item_text (lv, j, 2, buf, sizeof buf-1);
1552      id = do_find_userid (k->keyid, buf, NULL, NULL);      id = do_find_userid (k->keyid, buf, NULL, NULL);
1553      if (id == -1)      if (id == -1)
1554          BUG (dlg);          BUG (NULL);
1555      if (k->is_protected) {      if (k->is_protected) {
1556          pass = request_passphrase (_("Key Edit"), 1, &cancel);          pass = request_key_passphrase (k->ctx, _("Key Edit"), &cancel);
1557          if (cancel)          if (cancel)
1558              return FALSE;              return FALSE;
1559      }      }
1560    
1561      ke = new GpgKeyEdit (k->keyid);      ke = create_GpgKeyEdit (k->keyid);
     if (!ke)  
         BUG (NULL);  
1562      if (k->is_protected)      if (k->is_protected)
1563          ke->setPassphrase (pass);          ke->setPassphrase (pass);
1564      else      else
# Line 1594  do_editkey_primary (winpt_key_t k, HWND Line 1583  do_editkey_primary (winpt_key_t k, HWND
1583      gpgme_error_t err;      gpgme_error_t err;
1584      GpgKeyEdit *ke;      GpgKeyEdit *ke;
1585      int j, id, cancel=0;      int j, id, cancel=0;
1586        char valid[32];
1587      char buf[256], *pass = NULL;      char buf[256], *pass = NULL;
1588    
1589      if (listview_count_items (lv, 0) == 1)      if (listview_count_items (lv, 0) == 1)
1590          return TRUE;          return TRUE;
1591      if ((j = listview_get_curr_pos (lv)) == -1) {      if ((j = listview_get_curr_pos (lv)) == -1) {
1592          msg_box( dlg, _("Please select a user ID."), _("Key Edit"), MB_ERR );          msg_box (dlg, _("Please select a user ID."), _("Key Edit"), MB_ERR);
1593          return FALSE;          return FALSE;
1594      }      }
1595      listview_get_item_text (lv, j, 2, buf, sizeof buf-1);      listview_get_item_text (lv, j, UID_COL_VALID, valid, sizeof (valid)-1);
1596        if (!strcmp (valid, _("Revoked")))
1597            return FALSE;
1598        listview_get_item_text (lv, j, UID_COL_EMAIL, buf, sizeof (buf)-1);
1599      id = do_find_userid (k->keyid, buf, NULL, NULL);      id = do_find_userid (k->keyid, buf, NULL, NULL);
1600      if (id == -1)      if (id == -1)
1601          BUG (0);          BUG (0);
1602      if (k->is_protected) {      if (k->is_protected) {
1603          pass = request_passphrase (_("Key Edit"), 1, &cancel);          pass = request_key_passphrase (k->ctx, _("Key Edit"), &cancel);
1604          if (cancel)          if (cancel)
1605              return FALSE;              return FALSE;
1606      }      }
1607    
1608      ke = new GpgKeyEdit (k->keyid);      ke = create_GpgKeyEdit (k->keyid);
1609      if (k->is_protected)      if (k->is_protected)
1610          ke->setPassphrase (pass);          ke->setPassphrase (pass);
1611      else      else
# Line 1725  showpref_dlg_proc (HWND dlg, UINT msg, W Line 1718  showpref_dlg_proc (HWND dlg, UINT msg, W
1718          SetDlgItemText (dlg, IDC_SHOWPREF_UIDHINT, _("user ID:"));          SetDlgItemText (dlg, IDC_SHOWPREF_UIDHINT, _("user ID:"));
1719          SetWindowText (dlg, _("Key Preferences"));          SetWindowText (dlg, _("Key Preferences"));
1720          SetForegroundWindow (dlg);          SetForegroundWindow (dlg);
1721            center_window (dlg, cb->parent);
1722          break;          break;
1723    
1724      case WM_COMMAND:      case WM_COMMAND:
# Line 1757  do_editkey_showpref (winpt_key_t k, HWND Line 1751  do_editkey_showpref (winpt_key_t k, HWND
1751          return FALSE;          return FALSE;
1752      }      }
1753      memset (&cb, 0, sizeof (cb));      memset (&cb, 0, sizeof (cb));
1754        cb.parent = dlg;
1755      cb.opaque = k->ctx;      cb.opaque = k->ctx;
1756      cb.keyid = k->keyid;      cb.keyid = k->keyid;
1757      cb.lv = lv;      cb.lv = lv;
# Line 1780  do_editkey_deluid (winpt_key_t k, HWND d Line 1775  do_editkey_deluid (winpt_key_t k, HWND d
1775      GpgKeyEdit *ke;      GpgKeyEdit *ke;
1776      char email[128], name[128];      char email[128], name[128];
1777      char inf[384];      char inf[384];
1778      int j, id = 0;      int pos, id = 0;
1779    
1780      if (!k->key_pair)      if (!k->key_pair)
1781          return FALSE; /* XXX: see do_editkey_delsubkey */          return FALSE;
1782    
1783      if (listview_count_items (lv, 0) == 1) {      if (listview_count_items (lv, 0) == 1) {
1784          msg_box (dlg, _("Primary user ID can not be deleted!"),          msg_box (dlg, _("Primary user ID can not be deleted!"),
1785                   _("Key Edit"), MB_ERR);                   _("Key Edit"), MB_ERR);
1786          return FALSE;          return FALSE;
1787      }      }
1788      if ((j = listview_get_curr_pos (lv)) == -1) {      pos = listview_get_curr_pos (lv);
1789        if (pos == -1) {
1790          msg_box (dlg, _("Please select a user ID."), _("Key Edit"), MB_ERR);          msg_box (dlg, _("Please select a user ID."), _("Key Edit"), MB_ERR);
1791          return FALSE;          return FALSE;
1792      }      }
1793            
1794      /* XXX: add a hint that also all signatures will be deleted? */      listview_get_item_text (lv, pos, UID_COL_NAME, name, DIM(name) -1);
     listview_get_item_text (lv, j, UID_COL_NAME, name, DIM(name) -1);  
1795      _snprintf (inf, DIM (inf)-1, _("user ID \"%s\".\n\n"      _snprintf (inf, DIM (inf)-1, _("user ID \"%s\".\n\n"
1796                                     "All signatures on this user ID will be also deleted."                                     "All signatures on this user ID will be also deleted."
1797                                     "\n\n"                                     "\n\n"
# Line 1805  do_editkey_deluid (winpt_key_t k, HWND d Line 1800  do_editkey_deluid (winpt_key_t k, HWND d
1800      if (msg_box (dlg, inf, _("Key Edit"), MB_YESNO|MB_ICONWARNING) == IDNO)      if (msg_box (dlg, inf, _("Key Edit"), MB_YESNO|MB_ICONWARNING) == IDNO)
1801          return FALSE;          return FALSE;
1802            
1803      listview_get_item_text (lv, j, UID_COL_EMAIL, email, DIM (email)-1);      listview_get_item_text (lv, pos, UID_COL_EMAIL, email, DIM (email)-1);
1804      listview_get_item_text (lv, j, UID_COL_NAME, name, DIM (name)-1);      listview_get_item_text (lv, pos, UID_COL_NAME, name, DIM (name)-1);
1805      id = do_find_userid (k->keyid, email, name, NULL);      id = do_find_userid (k->keyid, email, name, NULL);
1806      if (id == -1)      if (id == -1)
1807          BUG (dlg);          BUG (0);
   
     ke = new GpgKeyEdit (k->keyid);  
     if (!ke)  
         BUG (NULL);  
1808    
1809        ke = create_GpgKeyEdit (k->keyid);
1810      err = ke->delUserid (id);      err = ke->delUserid (id);
1811      if (err)      if (err)
1812          msg_box (dlg, gpgme_strerror (err), _("Delete user ID"), MB_ERR);          msg_box (dlg, gpgme_strerror (err), _("Delete User ID"), MB_ERR);
1813      else {      else {
1814          listview_del_item (lv, j);          listview_del_item (lv, pos);
1815          k->update = 1;          k->update = 1;
1816          status_box (dlg, _("User ID successfully deleted"), _("GnuPG Status"));          status_box (dlg, _("User ID successfully deleted"), _("GnuPG Status"));
1817      }      }
# Line 1901  do_editkey_enable_disable (winpt_key_t k Line 1893  do_editkey_enable_disable (winpt_key_t k
1893  }  }
1894    
1895    
 /* Return default secret key. */  
 static gpgme_key_t  
 get_default_key (void)  
 {  
     gpgme_key_t def_sk;  
     char *keyid = get_gnupg_default_key ();  
   
     get_seckey (keyid, &def_sk);  
     free_if_alloc (keyid);  
     return def_sk;  
 }  
   
   
   
1896  static void  static void
1897  do_editkey_minimize (winpt_key_t k, HWND dlg)  do_editkey_minimize (winpt_key_t k, HWND dlg)
1898  {  {
# Line 1969  static int Line 1947  static int
1947  do_editkey_sign_userid (winpt_key_t k, HWND dlg, listview_ctrl_t lv, int mode)  do_editkey_sign_userid (winpt_key_t k, HWND dlg, listview_ctrl_t lv, int mode)
1948  {  {
1949      gpgme_error_t err;      gpgme_error_t err;
1950        winpt_key_s signer;
1951      GpgKeyEdit *ke;      GpgKeyEdit *ke;
1952      char *pass = NULL;      char *pass = NULL;
1953      char email[64], name[128];      char *defkey;
1954        char email[64], name[128], valid[32];
1955      int uid_index;      int uid_index;
1956      int cancel = 0;      int cancel = 0;
1957    
# Line 1980  do_editkey_sign_userid (winpt_key_t k, H Line 1960  do_editkey_sign_userid (winpt_key_t k, H
1960          msg_box (dlg, _("Please select a user ID."), _("Key Edit"), MB_ERR);          msg_box (dlg, _("Please select a user ID."), _("Key Edit"), MB_ERR);
1961          return FALSE;          return FALSE;
1962      }      }
1963        listview_get_item_text (lv, uid_index, UID_COL_VALID, valid, sizeof (valid)-1);
1964        if (!strcmp (valid, _("Revoked")))
1965            return TRUE;
1966      if (mode == CMD_SIGN) {      if (mode == CMD_SIGN) {
1967          cancel = msg_box (dlg, _("Do you really want to make this sig exportable?"),          cancel = msg_box (dlg, _("Do you really want to make this sig exportable?"),
1968                            _("Key Edit"), MB_QUEST_ASK);                            _("Key Edit"), MB_QUEST_ASK);
1969          if (cancel == IDNO)          if (cancel == IDNO)
1970              return FALSE;              return FALSE;
1971      }      }
   
1972      listview_get_item_text (lv, uid_index, UID_COL_EMAIL, email, sizeof (email)-1);      listview_get_item_text (lv, uid_index, UID_COL_EMAIL, email, sizeof (email)-1);
1973      listview_get_item_text (lv, uid_index, UID_COL_NAME, name, sizeof (name)-1);      listview_get_item_text (lv, uid_index, UID_COL_NAME, name, sizeof (name)-1);
1974      uid_index = do_find_userid (k->keyid, email, name, NULL);      uid_index = do_find_userid (k->keyid, email, name, NULL);
1975      if (k->is_protected) {  
1976          pass = request_passphrase (_("Key Edit"), 1, &cancel);      defkey = get_gnupg_default_key ();
1977        memset (&signer, 0, sizeof (signer));
1978        if (winpt_get_seckey (defkey, &signer)) {
1979            log_debug ("do_editkey_sign_userid: no default secret key.\r\n");
1980            free_if_alloc (defkey);
1981            return FALSE;
1982        }
1983        if (signer.is_protected) {
1984            pass = request_key_passphrase (signer.ctx, _("Key Edit"), &cancel);
1985          if (cancel)          if (cancel)
1986              return FALSE;              return FALSE;
1987      }      }
1988      ke = create_GpgKeyEdit (k->keyid);      ke = create_GpgKeyEdit (k->keyid);
1989      if (k->is_protected)      if (signer.is_protected)
1990          ke->setPassphrase (pass);          ke->setPassphrase (pass);
1991      else      else
1992          ke->setNoPassphrase (true);          ke->setNoPassphrase (true);
1993      ke->setLocalUser (get_default_key ());      ke->setLocalUser (signer.ctx);
1994      err = ke->signUserid (uid_index,      err = ke->signUserid (uid_index,
1995                            mode == CMD_SIGN? GPG_EDITKEY_SIGN : GPG_EDITKEY_LSIGN,                            mode == CMD_SIGN? GPG_EDITKEY_SIGN : GPG_EDITKEY_LSIGN,
1996                            0, NULL);                            0, NULL);
# Line 2103  keyedit_main_dlg_proc (HWND dlg, UINT ms Line 2093  keyedit_main_dlg_proc (HWND dlg, UINT ms
2093              BUG (NULL);              BUG (NULL);
2094          do_init_cmdlist (dlg, k->key_pair);          do_init_cmdlist (dlg, k->key_pair);
2095          lvsub = subkey_list_init (dlg, k);          lvsub = subkey_list_init (dlg, k);
         if (!lvsub)  
             BUG (0);  
2096          lvuid = userid_list_init (dlg, k);          lvuid = userid_list_init (dlg, k);
         if (!lvuid)  
             BUG (0);  
2097          item = GetDlgItem (dlg, IDC_KEYEDIT_KEYLIST);          item = GetDlgItem (dlg, IDC_KEYEDIT_KEYLIST);
2098          keyedit_subkey_proc.opaque = (void*)k;          keyedit_subkey_proc.opaque = (void*)k;
2099          keyedit_subkey_proc.dlg = dlg;          keyedit_subkey_proc.dlg = dlg;
# Line 2163  keyedit_main_dlg_proc (HWND dlg, UINT ms Line 2149  keyedit_main_dlg_proc (HWND dlg, UINT ms
2149      case WM_NOTIFY:      case WM_NOTIFY:
2150          NMHDR * notify;          NMHDR * notify;
2151          notify = (NMHDR *)lparam;          notify = (NMHDR *)lparam;
2152          if (notify && notify->code == NM_DBLCLK &&          if (!notify || notify->idFrom != IDC_KEYEDIT_UIDLIST)
2153              notify->idFrom == IDC_KEYEDIT_UIDLIST)              break;
2154            if (notify->code == NM_DBLCLK)
2155              do_editkey_showpref (k, dlg, lvuid);              do_editkey_showpref (k, dlg, lvuid);
2156            if (notify->code == NM_RCLICK && k->key_pair) {
2157                HMENU hm = LoadMenu (glob_hinst, MAKEINTRESOURCE (IDR_WINPT_KEYEDIT));
2158                HMENU popup = GetSubMenu (hm, 0);
2159                POINT p;
2160    
2161                GetCursorPos (&p);
2162                TrackPopupMenu (popup, TPM_RIGHTALIGN, p.x, p.y, 0, dlg, NULL);
2163                DestroyMenu (hm);
2164                DestroyMenu (popup);
2165            }
2166          break;          break;
2167    
2168      case WM_COMMAND:      case WM_COMMAND:
2169          switch( LOWORD( wparam ) ) {          switch (LOWORD (wparam)) {
2170          case IDOK:          case IDOK:
2171              cmd = lookup_cmd (dlg);              cmd = lookup_cmd (dlg);
2172              if (cmd == LB_ERR) {              if (cmd == LB_ERR) {
# Line 2203  keyedit_main_dlg_proc (HWND dlg, UINT ms Line 2200  keyedit_main_dlg_proc (HWND dlg, UINT ms
2200              case CMD_LSIGN: do_editkey_sign_userid (k, dlg,              case CMD_LSIGN: do_editkey_sign_userid (k, dlg,
2201                                                      lvuid, cmd);                                                      lvuid, cmd);
2202                              break;                              break;
2203              case CMD_CLEAN: do_editkey_clean (k, dlg);              case CMD_CLEAN: do_editkey_clean (k, dlg); break;
2204              case CMD_MINIMIZE: do_editkey_minimize (k, dlg);              case CMD_MINIMIZE: do_editkey_minimize (k, dlg); break;
2205              }              }
2206              break;              break;          
2207                
2208          case IDCANCEL:          case IDCANCEL:
2209              EndDialog (dlg, FALSE);              EndDialog (dlg, FALSE);
2210              break;              break;
# Line 2219  keyedit_main_dlg_proc (HWND dlg, UINT ms Line 2216  keyedit_main_dlg_proc (HWND dlg, UINT ms
2216          case IDC_KEYEDIT_REVOKE:          case IDC_KEYEDIT_REVOKE:
2217              gen_desig_revoke_cert (k, dlg);              gen_desig_revoke_cert (k, dlg);
2218              break;              break;
2219    
2220            case ID_KEYEDIT_UID_PRIM:
2221                do_editkey_primary (k, dlg, lvuid);
2222                break;
2223    
2224            case ID_KEYEDIT_UID_DEL:
2225                do_editkey_deluid (k, dlg, lvuid);
2226                break;
2227    
2228            case ID_KEYEDIT_UID_REV:
2229                do_editkey_revuid (k, dlg, lvuid);
2230                break;
2231          }          }
2232          break;          break;
2233      }      }

Legend:
Removed from v.211  
changed lines
  Added in v.225

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26