/[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 40 by werner, Thu Oct 27 15:25:13 2005 UTC revision 41 by twoaday, Fri Oct 28 07:15:26 2005 UTC
# Line 18  Line 18 
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    
 #ifdef HAVE_CONFIG_H  
 #include <config.h>  
 #endif  
   
 #include <windows.h>  
21  #include <windows.h>  #include <windows.h>
22    
23  #include "../resource.h"  #include "../resource.h"
# Line 38  Line 33 
33  #include "wptVersion.h"  #include "wptVersion.h"
34    
35  static struct {  static struct {
36      const char * name;      const char *name;
37      int id;      int id;
38  } opts[] = {  } opts[] = {
39      {"HomeDir",    IDC_GPGPREFS_HOMEDIR},      {"HomeDir",    IDC_GPGPREFS_HOMEDIR},
40      {"gpgProgram", IDC_GPGPREFS_EXEDIR},      {"gpgProgram", IDC_GPGPREFS_EXEDIR},
41      {"OptFile",    IDC_GPGPREFS_OPTFILE},      {"OptFile",    IDC_GPGPREFS_OPTFILE},
42      {0}      {"", 0}
43  };  };
44    
45    /* Dialog box procedure for the GPG preferences. */
46  BOOL CALLBACK  BOOL CALLBACK
47  gpgprefs_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)  gpgprefs_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
48  {  {
49      char exedir[1024], homedir[1024], optfile[1024];      char exedir[512], homedir[512], optfile[512];
50      char locale_dir[1024];      char locale_dir[512];
51      char * p = NULL, t[512];      char *p = NULL, t[256];
52      const char * s;      const char *s;
53      int have_optfile = 0;      int have_optfile = 0;
54      gpg_optfile_t opt = NULL;      gpg_optfile_t opt = NULL;
55      gpg_option_t e;      gpg_option_t e;
56      UINT n;      UINT n;
57            
58      switch ( msg ) {      switch (msg) {
59      case WM_INITDIALOG:      case WM_INITDIALOG:
60  #ifndef LANG_DE          SetWindowText (dlg, _("GnuPG Preferences"));
         SetWindowText( dlg, _("GnuPG Preferences") );  
61          SetDlgItemText( dlg, IDC_GPGPREFS_HOMEINF,          SetDlgItemText( dlg, IDC_GPGPREFS_HOMEINF,
62                         _("GnuPG home directory  (where both keyrings are located)") );                         _("GnuPG home directory  (where both keyrings are located)") );
63          SetDlgItemText( dlg, IDC_GPGPREFS_OPTINF,          SetDlgItemText( dlg, IDC_GPGPREFS_OPTINF,
# Line 72  gpgprefs_dlg_proc (HWND dlg, UINT msg, W Line 66  gpgprefs_dlg_proc (HWND dlg, UINT msg, W
66                         _("GnuPG exe file location (full path with added gpg.exe)") );                         _("GnuPG exe file location (full path with added gpg.exe)") );
67          SetDlgItemText( dlg, IDC_GPGPREFS_LOCALINF,          SetDlgItemText( dlg, IDC_GPGPREFS_LOCALINF,
68                         _("Locale directory (to access the translation files)") );                         _("Locale directory (to access the translation files)") );
69  #endif          SetDlgItemText (dlg, IDC_GPGPREFS_ASKLEVEL, _("Ask for the signature class during key sign"));
70    
71          for( n=0; (s = opts[n].name); n++ ) {          for( n=0; (s = opts[n].name); n++ ) {
72              p = get_reg_entry_gpg( s );              p = get_reg_entry_gpg( s );
73              if( p ) {              if( p ) {
# Line 81  gpgprefs_dlg_proc (HWND dlg, UINT msg, W Line 76  gpgprefs_dlg_proc (HWND dlg, UINT msg, W
76              }              }
77          }          }
78                    
79          if( (p = get_reg_entry_mo( )) ) {          p = get_reg_entry_mo ();
80              SetDlgItemText( dlg, IDC_GPGPREFS_LOCALE, p );          if (p) {
81              free_if_alloc( p );              SetDlgItemText (dlg, IDC_GPGPREFS_LOCALE, p);
82                free_if_alloc (p);
83          }          }
84          p = get_gnupg_cfgfile( );          p = get_gnupg_cfgfile ();
85          if( p ) {          if (p) {
86              parse_gpg_options( p, &opt );              parse_gpg_options (p, &opt);
87              free_if_alloc( p );              free_if_alloc (p);
88              if( opt && find_option( opt, "force-v3-sigs" ) )              if (opt && find_option( opt, "ask-cert-level" ) )
89                  CheckDlgButton( dlg, IDC_GPGPREFS_V3SIGS, BST_CHECKED );                  CheckDlgButton( dlg, IDC_GPGPREFS_ASKLEVEL, BST_CHECKED );
90              if( opt && (e=find_option( opt, "comment" )) )              if (opt && (e=find_option( opt, "comment" )) )
91                  SetDlgItemText( dlg, IDC_GPGPREFS_COMMENT, e->val );                  SetDlgItemText (dlg, IDC_GPGPREFS_COMMENT, e->val);
92              if( opt && (e=find_option( opt, "encrypt-to" )) )              if (opt && (e=find_option( opt, "encrypt-to")))
93                  SetDlgItemText( dlg, IDC_GPGPREFS_ENCTO, e->val );                            SetDlgItemText (dlg, IDC_GPGPREFS_ENCTO, e->val);
94                if (opt)
95                    release_gpg_options (opt);
96          }          }
97          center_window( dlg, NULL );          center_window (dlg, NULL);
98          SetForegroundWindow( dlg );          SetForegroundWindow (dlg);
99          return TRUE;          return TRUE;
100                    
101      case WM_SYSCOMMAND:      case WM_SYSCOMMAND:
# Line 187  gpgprefs_dlg_proc (HWND dlg, UINT msg, W Line 185  gpgprefs_dlg_proc (HWND dlg, UINT msg, W
185              }              }
186              parse_gpg_options( p, &opt );              parse_gpg_options( p, &opt );
187    
188              if( IsDlgButtonChecked( dlg, IDC_GPGPREFS_V3SIGS ) )              if( IsDlgButtonChecked( dlg, IDC_GPGPREFS_ASKLEVEL ) ) {
189                  modify_entry( opt, ENTRY_SINGLE, "force-v3-sigs", NULL );                  modify_entry( opt, ENTRY_SINGLE, "ask-cert-level", NULL );
190              else                  reg_prefs.gpg.ask_cert_level = 1;
191                  delete_option( opt, "force-v3-sigs" );              }
192                else {
193                    delete_option( opt, "ask-cert-level" );
194                    reg_prefs.gpg.ask_cert_level = 0;
195                }
196    
197              if( (n = GetDlgItemText(dlg, IDC_GPGPREFS_COMMENT, t, sizeof t - 1 ) ))              if( (n = GetDlgItemText(dlg, IDC_GPGPREFS_COMMENT, t, sizeof t - 1 ) ))
198                  modify_entry( opt, ENTRY_MULTI, "comment", t );                  modify_entry( opt, ENTRY_MULTI, "comment", t );
# Line 205  gpgprefs_dlg_proc (HWND dlg, UINT msg, W Line 207  gpgprefs_dlg_proc (HWND dlg, UINT msg, W
207                  delete_option( opt, "encrypt-to" );                  delete_option( opt, "encrypt-to" );
208    
209              commit_gpg_options( p, opt );              commit_gpg_options( p, opt );
210              release_gpg_options( opt );              release_gpg_options (opt);
211              EndDialog( dlg, TRUE );              EndDialog( dlg, TRUE );
212              return TRUE;              return TRUE;
213                            
# Line 238  gpgprefs_dlg_proc (HWND dlg, UINT msg, W Line 240  gpgprefs_dlg_proc (HWND dlg, UINT msg, W
240              const char * opt;              const char * opt;
241              opt = get_filename_dlg( dlg, FILE_OPEN, _("Choose GPG config file"), NULL, NULL );              opt = get_filename_dlg( dlg, FILE_OPEN, _("Choose GPG config file"), NULL, NULL );
242              if( opt )              if( opt )
243                  SetDlgItemText( dlg, IDC_GPGPREFS_OPTFILE, opt );                  SetDlgItemText (dlg, IDC_GPGPREFS_OPTFILE, opt);
244              return TRUE;              return TRUE;
245          }          }
246          break;          break;
247      }      }
248            
249      return FALSE;      return FALSE;
250  } /* gpgprefs_dlg_proc */  }

Legend:
Removed from v.40  
changed lines
  Added in v.41

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26