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

Diff of /trunk/Src/wptKeysignDlg.cpp

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

revision 226 by twoaday, Mon Jun 12 13:40:21 2006 UTC revision 229 by twoaday, Mon Jun 19 14:04:31 2006 UTC
# Line 24  Line 24 
24  #include <windows.h>  #include <windows.h>
25  #include <commctrl.h>  #include <commctrl.h>
26  #include <time.h>  #include <time.h>
27    #include <assert.h>
28    
29  #include "resource.h"  #include "resource.h"
30  #include "wptGPG.h"  #include "wptGPG.h"
# Line 168  BOOL CALLBACK Line 169  BOOL CALLBACK
169  showphoto_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)  showphoto_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
170  {  {
171      static winpt_key_t key;      static winpt_key_t key;
172      char buf[100];      char buf[200];
173    
174      switch (msg) {      switch (msg) {
175      case WM_INITDIALOG:      case WM_INITDIALOG:
# Line 212  showphoto_dlg_proc (HWND dlg, UINT msg, Line 213  showphoto_dlg_proc (HWND dlg, UINT msg,
213  BOOL CALLBACK  BOOL CALLBACK
214  sig_class_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)  sig_class_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
215  {  {
216        HWND parent;
217      int sig_class = 0;      int sig_class = 0;
218    
219      switch (msg) {      switch (msg) {
220      case WM_INITDIALOG:      case WM_INITDIALOG:
221            parent = (HWND)lparam;
222          SetWindowText (dlg, _("Choose Signature Class"));          SetWindowText (dlg, _("Choose Signature Class"));
223          SetDlgItemText (dlg, IDC_SIGCLASS_TITLEINF,          SetDlgItemText (dlg, IDC_SIGCLASS_TITLEINF,
224                          _("How carefully have you verified the key you are about to sign actually belongs to the person? If you don't know what to anwser, use \"0\"."));                          _("How carefully have you verified the key you are about to sign actually belongs to the person? If you don't know what to anwser, use \"0\"."));
# Line 229  sig_class_dlg_proc (HWND dlg, UINT msg, Line 232  sig_class_dlg_proc (HWND dlg, UINT msg,
232                          _("(3) I have done very careful checkings."));                          _("(3) I have done very careful checkings."));
233          CheckDlgButton (dlg, IDC_SIGCLASS_CLASS0, BST_CHECKED);          CheckDlgButton (dlg, IDC_SIGCLASS_CLASS0, BST_CHECKED);
234          SetForegroundWindow (dlg);          SetForegroundWindow (dlg);
235          center_window (dlg, NULL);          center_window (dlg, parent? parent : NULL);
236          return TRUE;          return TRUE;
237    
238      case WM_COMMAND:      case WM_COMMAND:
# Line 296  keysign_dlg_proc (HWND dlg, UINT msg, WP Line 299  keysign_dlg_proc (HWND dlg, UINT msg, WP
299      gpgme_error_t err;      gpgme_error_t err;
300      gpgme_key_t k;      gpgme_key_t k;
301      SYSTEMTIME st;      SYSTEMTIME st;
302      HWND h;      char keymsg[2048], *pwd;
     char keymsg[2048], pwd[256];  
303      const char *keyid, *s;      const char *keyid, *s;
304      int type, expires=0, idx;      int type, expires=0, idx;
305      int sig_class = 0;      int sig_class = 0;
# Line 349  keysign_dlg_proc (HWND dlg, UINT msg, WP Line 351  keysign_dlg_proc (HWND dlg, UINT msg, WP
351              EnableWindow (GetDlgItem (dlg, IDC_KEYSIGN_EXPSIG), FALSE);              EnableWindow (GetDlgItem (dlg, IDC_KEYSIGN_EXPSIG), FALSE);
352          CheckDlgButton (dlg, IDC_KEYSIGN_HIDE, BST_CHECKED);          CheckDlgButton (dlg, IDC_KEYSIGN_HIDE, BST_CHECKED);
353          SetForegroundWindow (dlg);          SetForegroundWindow (dlg);
354          h = GetDlgItem (dlg, IDC_KEYSIGN_PASSPHRASE);          SetFocus (GetDlgItem (dlg, IDC_KEYSIGN_PASSPHRASE));
         SetFocus (h);  
355          return FALSE;          return FALSE;
356                    
357      case WM_COMMAND:      case WM_COMMAND:
# Line 378  keysign_dlg_proc (HWND dlg, UINT msg, WP Line 379  keysign_dlg_proc (HWND dlg, UINT msg, WP
379              if (IsDlgButtonChecked (dlg, IDC_KEYSIGN_ASKLEVEL))              if (IsDlgButtonChecked (dlg, IDC_KEYSIGN_ASKLEVEL))
380                  sig_class = dialog_box_param (glob_hinst,                  sig_class = dialog_box_param (glob_hinst,
381                                                (LPCSTR)IDD_WINPT_SIGCLASS, dlg,                                                (LPCSTR)IDD_WINPT_SIGCLASS, dlg,
382                                                sig_class_dlg_proc, (LPARAM)NULL,                                                sig_class_dlg_proc, (LPARAM)dlg,
383                                                _("Choose Signature Class"),                                                _("Choose Signature Class"),
384                                                IDS_WINPT_SIGCLASS);                                                IDS_WINPT_SIGCLASS);
385              type = IsDlgButtonChecked (dlg, IDC_KEYSIGN_LOCAL);              type = IsDlgButtonChecked (dlg, IDC_KEYSIGN_LOCAL);
# Line 408  keysign_dlg_proc (HWND dlg, UINT msg, WP Line 409  keysign_dlg_proc (HWND dlg, UINT msg, WP
409                      if an advanced button is checked and offer to add it to the config                      if an advanced button is checked and offer to add it to the config
410                      file. */                      file. */
411    
412              GetDlgItemText (dlg, IDC_KEYSIGN_PASSPHRASE, pwd, DIM (pwd)-1);              GetDlgItemText_utf8 (dlg, IDC_KEYSIGN_PASSPHRASE, &pwd);
413              keyid = key->ctx->subkeys->keyid;              keyid = key->ctx->subkeys->keyid;
414              if (!keyid) {              assert (keyid != NULL); /* should be always true. */
                 wipememory (pwd, sizeof (pwd));  
                 msg_box (dlg, _("Could not get Key ID from key."), _("Key Signing"), MB_ERR);  
                 return TRUE;  
             }  
415              ke = new GpgKeyEdit (keyid);              ke = new GpgKeyEdit (keyid);
416              if (!ke)              if (!ke)
417                  BUG (NULL);                  BUG (NULL);
# Line 426  keysign_dlg_proc (HWND dlg, UINT msg, WP Line 423  keysign_dlg_proc (HWND dlg, UINT msg, WP
423                  ke->setLocalUser (k);                  ke->setLocalUser (k);
424    
425              err = ke->signKey (type, sig_class, expires? keymsg : "0");              err = ke->signKey (type, sig_class, expires? keymsg : "0");
426              wipememory (pwd, sizeof (pwd));              sfree_if_alloc (pwd);
427              if (err) {              if (err) {
428                  delete ke;                  delete ke;
429                  msg_box (dlg, gpgme_strerror (err), _("Key Signing"), MB_ERR);                  msg_box (dlg, gpgme_strerror (err), _("Key Signing"), MB_ERR);

Legend:
Removed from v.226  
changed lines
  Added in v.229

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26