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

Annotation of /trunk/Src/wptMainProc.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 255 - (hide annotations)
Tue Aug 1 16:37:23 2006 UTC (18 years, 7 months ago) by twoaday
File size: 18740 byte(s)


1 werner 36 /* wptMainProc.cpp - Main window procedure
2 twoaday 150 * Copyright (C) 2000-2006 Timo Schulz
3 werner 36 *
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 twoaday 248 #include "wptUTF8.h"
44 werner 36 #include "wptKeyManager.h"
45     #include "wptCard.h"
46     #include "wptCardEdit.h"
47    
48 twoaday 190
49 twoaday 255 int update_keycache (HWND hwnd);
50 twoaday 190
51 twoaday 248 /* Command for the Key Manager dialog. (0=no command) */
52 werner 36 static int cmd = 0;
53 twoaday 248
54     /* 1 indicates that the clipboard will be emptied o exit. */
55 werner 36 static int wipe_contents = 0;
56    
57    
58     /* Dialog box procedure to display all insecure all ElGamal keys. */
59     BOOL CALLBACK
60     elgamal_warn_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
61     {
62     gpg_keycache_t pc;
63     gpgme_key_t key;
64 twoaday 248 char *uid;
65 werner 36 char tmp[128+64+1];
66    
67 twoaday 72 switch (msg) {
68 werner 36 case WM_INITDIALOG:
69     pc = keycache_get_ctx (1);
70     while (!gpg_keycache_next_key (pc, 0, &key)) {
71     if (key->subkeys->pubkey_algo == GPGME_PK_ELG) {
72 twoaday 248 uid = utf8_to_native (key->uids->uid);
73 werner 36 _snprintf (tmp, sizeof (tmp)-1, "(0x%s) %s",
74 twoaday 248 key->subkeys->keyid+8, uid);
75 werner 36 SendDlgItemMessage (dlg, IDC_ELGWARN_LIST, LB_ADDSTRING,
76 twoaday 248 0, (LPARAM)(const char *)tmp);
77     free_if_alloc (uid);
78 werner 36 }
79     }
80     gpg_keycache_rewind (pc);
81     center_window (dlg, NULL);
82     SetForegroundWindow (dlg);
83     break;
84    
85     case WM_COMMAND:
86     switch (LOWORD (wparam)) {
87     case IDOK:
88     EndDialog (dlg, TRUE);
89     break;
90     }
91     break;
92     }
93     return FALSE;
94 twoaday 32 }
95 werner 36
96    
97     /* Dialog box procedure to confirm to delete the clipboard contents. */
98     static BOOL CALLBACK
99     confirm_delclipboard_dlg (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
100     {
101     switch (msg) {
102     case WM_INITDIALOG:
103     SetWindowText (dlg, _("Delete Clipboard Contents"));
104 twoaday 226 SetDlgItemText (dlg, IDC_CONFDELCLIP_BRAIN,
105     _("&Remember the answer"));
106     SetDlgItemText (dlg, IDC_CONFDELCLIP_INFO,
107     _("Do you want to delete the contents from the clipboard?"));
108 twoaday 105 SetDlgItemText (dlg, IDYES, _("&Yes"));
109 twoaday 121 SetDlgItemText (dlg, IDNO, _("&No"));
110 werner 36 center_window (dlg, NULL);
111     SetForegroundWindow (dlg);
112     break;
113    
114     case WM_COMMAND:
115     switch (LOWORD (wparam)) {
116     case IDYES:
117     wipe_contents = 1;
118     if (IsDlgButtonChecked (dlg, IDC_CONFDELCLIP_BRAIN))
119     set_reg_winpt_flag ("WipeClipboard", 1);
120 twoaday 248 EndDialog (dlg, 1);
121 werner 36 break;
122    
123     case IDNO:
124     wipe_contents = 0;
125     if (IsDlgButtonChecked (dlg, IDC_CONFDELCLIP_BRAIN))
126     set_reg_winpt_flag ("WipeClipboard", 0);
127 twoaday 248 EndDialog (dlg, 0);
128 werner 36 break;
129     }
130     break;
131     }
132     return FALSE;
133     }
134    
135    
136 twoaday 255 /* Handle the various command requests for the clipboard
137     and the current window. */
138     static void
139     clip_gpg_dlg (HWND hwnd, UINT id, int *r_upd_window)
140 werner 36 {
141 twoaday 68 gpgme_error_t err = gpg_error (GPG_ERR_NO_ERROR);
142 werner 36 int type;
143 twoaday 255 int disable_viewer = 0;
144 werner 36
145 twoaday 255 if (r_upd_window) {
146     *r_upd_window = 1;
147     /* for the current window mode it makes no sense to
148     use the clipboard viewer for decryption because the
149     text will be pasted directly into the window. */
150     disable_viewer = 1;
151 werner 36 }
152 twoaday 129 if ((id == ID_WINPT_SIGN || id == ID_WINPT_SIGNENCRYPT)
153     && gnupg_access_keyring (0)) {
154     msg_box (hwnd, _("Could not access secret keyring."), _("Sign"), MB_ERR);
155 werner 36 return;
156     }
157    
158 twoaday 255 switch (id) {
159 werner 36 case ID_WINPT_SYMENC:
160 twoaday 255 case ID_WINPT_CURRWND_SYMENC:
161     err = gpg_clip_sym_encrypt ();
162     if (err && r_upd_window)
163     *r_upd_window = 0;
164 werner 36 break;
165    
166     case ID_WINPT_ENCRYPT:
167 twoaday 255 case ID_WINPT_CURRWND_ENCRYPT:
168     dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_ENCRYPT, hwnd,
169 twoaday 68 clip_encrypt_dlg_proc, 0,
170 twoaday 255 _("Encryption"), IDS_WINPT_ENCRYPT);
171 werner 36 break;
172    
173     case ID_WINPT_SIGN:
174 twoaday 255 case ID_WINPT_CURRWND_SIGN:
175     dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_SIGN, hwnd,
176 twoaday 68 clip_sign_dlg_proc, 0,
177 twoaday 255 _("Signing"), IDS_WINPT_SIGN);
178 werner 36 break;
179    
180     case ID_WINPT_SIGNENCRYPT:
181 twoaday 255 case ID_WINPT_CURRWND_SIGNENCRYPT:
182     dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_SIGNENC, hwnd,
183 twoaday 68 clip_signenc_dlg_proc, 0,
184 twoaday 255 _("Sign & Encrypt"), IDS_WINPT_SIGNENC);
185 werner 36 break;
186    
187     case ID_WINPT_DECRYPT_VERIFY:
188 twoaday 255 case ID_WINPT_CURRWND_DECRYPT_VERIFY:
189 werner 36 err = gpg_clip_get_pgptype (&type);
190     if (err) {
191 twoaday 255 msg_box (hwnd, gpgme_strerror (err), _("Clipboard"), MB_ERR);
192     if (r_upd_window)
193     *r_upd_window = 0;
194 werner 36 break;
195     }
196 twoaday 255 if ((type & PGP_MESSAGE) && !(type & PGP_CLEARSIG))
197     err = clip_decrypt_dlg (hwnd, disable_viewer?
198     0 : reg_prefs.use_viewer);
199 twoaday 229 else if ((type & PGP_SIG) && !(type & PGP_CLEARSIG)) {
200 werner 36 text_input_s input;
201     gpgme_data_t sig;
202    
203 twoaday 225 memset (&input, 0, sizeof (input));
204 werner 36 err = gpg_data_new_from_clipboard (&sig, 0);
205 twoaday 225 if (err) {
206 twoaday 255 msg_box (hwnd, gpgme_strerror (err),_("Verify"), MB_ERR);
207     if (r_upd_window)
208     *r_upd_window = 0;
209 werner 36 return;
210     }
211     input.type = 0;
212 twoaday 225 dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_TEXT, hwnd,
213     text_input_dlg_proc, (LPARAM)&input,
214     _("Text Input"), IDS_WINPT_TEXT);
215    
216     /* the dialog might have changed the clipboard, so we restore
217     the original state (again). */
218     gpg_data_release_and_set_clipboard (sig, 0);
219     if (input.length > 0) {
220     dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_VERIFY, hwnd,
221     clip_verify_dlg_proc, (LPARAM)&input,
222     _("Verify"), IDS_WINPT_VERIFY);
223 werner 36 input.length = 0;
224 twoaday 225 free_if_alloc (input.data);
225 werner 36 }
226 twoaday 255 if (r_upd_window)
227     *r_upd_window = 0;
228 werner 36 }
229     else if (type & PGP_CLEARSIG) {
230 twoaday 255 dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_VERIFY, hwnd,
231     clip_verify_dlg_proc, 0,
232     _("Verify"), IDS_WINPT_VERIFY);
233     if (r_upd_window)
234     *r_upd_window = 0;
235 werner 36 }
236 twoaday 255 else if ((type & PGP_PUBKEY) || (type & PGP_SECKEY)) {
237 twoaday 165 km_clip_import (GetDesktopWindow (), NULL, NULL);
238 twoaday 255 if (r_upd_window)
239     *r_upd_window = 0;
240     }
241     else {
242 werner 36 msg_box (hwnd, _("Unknown OpenPGP type."), _("Clipboard"), MB_ERR);
243 twoaday 255 if (r_upd_window)
244     *r_upd_window = 0;
245     }
246 werner 36 }
247 twoaday 72 }
248 werner 36
249    
250     /* Load the Card Manager with the current card. */
251     static void
252 twoaday 121 load_card_manager (void)
253 werner 36 {
254     gpg_card_t card;
255    
256     card = gpg_card_load ();
257 twoaday 193 if (!card)
258     return;
259    
260     dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_CARD_EDIT,
261     GetDesktopWindow (), card_edit_dlg_proc,
262     (LPARAM)card,
263     _("Card Edit"), IDS_WINPT_CARD_EDIT);
264     gpg_card_release (card);
265 werner 36 }
266    
267    
268     /* Add the winpt symbol to the task bar. */
269     static void
270     add_taskbar_icon (HWND hwnd, NOTIFYICONDATA *nid)
271     {
272     nid->cbSize = sizeof (NOTIFYICONDATA);
273     nid->uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
274     nid->uCallbackMessage = WM_USER;
275     nid->hWnd = hwnd;
276     nid->hIcon = LoadIcon (glob_hinst, MAKEINTRESOURCE (IDI_WINPT));
277     strcpy (nid->szTip, "Windows Privacy Tray v"PGM_VERSION);
278     Shell_NotifyIcon (NIM_ADD, nid);
279     DestroyIcon (nid->hIcon);
280     }
281    
282    
283 twoaday 229 /* Initialize all needed common controls. */
284 twoaday 193 static void
285     init_common_controls (void)
286     {
287     INITCOMMONCONTROLSEX cce;
288    
289     /* date control, toolbar, trackbar, ... */
290     cce.dwSize = sizeof (INITCOMMONCONTROLSEX);
291     cce.dwICC = ICC_DATE_CLASSES|ICC_BAR_CLASSES;
292     InitCommonControlsEx (&cce);
293     }
294    
295    
296 twoaday 248 /* Wipe the clipboard if the user requested it. */
297     static void
298     wipe_clipboard (int manual_shutdown)
299     {
300     int has_data = 0;
301    
302     if (!gpg_clip_istext_avail (&has_data) && has_data) {
303     int chk = get_reg_winpt_flag ("WipeClipboard");
304     if (chk == -1 && manual_shutdown)
305     DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_CONFDELCLIP,
306     GetDesktopWindow (), confirm_delclipboard_dlg, 0);
307     if (wipe_contents || chk)
308     set_clip_text (NULL, " ", 1);
309     wipe_contents = 0;
310     }
311     }
312    
313    
314 werner 36 /* Main message loop for the tray window. */
315     LRESULT CALLBACK
316     winpt_main_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
317     {
318     static NOTIFYICONDATA NID;
319 twoaday 174 static DWORD cookie;
320 twoaday 139 static int use_hotkey = 0;
321 twoaday 193 static int manual_shutdown = 0;
322 twoaday 139 HWND wnd;
323     gpgme_error_t err;
324     curr_wnd_ctx currwnd = {0};
325     const char *s;
326 twoaday 248 int rc, set_wc = 0;
327     int has_data = 0;
328 werner 36
329     switch (msg) {
330     case WM_CREATE:
331     add_taskbar_icon (hwnd, &NID);
332     rc = wsock_init ();
333     if (rc)
334     msg_box (NULL, winpt_strerror (rc), "Winsock2 DLL", MB_ERR);
335     if (!reg_prefs.no_hotkeys) {
336     rc = hotkeys_register (hwnd);
337     if (rc)
338     msg_box (hwnd, hotkeys_strerror (), winpt_strerror (rc), MB_ERR);
339     }
340     rc = PTD_initialize ();
341     if (!rc)
342     msg_box (hwnd, _("Could not set current window mode hooks."),
343     _("WinPT Error"), MB_OK);
344     mapi_init ();
345 twoaday 193 init_common_controls ();
346 twoaday 174 html_help_init (&cookie);
347 werner 36 LoadLibrary ("RichEd32.Dll");
348 twoaday 193 manual_shutdown = 0;
349 werner 36 break;
350    
351     case WM_ENDSESSION:
352     case WM_DESTROY:
353     case WM_CLOSE:
354     case WM_QUIT:
355     mapi_deinit ();
356     wsock_end ();
357     keycache_release (1);
358 twoaday 222 gnupg_backup_keyrings (reg_prefs.auto_backup,
359 twoaday 248 reg_prefs.backup.mode,
360     reg_prefs.backup.include_secr);
361 werner 36 free_reg_prefs ();
362     free_gnupg_table ();
363     hotkeys_unregister (hwnd);
364     PTD_delete ();
365     agent_flush_cache ();
366 twoaday 174 html_help_deinit (cookie);
367 twoaday 248 wipe_clipboard (manual_shutdown);
368 werner 36 debug_end ();
369     Shell_NotifyIcon (NIM_DELETE, &NID);
370     PostQuitMessage (0);
371     ExitProcess (0);
372 twoaday 72 break;
373 werner 36
374     case WM_USER:
375     switch (lparam) {
376     case WM_RBUTTONUP:
377     HMENU hm, popup;
378     POINT p;
379    
380 twoaday 244 if (!wait_for_progress_cb (0))
381     break;
382 twoaday 248 gpg_read_only = gpg_check_permissions (0) == 0? 0 : 1;
383 werner 36 SetForegroundWindow (hwnd);
384     GetCursorPos (&p);
385     hm = LoadMenu (glob_hinst, MAKEINTRESOURCE (IDR_WINPT));
386     popup = GetSubMenu (hm, 0);
387 twoaday 72
388 twoaday 248 if (!scard_support)
389     set_menu_state (popup, ID_WINPT_CARD, MF_DISABLED|MF_GRAYED);
390 twoaday 193 set_menu_text (popup, ID_WINPT_FILE, _("File Manager"));
391     set_menu_text (popup, ID_WINPT_KEY, _("Key Manager"));
392     set_menu_text (popup, ID_WINPT_CARD, _("Card Manager"));
393 twoaday 246 set_menu_text (popup, ID_WINPT_EDIT, _("Edit"));
394 werner 36 set_menu_text (popup, ID_WINPT_ABOUT, _("About..."));
395     set_menu_text (popup, ID_WINPT_QUIT, _("Exit"));
396     set_menu_text (popup, ID_WINPT_SYMENC, _("Symmetric"));
397     set_menu_text (popup, ID_WINPT_ENCRYPT, _("Encrypt"));
398 twoaday 72 set_menu_text (popup, ID_WINPT_SIGN, _("Sign"));
399 werner 36 set_menu_text (popup, ID_WINPT_SIGNENCRYPT, _("Sign && Encrypt"));
400     set_menu_text (popup, ID_WINPT_DECRYPT, _("Decrypt/Verify"));
401     set_menu_text (popup, ID_WINPT_VERIFY, _("Verify"));
402     set_menu_text (popup, ID_WINPT_CURRWND_ENCRYPT, _("Encrypt"));
403     set_menu_text (popup, ID_WINPT_CURRWND_SIGNENCRYPT, _("Sign && Encrypt"));
404     set_menu_text (popup, ID_WINPT_CURRWND_DECRYPT_VERIFY, _("Decrypt/Verify"));
405     set_menu_text (popup, ID_WINPT_CURRWND_SIGN, _("Sign"));
406 twoaday 234 set_menu_text (popup, ID_WINPT_CURRWND_SYMENC, _("Symmetric"));
407 twoaday 72 if (!secret_key_available ()) {
408     set_menu_state (popup, ID_WINPT_SIGN, MF_DISABLED|MF_GRAYED);
409     set_menu_state (popup, ID_WINPT_CURRWND_SIGN, MF_DISABLED|MF_GRAYED);
410     set_menu_state (popup, ID_WINPT_SIGNENCRYPT, MF_DISABLED|MF_GRAYED);
411     set_menu_state (popup, ID_WINPT_CURRWND_SIGNENCRYPT, MF_DISABLED|MF_GRAYED);
412     }
413 twoaday 246 /* change popup texts */
414     set_menu_text_bypos (popup, 4, _("Clipboard"));
415     set_menu_text_bypos (popup, 5, _("Current Window"));
416     set_menu_text_bypos (popup, 7, _("Preferences"));
417 werner 36
418 twoaday 72 TrackPopupMenu (popup, TPM_RIGHTALIGN, p.x, p.y, 0, hwnd, NULL);
419     PostMessage (hwnd, WM_USER, 0, 0);
420     DestroyMenu (popup);
421     DestroyMenu (hm);
422 werner 36 break;
423    
424     case WM_LBUTTONDBLCLK:
425 twoaday 244 if (!wait_for_progress_cb (0))
426     break;
427 twoaday 78 gpg_read_only = gpg_check_permissions (0) == 0? 0 : 1;
428     SendMessage (hwnd, WM_COMMAND, ID_WINPT_KEY, 0);
429 werner 36 break;
430     }
431     break;
432    
433     case WM_HOTKEY:
434     cmd = 0;
435 twoaday 229 switch (wparam) {
436 werner 36 case WPT_CLIP_ENCRYPT_ID:
437     SendMessage( hwnd, WM_COMMAND, ID_WINPT_ENCRYPT, 0 );
438     break;
439    
440     case WPT_CLIP_DECRYPT_VERIFY_ID:
441     SendMessage( hwnd, WM_COMMAND, ID_WINPT_DECRYPT_VERIFY, 0 );
442     break;
443    
444     case WPT_CLIP_SIGN_ID:
445     SendMessage( hwnd, WM_COMMAND, ID_WINPT_SIGN, 0 );
446     break;
447    
448     case WPT_CLIP_SIGN_ENCRYPT_ID:
449     SendMessage( hwnd, WM_COMMAND, ID_WINPT_SIGNENCRYPT, 0 );
450     break;
451    
452     case WPT_CURRWND_ENCRYPT_ID:
453     use_hotkey = 1;
454     SendMessage( hwnd, WM_COMMAND, ID_WINPT_CURRWND_ENCRYPT, 0 );
455     break;
456    
457     case WPT_CURRWND_SIGN_ID:
458     use_hotkey = 1;
459     SendMessage( hwnd, WM_COMMAND, ID_WINPT_CURRWND_SIGN, 0 );
460     break;
461    
462     case WPT_CURRWND_SIGN_ENCRYPT_ID:
463     use_hotkey = 1;
464     SendMessage( hwnd, WM_COMMAND, ID_WINPT_CURRWND_SIGNENCRYPT, 0 );
465     break;
466    
467     case WPT_CURRWND_DECRYPT_VERIFY_ID:
468     use_hotkey = 1;
469     SendMessage( hwnd, WM_COMMAND, ID_WINPT_CURRWND_DECRYPT_VERIFY, 0 );
470     break;
471    
472     case WPT_AGENT_FORGET_ID:
473 twoaday 248 rc = msg_box (hwnd, _("Remove all passphrases from cache?"),
474     _("WinPT"), MB_YESNO|MB_ICONQUESTION);
475     if (rc == IDYES)
476     agent_flush_cache ();
477 werner 36 break;
478     }
479     break;
480    
481     case WM_COMMAND:
482 twoaday 248 if (gnupg_access_keyring (1)) {
483     if (log_box( "WinPT", MB_ERR|MB_YESNO,
484     _("Could not access public keyring, exit WinPT?") ) == IDYES)
485     SendMessage (hwnd, WM_DESTROY, 0, 0);
486 werner 36 break;
487     }
488 twoaday 248 switch (wparam) {
489 werner 36 /** Clipboard operations **/
490     case ID_WINPT_SYMENC:
491     case ID_WINPT_ENCRYPT:
492     case ID_WINPT_SIGN:
493     case ID_WINPT_SIGNENCRYPT:
494     case ID_WINPT_DECRYPT_VERIFY:
495 twoaday 193 err = gpg_clip_istext_avail (&has_data);
496     if (err) {
497     msg_box (hwnd, gpgme_strerror (err),_("Clipboard"), MB_ERR);
498 werner 36 break;
499     }
500 twoaday 193 if (!has_data) {
501     msg_box (hwnd, winpt_strerror (WPTERR_CLIP_EMPTY),
502     _("Clipboard"), MB_ERR);
503 werner 36 break;
504     }
505 twoaday 255 clip_gpg_dlg (hwnd, (int)wparam, NULL);
506 werner 36 break;
507 twoaday 193
508 werner 36 /** Current window operations **/
509     case ID_WINPT_CURRWND_SYMENC:
510     case ID_WINPT_CURRWND_ENCRYPT:
511     case ID_WINPT_CURRWND_SIGNENCRYPT:
512     case ID_WINPT_CURRWND_DECRYPT_VERIFY:
513     case ID_WINPT_CURRWND_SIGN:
514 twoaday 248 rc = get_window_contents (hwnd, &currwnd, &use_hotkey);
515     if (rc) {
516     log_box (_("WinPT Error"), MB_ERR,
517 werner 36 _("Make sure that the window contains text.\n"
518     "%s."),
519 twoaday 248 winpt_strerror (WPTERR_CURR_WND));
520 werner 36 break;
521     }
522 twoaday 255 clip_gpg_dlg (hwnd, (int)wparam, &set_wc);
523     if (set_wc == 1)
524 twoaday 129 set_window_contents (hwnd, &currwnd);
525 werner 36 break;
526    
527     /** File handling **/
528     case ID_WINPT_FILE:
529 twoaday 139 s = _("File Manager (use drag & drop to add files)");
530     wnd = FindWindow (NULL, s);
531     if (wnd && IsIconic (wnd))
532     ShowWindow (wnd, SW_RESTORE);
533     dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_FILE,
534     GetDesktopWindow (), file_manager_dlg_proc, 0,
535     s, IDS_WINPT_FILE);
536 werner 36 break;
537    
538     /** Misc **/
539     case ID_WINPT_KEY:
540 twoaday 139 wnd = FindWindow (NULL, _("Key Manager"));
541     if (wnd && IsIconic (wnd))
542     ShowWindow (wnd, SW_RESTORE);
543 twoaday 180 if (wnd)
544     SetForegroundWindow (wnd);
545 twoaday 139 dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_KEYMISC,
546 twoaday 193 GetDesktopWindow(), keymanager_dlg_proc,
547     cmd != 0? (LPARAM)cmd : 0,
548 twoaday 139 _("Key Manager"), IDS_WINPT_KEYMISC);
549 werner 36 cmd = 0;
550     break;
551    
552     case ID_WINPT_CARD:
553 twoaday 121 load_card_manager ();
554 werner 36 break;
555    
556     case ID_WINPT_EDIT:
557     dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_CLIPEDIT,
558 twoaday 68 GetDesktopWindow(), clip_edit_dlg_proc, 0,
559 werner 36 _("Clipboard Editor"), IDS_WINPT_CLIPEDIT );
560     break;
561    
562     case ID_WINPT_ABOUT:
563     dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_ABOUT, GetDesktopWindow(),
564 twoaday 68 about_winpt_dlg_proc, 0,
565 werner 36 _("About WinPT"), IDS_WINPT_ABOUT );
566     break;
567    
568     case ID_WINPT_PREFS:
569     dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_PREFS, GetDesktopWindow(),
570 twoaday 68 prefs_dlg_proc, 0,
571 werner 36 _("WinPT Preferences"), IDS_WINPT_PREFS );
572     break;
573    
574     case ID_WINPT_GPGPREFS:
575 twoaday 190 rc = dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_GPGPREFS,
576     GetDesktopWindow(), gpgprefs_dlg_proc, 0,
577 werner 36 _("GnuPG Preferences"), IDS_WINPT_GPGPREFS);
578 twoaday 190 if (rc == TRUE)
579     update_keycache (GetDesktopWindow ());
580 werner 36 break;
581    
582     case ID_WINPT_QUIT:
583 twoaday 193 manual_shutdown = 1;
584 werner 36 SendMessage (hwnd, WM_DESTROY, 0, 0);
585     break;
586     }
587     break;
588     }
589    
590     return DefWindowProc (hwnd, msg, wparam, lparam);
591     }

Properties

Name Value
svn:eol-style native

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26