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

Annotation of /trunk/Src/wptMainProc.cpp

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

Name Value
svn:eol-style native

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26