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

Annotation of /trunk/Src/wptMainProc.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 105 - (hide annotations)
Wed Nov 30 10:22:00 2005 UTC (19 years, 3 months ago) by twoaday
File size: 20762 byte(s)
Several cleanups and improved translation.


1 werner 36 /* wptMainProc.cpp - Main window procedure
2     * Copyright (C) 2000-2005 Timo Schulz
3     *
4     * This file is part of WinPT.
5     *
6     * WinPT is free software; you can redistribute it and/or modify
7     * it under the terms of the GNU General Public License as published by
8     * the Free Software Foundation; either version 2 of the License, or
9     * (at your option) any later version.
10     *
11     * WinPT is distributed in the hope that it will be useful,
12     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     * GNU General Public License for more details.
15     *
16     * You should have received a copy of the GNU General Public License
17     * along with WinPT; if not, write to the Free Software Foundation,
18     * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19     */
20    
21     #ifdef HAVE_CONFIG_H
22     #include <config.h>
23     #endif
24    
25     #include <windows.h>
26     #include <commctrl.h>
27     #include <io.h>
28    
29 werner 47 #include "resource.h"
30 werner 36 #include "wptTypes.h"
31     #include "wptGPG.h"
32     #include "wptW32API.h"
33     #include "wptVersion.h"
34     #include "wptCommonCtl.h"
35     #include "wptContext.h" /* for passphrase_s */
36     #include "wptDlgs.h"
37     #include "wptErrors.h"
38     #include "wptNLS.h"
39     #include "wptHotkey.h"
40     #include "wptRegistry.h"
41     #include "wptKeyserver.h"
42     #include "wptAgent.h"
43     #include "wptKeyManager.h"
44     #include "wptCard.h"
45     #include "wptCryptdisk.h"
46     #include "wptCardEdit.h"
47 werner 48 #include "wptCrypto.h"
48 werner 36
49     extern HWND activ_hwnd;
50     static int cmd = 0;
51     static int wipe_contents = 0;
52    
53    
54     /* Dialog box procedure to display all insecure all ElGamal keys. */
55     BOOL CALLBACK
56     elgamal_warn_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
57     {
58     gpg_keycache_t pc;
59     gpgme_key_t key;
60     char tmp[128+64+1];
61    
62 twoaday 72 switch (msg) {
63 werner 36 case WM_INITDIALOG:
64     pc = keycache_get_ctx (1);
65     while (!gpg_keycache_next_key (pc, 0, &key)) {
66     if (key->subkeys->pubkey_algo == GPGME_PK_ELG) {
67     _snprintf (tmp, sizeof (tmp)-1, "(0x%s) %s",
68     key->subkeys->keyid+8, key->uids->uid);
69     SendDlgItemMessage (dlg, IDC_ELGWARN_LIST, LB_ADDSTRING,
70     0, (LPARAM)(const char *) tmp);
71     }
72     }
73     gpg_keycache_rewind (pc);
74     center_window (dlg, NULL);
75     SetForegroundWindow (dlg);
76     break;
77    
78     case WM_COMMAND:
79     switch (LOWORD (wparam)) {
80     case IDOK:
81     EndDialog (dlg, TRUE);
82     break;
83     }
84     break;
85     }
86     return FALSE;
87 twoaday 32 }
88 werner 36
89    
90     /* @unused
91     static int
92     cleanup_tmp_files (void)
93     {
94     struct _finddata_t dat;
95     char tmp[384];
96     long hd;
97    
98     if (GetTempPath (sizeof (tmp)-1, tmp) == FALSE ||
99     SetCurrentDirectory (tmp) == FALSE) {
100     winpt_errmsg ("GetTempPath", 0);
101     return WPTERR_GENERAL;
102     }
103     hd = _findfirst ("gpgmeOUT*", &dat);
104     if (hd == -1)
105     return 0;
106     do {
107     secure_unlink (dat.name, WIPE_MODE_SIMPLE);
108     } while (_findnext (hd, &dat) == 0);
109     _findclose (hd);
110     return 0;
111     }
112     */
113    
114    
115     /* Dialog box procedure to confirm to delete the clipboard contents. */
116     static BOOL CALLBACK
117     confirm_delclipboard_dlg (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
118     {
119     switch (msg) {
120     case WM_INITDIALOG:
121     SetWindowText (dlg, _("Delete Clipboard Contents"));
122 twoaday 95 SetDlgItemText (dlg, IDC_CONFDELCLIP_BRAIN, _("&Remember the answer"));
123     SetDlgItemText (dlg, IDC_CONFDELCLIP_INFO, _("Do you want to delete the contents from the clipboard?"));
124 twoaday 105 SetDlgItemText (dlg, IDYES, _("&Yes"));
125     SetDlgItemText (dlg, IDNO, _("&No"));
126 werner 36 center_window (dlg, NULL);
127     SetForegroundWindow (dlg);
128     break;
129    
130     case WM_COMMAND:
131     switch (LOWORD (wparam)) {
132     case IDYES:
133     wipe_contents = 1;
134     if (IsDlgButtonChecked (dlg, IDC_CONFDELCLIP_BRAIN))
135     set_reg_winpt_flag ("WipeClipboard", 1);
136     EndDialog (dlg, TRUE);
137     break;
138    
139     case IDNO:
140     wipe_contents = 0;
141     if (IsDlgButtonChecked (dlg, IDC_CONFDELCLIP_BRAIN))
142     set_reg_winpt_flag ("WipeClipboard", 0);
143     EndDialog (dlg, FALSE);
144     break;
145     }
146     break;
147     }
148     return FALSE;
149     }
150    
151    
152     static gpgme_error_t
153     currwnd_gpg_dlg (HWND hwnd, UINT id, int *ret_set)
154     {
155 twoaday 68 gpgme_error_t err = gpg_error (GPG_ERR_NO_ERROR);
156 werner 36 int type;
157    
158     if (ret_set)
159     *ret_set = 1;
160     switch (id) {
161     case ID_WINPT_CURRWND_SYMENC:
162     gpg_encrypt_symmetric ();
163     break;
164    
165     case ID_WINPT_CURRWND_ENCRYPT:
166     dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_ENCRYPT, hwnd,
167 twoaday 68 clip_encrypt_dlg_proc, 0,
168 werner 36 _("Encryption"), IDS_WINPT_ENCRYPT );
169     break;
170    
171     case ID_WINPT_CURRWND_SIGNENCRYPT:
172     dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_SIGNENC, hwnd,
173 twoaday 68 clip_signenc_dlg_proc, 0,
174 werner 36 _("Sign & Encrypt"), IDS_WINPT_SIGNENC );
175     break;
176    
177     case ID_WINPT_CURRWND_SIGN:
178     dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_SIGN, hwnd,
179 twoaday 68 clip_sign_dlg_proc, 0,
180 werner 36 _("Signing"), IDS_WINPT_SIGN );
181     break;
182    
183     case ID_WINPT_CURRWND_DECRYPT_VERIFY:
184     err = gpg_clip_get_pgptype (&type);
185     if (err) {
186     msg_box (hwnd, gpgme_strerror (err), _("Clipboard"), MB_ERR);
187     break;
188     }
189     if( (type & PGP_MESSAGE) && !(type & PGP_CLEARSIG) ) {
190     /* It makes only sense to insert the data in the window if it's
191     really a ciphertext. Verfied data doesn't need this. */
192     err = clip_decrypt_dlg (hwnd);
193     if (!err && reg_prefs.use_viewer) {
194     dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_CLIPEDIT,
195 twoaday 68 GetDesktopWindow(), clip_edit_dlg_proc, 0,
196 werner 36 _("Clipboard Editor"), IDS_WINPT_CLIPEDIT);
197     if (ret_set)
198     *ret_set = 0;
199     }
200     }
201     else if ((type & PGP_PUBKEY) && !(type & PGP_CLEARSIG))
202     km_clip_import (GetDesktopWindow ());
203     else {
204     dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_VERIFY, hwnd,
205 twoaday 68 clip_verify_dlg_proc, 0,
206 werner 36 _("Verify"), IDS_WINPT_VERIFY );
207     err = gpg_error (GPG_ERR_EOF); /* make sure window is ot updated. */
208     }
209     break;
210     }
211    
212     return err;
213     }
214    
215    
216     static void
217     clip_gpg_dlg (HWND hwnd, UINT id)
218     {
219     gpgme_error_t err;
220     int type;
221    
222     if( (id == ID_WINPT_SIGN || id == ID_WINPT_SIGNENCRYPT)
223     && gnupg_access_keyring (0) ) {
224     msg_box( hwnd, _("Could not access secret keyring."), _("Sign"), MB_ERR );
225     return;
226     }
227    
228     switch( id ) {
229     case ID_WINPT_SYMENC:
230     gpg_encrypt_symmetric();
231     break;
232    
233     case ID_WINPT_ENCRYPT:
234     dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_ENCRYPT, hwnd,
235 twoaday 68 clip_encrypt_dlg_proc, 0,
236 werner 36 _("Encryption"), IDS_WINPT_ENCRYPT );
237     break;
238    
239     case ID_WINPT_SIGN:
240     dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_SIGN, hwnd,
241 twoaday 68 clip_sign_dlg_proc, 0,
242 werner 36 _("Signing"), IDS_WINPT_SIGN );
243     break;
244    
245     case ID_WINPT_SIGNENCRYPT:
246     dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_SIGNENC, hwnd,
247 twoaday 68 clip_signenc_dlg_proc, 0,
248 werner 36 _("Sign & Encrypt"), IDS_WINPT_SIGNENC );
249     break;
250    
251     case ID_WINPT_DECRYPT_VERIFY:
252     err = gpg_clip_get_pgptype (&type);
253     if (err) {
254     msg_box( hwnd, gpgme_strerror( err ), _("Clipboard"), MB_ERR );
255     break;
256     }
257     if( (type & PGP_MESSAGE) && !(type & PGP_CLEARSIG) ) {
258     err = clip_decrypt_dlg (hwnd);
259     if (!err && reg_prefs.use_viewer) {
260     dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_CLIPEDIT,
261 twoaday 68 GetDesktopWindow(), clip_edit_dlg_proc, 0,
262 werner 36 _("Clipboard Editor"), IDS_WINPT_CLIPEDIT );
263     }
264     }
265     else if( (type & PGP_SIG) && !(type & PGP_CLEARSIG) ) {
266     text_input_s input;
267     gpgme_data_t sig;
268    
269     memset( &input, 0, sizeof (input) );
270     err = gpg_data_new_from_clipboard (&sig, 0);
271     if( err ) {
272     msg_box( hwnd, gpgme_strerror( err ),_("Verify"), MB_ERR );
273     return;
274     }
275     input.type = 0;
276     dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_TEXT, hwnd,
277     text_input_dlg_proc, (LPARAM)&input,
278     _("Text Input"), IDS_WINPT_TEXT );
279    
280     gpg_data_release_and_set_clipboard( sig, 0 );
281     if( input.length ) {
282     dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_VERIFY, hwnd,
283     clip_verify_dlg_proc, (LPARAM)&input,
284     _("Verify"), IDS_WINPT_VERIFY );
285     input.length = 0;
286     free_if_alloc( input.data );
287     }
288     }
289     else if (type & PGP_CLEARSIG) {
290     dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_VERIFY, hwnd,
291 twoaday 68 clip_verify_dlg_proc, 0,
292 werner 36 _("Verify"), IDS_WINPT_VERIFY );
293     }
294     else if ((type & PGP_PUBKEY) || (type & PGP_SECKEY))
295     km_clip_import (GetDesktopWindow ());
296     else
297     msg_box (hwnd, _("Unknown OpenPGP type."), _("Clipboard"), MB_ERR);
298     }
299 twoaday 72 }
300 werner 36
301    
302 twoaday 72 static bool
303     secret_key_available (void)
304     {
305     gpg_keycache_t sec = keycache_get_ctx (0);
306     if (!sec || gpg_keycache_get_size (sec) == 0)
307     return false;
308     return true;
309     }
310    
311    
312 werner 36 /* Load the Card Manager with the current card. */
313     static void
314     load_smartcard (void)
315     {
316     gpg_card_t card;
317    
318     card = gpg_card_load ();
319     if (card) {
320     dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_CARD_EDIT,
321     GetDesktopWindow (), card_edit_dlg_proc,
322     (LPARAM)card,
323     _("Card Edit"), IDS_WINPT_CARD_EDIT);
324     gpg_card_release (card);
325     card = NULL;
326     }
327     }
328    
329    
330     /* Add the winpt symbol to the task bar. */
331     static void
332     add_taskbar_icon (HWND hwnd, NOTIFYICONDATA *nid)
333     {
334     nid->cbSize = sizeof (NOTIFYICONDATA);
335     nid->uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
336     nid->uCallbackMessage = WM_USER;
337     nid->hWnd = hwnd;
338     nid->hIcon = LoadIcon (glob_hinst, MAKEINTRESOURCE (IDI_WINPT));
339     strcpy (nid->szTip, "Windows Privacy Tray v"PGM_VERSION);
340     Shell_NotifyIcon (NIM_ADD, nid);
341     DestroyIcon (nid->hIcon);
342     }
343    
344    
345     /* Main message loop for the tray window. */
346     LRESULT CALLBACK
347     winpt_main_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
348     {
349     static NOTIFYICONDATA NID;
350     static int use_hotkey = 0;
351     reminder_ctx_s ctx;
352     LPARAM param;
353     curr_wnd_ctx currwnd = {0};
354     int rc, set_wc = 0, has_data = 0;
355     INITCOMMONCONTROLSEX cce;
356     gpgme_error_t err;
357    
358     switch (msg) {
359     case WM_CREATE:
360     add_taskbar_icon (hwnd, &NID);
361     rc = wsock_init ();
362     if (rc)
363     msg_box (NULL, winpt_strerror (rc), "Winsock2 DLL", MB_ERR);
364     if (!reg_prefs.no_hotkeys) {
365     rc = hotkeys_register (hwnd);
366     if (rc)
367     msg_box (hwnd, hotkeys_strerror (), winpt_strerror (rc), MB_ERR);
368     }
369     rc = PTD_initialize ();
370     if (!rc)
371     msg_box (hwnd, _("Could not set current window mode hooks."),
372     _("WinPT Error"), MB_OK);
373     mapi_init ();
374     /* init common controls: date control. */
375     cce.dwSize = sizeof (INITCOMMONCONTROLSEX);
376     cce.dwICC = ICC_DATE_CLASSES;
377     InitCommonControlsEx (&cce);
378     LoadLibrary ("RichEd32.Dll");
379     break;
380    
381     case WM_ENDSESSION:
382     case WM_DESTROY:
383     case WM_CLOSE:
384     case WM_QUIT:
385     cryptdisk_cleanup ();
386     mapi_deinit ();
387     wsock_end ();
388     keycache_release (1);
389     gnupg_backup_keyrings ();
390     free_reg_prefs ();
391     free_gnupg_table ();
392     hotkeys_unregister (hwnd);
393     release_file_lock (&mo_file);
394     PTD_delete ();
395     agent_flush_cache ();
396     if (!gpg_clip_istext_avail (&has_data) && has_data) {
397     int chk = get_reg_winpt_flag ("WipeClipboard");
398 twoaday 78 if (chk == -1 && msg != WM_ENDSESSION)
399 werner 36 DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_CONFDELCLIP,
400     GetDesktopWindow (), confirm_delclipboard_dlg,
401 twoaday 68 0);
402 werner 36 if (wipe_contents || chk)
403     set_clip_text (NULL, " ", 1);
404     wipe_contents = 0;
405     }
406     debug_end ();
407     /*cleanup_tmp_files ();*/
408     Shell_NotifyIcon (NIM_DELETE, &NID);
409     PostQuitMessage (0);
410     ExitProcess (0);
411 twoaday 72 break;
412 werner 36
413     case WM_USER:
414     switch (lparam) {
415     case WM_RBUTTONUP:
416     HMENU hm, popup;
417     POINT p;
418    
419     gpg_read_only = gpg_check_permissions (0) == 0? 0 : 1;
420    
421     SetForegroundWindow (hwnd);
422     GetCursorPos (&p);
423     hm = LoadMenu (glob_hinst, MAKEINTRESOURCE (IDR_WINPT));
424     popup = GetSubMenu (hm, 0);
425 twoaday 72
426 werner 36 set_menu_text( popup, ID_WINPT_FILE, _("File Manager") );
427     set_menu_text( popup, ID_WINPT_KEY, _("Key Manager") );
428     set_menu_text( popup, ID_WINPT_CARD, _("Card Manager") );
429     if (!scard_support)
430     set_menu_state (popup, ID_WINPT_CARD, MF_DISABLED|MF_GRAYED);
431     if (!cryptdisk_available ()) {
432     set_menu_state (popup, ID_WINPT_CDISKNEW, MF_DISABLED|MF_GRAYED);
433     set_menu_state (popup, ID_WINPT_CDISKMOUNT, MF_DISABLED|MF_GRAYED);
434     set_menu_state (popup, ID_WINPT_CDISKUNMOUNT, MF_DISABLED|MF_GRAYED);
435     }
436    
437     set_menu_text (popup, ID_WINPT_EDIT, _("Edit Clipboard"));
438     set_menu_text (popup, ID_WINPT_ABOUT, _("About..."));
439     set_menu_text (popup, ID_WINPT_QUIT, _("Exit"));
440     set_menu_text (popup, ID_WINPT_SYMENC, _("Symmetric"));
441     set_menu_text (popup, ID_WINPT_ENCRYPT, _("Encrypt"));
442 twoaday 72 set_menu_text (popup, ID_WINPT_SIGN, _("Sign"));
443 werner 36 set_menu_text (popup, ID_WINPT_SIGNENCRYPT, _("Sign && Encrypt"));
444     set_menu_text (popup, ID_WINPT_DECRYPT, _("Decrypt/Verify"));
445     set_menu_text (popup, ID_WINPT_VERIFY, _("Verify"));
446     set_menu_text (popup, ID_WINPT_CURRWND_ENCRYPT, _("Encrypt"));
447     set_menu_text (popup, ID_WINPT_CURRWND_SIGNENCRYPT, _("Sign && Encrypt"));
448     set_menu_text (popup, ID_WINPT_CURRWND_DECRYPT_VERIFY, _("Decrypt/Verify"));
449     set_menu_text (popup, ID_WINPT_CURRWND_SIGN, _("Sign"));
450 twoaday 72 if (!secret_key_available ()) {
451     set_menu_state (popup, ID_WINPT_SIGN, MF_DISABLED|MF_GRAYED);
452     set_menu_state (popup, ID_WINPT_CURRWND_SIGN, MF_DISABLED|MF_GRAYED);
453     set_menu_state (popup, ID_WINPT_SIGNENCRYPT, MF_DISABLED|MF_GRAYED);
454     set_menu_state (popup, ID_WINPT_CURRWND_SIGNENCRYPT, MF_DISABLED|MF_GRAYED);
455     }
456 werner 36 /* change popup texts */
457     set_menu_text_bypos (popup, 6, _("Clipboard"));
458     set_menu_text_bypos (popup, 7, _("Current Window"));
459     set_menu_text_bypos (popup, 9, _("Preferences"));
460    
461 twoaday 72 TrackPopupMenu (popup, TPM_RIGHTALIGN, p.x, p.y, 0, hwnd, NULL);
462     PostMessage (hwnd, WM_USER, 0, 0);
463     DestroyMenu (popup);
464     DestroyMenu (hm);
465 werner 36 break;
466    
467     case WM_LBUTTONDBLCLK:
468 twoaday 78 gpg_read_only = gpg_check_permissions (0) == 0? 0 : 1;
469     SendMessage (hwnd, WM_COMMAND, ID_WINPT_KEY, 0);
470 werner 36 break;
471     }
472     break;
473    
474     case WM_HOTKEY:
475     cmd = 0;
476     switch( wparam ) {
477     case WPT_CLIP_ENCRYPT_ID:
478     SendMessage( hwnd, WM_COMMAND, ID_WINPT_ENCRYPT, 0 );
479     break;
480    
481     case WPT_CLIP_DECRYPT_VERIFY_ID:
482     SendMessage( hwnd, WM_COMMAND, ID_WINPT_DECRYPT_VERIFY, 0 );
483     break;
484    
485     case WPT_CLIP_SIGN_ID:
486     SendMessage( hwnd, WM_COMMAND, ID_WINPT_SIGN, 0 );
487     break;
488    
489     case WPT_CLIP_SIGN_ENCRYPT_ID:
490     SendMessage( hwnd, WM_COMMAND, ID_WINPT_SIGNENCRYPT, 0 );
491     break;
492    
493     case WPT_CURRWND_ENCRYPT_ID:
494     use_hotkey = 1;
495     SendMessage( hwnd, WM_COMMAND, ID_WINPT_CURRWND_ENCRYPT, 0 );
496     break;
497    
498     case WPT_CURRWND_SIGN_ID:
499     use_hotkey = 1;
500     SendMessage( hwnd, WM_COMMAND, ID_WINPT_CURRWND_SIGN, 0 );
501     break;
502    
503     case WPT_CURRWND_SIGN_ENCRYPT_ID:
504     use_hotkey = 1;
505     SendMessage( hwnd, WM_COMMAND, ID_WINPT_CURRWND_SIGNENCRYPT, 0 );
506     break;
507    
508     case WPT_CURRWND_DECRYPT_VERIFY_ID:
509     use_hotkey = 1;
510     SendMessage( hwnd, WM_COMMAND, ID_WINPT_CURRWND_DECRYPT_VERIFY, 0 );
511     break;
512    
513     case WPT_AGENT_FORGET_ID:
514     rc = msg_box( hwnd, _("Remove all passphrases from cache?"),
515     _("WinPT"), MB_YESNO|MB_ICONQUESTION );
516     if( rc == IDYES )
517     agent_flush_cache();
518     break;
519     }
520     break;
521    
522     case WM_COMMAND:
523     if( gnupg_access_keyring( 1 ) ) {
524     if( log_box( "WinPT", MB_ERR|MB_YESNO,
525     _("Could not access public keyring, exit WinPT?") ) == IDYES )
526     SendMessage( hwnd, WM_DESTROY, 0, 0 );
527     break;
528     }
529     switch( wparam ) {
530     /** Clipboard operations **/
531     case ID_WINPT_SYMENC:
532     case ID_WINPT_ENCRYPT:
533     case ID_WINPT_SIGN:
534     case ID_WINPT_SIGNENCRYPT:
535     case ID_WINPT_DECRYPT_VERIFY:
536     err = gpg_clip_istext_avail( &has_data );
537     if( err ) {
538     msg_box( hwnd, gpgme_strerror( err ),_("Clipboard"), MB_ERR );
539     break;
540     }
541     if( !has_data ) {
542     msg_box( hwnd, winpt_strerror (WPTERR_CLIP_EMPTY),_("Clipboard"), MB_ERR );
543     break;
544     }
545     ctx.msecs = 500;
546     window_reminder( &ctx );
547     clip_gpg_dlg( hwnd, (int)wparam );
548     break;
549    
550     /** Current window operations **/
551     case ID_WINPT_CURRWND_SYMENC:
552     case ID_WINPT_CURRWND_ENCRYPT:
553     case ID_WINPT_CURRWND_SIGNENCRYPT:
554     case ID_WINPT_CURRWND_DECRYPT_VERIFY:
555     case ID_WINPT_CURRWND_SIGN:
556     rc = get_window_contents( hwnd, &currwnd, &use_hotkey );
557     if( rc ) {
558     log_box( _("WinPT Error"), MB_ERR,
559     _("Make sure that the window contains text.\n"
560     "%s."),
561     winpt_strerror( WPTERR_CURR_WND ) );
562     break;
563     }
564     ctx.msecs = 500;
565     window_reminder( &ctx );
566     rc = currwnd_gpg_dlg( hwnd, (UINT)wparam, &set_wc );
567     if( !rc && set_wc )
568     set_window_contents( hwnd, &currwnd );
569     break;
570    
571     /** File handling **/
572     case ID_WINPT_FILE:
573     dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_FILE,
574 twoaday 68 GetDesktopWindow(), file_manager_dlg_proc, 0,
575 werner 36 _("File Manager (use drag & drop to add files)"), IDS_WINPT_FILE );
576     break;
577    
578     /** Misc **/
579     case ID_WINPT_KEY:
580 twoaday 73 param = 0;
581 werner 36 if( cmd )
582     param = (LPARAM)cmd;
583     dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_KEYMISC,
584     GetDesktopWindow(), keymanager_dlg_proc, param,
585     _("Key Manager"), IDS_WINPT_KEYMISC );
586     cmd = 0;
587     break;
588    
589     case ID_WINPT_CARD:
590     load_smartcard ();
591     break;
592    
593     case ID_WINPT_EDIT:
594     dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_CLIPEDIT,
595 twoaday 68 GetDesktopWindow(), clip_edit_dlg_proc, 0,
596 werner 36 _("Clipboard Editor"), IDS_WINPT_CLIPEDIT );
597     break;
598    
599     case ID_WINPT_ABOUT:
600     dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_ABOUT, GetDesktopWindow(),
601 twoaday 68 about_winpt_dlg_proc, 0,
602 werner 36 _("About WinPT"), IDS_WINPT_ABOUT );
603     break;
604    
605     case ID_WINPT_PREFS:
606     dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_PREFS, GetDesktopWindow(),
607 twoaday 68 prefs_dlg_proc, 0,
608 werner 36 _("WinPT Preferences"), IDS_WINPT_PREFS );
609     break;
610    
611     case ID_WINPT_GPGPREFS:
612     dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_GPGPREFS, GetDesktopWindow(),
613 twoaday 68 gpgprefs_dlg_proc, 0,
614 werner 36 _("GnuPG Preferences"), IDS_WINPT_GPGPREFS);
615     break;
616    
617     case ID_WINPT_CDISKNEW:
618     DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_CDISK_NEW,
619 twoaday 68 GetDesktopWindow (), cryptdisk_new_dlg_proc, 0);
620 werner 36 break;
621    
622     case ID_WINPT_CDISKMOUNT:
623     DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_CDISK_MOUNT,
624 twoaday 68 GetDesktopWindow (), cryptdisk_mount_dlg_proc, 0);
625 werner 36 break;
626    
627     case ID_WINPT_CDISKUNMOUNT:
628     DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_CDISK_UMOUNT,
629 twoaday 68 GetDesktopWindow (), cryptdisk_umount_dlg_proc, 0);
630 werner 36 break;
631    
632     case ID_WINPT_CDISKUMOUNTALL:
633     cryptdisk_unmount (0, 0);
634     break;
635    
636     case ID_WINPT_QUIT:
637     SendMessage (hwnd, WM_DESTROY, 0, 0);
638     break;
639     }
640     break;
641     }
642    
643     return DefWindowProc (hwnd, msg, wparam, lparam);
644     }

Properties

Name Value
svn:eol-style native

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26