1 |
/* wptGPGPrefsDlg.cpp - GnuPG Preferences |
/* wptGPGPrefsDlg.cpp - GnuPG Preferences |
2 |
* Copyright (C) 2001-2006 Timo Schulz |
* Copyright (C) 2001-2006, 2007 Timo Schulz |
3 |
* |
* |
4 |
* This file is part of WinPT. |
* This file is part of WinPT. |
5 |
* |
* |
70 |
} |
} |
71 |
free_if_alloc (path); |
free_if_alloc (path); |
72 |
|
|
|
p = get_reg_entry_mo (); |
|
|
if (p) { |
|
|
if (dir_exist_check (p) == 0) { |
|
|
SetDlgItemText (dlg, IDC_GPGPREFS_LOCALE, p); |
|
|
EnableWindow (GetDlgItem (dlg, IDC_GPGPREFS_LOCALE), FALSE); |
|
|
EnableWindow (GetDlgItem (dlg, IDC_GPGPREFS_LOCDLG), FALSE); |
|
|
} |
|
|
free_if_alloc (p); |
|
|
} |
|
|
|
|
73 |
path = get_reg_entry_gpg ("HomeDir"); |
path = get_reg_entry_gpg ("HomeDir"); |
74 |
p = multi_gnupg_path (1); |
p = multi_gnupg_path (1); |
75 |
if (path && dir_exist_check (path) == 0 && p && strcmp (path, p)) { |
if (path && dir_exist_check (path) == 0 && p && strcmp (path, p)) { |
106 |
SetDlgItemText (dlg, IDC_GPGPREFS_EXEDIR, p); |
SetDlgItemText (dlg, IDC_GPGPREFS_EXEDIR, p); |
107 |
free_if_alloc (p); |
free_if_alloc (p); |
108 |
} |
} |
109 |
p = get_reg_entry_mo (); |
|
|
if (p) { |
|
|
SetDlgItemText (dlg, IDC_GPGPREFS_LOCALE, p); |
|
|
free_if_alloc (p); |
|
|
} |
|
110 |
/* if there is no 'HomeDir' registry value but an existing |
/* if there is no 'HomeDir' registry value but an existing |
111 |
GPG multipath, we use this as the home dir instead. */ |
GPG multipath, we use this as the home dir instead. */ |
112 |
if (!item_get_text_length (dlg, IDC_GPGPREFS_HOMEDIR)) { |
if (!item_get_text_length (dlg, IDC_GPGPREFS_HOMEDIR)) { |
125 |
static int gpg4win = false; |
static int gpg4win = false; |
126 |
char exedir[512]; |
char exedir[512]; |
127 |
char homedir[512]; |
char homedir[512]; |
|
char locale_dir[512]; |
|
128 |
char *p = NULL, t[256]; |
char *p = NULL, t[256]; |
129 |
const char *s; |
const char *s; |
130 |
const char *folder; |
const char *folder; |
139 |
_("GnuPG home directory (where both keyrings are located)")); |
_("GnuPG home directory (where both keyrings are located)")); |
140 |
SetDlgItemText ( dlg, IDC_GPGPREFS_EXEINF, |
SetDlgItemText ( dlg, IDC_GPGPREFS_EXEINF, |
141 |
_("GnuPG exe file location (full path with added gpg.exe)")); |
_("GnuPG exe file location (full path with added gpg.exe)")); |
|
SetDlgItemText ( dlg, IDC_GPGPREFS_LOCALINF, |
|
|
_("Locale directory (to access the translation files)")); |
|
142 |
SetDlgItemText (dlg, IDC_GPGPREFS_ASKLEVEL, _("Ask for the signature class during key sign")); |
SetDlgItemText (dlg, IDC_GPGPREFS_ASKLEVEL, _("Ask for the signature class during key sign")); |
143 |
SetDlgItemText (dlg, IDC_GPGPREFS_ASKEXPIRE, _("Allow to set an expiration date for signatures")); |
SetDlgItemText (dlg, IDC_GPGPREFS_ASKEXPIRE, _("Allow to set an expiration date for signatures")); |
144 |
SetDlgItemText (dlg, IDC_GPGPREFS_CMTINF, _("Comment in armored files")); |
SetDlgItemText (dlg, IDC_GPGPREFS_CMTINF, _("Comment in armored files")); |
146 |
SetDlgItemText (dlg, IDC_GPGPREFS_ALLOPTINF, _("General GPG options")); |
SetDlgItemText (dlg, IDC_GPGPREFS_ALLOPTINF, _("General GPG options")); |
147 |
SetDlgItemText (dlg, IDC_GPGPREFS_HOMEDLG, _("Browse...")); |
SetDlgItemText (dlg, IDC_GPGPREFS_HOMEDLG, _("Browse...")); |
148 |
SetDlgItemText (dlg, IDC_GPGREFS_EXEDLG, _("Browse...")); |
SetDlgItemText (dlg, IDC_GPGREFS_EXEDLG, _("Browse...")); |
|
SetDlgItemText (dlg, IDC_GPGPREFS_LOCDLG, _("Browse...")); |
|
149 |
SetDlgItemText (dlg, IDC_GPGPREFS_OVRDEFAULT, _("&Overwrite default settings")); |
SetDlgItemText (dlg, IDC_GPGPREFS_OVRDEFAULT, _("&Overwrite default settings")); |
150 |
SetDlgItemText (dlg, IDCANCEL, _("&Cancel")); |
SetDlgItemText (dlg, IDCANCEL, _("&Cancel")); |
151 |
|
|
240 |
_("Preferences"), MB_ERR); |
_("Preferences"), MB_ERR); |
241 |
return FALSE; |
return FALSE; |
242 |
} |
} |
243 |
if (GetDlgItemText (dlg, IDC_GPGPREFS_LOCALE, |
|
|
locale_dir, DIM (locale_dir) -1) > 0) { |
|
|
if (dir_exist_check (locale_dir)) { |
|
|
log_box ( _("Preferences"), MB_ERR, "%s: %s", locale_dir, |
|
|
winpt_strerror (WPTERR_DIR_OPEN)); |
|
|
return FALSE; |
|
|
} |
|
|
if (!gpg4win) |
|
|
set_reg_entry_mo (locale_dir); |
|
|
gettext_set_file ("winpt", locale_dir); |
|
|
} |
|
|
else if (!gpg4win) |
|
|
set_reg_entry_mo (""); |
|
|
|
|
244 |
p = get_gnupg_cfgfile (); |
p = get_gnupg_cfgfile (); |
245 |
if (!p) { |
if (!p) { |
246 |
msg_box (dlg, _("Could not get GPG config file"), |
msg_box (dlg, _("Could not get GPG config file"), |
309 |
free_if_alloc (name); |
free_if_alloc (name); |
310 |
} |
} |
311 |
return TRUE; |
return TRUE; |
|
|
|
|
case IDC_GPGPREFS_LOCDLG: |
|
|
folder = get_folder_dlg (dlg, _("Choose Locale Directory"), NULL); |
|
|
if (folder) |
|
|
SetDlgItemText (dlg, IDC_GPGPREFS_LOCALE, folder); |
|
|
return TRUE; |
|
312 |
|
|
313 |
case IDC_GPGREFS_EXEDLG: |
case IDC_GPGREFS_EXEDLG: |
314 |
|
// TODO: use gpgme_ctx_set_engine_info instead. |
315 |
n = msg_box (dlg, _("Please be aware that the modifcation of " |
n = msg_box (dlg, _("Please be aware that the modifcation of " |
316 |
"the value will affect all installed " |
"the value will affect all installed " |
317 |
"programs which use GPG via the " |
"programs which use GPG via the " |
318 |
"GPGME interface library\n\n" |
"GPGME interface library\n\n" |
319 |
"Do you really want to continue?"), |
"Do you really want to continue?"), |
320 |
_("GPG Warning"), MB_WARN_ASK); |
_("GPG WARNING"), MB_WARN_ASK); |
321 |
if (n != IDYES) |
if (n != IDYES) |
322 |
return TRUE; |
return TRUE; |
323 |
|
|