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

Diff of /trunk/Src/wptCardDlg.cpp

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

revision 26 by twoaday, Mon Oct 17 08:49:30 2005 UTC revision 28 by twoaday, Thu Oct 20 12:35:59 2005 UTC
# Line 36  Line 36 
36  #include "wptUTF8.h"  #include "wptUTF8.h"
37  #include "wptCardEdit.h"  #include "wptCardEdit.h"
38  #include "wptCard.h"  #include "wptCard.h"
39    #include "wptContext.h"
40    
41  int keygen_check_date (SYSTEMTIME * st);  int keygen_check_date (SYSTEMTIME * st);
42    
# Line 162  gpg_card_load (void) Line 163  gpg_card_load (void)
163          gpg_card_release (card);          gpg_card_release (card);
164          card = NULL;          card = NULL;
165      }      }
166        else {
167            struct winpt_key_s key;
168            memset (&key, 0, sizeof (key));
169            winpt_get_pubkey (card->fpr[1]+32, &key);
170            if (key.ext) {
171                key.ext->card_type = strdup (card->card_type);
172                if (!key.ext->card_type)
173                    BUG (NULL);
174                /* memory will be released in gpg_keycache_release (). */
175            }
176        }
177    
178  leave:  leave:
179      delete ce;      delete ce;
# Line 240  card_status (HWND dlg, gpg_card_t card) Line 252  card_status (HWND dlg, gpg_card_t card)
252      s = card->serial;      s = card->serial;
253      while (s && *s == '0') s++;      while (s && *s == '0') s++;
254      _snprintf (cardinf, sizeof (cardinf)-1,      _snprintf (cardinf, sizeof (cardinf)-1,
255                 "Card Edit - OpenPGP card no. %s version %s",                 "Card Edit - %s serial no. %s version %s",
256                 s, get_printable_version (card->version));                       card->card_type, s, get_printable_version (card->version));
257      SetWindowText (dlg, cardinf);      SetWindowText (dlg, cardinf);
258    
259      return 0;      return 0;
# Line 264  prepare_dialog (HWND dlg) Line 276  prepare_dialog (HWND dlg)
276  }  }
277    
278    
   
279  /* Return 0 if the given string @str has the proper format. */  /* Return 0 if the given string @str has the proper format. */
280  static int  static int
281  check_string (const char *str, int flags)  check_string (const char *str, int flags)
# Line 370  do_proc_card_cmds (HWND dlg, struct pin_ Line 381  do_proc_card_cmds (HWND dlg, struct pin_
381                           gpgme_strerror (err));                           gpgme_strerror (err));
382                  errc--;                  errc--;
383                  /* If no card is inserted, we leave the loop. */                  /* If no card is inserted, we leave the loop. */
384                  if (gpgme_err_code (err) == GPG_ERR_CARD_REMOVED)                  if (gpgme_err_code (err) == GPG_ERR_CARD_NOT_PRESENT)
385                      break;                      break;
386              }              }
387          }          }
# Line 498  card_edit_dlg_proc (HWND dlg, UINT msg, Line 509  card_edit_dlg_proc (HWND dlg, UINT msg,
509              SetDlgItemText (dlg, dstid, tmp);              SetDlgItemText (dlg, dstid, tmp);
510              break;              break;
511          }          }
512          switch( LOWORD( wparam ) ) {          switch (LOWORD (wparam)) {
513          case IDC_CEDIT_CHPIN:          case IDC_CEDIT_CHPIN:
514              DialogBoxParam( glob_hinst, (LPCTSTR)IDD_WINPT_CARD_CHPIN, dlg,              DialogBoxParam( glob_hinst, (LPCTSTR)IDD_WINPT_CARD_CHPIN, dlg,
515                              card_changepin_dlg_proc, NULL );                              card_changepin_dlg_proc, NULL );
# Line 524  card_edit_dlg_proc (HWND dlg, UINT msg, Line 535  card_edit_dlg_proc (HWND dlg, UINT msg,
535              }              }
536              do_proc_card_cmds (dlg, &pincb, card);              do_proc_card_cmds (dlg, &pincb, card);
537              free_pincb (&pincb);              free_pincb (&pincb);
538              if( !n )              if (!n)
539                  EndDialog( dlg, TRUE );                  EndDialog (dlg, TRUE);
540              break;              break;
541    
542          case IDCANCEL:          case IDCANCEL:
# Line 633  card_keygen_dlg_proc (HWND dlg, UINT msg Line 644  card_keygen_dlg_proc (HWND dlg, UINT msg
644              n = item_get_text_length (dlg, IDC_CKEYGEN_COMMENT);              n = item_get_text_length (dlg, IDC_CKEYGEN_COMMENT);
645              if (n > 0)              if (n > 0)
646                  GetDlgItemText (dlg, IDC_CKEYGEN_COMMENT, comment, sizeof (comment)-1);                  GetDlgItemText (dlg, IDC_CKEYGEN_COMMENT, comment, sizeof (comment)-1);
647              if (is_8bit_string (name) ||is_8bit_string (comment)) {              if (is_8bit_string (name) || n > 0 && is_8bit_string (comment)) {
648                  msg_box (dlg, _("Please use plain ASCII charset for the fields."),                  msg_box (dlg, _("Please use plain ASCII charset for the fields."),
649                           _("Card Edit"), MB_INFO);                           _("Card Edit"), MB_INFO);
650                  return TRUE;                  return TRUE;
# Line 658  card_keygen_dlg_proc (HWND dlg, UINT msg Line 669  card_keygen_dlg_proc (HWND dlg, UINT msg
669                  if (!keygen_check_date (&st)) {                  if (!keygen_check_date (&st)) {
670                      msg_box (dlg, _("The date you have chosen lies in the past."),                      msg_box (dlg, _("The date you have chosen lies in the past."),
671                               _("Card Edit"), MB_ERR);                               _("Card Edit"), MB_ERR);
672                        free_pincb (&pincb);
673                      delete ce;                      delete ce;
674                      return TRUE;                      return TRUE;
675                  }                  }
# Line 679  card_keygen_dlg_proc (HWND dlg, UINT msg Line 691  card_keygen_dlg_proc (HWND dlg, UINT msg
691                                expires? valid : 0, NULL);                                expires? valid : 0, NULL);
692                            
693              SetCursor (LoadCursor (NULL, IDC_ARROW));              SetCursor (LoadCursor (NULL, IDC_ARROW));
694              /*              
695              if (gpgme_err_code (err) == GPG_ERR_CANCELLED)              if (gpgme_err_code (err) == GPG_ERR_CANCELED)
696                  msg_box (dlg, _("Operation was canceled. It seems that there are "                  msg_box (dlg, _("Operation was canceled. It seems that there are "
697                                  "existing\nkeys on the cards. You need to mark the "                                  "existing\nkeys on the cards. You need to mark the "
698                                  "'Overwrite' flag."), _("Card Edit"), MB_INFO);                                  "'Overwrite' flag."), _("Card Edit"), MB_INFO);
699              else */              else
700              if (err)              if (err)
701                  msg_box (dlg, "The operation does not succeed.\n"                  msg_box (dlg, "The operation does not succeed.\n"
702                                "Please make sure you entered the right PIN's."                                "Please make sure you entered the right PIN's."

Legend:
Removed from v.26  
changed lines
  Added in v.28

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26