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

Diff of /trunk/Src/wptGPGPrefsDlg.cpp

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

revision 4 by twoaday, Sun Feb 6 11:11:40 2005 UTC revision 271 by twoaday, Sun Nov 5 08:57:45 2006 UTC
# Line 1  Line 1 
1  /* wptGPGPrefsDlg.cpp - WinPT GnuPG Preferences  /* wptGPGPrefsDlg.cpp - GnuPG Preferences
2   *      Copyright (C) 2001-2005 Timo Schulz   *      Copyright (C) 2001-2006 Timo Schulz
3   *   *
4   * This file is part of WinPT.   * This file is part of WinPT.
5   *   *
6   * WinPT is free software; you can redistribute it and/or modify   * 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   * 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   * the Free Software Foundation; either version 2 of the License, or
9   * (at your option) any later version.   * (at your option) any later version.
10   *   *
11   * WinPT is distributed in the hope that it will be useful,   * WinPT is distributed in the hope that it will be useful,
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.
15   *   *
16   * You should have received a copy of the GNU General Public License   * You should have received a copy of the GNU General Public License
17   * along with WinPT; if not, write to the Free Software Foundation,   * along with WinPT; if not, write to the Free Software Foundation,
18   * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA   * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19   */   */
20    
21  #include <windows.h>  #ifdef HAVE_CONFIG_H
22    #include <config.h>
23  #include "../resource.h"  #endif
24  #include "wptNLS.h"  
25  #include "wptTypes.h"  #include <windows.h>
26  #include "wptErrors.h"  
27  #include "wptGPG.h"  #include "resource.h"
28  #include "wptRegistry.h"  #include "wptNLS.h"
29  #include "wptCommonCtl.h"  #include "wptTypes.h"
30  #include "wptContext.h" /* for passphrase_s */  #include "wptErrors.h"
31  #include "wptDlgs.h"  #include "wptGPG.h"
32  #include "wptW32API.h"  #include "wptRegistry.h"
33  #include "wptVersion.h"  #include "wptCommonCtl.h"
34    #include "wptW32API.h"
35  static struct {  
36      const char * name;  
37      int id;  /* Enable all edit items if @val is TRUE, disable them otherwise. */
38  } opts[] = {  static void
39      {"HomeDir",    IDC_GPGPREFS_HOMEDIR},  enable_disable_items (HWND dlg, BOOL val)
40      {"gpgProgram", IDC_GPGPREFS_EXEDIR},  {
41      {"OptFile",    IDC_GPGPREFS_OPTFILE},      EnableWindow (GetDlgItem (dlg, IDC_GPGPREFS_EXEDIR), val);
42      {0}      EnableWindow (GetDlgItem (dlg, IDC_GPGREFS_EXEDLG), val);
43  };      EnableWindow (GetDlgItem (dlg, IDC_GPGPREFS_LOCALE), val);
44        EnableWindow (GetDlgItem (dlg, IDC_GPGPREFS_LOCDLG), val);
45        EnableWindow (GetDlgItem (dlg, IDC_GPGPREFS_HOMEDIR), val);
46  BOOL CALLBACK      EnableWindow (GetDlgItem (dlg, IDC_GPGPREFS_HOMEDLG), val);
47  gpgprefs_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)  }
48  {  
49      char exedir[1024], homedir[1024], optfile[1024];  
50      char locale_dir[1024];  /* Load the GPG4WIN default values and disabled the
51      char * p = NULL, t[512];     dialog items to indicate these are fixed values.
52      const char * s;     Return value: true if GPG4win was found. */
53      int have_optfile = 0;  static bool
54      gpg_optfile_t opt = NULL;  load_gpg4win_values (HWND dlg)
55      gpg_option_t e;  {
56      UINT n;      char *path;
57            char *p;
58      switch ( msg ) {  
59      case WM_INITDIALOG:      path = get_reg_entry_gpg4win (NULL);
60  #ifndef LANG_DE      if (!path)
61          SetWindowText( dlg, _("GnuPG Preferences") );          return false;
62          SetDlgItemText( dlg, IDC_GPGPREFS_HOMEINF,      p = make_filename (path, "gpg", "exe");
63                         _("GnuPG home directory  (where both keyrings are located)") );      if (p) {
64          SetDlgItemText( dlg, IDC_GPGPREFS_OPTINF,          if (file_exist_check (p) == 0) {
65                         _("GnuPG config file (default: use gpg.conf)") );              SetDlgItemText (dlg, IDC_GPGPREFS_EXEDIR, p);
66          SetDlgItemText( dlg, IDC_GPGPREFS_EXEINF,              EnableWindow (GetDlgItem (dlg, IDC_GPGPREFS_EXEDIR), FALSE);
67                         _("GnuPG exe file location (full path with added gpg.exe)") );              EnableWindow (GetDlgItem (dlg, IDC_GPGREFS_EXEDLG), FALSE);
68          SetDlgItemText( dlg, IDC_GPGPREFS_LOCALINF,          }
69                         _("Locale directory (to access the translation files)") );          free_if_alloc (p);
70  #endif      }
71          for( n=0; (s = opts[n].name); n++ ) {      free_if_alloc (path);
72              p = get_reg_entry_gpg( s );  
73              if( p ) {      p = get_reg_entry_mo ();
74                  SetDlgItemText( dlg, opts[n].id, p );      if (p) {
75                  free_if_alloc( p );          if (dir_exist_check (p) == 0) {
76              }              SetDlgItemText (dlg, IDC_GPGPREFS_LOCALE, p);
77          }              EnableWindow (GetDlgItem (dlg, IDC_GPGPREFS_LOCALE), FALSE);
78                        EnableWindow (GetDlgItem (dlg, IDC_GPGPREFS_LOCDLG), FALSE);
79          if( (p = get_reg_entry_mo( )) ) {          }
80              SetDlgItemText( dlg, IDC_GPGPREFS_LOCALE, p );          free_if_alloc (p);
81              free_if_alloc( p );      }
82          }      
83          p = get_gnupg_cfgfile( );      path = get_reg_entry_gpg ("HomeDir");
84          if( p ) {      p = multi_gnupg_path (1);
85              parse_gpg_options( p, &opt );      if (path && dir_exist_check (path) == 0 && p && strcmp (path, p)) {
86              free_if_alloc( p );          /* The 'HomeDir' has a higher priority so if the key exists and is
87              if( opt && find_option( opt, "force-v3-sigs" ) )             different from the multi user path, we force the use of it. */
88                  CheckDlgButton( dlg, IDC_GPGPREFS_V3SIGS, BST_CHECKED );          free_if_alloc (p);
89              if( opt && (e=find_option( opt, "comment" )) )          p = path;
90                  SetDlgItemText( dlg, IDC_GPGPREFS_COMMENT, e->val );      }
91              if( opt && (e=find_option( opt, "encrypt-to" )) )      else
92                  SetDlgItemText( dlg, IDC_GPGPREFS_ENCTO, e->val );                    free_if_alloc (path);
93          }      if (p) {
94          center_window( dlg );          SetDlgItemText (dlg, IDC_GPGPREFS_HOMEDIR, p);
95          SetForegroundWindow( dlg );          EnableWindow (GetDlgItem (dlg, IDC_GPGPREFS_HOMEDIR), FALSE);
96          return TRUE;          EnableWindow (GetDlgItem (dlg, IDC_GPGPREFS_HOMEDLG), FALSE);
97                    free_if_alloc (p);
98      case WM_SYSCOMMAND:      }
99          if( LOWORD( wparam ) == SC_CLOSE )      return true;
100              EndDialog( dlg, TRUE );  }
101          return FALSE;  
102            
103      case WM_COMMAND:  /* Load the GPG values direct from the registry. */
104          switch ( LOWORD( wparam ) ) {  static void
105          case IDC_GPGPREFS_SAVE:  load_registry_values (HWND dlg)
106              if( !GetDlgItemText( dlg, IDC_GPGPREFS_HOMEDIR, homedir, sizeof homedir -1 ) ) {  {
107                  msg_box( dlg, _("Please enter the GnuPG home directory."), _("Preferences"), MB_ERR );      char *p;
108                  return FALSE;  
109              }      p = get_reg_entry_gpg ("HomeDir");
110              if( dir_exist_check( homedir ) ) {      if (p) {
111                  _snprintf( t, sizeof t - 1, "%s: %s", homedir, winpt_strerror(WPTERR_DIR_OPEN) );          SetDlgItemText (dlg, IDC_GPGPREFS_HOMEDIR, p);
112                  msg_box( dlg, t, _("Preferences"), MB_ERR );          free_if_alloc (p);
113                  return FALSE;      }
114              }      p = get_reg_entry_gpg ("gpgProgram");
115                    if (p) {
116              if( GetDlgItemText( dlg, IDC_GPGPREFS_OPTFILE, optfile, sizeof optfile - 1 ) ) {          SetDlgItemText (dlg, IDC_GPGPREFS_EXEDIR, p);
117                  if ( file_exist_check( optfile ) ) {          free_if_alloc (p);
118                      n = msg_box(dlg, _("Could not find GPG config file.\n"      }
119                                         "Do you want to create a config file?"),      p = get_reg_entry_mo ();
120                                  _("Preferences"), MB_INFO|MB_YESNO );      if (p) {
121                      if( n == IDNO ) {          SetDlgItemText (dlg, IDC_GPGPREFS_LOCALE, p);
122                          SetDlgItemText( dlg, IDC_GPGPREFS_OPTFILE, "" );          free_if_alloc (p);
123                          return FALSE;      }
124                      }      /* if there is no 'HomeDir' registry value but an existing
125                      else if( n == IDYES ) {         GPG multipath, we use this as the home dir instead. */
126                          FILE * fp = fopen( optfile, "wb" );      if (!item_get_text_length (dlg, IDC_GPGPREFS_HOMEDIR)) {
127                          if( fp )          p = multi_gnupg_path (0);
128                              fclose( fp );          if (p && dir_exist_check (p) == 0)
129                          if( file_exist_check( optfile ) ) {              SetDlgItemText (dlg, IDC_GPGPREFS_HOMEDIR, p);
130                              log_box( _("Preferences"), MB_ERR, "%s: %s", optfile, winpt_strerror( WPTERR_FILE_CREAT ) );          free_if_alloc (p);
131                              return FALSE;      }
132                          }  }
133                          have_optfile = 1;  
134                      }  
135                  }  /* Dialog box procedure for the GPG preferences. */
136                  else  BOOL CALLBACK
137                      have_optfile = 1;  gpgprefs_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
138                  if( have_optfile ) {  {
139                      if( set_reg_entry_gpg( "OptFile", optfile ) ) {      static int gpg4win = false;
140                          msg_box( dlg, _("Could not save 'OptFile' in the registry."), _("Preferences"), MB_ERR );      char exedir[512];
141                          return FALSE;      char homedir[512];
142                      }      char locale_dir[512];
143                  }      char *p = NULL, t[256];
144              }      const char *s;
145              else {      const char *folder;
146                  char * t = get_gnupg_cfgfile( );      config_file_t opt = NULL;
147                  if( t && !file_exist_check(t) )      conf_option_t e;
148                      set_reg_entry_gpg( "OptFile", t );      UINT n;
149                  else      
150                      set_reg_entry_gpg( "OptFile", "" );      switch (msg) {
151                  free_if_alloc( t );      case WM_INITDIALOG:
152              }          SetWindowText (dlg, _("GnuPG Preferences"));
153              if ( set_reg_entry_gpg( "HomeDir", homedir ) ) {                              SetDlgItemText (dlg, IDC_GPGPREFS_HOMEINF,
154                  msg_box( dlg, _("Could not save 'HomeDir' in the registry."), _("Preferences"), MB_ERR );                         _("GnuPG home directory  (where both keyrings are located)"));
155                  return FALSE;          SetDlgItemText ( dlg, IDC_GPGPREFS_EXEINF,
156              }                          _("GnuPG exe file location (full path with added gpg.exe)"));
157              if( !GetDlgItemText( dlg, IDC_GPGPREFS_EXEDIR, exedir, sizeof exedir -1 ) ) {          SetDlgItemText ( dlg, IDC_GPGPREFS_LOCALINF,
158                  msg_box( dlg, _("Please enter where GPG.exe is located."), _("Preferences"), MB_ERR );                          _("Locale directory (to access the translation files)"));
159                  return FALSE;          SetDlgItemText (dlg, IDC_GPGPREFS_ASKLEVEL, _("Ask for the signature class during key sign"));
160              }          SetDlgItemText (dlg, IDC_GPGPREFS_ASKEXPIRE, _("Allow to set an expiration date for signatures"));
161              if( file_exist_check( exedir ) ) {          SetDlgItemText (dlg, IDC_GPGPREFS_CMTINF, _("Comment in armored files"));
162                  msg_box( dlg, _("Could not find the GPG program in this directory."), _("Preferences"), MB_ERR );          SetDlgItemText (dlg, IDC_GPGPREFS_ENCINF, _("Encrypt to this key"));
163                  return FALSE;          SetDlgItemText (dlg, IDC_GPGPREFS_ALLOPTINF, _("General GPG options"));
164              }          SetDlgItemText (dlg, IDC_GPGPREFS_HOMEDLG, _("Browse..."));
165              if( set_reg_entry_gpg("gpgProgram", exedir ) ) {          SetDlgItemText (dlg, IDC_GPGREFS_EXEDLG, _("Browse..."));
166                  msg_box( dlg, _("Could not save 'gpgProgram' in the registry"), _("Preferences"), MB_ERR );          SetDlgItemText (dlg, IDC_GPGPREFS_LOCDLG, _("Browse..."));
167                  return FALSE;          SetDlgItemText (dlg, IDC_GPGPREFS_OVRDEFAULT, _("&Overwrite default settings"));
168              }          SetDlgItemText (dlg, IDCANCEL, _("&Cancel"));
169              if( GetDlgItemText( dlg, IDC_GPGPREFS_LOCALE, locale_dir, sizeof (locale_dir) -1 ) ) {  
170                  if (dir_exist_check (locale_dir)) {          gpg4win = load_gpg4win_values (dlg);
171                      log_box( _("Preferences"), MB_ERR, "%s: %s", locale_dir, winpt_strerror (WPTERR_DIR_OPEN));          if (!gpg4win) {
172                      return FALSE;              load_registry_values (dlg);
173                  }              CheckDlgButton (dlg, IDC_GPGPREFS_OVRDEFAULT, BST_CHECKED);
174                  set_reg_entry_mo (locale_dir);          }
175                  set_gettext_file ("winpt", locale_dir);  
176              }          p = get_gnupg_cfgfile ();
177              else          if (p) {
178                  set_reg_entry_mo ("");              parse_config (p, &opt);
179                free_if_alloc (p);
180              p = get_gnupg_cfgfile ();              if (opt) {
181              if( !p ) {                  if (conf_find_option (opt, "ask-cert-expire"))
182                  msg_box( dlg, _("Could not get GPG config file"), _("Preferences"), MB_ERR );                      CheckDlgButton (dlg, IDC_GPGPREFS_ASKEXPIRE, BST_CHECKED);
183                  EndDialog( dlg, FALSE );                  if (conf_find_option (opt, "ask-cert-level"))
184              }                      CheckDlgButton (dlg, IDC_GPGPREFS_ASKLEVEL, BST_CHECKED);
185              parse_gpg_options( p, &opt );                  e = conf_find_option (opt, "comment");
186                    if (e != NULL)
187              if( IsDlgButtonChecked( dlg, IDC_GPGPREFS_V3SIGS ) )                      SetDlgItemText (dlg, IDC_GPGPREFS_COMMENT, e->val);
188                  modify_entry( opt, ENTRY_SINGLE, "force-v3-sigs", NULL );                  e = conf_find_option (opt, "encrypt-to");
189              else                  if (e != NULL)
190                  delete_option( opt, "force-v3-sigs" );                      SetDlgItemText (dlg, IDC_GPGPREFS_ENCTO, e->val);
191                    release_config (opt);
192              if( (n = GetDlgItemText(dlg, IDC_GPGPREFS_COMMENT, t, sizeof t - 1 ) ))              }
193                  modify_entry( opt, ENTRY_MULTI, "comment", t );          }
194              else if( n == 0 )  
195                  modify_entry( opt, ENTRY_MULTI, "comment", "\"\"" );          center_window (dlg, NULL);
196              else          SetForegroundWindow (dlg);
197                  delete_option( opt, "comment" );          return TRUE;
198    
199              if( (n=GetDlgItemText( dlg, IDC_GPGPREFS_ENCTO, t, sizeof t -1 ) ) )      case WM_DESTROY:
200                  modify_entry( opt, ENTRY_MULTI, "encrypt-to", t );          gpg4win = false;
201              else          break;
202                  delete_option( opt, "encrypt-to" );          
203        case WM_COMMAND:
204              commit_gpg_options( p, opt );          if (HIWORD (wparam) == BN_CLICKED &&
205              release_gpg_options( opt );              LOWORD (wparam) == IDC_GPGPREFS_OVRDEFAULT) {
206              EndDialog( dlg, TRUE );              if (IsDlgButtonChecked (dlg, LOWORD (wparam))) {
207              return TRUE;                  enable_disable_items (dlg, TRUE);
208                                gpg4win = false;
209          case IDC_GPGPREFS_HOMEDLG:              }
210              const char * home;              else {
211                    enable_disable_items (dlg, FALSE);
212              home = get_folder_dlg( dlg, _("Choose GPG home directory"), NULL );                  gpg4win = true;
213              if( home )              }
214                  SetDlgItemText( dlg, IDC_GPGPREFS_HOMEDIR, home );              break;
215              break;          }
216    
217          case IDC_GPGREFS_EXEDLG:          switch (LOWORD (wparam)) {
218              const char * bin;          case IDC_GPGPREFS_SAVE:
219              bin = get_filename_dlg( dlg, FILE_OPEN, _("Choose GPG binary"), _("Executable Files (*.exe)\0*.exe\0\0"), NULL );              if (!GetDlgItemText (dlg, IDC_GPGPREFS_HOMEDIR,
220              if( bin )                                   homedir, sizeof (homedir) -1)) {
221                  SetDlgItemText( dlg, IDC_GPGPREFS_EXEDIR, bin );                  msg_box (dlg, _("Please enter the GnuPG home directory."),
222              return TRUE;                           _("Preferences"), MB_ERR);
223                                return FALSE;
224          case IDC_GPGPREFS_OPTDLG:              }
225              const char * opt;              if (dir_exist_check (homedir)) {
226              opt = get_filename_dlg( dlg, FILE_OPEN, _("Choose GPG config file"), NULL, NULL );                  _snprintf (t, sizeof (t) - 1, "%s: %s", homedir,
227              if( opt )                             winpt_strerror (WPTERR_DIR_OPEN));
228                  SetDlgItemText( dlg, IDC_GPGPREFS_OPTFILE, opt );                  msg_box (dlg, t, _("Preferences"), MB_ERR);
229              return TRUE;                  return FALSE;
230          }              }
231          break;              
232      }              if (!gpg4win && set_reg_entry_gpg ("HomeDir", homedir)) {
233                        msg_box (dlg, _("Could not save 'HomeDir' in the registry."),
234      return FALSE;                           _("Preferences"), MB_ERR);
235  } /* gpgprefs_dlg_proc */                  return FALSE;
236                }
237                if (!GetDlgItemText (dlg, IDC_GPGPREFS_EXEDIR,
238                                     exedir, sizeof (exedir) -1)) {
239                    msg_box (dlg, _("Please enter where GPG.exe is located."),
240                             _("Preferences"), MB_ERR);
241                    return FALSE;
242                }
243                if (file_exist_check (exedir)) {
244                    msg_box (dlg, _("Could not find the GPG program in this directory."),
245                             _("Preferences"), MB_ERR);
246                    return FALSE;
247                }
248                if (!gpg4win && set_reg_entry_gpg ("gpgProgram", exedir)) {
249                    msg_box (dlg, _("Could not save 'gpgProgram' in the registry"),
250                             _("Preferences"), MB_ERR);
251                    return FALSE;
252                }
253                if (GetDlgItemText (dlg, IDC_GPGPREFS_LOCALE,
254                                    locale_dir, sizeof (locale_dir) -1) > 0) {
255                    if (dir_exist_check (locale_dir)) {
256                        log_box ( _("Preferences"), MB_ERR, "%s: %s", locale_dir,
257                                 winpt_strerror (WPTERR_DIR_OPEN));
258                        return FALSE;
259                    }
260                    if (!gpg4win)
261                        set_reg_entry_mo (locale_dir);
262                    set_gettext_file ("winpt", locale_dir);
263                }
264                else if (!gpg4win)
265                    set_reg_entry_mo ("");
266    
267                p = get_gnupg_cfgfile ();
268                if (!p) {
269                    msg_box (dlg, _("Could not get GPG config file"),
270                             _("Preferences"), MB_ERR);
271                    EndDialog (dlg, FALSE);
272                    return TRUE;
273                }
274                parse_config (p, &opt);
275    
276                if (IsDlgButtonChecked (dlg, IDC_GPGPREFS_ASKLEVEL)) {
277                    conf_modify_entry (opt, ENTRY_SINGLE, "ask-cert-level", NULL);
278                    reg_prefs.gpg.ask_cert_level = 1;
279                }
280                else {
281                    conf_delete_option (opt, "ask-cert-level");
282                    reg_prefs.gpg.ask_cert_level = 0;
283                }
284                if (IsDlgButtonChecked (dlg, IDC_GPGPREFS_ASKEXPIRE)) {
285                    conf_modify_entry (opt, ENTRY_SINGLE, "ask-cert-expire", NULL);
286                    reg_prefs.gpg.ask_cert_expire = 1;
287                }
288                else {
289                    conf_delete_option (opt, "ask-cert-expire");
290                    reg_prefs.gpg.ask_cert_expire = 0;
291                }
292    
293                n = GetDlgItemText(dlg, IDC_GPGPREFS_COMMENT, t, DIM (t)-1);
294                if (n > 0)
295                    conf_modify_entry (opt, ENTRY_MULTI, "comment", t);
296                else if (n == 0)
297                    conf_modify_entry (opt, ENTRY_MULTI, "comment", "\"\"");
298                else
299                    conf_delete_option (opt, "comment");
300    
301                n = GetDlgItemText (dlg, IDC_GPGPREFS_ENCTO, t, DIM (t)-1);
302                if (n > 0)
303                    conf_modify_entry (opt, ENTRY_MULTI, "encrypt-to", t);
304                else
305                    conf_delete_option (opt, "encrypt-to");
306    
307                commit_config (p, opt);
308                release_config (opt);
309                /* only return TRUE if the home dir has been changed. */
310                if (SendDlgItemMessage (dlg, IDC_GPGPREFS_HOMEDIR, EM_GETMODIFY, 0, 0)) {
311                    set_gnupg_default_key (NULL);
312                    EndDialog (dlg, TRUE);          
313                }
314                else
315                    EndDialog (dlg, FALSE);
316                return TRUE;
317                
318            case IDC_GPGPREFS_HOMEDLG:
319                folder = get_folder_dlg (dlg, _("Choose GPG Home Directory"), NULL);
320                if (folder) {
321                    char *name;
322    
323                    SetDlgItemText (dlg, IDC_GPGPREFS_HOMEDIR, folder);
324                    SendDlgItemMessage (dlg, IDC_GPGPREFS_HOMEDIR,
325                                        EM_SETMODIFY, (WPARAM)(UINT)TRUE, 0);
326                    if (GetDlgItemText (dlg, IDC_GPGPREFS_EXEDIR,
327                                        exedir, DIM (exedir)-1) > 0)
328                        break;
329                    name = make_filename (folder, "gpg", "exe");
330                    if (file_exist_check (name) == 0)
331                        SetDlgItemText (dlg, IDC_GPGPREFS_EXEDIR, name);
332                    free_if_alloc (name);
333                }
334                return TRUE;
335    
336            case IDC_GPGPREFS_LOCDLG:
337                folder = get_folder_dlg (dlg, _("Choose Locale Directory"), NULL);
338                if (folder)
339                    SetDlgItemText (dlg, IDC_GPGPREFS_LOCALE, folder);
340                return TRUE;
341                
342            case IDC_GPGREFS_EXEDLG:
343                s = get_fileopen_dlg (dlg, _("Choose GPG Binary"),
344                                      "Executable Files (*.exe)\0*.exe\0\0",
345                                      NULL);
346                if (s)
347                    SetDlgItemText (dlg, IDC_GPGPREFS_EXEDIR, s);
348                return TRUE;
349                
350            case IDCANCEL:
351                EndDialog (dlg, FALSE);
352                return TRUE;
353            }
354            break;
355        }
356        
357        return FALSE;
358    }

Legend:
Removed from v.4  
changed lines
  Added in v.271

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26