/[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 169 by twoaday, Thu Jan 26 10:17:17 2006 UTC revision 170 by twoaday, Mon Jan 30 12:42:57 2006 UTC
# Line 1  Line 1 
1  /* wptKeysignDlg.cpp - Key signing dialog  /* wptKeysignDlg.cpp - Key signing dialog
2   *      Copyright (C) 2001-2005 Timo Schulz   *      Copyright (C) 2001-2006 Timo Schulz
3   *   *
4   * This file is part of WinPT.   * This file is part of WinPT.
5   *   *
# Line 39  Line 39 
39  #include "wptKeylist.h"  #include "wptKeylist.h"
40  #include "wptKeyEdit.h"  #include "wptKeyEdit.h"
41    
 static int sig_class_choice = 0;  
42    
43  /* Return a beautified printable fingerprint of @fpr. */  /* Return a beautified printable fingerprint of @fpr. */
44  static const char*  static const char*
# Line 159  do_check_protection (HWND dlg) Line 158  do_check_protection (HWND dlg)
158  BOOL CALLBACK  BOOL CALLBACK
159  sig_class_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)  sig_class_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
160  {  {
161        int sig_class = 0;
162    
163      switch (msg) {      switch (msg) {
164      case WM_INITDIALOG:      case WM_INITDIALOG:
165          SetWindowText (dlg, _("Choose Signature Class"));          SetWindowText (dlg, _("Choose Signature Class"));
# Line 173  sig_class_dlg_proc (HWND dlg, UINT msg, Line 174  sig_class_dlg_proc (HWND dlg, UINT msg,
174          return TRUE;          return TRUE;
175    
176      case WM_COMMAND:      case WM_COMMAND:
177          switch( LOWORD( wparam ) ) {          switch (LOWORD (wparam)) {
178          case IDOK:          case IDOK:
179              if (IsDlgButtonChecked (dlg, IDC_SIGCLASS_CLASS0))              if (IsDlgButtonChecked (dlg, IDC_SIGCLASS_CLASS0))
180                  sig_class_choice = 0;                  sig_class = 0;
181              else if (IsDlgButtonChecked (dlg, IDC_SIGCLASS_CLASS1))              else if (IsDlgButtonChecked (dlg, IDC_SIGCLASS_CLASS1))
182                  sig_class_choice = 1;                  sig_class = 1;
183              else if (IsDlgButtonChecked (dlg, IDC_SIGCLASS_CLASS2))              else if (IsDlgButtonChecked (dlg, IDC_SIGCLASS_CLASS2))
184                  sig_class_choice = 2;                  sig_class = 2;
185              else if (IsDlgButtonChecked (dlg, IDC_SIGCLASS_CLASS3))              else if (IsDlgButtonChecked (dlg, IDC_SIGCLASS_CLASS3))
186                  sig_class_choice = 3;                  sig_class = 3;
187              else              else
188                  sig_class_choice = 0;                  sig_class = 0;
189              EndDialog (dlg, TRUE);              EndDialog (dlg, sig_class);
190                return TRUE;
191    
192            case IDCANCEL:
193                EndDialog (dlg, 0);
194              return TRUE;              return TRUE;
195          }          }
196          break;          break;
# Line 227  keysign_dlg_proc (HWND dlg, UINT msg, WP Line 232  keysign_dlg_proc (HWND dlg, UINT msg, WP
232      char *uid = NULL;      char *uid = NULL;
233      const char *keyid, *s;      const char *keyid, *s;
234      int type, expires=0, idx;      int type, expires=0, idx;
235        int sig_class = 0;
236            
237      switch ( msg )  {      switch ( msg )  {
238      case WM_INITDIALOG:      case WM_INITDIALOG:
239          if (lparam == 0)          if (lparam == 0)
240              dlg_fatal_error (dlg, "Could not get dialog param.");              dlg_fatal_error (dlg, "Could not get dialog param.");
         #ifndef LANG_DE  
241          SetWindowText (dlg, _("Key Signing"));          SetWindowText (dlg, _("Key Signing"));
         #endif  
242          key = (winpt_key_t) lparam;          key = (winpt_key_t) lparam;
243          s = key->ctx->uids->uid;          s = key->ctx->uids->uid;
244          uid = utf8_to_wincp (s, strlen (s));          uid = utf8_to_wincp (s, strlen (s));
# Line 277  keysign_dlg_proc (HWND dlg, UINT msg, WP Line 281  keysign_dlg_proc (HWND dlg, UINT msg, WP
281          h = GetDlgItem (dlg, IDC_KEYSIGN_PASSPHRASE);          h = GetDlgItem (dlg, IDC_KEYSIGN_PASSPHRASE);
282          SetFocus (h);          SetFocus (h);
283          return FALSE;          return FALSE;
       
     case WM_DESTROY:  
         sig_class_choice = 0;  
         break;  
284    
285      case WM_SYSCOMMAND:      case WM_SYSCOMMAND:
286          if( LOWORD( wparam ) == SC_CLOSE ) {          if( LOWORD( wparam ) == SC_CLOSE ) {
# Line 299  keysign_dlg_proc (HWND dlg, UINT msg, WP Line 299  keysign_dlg_proc (HWND dlg, UINT msg, WP
299              EnableWindow (GetDlgItem (dlg, IDC_KEYSIGN_EXPIRES), enable? TRUE : FALSE);              EnableWindow (GetDlgItem (dlg, IDC_KEYSIGN_EXPIRES), enable? TRUE : FALSE);
300          }          }
301    
302          switch( LOWORD( wparam ) ) {          switch (LOWORD (wparam)) {
303          case IDOK:          case IDOK:
304              if (IsDlgButtonChecked (dlg, IDC_KEYSIGN_ASKLEVEL))              if (IsDlgButtonChecked (dlg, IDC_KEYSIGN_ASKLEVEL))
305                  dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_SIGCLASS, dlg,                  sig_class = dialog_box_param (glob_hinst,
306                                    sig_class_dlg_proc, (LPARAM)NULL,                                                (LPCSTR)IDD_WINPT_SIGCLASS, dlg,
307                                    _("Choose Signature Class"),  IDS_WINPT_SIGCLASS);                                                sig_class_dlg_proc, (LPARAM)NULL,
308                                                  _("Choose Signature Class"),
309                                                  IDS_WINPT_SIGCLASS);
310              type = IsDlgButtonChecked (dlg, IDC_KEYSIGN_LOCAL);              type = IsDlgButtonChecked (dlg, IDC_KEYSIGN_LOCAL);
311              if (type)              if (type)
312                  type = GPG_EDITKEY_LSIGN;                  type = GPG_EDITKEY_LSIGN;
# Line 342  keysign_dlg_proc (HWND dlg, UINT msg, WP Line 344  keysign_dlg_proc (HWND dlg, UINT msg, WP
344              if (k)              if (k)
345                  ke->setLocalUser (k);                  ke->setLocalUser (k);
346    
347              err = ke->signKey (type, sig_class_choice, expires? keymsg : "0");              err = ke->signKey (type, sig_class, expires? keymsg : "0");
348              wipememory (pwd, sizeof (pwd));              wipememory (pwd, sizeof (pwd));
349              if (err) {              if (err) {
350                  delete ke;                  delete ke;
# Line 353  keysign_dlg_proc (HWND dlg, UINT msg, WP Line 355  keysign_dlg_proc (HWND dlg, UINT msg, WP
355                  msg_box (dlg, _("This key is already signed by your key"),                  msg_box (dlg, _("This key is already signed by your key"),
356                           _("Key Signing"), MB_INFO);                           _("Key Signing"), MB_INFO);
357              else {              else {
358                  status_box (dlg, _("Key successfully signed."), PGM_NAME);                  status_box (dlg, _("Key successfully signed."), _("Key Signing"));
359                  key->update = 1;                  key->update = 1;
360              }              }
361              delete ke;              delete ke;

Legend:
Removed from v.169  
changed lines
  Added in v.170

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26