46 |
char* get_reg_entry_keyserver (const char *); |
char* get_reg_entry_keyserver (const char *); |
47 |
int set_reg_entry_keyserver (const char *, const char *); |
int set_reg_entry_keyserver (const char *, const char *); |
48 |
|
|
49 |
enum { KS_COL_NAME = 0, KS_COL_PORT, KS_COL_DEFAULT }; |
enum { KS_COL_NAME = 0, KS_COL_PORT }; |
50 |
|
|
51 |
/* Callback context to modify (add, edit) keyserver items. */ |
/* Callback context to modify (add, edit) keyserver items. */ |
52 |
struct keyserver_rec_s { |
struct keyserver_rec_s { |
316 |
} |
} |
317 |
|
|
318 |
|
|
|
/* Format the proxy host and display it in the dialog. */ |
|
|
static void |
|
|
set_proxy (HWND dlg) |
|
|
{ |
|
|
char buf[384]; |
|
|
|
|
|
if (proxy.host) |
|
|
_snprintf (buf, sizeof (buf)-1, "%s proxy: \"%s:%d\"", |
|
|
name_from_proto (proxy.proto), proxy.host, proxy.port); |
|
|
else |
|
|
strcpy (buf, _("Proxy: none")); |
|
|
SetDlgItemText (dlg, IDC_KEYSERVER_PROXY, buf); |
|
|
} |
|
|
|
|
|
|
|
319 |
static int inline |
static int inline |
320 |
kserver_get_pos (listview_ctrl_t lv) |
kserver_get_pos (listview_ctrl_t lv) |
321 |
{ |
{ |
335 |
} |
} |
336 |
|
|
337 |
|
|
|
/* Load the default keyserver and mark it in @lv. */ |
|
338 |
static void |
static void |
339 |
load_default_ks (listview_ctrl_t lv) |
set_default_ks (listview_ctrl_t lv) |
340 |
{ |
{ |
341 |
char * p, buf[192]; |
char *p, buf[200]; |
342 |
int i; |
int i; |
343 |
|
|
344 |
p = get_reg_entry_keyserver ("Default"); |
p = get_reg_entry_keyserver ("Default"); |
345 |
if (!p) |
if (!p) |
346 |
return; |
return; |
347 |
for (i = 0; i < listview_count_items (lv, 0); i++) { |
for (i=0; i < listview_count_items (lv, 0); i++) { |
348 |
listview_get_item_text (lv, i, KS_COL_NAME, buf, sizeof (buf)-1); |
listview_get_item_text (lv, i, KS_COL_NAME, buf, sizeof (buf)-1); |
349 |
if (!strncmp (p, buf, strlen (p))) { |
if (!strcmp (buf, p)) { |
350 |
listview_add_sub_item (lv, i, KS_COL_DEFAULT, "x"); |
listview_select_one (lv, i); |
351 |
break; |
break; |
352 |
} |
} |
353 |
} |
} |
367 |
return -1; |
return -1; |
368 |
} |
} |
369 |
listview_get_item_text (lv, idx, KS_COL_NAME, buf, sizeof (buf)-1); |
listview_get_item_text (lv, idx, KS_COL_NAME, buf, sizeof (buf)-1); |
370 |
if (!strncmp (buf, "http", 4) && !strncmp (buf, "hkp", 3)) { |
if (strncmp (buf, "http", 4) && strncmp (buf, "hkp", 3)) { |
371 |
msg_box (NULL, _("Only HTTP keyserver can be used."), |
msg_box (NULL, _("Only HTTP keyserver can be used."), |
372 |
_("Keyserver"), MB_ERR); |
_("Keyserver"), MB_ERR); |
373 |
return -1; |
return -1; |
374 |
} |
} |
|
for (i = 0; i < listview_count_items (lv, 0); i++) |
|
|
listview_add_sub_item (lv, i, KS_COL_DEFAULT, ""); |
|
|
listview_add_sub_item (lv, idx, KS_COL_DEFAULT, "x"); |
|
|
listview_get_item_text (lv, idx, KS_COL_NAME, buf, sizeof (buf)-1); |
|
375 |
set_reg_entry_keyserver ("Default", buf); |
set_reg_entry_keyserver ("Default", buf); |
376 |
i = kserver_get_port (lv); |
i = kserver_get_port (lv); |
377 |
sprintf (port, "%d", i); |
sprintf (port, "%d", i); |
385 |
keyserver_list_build (listview_ctrl_t *r_lv, HWND hwnd) |
keyserver_list_build (listview_ctrl_t *r_lv, HWND hwnd) |
386 |
{ |
{ |
387 |
struct listview_column_s keyserver[] = { |
struct listview_column_s keyserver[] = { |
388 |
{0, 160, (char *)_("DNS Name")}, |
{0, 180, (char *)_("DNS Name")}, |
389 |
{1, 46, (char *)_("Port")}, |
{1, 55, (char *)_("Port")}, |
|
{2, 60, (char *)_("Default")}, |
|
390 |
{0, 0, NULL} |
{0, 0, NULL} |
391 |
}; |
}; |
392 |
HICON ico[1]; |
HICON ico[1]; |
408 |
sprintf (buf, "%d", server[j].port); |
sprintf (buf, "%d", server[j].port); |
409 |
listview_add_sub_item (lv, 0, KS_COL_PORT, buf); |
listview_add_sub_item (lv, 0, KS_COL_PORT, buf); |
410 |
} |
} |
|
load_default_ks (lv); |
|
411 |
if (listview_count_items (lv, 0) == 0) { |
if (listview_count_items (lv, 0) == 0) { |
412 |
listview_add_item (lv, ""); |
listview_add_item (lv, ""); |
413 |
listview_add_sub_item (lv, 0, KS_COL_NAME, DEF_HKP_KEYSERVER); |
listview_add_sub_item (lv, 0, KS_COL_NAME, DEF_HKP_KEYSERVER); |
518 |
EnableWindow (GetDlgItem (dlg, IDC_KSERVADD_TYPES), FALSE); |
EnableWindow (GetDlgItem (dlg, IDC_KSERVADD_TYPES), FALSE); |
519 |
} |
} |
520 |
else |
else |
521 |
SetDlgItemInt (dlg, IDC_KSERVADD_PORT, 11371, FALSE); |
SetDlgItemInt (dlg, IDC_KSERVADD_PORT, 11371, FALSE); |
522 |
SetWindowText (dlg, _("Edit Keyserver")); |
SetWindowText (dlg, _("Edit Keyserver")); |
523 |
SetDlgItemText (dlg, IDOK, _("&Add")); |
SetDlgItemText (dlg, IDOK, _("&Add")); |
524 |
SetDlgItemText (dlg, IDCANCEL, _("&Cancel")); |
SetDlgItemText (dlg, IDCANCEL, _("&Cancel")); |
587 |
SetDlgItemText (dlg, IDC_KEYSERVER_INFO, |
SetDlgItemText (dlg, IDC_KEYSERVER_INFO, |
588 |
_("Please enter the key ID or email address you search for")); |
_("Please enter the key ID or email address you search for")); |
589 |
SetDlgItemText (dlg, IDC_KEYSERVER_INDEX, _("&Search")); |
SetDlgItemText (dlg, IDC_KEYSERVER_INDEX, _("&Search")); |
590 |
SetDlgItemText (dlg, IDC_KEYSERVER_PROXSETT, _("C&hange")); |
SetDlgItemText (dlg, IDC_KEYSERVER_PROXSETT, _("C&hange proxy")); |
591 |
SetDlgItemText (dlg, IDC_KEYSERVER_DEFAULT, _("Set &default")); |
SetDlgItemText (dlg, IDC_KEYSERVER_DEFAULT, _("Set &default")); |
592 |
SetDlgItemText (dlg, IDCANCEL, _("&Close")); |
SetDlgItemText (dlg, IDCANCEL, _("&Close")); |
593 |
|
|
|
set_proxy (dlg); |
|
594 |
keyserver_list_build (&lv, GetDlgItem (dlg, IDC_KEYSERVER_LIST)); |
keyserver_list_build (&lv, GetDlgItem (dlg, IDC_KEYSERVER_LIST)); |
595 |
|
set_default_ks (lv); |
596 |
center_window (dlg, NULL); |
center_window (dlg, NULL); |
597 |
SetForegroundWindow (dlg); |
SetForegroundWindow (dlg); |
598 |
return TRUE; |
return TRUE; |
641 |
dialog_box_param (glob_hinst, (LPCTSTR)IDD_WINPT_KEYSERVER_PROXY, |
dialog_box_param (glob_hinst, (LPCTSTR)IDD_WINPT_KEYSERVER_PROXY, |
642 |
dlg, keyserver_proxy_dlg_proc, NULL, |
dlg, keyserver_proxy_dlg_proc, NULL, |
643 |
_("Proxy Settings"), IDS_WINPT_KEYSERVER_PROXY); |
_("Proxy Settings"), IDS_WINPT_KEYSERVER_PROXY); |
|
set_proxy (dlg); |
|
644 |
return TRUE; |
return TRUE; |
645 |
|
|
646 |
case IDC_KEYSERVER_INDEX: |
case IDC_KEYSERVER_INDEX: |