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

Diff of /trunk/Src/wptMainProc.cpp

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

revision 19 by twoaday, Fri May 20 08:39:15 2005 UTC revision 32 by twoaday, Mon Oct 24 08:03:48 2005 UTC
# Line 39  Line 39 
39  #include "wptKeyManager.h"  #include "wptKeyManager.h"
40  #include "wptCard.h"  #include "wptCard.h"
41  #include "wptCryptdisk.h"  #include "wptCryptdisk.h"
42    #include "wptCardEdit.h"
43    
44  extern HWND activ_hwnd;  extern HWND activ_hwnd;
45  static int cmd = 0;  static int cmd = 0;
46  static int wipe_contents = 0;  static int wipe_contents = 0;
47    
48    
49    /* Dialog box procedure to display all insecure all ElGamal keys. */
50  BOOL CALLBACK  BOOL CALLBACK
51  elgamal_warn_dlg_proc( HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam )  elgamal_warn_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
52  {  {
53      gpgme_keycache_t pc;      gpg_keycache_t pc;
54      gpgme_key_t key;      gpgme_key_t key;
55        char tmp[128+64+1];
56    
57      switch( msg ) {      switch( msg ) {
58      case WM_INITDIALOG:      case WM_INITDIALOG:
59          pc = keycache_get_ctx( 1 );          pc = keycache_get_ctx (1);
60          while( !gpgme_keycache_next_key( pc, 0, &key ) ) {          while (!gpg_keycache_next_key (pc, 0, &key)) {
61              if( gpgme_key_get_ulong_attr( key, GPGME_ATTR_ALGO, NULL, 0 )              if (key->subkeys->pubkey_algo == GPGME_PK_ELG) {
62                  == GPGME_PK_ELG_ES ) {                  _snprintf (tmp, sizeof (tmp)-1, "(0x%s) %s",
63                  char tmp[128+64+1];                             key->subkeys->keyid+8, key->uids->uid);
64                  _snprintf( tmp, sizeof (tmp)-1, "(0x%s) %s",                  SendDlgItemMessage (dlg, IDC_ELGWARN_LIST, LB_ADDSTRING,
65                  gpgme_key_get_string_attr( key, GPGME_ATTR_KEYID, NULL, 0 )+8,                                      0, (LPARAM)(const char *) tmp);
                 gpgme_key_get_string_attr( key, GPGME_ATTR_USERID, NULL, 0 ) );  
                 SendDlgItemMessage( dlg, IDC_ELGWARN_LIST, LB_ADDSTRING,  
                                     0, (LPARAM)(const char *) tmp );  
66              }              }
67          }          }
68          gpgme_keycache_rewind( pc );          gpg_keycache_rewind (pc);
69          center_window( dlg );          center_window (dlg, NULL);
70          SetForegroundWindow( dlg );          SetForegroundWindow (dlg);
71          break;          break;
72    
73      case WM_COMMAND:      case WM_COMMAND:
74          switch( LOWORD( wparam ) ) {          switch (LOWORD (wparam)) {
75          case IDOK:          case IDOK:
76              EndDialog( dlg, TRUE );              EndDialog (dlg, TRUE);
77              break;              break;
78          }          }
79          break;          break;
80      }      }
81      return FALSE;      return FALSE;
82  } /* elgamal_warn_dlg_proc */  }
83    
84    
85  static void  /* @unused
86    static int
87  cleanup_tmp_files (void)  cleanup_tmp_files (void)
88  {  {
89      struct _finddata_t dat;      struct _finddata_t dat;
# Line 92  cleanup_tmp_files (void) Line 93  cleanup_tmp_files (void)
93      if (GetTempPath (sizeof (tmp)-1, tmp) == FALSE ||      if (GetTempPath (sizeof (tmp)-1, tmp) == FALSE ||
94          SetCurrentDirectory (tmp) == FALSE) {          SetCurrentDirectory (tmp) == FALSE) {
95          winpt_errmsg ("GetTempPath", 0);          winpt_errmsg ("GetTempPath", 0);
96          return;          return WPTERR_GENERAL;
97      }      }
98      hd = _findfirst ("gpgmeOUT*", &dat);      hd = _findfirst ("gpgmeOUT*", &dat);
99      if (hd == -1)      if (hd == -1)
100          return;          return 0;
101      do {      do {
102          secure_unlink (dat.name, WIPE_MODE_SIMPLE);          secure_unlink (dat.name, WIPE_MODE_SIMPLE);
103      } while (_findnext (hd, &dat) == 0);      } while (_findnext (hd, &dat) == 0);
104      _findclose (hd);      _findclose (hd);
105        return 0;
106  }  }
107    */
108    
109    
110    /* Dialog box procedure to confirm to delete the clipboard contents. */
111  static BOOL CALLBACK  static BOOL CALLBACK
112  confirm_delclipboard_dlg (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)  confirm_delclipboard_dlg (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
113  {  {
114      switch (msg) {      switch (msg) {
115      case WM_INITDIALOG:      case WM_INITDIALOG:
116          center_window (dlg);          SetWindowText (dlg, _("Delete Clipboard Contents"));
117            center_window (dlg, NULL);
118          SetForegroundWindow (dlg);          SetForegroundWindow (dlg);
119          break;          break;
120    
# Line 132  confirm_delclipboard_dlg (HWND dlg, UINT Line 137  confirm_delclipboard_dlg (HWND dlg, UINT
137          break;          break;
138      }      }
139      return FALSE;      return FALSE;
140  } /* confirm_delclipboard_dlg */  }
141    
142    
143  static int  static gpgme_error_t
144  currwnd_gpg_dlg (HWND hwnd, UINT id, int *ret_set)  currwnd_gpg_dlg (HWND hwnd, UINT id, int *ret_set)
145  {  {
146      gpgme_error_t err;      gpgme_error_t err;
147      gpgme_pgptype_t type;      int type;
     int rc = 0;  
148            
149      if( ret_set )      if (ret_set)
150          *ret_set = 1;          *ret_set = 1;
151      switch( id ) {      switch (id) {
152      case ID_WINPT_CURRWND_SYMENC:      case ID_WINPT_CURRWND_SYMENC:
153          gpgme_encrypt_symmetric ();          gpg_encrypt_symmetric ();
154          break;          break;
155    
156      case ID_WINPT_CURRWND_ENCRYPT:      case ID_WINPT_CURRWND_ENCRYPT:
# Line 168  currwnd_gpg_dlg (HWND hwnd, UINT id, int Line 172  currwnd_gpg_dlg (HWND hwnd, UINT id, int
172          break;          break;
173                    
174      case ID_WINPT_CURRWND_DECRYPT_VERIFY:      case ID_WINPT_CURRWND_DECRYPT_VERIFY:
175          err = gpgme_clip_get_pgptype( &type );          err = gpg_clip_get_pgptype (&type);
176          if( err ) {          if (err) {
177              msg_box( hwnd, gpgme_strerror( err ), _("Clipboard"), MB_ERR );              msg_box (hwnd, gpgme_strerror (err), _("Clipboard"), MB_ERR);
178              break;              break;
179          }          }
180          if( (type & GPGME_PGP_MESSAGE) && !(type & GPGME_PGP_CLEARSIG) ) {          if( (type & PGP_MESSAGE) && !(type & PGP_CLEARSIG) ) {
181              /* It makes only sense to insert the data in the window if it's              /* It makes only sense to insert the data in the window if it's
182                 really a ciphertext. Verfied data doesn't need this. */                 really a ciphertext. Verfied data doesn't need this. */
183              rc = clip_decrypt_dlg( hwnd );              err = clip_decrypt_dlg (hwnd);
184              if( !rc && reg_prefs.use_viewer ) {              if (!err && reg_prefs.use_viewer) {
185                  dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_CLIPEDIT,                  dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_CLIPEDIT,
186                                    GetDesktopWindow(), clip_edit_dlg_proc, NULL,                                    GetDesktopWindow(), clip_edit_dlg_proc, NULL,
187                                   _("Clipboard Editor"), IDS_WINPT_CLIPEDIT );                                   _("Clipboard Editor"), IDS_WINPT_CLIPEDIT);
188                  if( ret_set )                  if (ret_set)
189                      *ret_set = 0;                      *ret_set = 0;
190              }              }
191          }          }
192          else if ((type & GPGME_PGP_PUBKEY) && !(type & GPGME_PGP_CLEARSIG))          else if ((type & PGP_PUBKEY) && !(type & PGP_CLEARSIG))
193              km_clip_import (GetDesktopWindow ());              km_clip_import (GetDesktopWindow ());
194          else {          else {
195              dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_VERIFY, hwnd,              dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_VERIFY, hwnd,
196                                clip_verify_dlg_proc, NULL,                                clip_verify_dlg_proc, NULL,
197                                _("Verify"), IDS_WINPT_VERIFY );                                _("Verify"), IDS_WINPT_VERIFY );
198              rc = 1;              err  = gpg_error (GPG_ERR_EOF); /* make sure window is ot updated. */
199          }          }
200          break;          break;
201      }      }
202            
203      return rc;      return err;
204  } /* currwnd_gpg_dlg */  }
205    
206    
207  static void  static void
208  clip_gpg_dlg( HWND hwnd, UINT id )  clip_gpg_dlg (HWND hwnd, UINT id)
209  {  {
210      gpgme_error_t ec;      gpgme_error_t err;
211      gpgme_pgptype_t type;      int type;
212      size_t size = 0;      size_t size = 0;    
     int rc;  
213            
214      if( (id == ID_WINPT_SIGN || id == ID_WINPT_SIGNENCRYPT)      if( (id == ID_WINPT_SIGN || id == ID_WINPT_SIGNENCRYPT)
215          && gnupg_access_keyring (0) ) {          && gnupg_access_keyring (0) ) {
# Line 216  clip_gpg_dlg( HWND hwnd, UINT id ) Line 219  clip_gpg_dlg( HWND hwnd, UINT id )
219            
220      switch( id ) {      switch( id ) {
221      case ID_WINPT_SYMENC:      case ID_WINPT_SYMENC:
222          gpgme_encrypt_symmetric();          gpg_encrypt_symmetric();
223          break;          break;
224                    
225      case ID_WINPT_ENCRYPT:      case ID_WINPT_ENCRYPT:
# Line 238  clip_gpg_dlg( HWND hwnd, UINT id ) Line 241  clip_gpg_dlg( HWND hwnd, UINT id )
241          break;          break;
242                    
243      case ID_WINPT_DECRYPT_VERIFY:      case ID_WINPT_DECRYPT_VERIFY:
244          ec = gpgme_clip_get_pgptype( &type );          err = gpg_clip_get_pgptype (&type);
245          if( ec ) {          if (err) {
246              msg_box( hwnd, gpgme_strerror( ec ), _("Clipboard"), MB_ERR );              msg_box( hwnd, gpgme_strerror( err ), _("Clipboard"), MB_ERR );
247              break;              break;
248          }          }
249          if( (type & GPGME_PGP_MESSAGE) && !(type & GPGME_PGP_CLEARSIG) ) {          if( (type & PGP_MESSAGE) && !(type & PGP_CLEARSIG) ) {
250              rc = clip_decrypt_dlg (hwnd);              err = clip_decrypt_dlg (hwnd);
251              if (!rc && reg_prefs.use_viewer) {              if (!err && reg_prefs.use_viewer) {
252                  dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_CLIPEDIT,                  dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_CLIPEDIT,
253                                    GetDesktopWindow(), clip_edit_dlg_proc, NULL,                                    GetDesktopWindow(), clip_edit_dlg_proc, NULL,
254                                   _("Clipboard Editor"), IDS_WINPT_CLIPEDIT );                                   _("Clipboard Editor"), IDS_WINPT_CLIPEDIT );
255              }              }
256          }          }
257          else if( (type & GPGME_PGP_SIG) && !(type & GPGME_PGP_CLEARSIG) ) {          else if( (type & PGP_SIG) && !(type & PGP_CLEARSIG) ) {
258              text_input_s input;              text_input_s input;
259              gpgme_data_t sig;              gpgme_data_t sig;
260                            
261              memset( &input, 0, sizeof (input) );              memset( &input, 0, sizeof (input) );
262              ec = gpgme_data_new_from_clipboard (&sig);              err = gpg_data_new_from_clipboard (&sig, 0);
263              if( ec ) {              if( err ) {
264                  msg_box( hwnd, gpgme_strerror( ec ),_("Verify"), MB_ERR );                  msg_box( hwnd, gpgme_strerror( err ),_("Verify"), MB_ERR );
265                  return;                  return;
266              }              }
267              input.type = 0;              input.type = 0;
# Line 266  clip_gpg_dlg( HWND hwnd, UINT id ) Line 269  clip_gpg_dlg( HWND hwnd, UINT id )
269                               text_input_dlg_proc, (LPARAM)&input,                               text_input_dlg_proc, (LPARAM)&input,
270                               _("Text Input"), IDS_WINPT_TEXT );                               _("Text Input"), IDS_WINPT_TEXT );
271                            
272              gpgme_data_release_and_set_clipboard( sig );              gpg_data_release_and_set_clipboard( sig, 0 );
273              if( input.length ) {              if( input.length ) {
274                  dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_VERIFY, hwnd,                  dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_VERIFY, hwnd,
275                                   clip_verify_dlg_proc, (LPARAM)&input,                                   clip_verify_dlg_proc, (LPARAM)&input,
# Line 275  clip_gpg_dlg( HWND hwnd, UINT id ) Line 278  clip_gpg_dlg( HWND hwnd, UINT id )
278                  free_if_alloc( input.data );                  free_if_alloc( input.data );
279              }              }
280          }          }
281          else if (type & GPGME_PGP_CLEARSIG) {          else if (type & PGP_CLEARSIG) {
282              dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_VERIFY, hwnd,              dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_VERIFY, hwnd,
283                                clip_verify_dlg_proc, NULL,                                clip_verify_dlg_proc, NULL,
284                                _("Verify"), IDS_WINPT_VERIFY );                                _("Verify"), IDS_WINPT_VERIFY );
285          }          }
286          else if ((type & GPGME_PGP_PUBKEY) || (type & GPGME_PGP_SECKEY))          else if ((type & PGP_PUBKEY) || (type & PGP_SECKEY))
287              km_clip_import (GetDesktopWindow ());              km_clip_import (GetDesktopWindow ());
288          else          else
289              msg_box (hwnd, _("Unknown OpenPGP type."), _("Clipboard"), MB_ERR);              msg_box (hwnd, _("Unknown OpenPGP type."), _("Clipboard"), MB_ERR);
# Line 288  clip_gpg_dlg( HWND hwnd, UINT id ) Line 291  clip_gpg_dlg( HWND hwnd, UINT id )
291  } /* clip_gpg_dlg */  } /* clip_gpg_dlg */
292    
293    
294  gpgme_card_t  /* Load the Card Manager with the current card. */
295  smartcard_init (void)  static void
296    load_smartcard (void)
297  {  {
298      /*      gpg_card_t card;
299      pcsc_loadlib (scard_support);  
300      rc = show_card_status ();      card = gpg_card_load ();
301      if( rc )          if (card) {
302          break;          dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_CARD_EDIT,
303      */                            GetDesktopWindow (), card_edit_dlg_proc,
304      return gpg_load_scard ();                            (LPARAM)card,
305  } /* smartcard_init */                            _("Card Edit"), IDS_WINPT_CARD_EDIT);
306            gpg_card_release (card);
307            card = NULL;    
308        }
309    }
310    
311    
312    /* Add the winpt symbol to the task bar. */
313    static void
314    add_taskbar_icon (HWND hwnd, NOTIFYICONDATA *nid)
315    {
316        nid->cbSize = sizeof (NOTIFYICONDATA);
317        nid->uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
318        nid->uCallbackMessage = WM_USER;
319        nid->hWnd = hwnd;
320        nid->hIcon = LoadIcon (glob_hinst, MAKEINTRESOURCE (IDI_WINPT));
321        strcpy (nid->szTip, "Windows Privacy Tray v"PGM_VERSION);
322        Shell_NotifyIcon (NIM_ADD, nid);
323        DestroyIcon (nid->hIcon);
324    }
325    
326    
327    /* Main message loop for the tray window. */
328  LRESULT CALLBACK  LRESULT CALLBACK
329  winpt_main_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)  winpt_main_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
330  {                {              
# Line 312  winpt_main_proc (HWND hwnd, UINT msg, WP Line 336  winpt_main_proc (HWND hwnd, UINT msg, WP
336      size_t size = 0;      size_t size = 0;
337      int rc, set_wc = 0, has_data = 0;      int rc, set_wc = 0, has_data = 0;
338      INITCOMMONCONTROLSEX cce;      INITCOMMONCONTROLSEX cce;
339      gpgme_error_t ec;      gpgme_error_t err;
     gpgme_card_t card;  
340    
341      switch( msg ) {      switch (msg) {
342      case WM_CREATE:      case WM_CREATE:
343          NID.cbSize = sizeof (NID);          add_taskbar_icon (hwnd, &NID);
         NID.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;  
         NID.uCallbackMessage = WM_USER;  
         NID.hWnd = hwnd;  
         NID.hIcon = LoadIcon (glob_hinst, MAKEINTRESOURCE (IDI_WINPT));  
         strcpy (NID.szTip, "Windows Privacy Tray v"PGM_VERSION);  
         Shell_NotifyIcon (NIM_ADD, &NID);  
         DestroyIcon (NID.hIcon);  
344          rc = wsock_init ();          rc = wsock_init ();
345          if (rc)          if (rc)
346              msg_box (NULL, winpt_strerror (rc), "Winsock2 DLL", MB_ERR);              msg_box (NULL, winpt_strerror (rc), "Winsock2 DLL", MB_ERR);
# Line 335  winpt_main_proc (HWND hwnd, UINT msg, WP Line 351  winpt_main_proc (HWND hwnd, UINT msg, WP
351          }          }
352          rc = PTD_initialize ();          rc = PTD_initialize ();
353          if (!rc)          if (!rc)
354              msg_box (hwnd, _("Could not set current window mode hooks."), _("WinPT Error"), MB_OK);              msg_box (hwnd, _("Could not set current window mode hooks."),
355                         _("WinPT Error"), MB_OK);
356          mapi_init ();          mapi_init ();
357          /* init common controls: date control. */          /* init common controls: date control. */
358          cce.dwSize = sizeof (INITCOMMONCONTROLSEX);          cce.dwSize = sizeof (INITCOMMONCONTROLSEX);
# Line 344  winpt_main_proc (HWND hwnd, UINT msg, WP Line 361  winpt_main_proc (HWND hwnd, UINT msg, WP
361          LoadLibrary ("RichEd32.Dll");          LoadLibrary ("RichEd32.Dll");
362          break;          break;
363                    
364        case WM_ENDSESSION:
365      case WM_DESTROY:      case WM_DESTROY:
366      case WM_CLOSE:      case WM_CLOSE:
367        case WM_QUIT:
368          cryptdisk_cleanup ();          cryptdisk_cleanup ();
369          mapi_deinit ();          mapi_deinit ();
370          wsock_end ();                  wsock_end ();        
371          keycache_release ();          keycache_release (1);
372          gnupg_backup_keyrings ();          gnupg_backup_keyrings ();
373          free_reg_prefs ();          free_reg_prefs ();
374          free_gnupg_table ();          free_gnupg_table ();
# Line 357  winpt_main_proc (HWND hwnd, UINT msg, WP Line 376  winpt_main_proc (HWND hwnd, UINT msg, WP
376          release_file_lock (&mo_file);          release_file_lock (&mo_file);
377          PTD_delete ();          PTD_delete ();
378          agent_flush_cache ();          agent_flush_cache ();
379          if (!gpgme_clip_istext_avail (&has_data) && has_data) {          if (!gpg_clip_istext_avail (&has_data) && has_data) {
380              int chk = get_reg_winpt_flag ("WipeClipboard");              int chk = get_reg_winpt_flag ("WipeClipboard");
381              if (chk == -1)              if (chk == -1)
382                  DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_CONFDELCLIP,                  DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_CONFDELCLIP,
# Line 367  winpt_main_proc (HWND hwnd, UINT msg, WP Line 386  winpt_main_proc (HWND hwnd, UINT msg, WP
386                  set_clip_text (NULL, " ", 1);                  set_clip_text (NULL, " ", 1);
387              wipe_contents = 0;              wipe_contents = 0;
388          }          }
389          gpgme_lib_cleanup ();          debug_end ();
390          cleanup_tmp_files ();          /*cleanup_tmp_files ();*/
391          Shell_NotifyIcon (NIM_DELETE, &NID);          Shell_NotifyIcon (NIM_DELETE, &NID);
392          PostQuitMessage (0);          PostQuitMessage (0);
393          ExitProcess (0);          ExitProcess (0);
# Line 398  winpt_main_proc (HWND hwnd, UINT msg, WP Line 417  winpt_main_proc (HWND hwnd, UINT msg, WP
417                  set_menu_state (popup, ID_WINPT_CDISKUNMOUNT, MF_DISABLED|MF_GRAYED);                  set_menu_state (popup, ID_WINPT_CDISKUNMOUNT, MF_DISABLED|MF_GRAYED);
418              }              }
419    
420              set_menu_text( popup, ID_WINPT_EDIT, _("Edit Clipboard") );              set_menu_text (popup, ID_WINPT_EDIT, _("Edit Clipboard"));
421              set_menu_text( popup, ID_WINPT_ABOUT, _("About...") );              set_menu_text (popup, ID_WINPT_ABOUT, _("About..."));
422              set_menu_text( popup, ID_WINPT_QUIT, _("Exit") );              set_menu_text (popup, ID_WINPT_QUIT, _("Exit"));
423              set_menu_text( popup, ID_WINPT_SYMENC, _("Symmetric") );              set_menu_text (popup, ID_WINPT_SYMENC, _("Symmetric"));
424  #if 0              set_menu_text (popup, ID_WINPT_ENCRYPT, _("Encrypt"));
425              set_menu_text( popup, ID_WINPT_ENCRYPT, _("Encrypt") );              set_menu_text (popup, ID_WINPT_SIGNENCRYPT, _("Sign && Encrypt"));
426              set_menu_text( popup, ID_WINPT_SIGNENCRYPT, _("Sign && Encrypt") );              set_menu_text (popup, ID_WINPT_DECRYPT, _("Decrypt/Verify"));
427              set_menu_text( popup, ID_WINPT_DECRYPT, _("Decrypt/Verify") );              set_menu_text (popup, ID_WINPT_VERIFY, _("Verify"));
428              set_menu_text( popup, ID_WINPT_VERIFY, _("Verify") );              set_menu_text (popup, ID_WINPT_CURRWND_ENCRYPT, _("Encrypt"));
429              set_menu_text( popup, ID_WINPT_CURRWND_ENCRYPT, _("Encrypt") );              set_menu_text (popup, ID_WINPT_CURRWND_SIGNENCRYPT, _("Sign && Encrypt"));
430              set_menu_text( popup, ID_WINPT_CURRWND_SIGNENCRYPT, _("Sign && Encrypt") );              set_menu_text (popup, ID_WINPT_CURRWND_DECRYPT_VERIFY, _("Decrypt/Verify"));
431              set_menu_text( popup, ID_WINPT_CURRWND_DECRYPT_VERIFY, _("Decrypt/Verify") );              set_menu_text (popup, ID_WINPT_CURRWND_SIGN, _("Sign"));
432              set_menu_text( popup, ID_WINPT_CURRWND_SIGN, _("Sign") );              /* change popup texts */
433  #endif              set_menu_text_bypos (popup, 6, _("Clipboard"));
434                set_menu_text_bypos (popup, 7, _("Current Window"));
435                set_menu_text_bypos (popup, 9, _("Preferences"));
436    
437  #endif  #endif
438              TrackPopupMenu( popup, TPM_RIGHTALIGN, p.x, p.y, 0, hwnd, NULL );              TrackPopupMenu( popup, TPM_RIGHTALIGN, p.x, p.y, 0, hwnd, NULL );
439              PostMessage( hwnd, WM_USER, 0, 0 );              PostMessage( hwnd, WM_USER, 0, 0 );
# Line 487  winpt_main_proc (HWND hwnd, UINT msg, WP Line 509  winpt_main_proc (HWND hwnd, UINT msg, WP
509          case ID_WINPT_SIGN:          case ID_WINPT_SIGN:
510          case ID_WINPT_SIGNENCRYPT:          case ID_WINPT_SIGNENCRYPT:
511          case ID_WINPT_DECRYPT_VERIFY:          case ID_WINPT_DECRYPT_VERIFY:
512              ec = gpgme_clip_istext_avail( &has_data );              err = gpg_clip_istext_avail( &has_data );
513              if( ec ) {              if( err ) {
514                  msg_box( hwnd, gpgme_strerror( ec ),_("Clipboard"), MB_ERR );                  msg_box( hwnd, gpgme_strerror( err ),_("Clipboard"), MB_ERR );
515                  break;                  break;
516              }              }
517              if( !has_data ) {              if( !has_data ) {
518                  msg_box( hwnd, gpgme_strerror( GPGME_Clip_Empty ),_("Clipboard"), MB_ERR );                  msg_box( hwnd, winpt_strerror (WPTERR_CLIP_EMPTY),_("Clipboard"), MB_ERR );
519                  break;                  break;
520              }              }
521              ctx.msecs = 500;              ctx.msecs = 500;
# Line 541  winpt_main_proc (HWND hwnd, UINT msg, WP Line 563  winpt_main_proc (HWND hwnd, UINT msg, WP
563              break;              break;
564    
565          case ID_WINPT_CARD:          case ID_WINPT_CARD:
566              card = smartcard_init ();              load_smartcard ();
             if( card ) {  
                 dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_CARD_EDIT,  
                                   GetDesktopWindow(), card_edit_dlg_proc,  
                                   (LPARAM)card,  
                                   _("Card Edit"), IDS_WINPT_CARD_EDIT );  
                 gpgme_card_release( card ); card = NULL;  
             }  
567              break;              break;
568                            
569          case ID_WINPT_EDIT:          case ID_WINPT_EDIT:
# Line 570  winpt_main_proc (HWND hwnd, UINT msg, WP Line 585  winpt_main_proc (HWND hwnd, UINT msg, WP
585              break;              break;
586                            
587          case ID_WINPT_GPGPREFS:          case ID_WINPT_GPGPREFS:
588              dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_GPGPREFS, GetDesktopWindow(),              dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_GPGPREFS, GetDesktopWindow(),
589                                gpgprefs_dlg_proc, NULL,                                gpgprefs_dlg_proc, NULL,
590                               _("GnuPG Preferences"), IDS_WINPT_GPGPREFS );                                _("GnuPG Preferences"), IDS_WINPT_GPGPREFS);
591              break;              break;
592    
593          case ID_WINPT_CDISKNEW:          case ID_WINPT_CDISKNEW:
# Line 602  winpt_main_proc (HWND hwnd, UINT msg, WP Line 617  winpt_main_proc (HWND hwnd, UINT msg, WP
617      }      }
618            
619      return DefWindowProc (hwnd, msg, wparam, lparam);      return DefWindowProc (hwnd, msg, wparam, lparam);
620  } /* winpt_main_proc */  }

Legend:
Removed from v.19  
changed lines
  Added in v.32

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26