191 |
} /* load_toolbar */ |
} /* load_toolbar */ |
192 |
|
|
193 |
|
|
194 |
|
/* Center window @dlg. */ |
195 |
static void |
static void |
196 |
do_center_window (HWND dlg, struct km_info * kmi) |
do_center_window (HWND dlg, struct km_info * kmi) |
197 |
{ |
{ |
205 |
|
|
206 |
kmi->ypos_sep = rect.bottom; |
kmi->ypos_sep = rect.bottom; |
207 |
|
|
208 |
p = get_reg_entry( HKEY_CURRENT_USER, "Software\\WinPT", "KM_Pos_X" ); |
p = get_reg_entry (HKEY_CURRENT_USER, "Software\\WinPT", "KM_Pos_X"); |
209 |
if( p && !strcmp( p, " " ) ) { |
if (p && !strcmp (p, " ")) { |
210 |
free_if_alloc( p ); |
free_if_alloc (p); |
211 |
center_window( dlg, NULL ); |
center_window (dlg, NULL); |
212 |
return; |
return; |
213 |
} |
} |
214 |
else if( p ) |
else if (p) |
215 |
pos_x = atol( p ); |
pos_x = atol (p); |
216 |
|
|
217 |
p = get_reg_entry( HKEY_CURRENT_USER, "Software\\WinPT", "KM_Pos_Y" ); |
p = get_reg_entry (HKEY_CURRENT_USER, "Software\\WinPT", "KM_Pos_Y"); |
218 |
if( p && !strcmp( p, " " ) ) { |
if (p && !strcmp (p, " ")) { |
219 |
free_if_alloc( p ); |
free_if_alloc (p); |
220 |
center_window( dlg, NULL ); |
center_window(dlg, NULL); |
221 |
return; |
return; |
222 |
} |
} |
223 |
else if( p ) |
else if (p) |
224 |
pos_y = atol( p ); |
pos_y = atol (p); |
225 |
|
|
226 |
if( !pos_y && !pos_x ) { |
if (!pos_y && !pos_x) { |
227 |
center_window( dlg, NULL ); |
center_window (dlg, NULL); |
228 |
return; |
return; |
229 |
} |
} |
230 |
|
|
231 |
if( pos_x > GetSystemMetrics( SM_CXSCREEN ) |
if (pos_x < 0 || pos_y < 0) |
232 |
|| pos_y > GetSystemMetrics( SM_CYSCREEN ) ) { |
pos_x = pos_y = 0; |
233 |
|
if (pos_x > GetSystemMetrics (SM_CXSCREEN) |
234 |
|
|| pos_y > GetSystemMetrics (SM_CYSCREEN)) { |
235 |
pos_x = pos_y = 0; |
pos_x = pos_y = 0; |
236 |
} |
} |
237 |
GetClientRect( dlg, &rect ); |
GetClientRect (dlg, &rect); |
238 |
MoveWindow( dlg, pos_x, pos_y, rect.right, rect.bottom, TRUE ); |
MoveWindow (dlg, pos_x, pos_y, rect.right, rect.bottom, TRUE); |
239 |
} |
} |
240 |
|
|
241 |
|
|
685 |
kmi->hwnd_sep = regist_sep_wnd (dlg, kmi); |
kmi->hwnd_sep = regist_sep_wnd (dlg, kmi); |
686 |
imagelist_load (dlg); |
imagelist_load (dlg); |
687 |
|
|
|
#ifndef LANG_DE |
|
688 |
SetWindowText( dlg, _("Key Manager") ); |
SetWindowText( dlg, _("Key Manager") ); |
|
#endif |
|
689 |
menu = LoadMenu( glob_hinst, (LPCSTR)IDR_WINPT_KEYMISC ); |
menu = LoadMenu( glob_hinst, (LPCSTR)IDR_WINPT_KEYMISC ); |
690 |
#ifndef LANG_DE |
set_menu_text_bypos (menu, 0, _("File")); |
691 |
|
set_menu_text_bypos (menu, 1, _("Edit")); |
692 |
|
set_menu_text_bypos (menu, 2, _("View")); |
693 |
|
set_menu_text_bypos (menu, 3, _("Key")); |
694 |
|
set_menu_text_bypos (menu, 4, _("Groups")); |
695 |
|
|
696 |
|
set_menu_text (menu, ID_KEYMISC_EDITKEY, _("Edit")); |
697 |
set_menu_text (menu, ID_KEYMISC_MAIL, _("Send Mail...")); |
set_menu_text (menu, ID_KEYMISC_MAIL, _("Send Mail...")); |
698 |
set_menu_text (menu, ID_KEYMISC_OT, _("Ownertrust")); /* XXX */ |
set_menu_text (menu, ID_KEYMISC_OT, _("Ownertrust")); /* XXX */ |
699 |
set_menu_text (menu, ID_KEYMISC_COPY, _("&Copy\tCtrl+C")); |
set_menu_text (menu, ID_KEYMISC_COPY, _("&Copy\tCtrl+C")); |
722 |
set_menu_text (menu, ID_KEYMISC_REFRESH_KEYS, _("Refresh &Keys (Keyserver)")); |
set_menu_text (menu, ID_KEYMISC_REFRESH_KEYS, _("Refresh &Keys (Keyserver)")); |
723 |
set_menu_text (menu, ID_KEYMISC_INFO, _("Info") ); |
set_menu_text (menu, ID_KEYMISC_INFO, _("Info") ); |
724 |
set_menu_text (menu, ID_KEYMISC_HELP, _("&Help")); |
set_menu_text (menu, ID_KEYMISC_HELP, _("&Help")); |
725 |
|
|
|
#endif |
|
726 |
SetMenu (dlg, menu); |
SetMenu (dlg, menu); |
727 |
if( keyring_check_last_access() ) |
if( keyring_check_last_access() ) |
728 |
keycache_set_reload( 1 ); |
keycache_set_reload( 1 ); |
752 |
km_groups_load( gc ); |
km_groups_load( gc ); |
753 |
#endif |
#endif |
754 |
SetClassLong (dlg, GCL_HICON, (LONG)LoadIcon (glob_hinst, (LPCTSTR)IDI_WINPT)); |
SetClassLong (dlg, GCL_HICON, (LONG)LoadIcon (glob_hinst, (LPCTSTR)IDI_WINPT)); |
|
SetForegroundWindow (dlg); |
|
755 |
|
|
756 |
kmi->statbar = setup_status_bar (dlg, kmi->lv); |
kmi->statbar = setup_status_bar (dlg, kmi->lv); |
|
|
|
757 |
SetWindowLong (dlg, GWL_USERDATA, (LONG)kmi); |
SetWindowLong (dlg, GWL_USERDATA, (LONG)kmi); |
758 |
kmi->toolbar = load_toolbar (dlg, kmi); |
kmi->toolbar = load_toolbar (dlg, kmi); |
759 |
|
|
760 |
do_center_window (dlg, kmi); |
do_center_window (dlg, kmi); |
761 |
do_resize_window (dlg, kmi); |
do_resize_window (dlg, kmi); |
762 |
update_ui_items (dlg, kmi->lv); |
update_ui_items (dlg, kmi->lv); |
763 |
|
|
764 |
|
SetDlgItemText (dlg, IDC_KEYMISC_GTEXT, _("Groups")); |
765 |
|
SetForegroundWindow (dlg); |
766 |
return TRUE; |
return TRUE; |
767 |
|
|
768 |
case WM_DESTROY: |
case WM_DESTROY: |
901 |
GetCursorPos (&p); |
GetCursorPos (&p); |
902 |
hm = LoadMenu (glob_hinst, MAKEINTRESOURCE (IDR_WINPT_KEYMISC_CTX)); |
hm = LoadMenu (glob_hinst, MAKEINTRESOURCE (IDR_WINPT_KEYMISC_CTX)); |
903 |
popup = GetSubMenu (hm, 0); |
popup = GetSubMenu (hm, 0); |
904 |
#ifndef LANG_DE |
|
905 |
set_menu_text (popup, ID_KEYCTX_UID_COPY, _("Copy User ID to Clipboard")); |
set_menu_text (popup, ID_KEYCTX_UID_COPY, _("Copy User ID to Clipboard")); |
906 |
set_menu_text (popup, ID_KEYCTX_KEYID_COPY, _("Copy Key ID to Clipboard")); |
set_menu_text (popup, ID_KEYCTX_KEYID_COPY, _("Copy Key ID to Clipboard")); |
907 |
set_menu_text (popup, ID_KEYCTX_FPR_COPY, _("Copy Fingerprint to Clipboard")); |
set_menu_text (popup, ID_KEYCTX_FPR_COPY, _("Copy Fingerprint to Clipboard")); |
926 |
set_menu_text_bypos (popup, 0, _("Key Attributes")); |
set_menu_text_bypos (popup, 0, _("Key Attributes")); |
927 |
set_menu_text_bypos (popup, 6, _("Add")); |
set_menu_text_bypos (popup, 6, _("Add")); |
928 |
set_menu_text_bypos (popup, 19, _("Send to Keyserver")); |
set_menu_text_bypos (popup, 19, _("Send to Keyserver")); |
929 |
#endif |
|
930 |
|
set_menu_text (popup, ID_KEYCTX_ADDKEY, _("Key...")); |
931 |
|
set_menu_text (popup, ID_KEYCTX_ADDUID, _("User ID...")); |
932 |
|
set_menu_text (popup, ID_KEYCTX_ADDPHOTO, _("Photo ID...")); |
933 |
|
set_menu_text (popup, ID_KEYCTX_ADDREV, _("Revoker...")); |
934 |
|
|
935 |
idx = listview_get_curr_pos (kmi->lv); |
idx = listview_get_curr_pos (kmi->lv); |
936 |
if (km_check_for_seckey (kmi->lv, idx, &i)) |
if (km_check_for_seckey (kmi->lv, idx, &i)) |
937 |
set_menu_state (popup, ID_KEYCTX_SETDEFKEY, MF_ENABLED); |
set_menu_state (popup, ID_KEYCTX_SETDEFKEY, MF_ENABLED); |
992 |
|
|
993 |
case LVN_COLUMNCLICK: |
case LVN_COLUMNCLICK: |
994 |
if (notify->idFrom == IDC_KEYMISC_KEYLIST) { |
if (notify->idFrom == IDC_KEYMISC_KEYLIST) { |
995 |
NMLISTVIEW * p = (LPNMLISTVIEW) lparam; |
NMLISTVIEW * nml = (LPNMLISTVIEW) lparam; |
996 |
int sortby = 0; |
int sortby = 0; |
997 |
switch (p->iSubItem) { |
switch (nml->iSubItem) { |
998 |
case 0: sortby = KEY_SORT_USERID; break; |
case 0: sortby = KEY_SORT_USERID; break; |
999 |
case 1: sortby = KEY_SORT_KEYID; break; |
case 1: sortby = KEY_SORT_KEYID; break; |
1000 |
case 2: sortby = KEY_SORT_IS_SECRET; break; |
case 2: sortby = KEY_SORT_IS_SECRET; break; |
1040 |
|
|
1041 |
case WM_INITMENUPOPUP: |
case WM_INITMENUPOPUP: |
1042 |
if ((UINT)LOWORD (lparam) == 3) { |
if ((UINT)LOWORD (lparam) == 3) { |
1043 |
HMENU hm = (HMENU)wparam; |
HMENU m = (HMENU)wparam; |
1044 |
set_menu_text_bypos (hm, 0, _("New")); |
set_menu_text_bypos (m, 0, _("New")); |
1045 |
} |
} |
1046 |
return FALSE; |
return FALSE; |
1047 |
|
|
1104 |
} |
} |
1105 |
|
|
1106 |
{ |
{ |
1107 |
char t[128]; |
char rinf[128]; |
1108 |
listview_get_item_text( kmi->lv, idx, 5, t, sizeof t -1 ); |
listview_get_item_text (kmi->lv, idx, 5, rinf, sizeof (rinf) -1); |
1109 |
if( strchr( t, 'R' ) ) { |
if (strchr (rinf, 'R')) { |
1110 |
msg_box( dlg, _("Key already revoked!"), _("Key Manager"), MB_INFO ); |
msg_box (dlg, _("Key already revoked!"), |
1111 |
|
_("Key Manager"), MB_INFO); |
1112 |
return TRUE; |
return TRUE; |
1113 |
} |
} |
1114 |
} |
} |
1186 |
|
|
1187 |
case ID_KEYMISC_RECACHE: |
case ID_KEYMISC_RECACHE: |
1188 |
/* If there is already a reload request, don't bother the user with a message. */ |
/* If there is already a reload request, don't bother the user with a message. */ |
1189 |
if( keycache_get_reload() == 1 ) |
if (keycache_get_reload () == 1) |
1190 |
idx = IDYES; |
idx = IDYES; |
1191 |
else { |
else { |
1192 |
char t[256]; |
char inf[256]; |
1193 |
_snprintf( t, sizeof t -1, |
_snprintf (inf, sizeof (inf) -1, |
1194 |
_("This is only useful when the keyring has been " |
_("This is only useful when the keyring has been " |
1195 |
"modified (sign a key...).\n" |
"modified (sign a key...).\n" |
1196 |
"Do you really want to reload the keycache?") ); |
"Do you really want to reload the keycache?")); |
1197 |
idx = msg_box( dlg, t, _("Key Manager"), MB_YESNO ); |
idx = msg_box (dlg, inf, _("Key Manager"), MB_YESNO); |
1198 |
} |
} |
1199 |
if( idx == IDYES ) { |
if( idx == IDYES ) { |
1200 |
rcs.kr_reload = rcs.kr_update = 1; |
rcs.kr_reload = rcs.kr_update = 1; |
1251 |
return TRUE; |
return TRUE; |
1252 |
|
|
1253 |
case ID_KEYMISC_SENDRECV: |
case ID_KEYMISC_SENDRECV: |
1254 |
|
memset (&genkey, 0, sizeof (genkey)); |
1255 |
dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_KEYSERVER, dlg, |
dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_KEYSERVER, dlg, |
1256 |
keyserver_dlg_proc, 0, _("Keyserver Access"), |
keyserver_dlg_proc, (LPARAM)&genkey, |
1257 |
IDS_WINPT_KEYSERVER ); |
_("Keyserver Access"), IDS_WINPT_KEYSERVER); |
1258 |
|
if (genkey.newkey != NULL) |
1259 |
|
keylist_add_key (kmi->lv, KEYLIST_LIST, genkey.newkey); |
1260 |
return TRUE; |
return TRUE; |
1261 |
|
|
1262 |
case ID_KEYMISC_GPGPREFS: |
case ID_KEYMISC_GPGPREFS: |