/[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 327 by twoaday, Fri Aug 3 13:54:55 2007 UTC revision 328 by twoaday, Fri Sep 25 16:07:38 2009 UTC
# Line 1  Line 1 
1  /* wptMainProc.cpp - Main window procedure  /* wptMainProc.cpp - Main window procedure
2   *      Copyright (C) 2000-2006 Timo Schulz   *      Copyright (C) 2000-2009 Timo Schulz
3   *   *
4   * This file is part of WinPT.   * This file is part of WinPT.
5   *   *
# Line 12  Line 12 
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU General Public License for more details.   * GNU General Public License for more details.
  *  
  * You should have received a copy of the GNU General Public License  
  * along with WinPT; if not, write to the Free Software Foundation,  
  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA  
15   */   */
16    
17  #ifdef HAVE_CONFIG_H  #ifdef HAVE_CONFIG_H
# Line 46  Line 42 
42  #include "wptKeyserver.h"  #include "wptKeyserver.h"
43  #include "wptAgent.h"  #include "wptAgent.h"
44  #include "wptUTF8.h"  #include "wptUTF8.h"
45    #include "wptKeylist.h"
46  #include "wptKeyManager.h"  #include "wptKeyManager.h"
47  #include "wptCard.h"  #include "wptCard.h"
48  #include "wptCardEdit.h"  #include "wptCardEdit.h"
# Line 75  elgamal_warn_dlg_proc (HWND dlg, UINT ms Line 72  elgamal_warn_dlg_proc (HWND dlg, UINT ms
72          while (!gpg_keycache_next_key (pc, 0, &key)) {          while (!gpg_keycache_next_key (pc, 0, &key)) {
73              if (key->subkeys->pubkey_algo == GPGME_PK_ELG) {              if (key->subkeys->pubkey_algo == GPGME_PK_ELG) {
74                  uid = utf8_to_native (key->uids->uid);                  uid = utf8_to_native (key->uids->uid);
75                  _snprintf (tmp, sizeof (tmp)-1, "(0x%s) %s",                  _snprintf (tmp, DIM (tmp)-1, "(0x%s) %s",
76                             key->subkeys->keyid+8, uid);                             key->subkeys->keyid+8, uid);
77                  SendDlgItemMessage (dlg, IDC_ELGWARN_LIST, LB_ADDSTRING,                  SendDlgItemMessage (dlg, IDC_ELGWARN_LIST, LB_ADDSTRING,
78                                      0, (LPARAM)(const char *)tmp);                                      0, (LPARAM)(const char *)tmp);
# Line 220  clip_gpg_dlg (HWND hwnd, UINT id, int *r Line 217  clip_gpg_dlg (HWND hwnd, UINT id, int *r
217                            
218              /* the dialog might have changed the clipboard, so we restore              /* the dialog might have changed the clipboard, so we restore
219                 the original state (again). */                 the original state (again). */
220              gpg_data_release_and_set_clipboard (sig, 0);              gpg_data_release_to_clipboard (sig, 0);
221              if (input.length > 0) {              if (input.length > 0) {
222                  dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_VERIFY, hwnd,                  dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_VERIFY, hwnd,
223                                    clip_verify_dlg_proc, (LPARAM)&input,                                    clip_verify_dlg_proc, (LPARAM)&input,
# Line 325  winpt_main_proc (HWND hwnd, UINT msg, WP Line 322  winpt_main_proc (HWND hwnd, UINT msg, WP
322      static DWORD cookie;      static DWORD cookie;
323      static int use_hotkey = 0;      static int use_hotkey = 0;
324      static int manual_shutdown = 0;      static int manual_shutdown = 0;
325      HWND wnd;      HWND wnd, cw_main, cw_focus;
326      gpgme_error_t err;      gpgme_error_t err;
     curr_wnd_ctx currwnd = {0};  
327      const char *s;      const char *s;
328      int rc, set_wc = 0;      int rc, set_wc = 0;
329      int has_data = 0;      int has_data = 0;
# Line 349  winpt_main_proc (HWND hwnd, UINT msg, WP Line 345  winpt_main_proc (HWND hwnd, UINT msg, WP
345                       _("WinPT Error"), MB_OK);                       _("WinPT Error"), MB_OK);
346          mapi_init ();          mapi_init ();
347          init_common_controls ();          init_common_controls ();
348          html_help_init (&cookie);          //html_help_init (&cookie);
349          LoadLibrary ("RichEd32.Dll");          LoadLibrary ("RichEd32.Dll");
350          manual_shutdown = 0;          manual_shutdown = 0;
351          break;          break;
# Line 359  winpt_main_proc (HWND hwnd, UINT msg, WP Line 355  winpt_main_proc (HWND hwnd, UINT msg, WP
355      case WM_CLOSE:      case WM_CLOSE:
356      case WM_QUIT:      case WM_QUIT:
357          mapi_deinit ();          mapi_deinit ();
358          wsock_end ();                  wsock_end ();
359          keycache_release (1);          keycache_release (1);
360          /* FIXME: There seems to be a problem with the backup at the          /* FIXME: There seems to be a problem with the backup at the
361           * end on EFS file systems. I currently have no access to           * end on EFS file systems. I currently have no access to
# Line 371  winpt_main_proc (HWND hwnd, UINT msg, WP Line 367  winpt_main_proc (HWND hwnd, UINT msg, WP
367                                 reg_prefs.backup.include_secr);                                 reg_prefs.backup.include_secr);
368          free_reg_prefs ();                free_reg_prefs ();      
369          free_gnupg_table ();          free_gnupg_table ();
370            wipe_clipboard (manual_shutdown);
371          gettext_free_current_domain ();          gettext_free_current_domain ();
372          hotkeys_unregister (hwnd);          hotkeys_unregister (hwnd);
373          PTD_delete ();          PTD_delete ();
374          agent_flush_cache ();          agent_flush_cache ();
375          html_help_deinit (cookie);          //html_help_deinit (cookie);    
         wipe_clipboard (manual_shutdown);  
376          debug_end ();          debug_end ();
377          Shell_NotifyIcon (NIM_DELETE, &NID);          Shell_NotifyIcon (NIM_DELETE, &NID);
378          PostQuitMessage (0);          PostQuitMessage (0);
# Line 400  winpt_main_proc (HWND hwnd, UINT msg, WP Line 396  winpt_main_proc (HWND hwnd, UINT msg, WP
396    
397              if (!scard_support)              if (!scard_support)
398                  set_menu_state (popup, ID_WINPT_CARD, MF_DISABLED|MF_GRAYED);                  set_menu_state (popup, ID_WINPT_CARD, MF_DISABLED|MF_GRAYED);
399              set_menu_text (popup, ID_WINPT_FILE, _("File Manager"));              set_menu_text (popup, ID_WINPT_FILE, _("File Manager..."));
400              set_menu_text (popup, ID_WINPT_KEY, _("Key Manager"));              set_menu_text (popup, ID_WINPT_KEY, _("Key Manager..."));
401              set_menu_text (popup, ID_WINPT_CARD, _("Card Manager"));              set_menu_text (popup, ID_WINPT_CARD, _("Card Manager..."));
402              set_menu_text (popup, ID_WINPT_EDIT, _("Edit"));              set_menu_text (popup, ID_WINPT_EDIT, _("Edit..."));
403              set_menu_text (popup, ID_WINPT_ABOUT, _("About..."));              set_menu_text (popup, ID_WINPT_ABOUT, _("About..."));
404              set_menu_text (popup, ID_WINPT_QUIT, _("Exit"));              set_menu_text (popup, ID_WINPT_QUIT, _("Exit"));
405              set_menu_text (popup, ID_WINPT_SYMENC, _("Symmetric"));              set_menu_text (popup, ID_WINPT_SYMENC, _("Symmetric"));
# Line 424  winpt_main_proc (HWND hwnd, UINT msg, WP Line 420  winpt_main_proc (HWND hwnd, UINT msg, WP
420                  set_menu_state (popup, ID_WINPT_CURRWND_SIGNENCRYPT, MF_DISABLED|MF_GRAYED);                  set_menu_state (popup, ID_WINPT_CURRWND_SIGNENCRYPT, MF_DISABLED|MF_GRAYED);
421              }              }
422              /* change popup texts */                    /* change popup texts */      
423              set_menu_text_bypos (popup, 4, _("Clipboard"));              set_menu_text_bypos (popup, 3, _("Clipboard"));
424              set_menu_text_bypos (popup, 5, _("Current Window"));              set_menu_text_bypos (popup, 4, _("Current Window"));
425              set_menu_text_bypos (popup, 7, _("Preferences"));              set_menu_text_bypos (popup, 6, _("Preferences"));
426                
427                if (gettext_domain_needs_refresh())
428                    gettext_set_user_domain();
429              TrackPopupMenu (popup, TPM_RIGHTALIGN, p.x, p.y, 0, hwnd, NULL);              TrackPopupMenu (popup, TPM_RIGHTALIGN, p.x, p.y, 0, hwnd, NULL);
430              PostMessage (hwnd, WM_USER, 0, 0);              PostMessage (hwnd, WM_USER, 0, 0);
431              DestroyMenu (popup);              DestroyMenu (popup);
432              DestroyMenu (hm);              DestroyMenu (hm);
433              break;              break;
               
         case WM_LBUTTONDBLCLK:  
             if (!wait_for_progress_cb (0))  
                 break;  
             gpg_read_only = gpg_check_permissions (0) == 0? 0 : 1;  
             SendMessage (hwnd, WM_COMMAND, ID_WINPT_KEY, 0);  
             break;  
434          }          }
435          break;          break;
436                    
# Line 524  winpt_main_proc (HWND hwnd, UINT msg, WP Line 515  winpt_main_proc (HWND hwnd, UINT msg, WP
515          case ID_WINPT_CURRWND_SIGNENCRYPT:          case ID_WINPT_CURRWND_SIGNENCRYPT:
516          case ID_WINPT_CURRWND_DECRYPT_VERIFY:          case ID_WINPT_CURRWND_DECRYPT_VERIFY:
517          case ID_WINPT_CURRWND_SIGN:          case ID_WINPT_CURRWND_SIGN:
518              rc = get_window_contents (hwnd, &currwnd, &use_hotkey);              rc = copy_window_content (hwnd, &cw_main, &cw_focus, use_hotkey);
519              if (rc) {              if (rc) {
520                  log_box (_("WinPT Error"), MB_ERR,                  log_box (_("WinPT Error"), MB_ERR,
521                           _("Make sure that the window contains text.\n"                           _("Make sure that the window contains text.\n"
522                             "%s."),                             "%s."),
523                          winpt_strerror (WPTERR_CURR_WND));                           winpt_strerror (WPTERR_CURR_WND));
524                  break;                  break;
525              }              }
526              clip_gpg_dlg (hwnd, (int)wparam, &set_wc);              clip_gpg_dlg (hwnd, (int)wparam, &set_wc);
527              if (set_wc == 1)              if (set_wc == 1)
528                  set_window_contents (hwnd, &currwnd);                  paste_window_content (hwnd, cw_main, cw_focus);
529                use_hotkey = 0;
530              break;              break;
531                            
532              /** File handling **/              /** File handling **/

Legend:
Removed from v.327  
changed lines
  Added in v.328

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26