185 |
|
|
186 |
case WM_SYSCOMMAND: |
case WM_SYSCOMMAND: |
187 |
if (LOWORD (wparam) == SC_CLOSE) |
if (LOWORD (wparam) == SC_CLOSE) |
188 |
EndDialog (dlg, TRUE); |
EndDialog (dlg, FALSE); |
189 |
return FALSE; |
return FALSE; |
190 |
|
|
191 |
case WM_COMMAND: |
case WM_COMMAND: |
192 |
if (HIWORD (wparam) == BN_CLICKED && |
if (HIWORD (wparam) == BN_CLICKED && |
193 |
LOWORD (wparam) == IDC_GPGPREFS_OVRDEFAULT) { |
LOWORD (wparam) == IDC_GPGPREFS_OVRDEFAULT) { |
194 |
if (IsDlgButtonChecked (dlg, LOWORD (wparam))) |
if (IsDlgButtonChecked (dlg, LOWORD (wparam))) { |
195 |
enable_disable_items (dlg, TRUE); |
enable_disable_items (dlg, TRUE); |
196 |
else |
gpg4win = false; |
197 |
|
} |
198 |
|
else { |
199 |
enable_disable_items (dlg, FALSE); |
enable_disable_items (dlg, FALSE); |
200 |
|
gpg4win = true; |
201 |
|
} |
202 |
break; |
break; |
203 |
} |
} |
204 |
|
|
206 |
case IDC_GPGPREFS_SAVE: |
case IDC_GPGPREFS_SAVE: |
207 |
if (!GetDlgItemText (dlg, IDC_GPGPREFS_HOMEDIR, |
if (!GetDlgItemText (dlg, IDC_GPGPREFS_HOMEDIR, |
208 |
homedir, sizeof (homedir) -1)) { |
homedir, sizeof (homedir) -1)) { |
209 |
msg_box (dlg, _("Please enter the GnuPG home directory."), |
msg_box (dlg, _("Please enter the GnuPG home directory."), |
210 |
_("Preferences"), MB_ERR); |
_("Preferences"), MB_ERR); |
211 |
return FALSE; |
return FALSE; |
212 |
} |
} |
213 |
if (dir_exist_check (homedir)) { |
if (dir_exist_check (homedir)) { |
214 |
_snprintf (t, sizeof (t) - 1, "%s: %s", homedir, |
_snprintf (t, sizeof (t) - 1, "%s: %s", homedir, |
215 |
winpt_strerror (WPTERR_DIR_OPEN)); |
winpt_strerror (WPTERR_DIR_OPEN)); |
216 |
msg_box (dlg, t, _("Preferences"), MB_ERR); |
msg_box (dlg, t, _("Preferences"), MB_ERR); |
217 |
return FALSE; |
return FALSE; |
229 |
return FALSE; |
return FALSE; |
230 |
} |
} |
231 |
if (file_exist_check (exedir)) { |
if (file_exist_check (exedir)) { |
232 |
msg_box (dlg, _("Could not find the GPG program in this directory."), |
msg_box (dlg, _("Could not find the GPG program in this directory."), |
233 |
_("Preferences"), MB_ERR); |
_("Preferences"), MB_ERR); |
234 |
return FALSE; |
return FALSE; |
235 |
} |
} |
236 |
if (!gpg4win && set_reg_entry_gpg ("gpgProgram", exedir)) { |
if (!gpg4win && set_reg_entry_gpg ("gpgProgram", exedir)) { |
237 |
msg_box (dlg, _("Could not save 'gpgProgram' in the registry"), |
msg_box (dlg, _("Could not save 'gpgProgram' in the registry"), |
238 |
_("Preferences"), MB_ERR); |
_("Preferences"), MB_ERR); |
239 |
return FALSE; |
return FALSE; |
240 |
} |
} |
241 |
if (GetDlgItemText (dlg, IDC_GPGPREFS_LOCALE, locale_dir, sizeof (locale_dir) -1)) { |
if (GetDlgItemText (dlg, IDC_GPGPREFS_LOCALE, |
242 |
|
locale_dir, sizeof (locale_dir) -1) > 0) { |
243 |
if (dir_exist_check (locale_dir)) { |
if (dir_exist_check (locale_dir)) { |
244 |
log_box ( _("Preferences"), MB_ERR, "%s: %s", locale_dir, |
log_box ( _("Preferences"), MB_ERR, "%s: %s", locale_dir, |
245 |
winpt_strerror (WPTERR_DIR_OPEN)); |
winpt_strerror (WPTERR_DIR_OPEN)); |
260 |
} |
} |
261 |
parse_gpg_options (p, &opt); |
parse_gpg_options (p, &opt); |
262 |
|
|
263 |
if( IsDlgButtonChecked( dlg, IDC_GPGPREFS_ASKLEVEL ) ) { |
if (IsDlgButtonChecked (dlg, IDC_GPGPREFS_ASKLEVEL)) { |
264 |
modify_entry( opt, ENTRY_SINGLE, "ask-cert-level", NULL ); |
modify_entry (opt, ENTRY_SINGLE, "ask-cert-level", NULL); |
265 |
reg_prefs.gpg.ask_cert_level = 1; |
reg_prefs.gpg.ask_cert_level = 1; |
266 |
} |
} |
267 |
else { |
else { |
268 |
delete_option (opt, "ask-cert-level"); |
delete_option (opt, "ask-cert-level"); |
269 |
reg_prefs.gpg.ask_cert_level = 0; |
reg_prefs.gpg.ask_cert_level = 0; |
270 |
} |
} |
271 |
|
n = GetDlgItemText(dlg, IDC_GPGPREFS_COMMENT, t, sizeof t - 1); |
272 |
if( (n = GetDlgItemText(dlg, IDC_GPGPREFS_COMMENT, t, sizeof t - 1 ) )) |
if (n > 0) |
273 |
modify_entry( opt, ENTRY_MULTI, "comment", t ); |
modify_entry (opt, ENTRY_MULTI, "comment", t); |
274 |
else if( n == 0 ) |
else if (n == 0) |
275 |
modify_entry( opt, ENTRY_MULTI, "comment", "\"\"" ); |
modify_entry (opt, ENTRY_MULTI, "comment", "\"\""); |
276 |
else |
else |
277 |
delete_option( opt, "comment" ); |
delete_option (opt, "comment"); |
278 |
|
|
279 |
if( (n=GetDlgItemText( dlg, IDC_GPGPREFS_ENCTO, t, sizeof t -1 ) ) ) |
n = GetDlgItemText (dlg, IDC_GPGPREFS_ENCTO, t, sizeof t -1); |
280 |
modify_entry( opt, ENTRY_MULTI, "encrypt-to", t ); |
if (n > 0) |
281 |
|
modify_entry (opt, ENTRY_MULTI, "encrypt-to", t); |
282 |
else |
else |
283 |
delete_option( opt, "encrypt-to" ); |
delete_option (opt, "encrypt-to"); |
284 |
|
|
285 |
commit_gpg_options (p, opt); |
commit_gpg_options (p, opt); |
286 |
release_gpg_options (opt); |
release_gpg_options (opt); |
293 |
char *name; |
char *name; |
294 |
|
|
295 |
SetDlgItemText (dlg, IDC_GPGPREFS_HOMEDIR, folder); |
SetDlgItemText (dlg, IDC_GPGPREFS_HOMEDIR, folder); |
296 |
if (GetDlgItemText (dlg, IDC_GPGPREFS_EXEDIR, exedir, DIM (exedir)-1) > 0) |
if (GetDlgItemText (dlg, IDC_GPGPREFS_EXEDIR, |
297 |
|
exedir, DIM (exedir)-1) > 0) |
298 |
break; |
break; |
299 |
name = make_filename (folder, "gpg", "exe"); |
name = make_filename (folder, "gpg", "exe"); |
300 |
if (file_exist_check (name) == 0) |
if (file_exist_check (name) == 0) |