From 973497ea9a2f1b19520bc326bf2b36114426511f Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Thu, 27 Sep 2007 03:38:54 +0000 Subject: [PATCH] Add a "View all identities" option to the view menu of Network Identity Manager. This option will be toggled when selected. If enabled, all the known identities will be displayed in any credentials view which uses the identity of credentials as the primary group-by field. The setting of this option is persistent. ticket: 5719 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19982 dc483132-0cff-0310-8789-dd5450dbe970 --- src/windows/identity/ui/credwnd.c | 64 +++++++++++++++++++-- src/windows/identity/ui/credwnd.h | 2 + src/windows/identity/ui/lang/en_us/khapp.rc | 6 ++ src/windows/identity/ui/mainwnd.c | 5 ++ src/windows/identity/ui/resource.h | 1 + src/windows/identity/ui/uiconfig.csv | 1 + src/windows/identity/uilib/action.c | 3 +- src/windows/identity/uilib/actions.csv | 1 + src/windows/identity/uilib/khactiondef.h | 1 + 9 files changed, 77 insertions(+), 7 deletions(-) diff --git a/src/windows/identity/ui/credwnd.c b/src/windows/identity/ui/credwnd.c index f3ace70b8..2f36f330e 100644 --- a/src/windows/identity/ui/credwnd.c +++ b/src/windows/identity/ui/credwnd.c @@ -543,6 +543,11 @@ cw_load_view(khui_credwnd_tbl * tbl, wchar_t * view, HWND hwnd) { /* do nothing */ } + if (KHM_FAILED(khc_read_int32(hc_cw, L"ViewAllIdents", &tbl->view_all_idents))) + tbl->view_all_idents = 0; + + khui_check_action(KHUI_ACTION_VIEW_ALL_IDS, tbl->view_all_idents); + kmq_post_message(KMSG_ACT, KMSG_ACT_REFRESH, 0, 0); if(KHM_FAILED(khc_open_space(hc_vs, view, 0, &hc_v))) @@ -1808,6 +1813,9 @@ cw_update_outline(khui_credwnd_tbl * tbl) wchar_t ** idarray = NULL; int i; + khm_int32 and_flags = 0; + khm_int32 eq_flags = 0; + /* see if the default identity is in the list */ { khm_handle id_def = NULL; @@ -1868,8 +1876,16 @@ cw_update_outline(khui_credwnd_tbl * tbl) ; } - if (kcdb_identity_enum(KCDB_IDENT_FLAG_STICKY, - KCDB_IDENT_FLAG_STICKY, + if (tbl->view_all_idents) { + and_flags = 0; + eq_flags = 0; + } else { + and_flags = KCDB_IDENT_FLAG_STICKY; + eq_flags = KCDB_IDENT_FLAG_STICKY; + } + + if (kcdb_identity_enum(and_flags, + eq_flags, NULL, &cb_names, &n_idents) != KHM_ERROR_TOO_LONG || @@ -1884,8 +1900,8 @@ cw_update_outline(khui_credwnd_tbl * tbl) assert(idarray); #endif - if (KHM_FAILED(kcdb_identity_enum(KCDB_IDENT_FLAG_STICKY, - KCDB_IDENT_FLAG_STICKY, + if (KHM_FAILED(kcdb_identity_enum(and_flags, + eq_flags, idnames, &cb_names, &n_idents))) @@ -1899,11 +1915,20 @@ cw_update_outline(khui_credwnd_tbl * tbl) for (i=0; i < (int) n_idents; i++) { khm_handle h; + khm_int32 f_sticky; + khm_int32 flags; if (KHM_FAILED(kcdb_identity_create(idarray[i], KCDB_IDENT_FLAG_CREATE, &h))) continue; + kcdb_identity_get_flags(h, &flags); + + if (flags & KCDB_IDENT_FLAG_STICKY) + f_sticky = KHUI_CW_O_STICKY; + else + f_sticky = 0; + for (o = tbl->outline; o; o = LNEXT(o)) { if (!wcscmp(idarray[i], o->header)) break; @@ -1914,7 +1939,7 @@ cw_update_outline(khui_credwnd_tbl * tbl) if (o->start != -1) /* already visible? */ continue; o->flags &= (KHUI_CW_O_RELIDENT | KHUI_CW_O_SELECTED); - o->flags |= KHUI_CW_O_STICKY | KHUI_CW_O_VISIBLE | KHUI_CW_O_EMPTY; + o->flags |= f_sticky | KHUI_CW_O_VISIBLE | KHUI_CW_O_EMPTY; if (!kcdb_identity_is_equal(o->data, h)) { if (o->flags & KHUI_CW_O_RELIDENT) @@ -1927,7 +1952,7 @@ cw_update_outline(khui_credwnd_tbl * tbl) /* not found. create */ o = cw_new_outline_node(idarray[i]); LPUSH(&tbl->outline, o); - o->flags = KHUI_CW_O_STICKY | KHUI_CW_O_VISIBLE | KHUI_CW_O_EMPTY | KHUI_CW_O_RELIDENT; + o->flags = f_sticky | KHUI_CW_O_VISIBLE | KHUI_CW_O_EMPTY | KHUI_CW_O_RELIDENT; o->level = 0; o->col = grouping[0]; o->data = h; @@ -4361,6 +4386,8 @@ cw_wm_mouse(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) tbl->mouse_state = CW_MOUSE_WIDGET | CW_MOUSE_WSTICKY; + khm_refresh_identity_menus(); + return 0; } else if ((nm_state & CW_MOUSE_WICON) && (tbl->mouse_state & CW_MOUSE_WICON)) { @@ -4861,6 +4888,7 @@ cw_pp_ident_proc(HWND hwnd, kcdb_identity_set_flags(s->identity, flags, KCDB_IDENT_FLAG_STICKY | KCDB_IDENT_FLAG_DEFAULT); + khm_refresh_identity_menus(); return TRUE; case PSN_RESET: @@ -5299,6 +5327,30 @@ cw_wm_command(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) } break; + case KHUI_ACTION_VIEW_ALL_IDS: + { + khm_handle hc_cw = NULL; + + tbl->view_all_idents = !tbl->view_all_idents; + + cw_update_outline(tbl); + cw_update_extents(tbl, TRUE); + cw_update_selection_state(tbl); + + InvalidateRect(tbl->hwnd, NULL, TRUE); + + if(KHM_SUCCEEDED(khc_open_space(NULL, L"CredWindow", KHM_PERM_READ | KHM_PERM_WRITE, + &hc_cw))) { + khc_write_int32(hc_cw, L"ViewAllIdents", tbl->view_all_idents); + khc_close_space(hc_cw); + } + + khui_check_action(KHUI_ACTION_VIEW_ALL_IDS, tbl->view_all_idents); + + khm_refresh_identity_menus(); + } + break; + case KHUI_PACTION_UP: case KHUI_PACTION_UP_EXTEND: case KHUI_PACTION_UP_TOGGLE: diff --git a/src/windows/identity/ui/credwnd.h b/src/windows/identity/ui/credwnd.h index f47f62f65..6849f9f02 100644 --- a/src/windows/identity/ui/credwnd.h +++ b/src/windows/identity/ui/credwnd.h @@ -237,6 +237,8 @@ typedef struct khui_credwnd_tbl_t { khm_size n_idents; khm_size nc_idents; + khm_int32 view_all_idents; + } khui_credwnd_tbl; #define KHUI_MAXCB_HEADING 256 diff --git a/src/windows/identity/ui/lang/en_us/khapp.rc b/src/windows/identity/ui/lang/en_us/khapp.rc index cfdbe488d..02fa984c3 100644 --- a/src/windows/identity/ui/lang/en_us/khapp.rc +++ b/src/windows/identity/ui/lang/en_us/khapp.rc @@ -839,6 +839,11 @@ BEGIN IDS_CW_EXPIRED "(Expired)" END +STRINGTABLE +BEGIN + IDS_ACTION_VIEW_ALL_IDS "All identities" +END + #endif // English (U.S.) resources ///////////////////////////////////////////////////////////////////////////// @@ -856,3 +861,4 @@ END + diff --git a/src/windows/identity/ui/mainwnd.c b/src/windows/identity/ui/mainwnd.c index 91eeceaf4..42fcd193c 100644 --- a/src/windows/identity/ui/mainwnd.c +++ b/src/windows/identity/ui/mainwnd.c @@ -407,6 +407,11 @@ khm_main_wnd_proc(HWND hwnd, return 0; /* layout control */ + + case KHUI_ACTION_VIEW_ALL_IDS: + return SendMessage(khm_hwnd_main_cred, uMsg, + wParam, lParam); + case KHUI_ACTION_LAYOUT_MINI: if (khm_main_wnd_mode == KHM_MAIN_WND_MINI) { diff --git a/src/windows/identity/ui/resource.h b/src/windows/identity/ui/resource.h index e88564e30..1a75a3cb5 100644 --- a/src/windows/identity/ui/resource.h +++ b/src/windows/identity/ui/resource.h @@ -311,6 +311,7 @@ #define IDS_CW_TYPEF 316 #define IDS_CW_EXPIREF 317 #define IDS_CW_EXPIRED 318 +#define IDS_ACTION_VIEW_ALL_IDS 321 #define IDC_NC_CREDTEXT_LABEL 1009 #define IDC_NC_CREDTEXT 1012 #define IDC_NC_HELP 1017 diff --git a/src/windows/identity/ui/uiconfig.csv b/src/windows/identity/ui/uiconfig.csv index 6fb931dfd..3a8006f55 100644 --- a/src/windows/identity/ui/uiconfig.csv +++ b/src/windows/identity/ui/uiconfig.csv @@ -32,6 +32,7 @@ CredWindow,KC_SPACE,0,"Options for the credentials window as well as the Network NotificationAction,KC_INT32,50025,Action to perform when the user clicks on the notification icon. DefaultWindowMode,KC_INT32,1,(0-normal; 1-mini) DefaultTheme,KC_STRING,Default,Default theme. The name should correspond to a subspace in Themes + ViewAllIdents,KC_INT32,0,"Boolean. Try to display all known identities if non-zero." Windows,KC_SPACE,0,Window parameters _Schema,KC_SPACE,0,Schema Width,KC_INT32,0, diff --git a/src/windows/identity/uilib/action.c b/src/windows/identity/uilib/action.c index 9fd859839..700c13b72 100644 --- a/src/windows/identity/uilib/action.c +++ b/src/windows/identity/uilib/action.c @@ -83,8 +83,9 @@ khui_action_ref khui_menu_toolbars[] = { khui_action_ref khui_menu_view[] = { MENU_ACTION(KHUI_ACTION_LAYOUT_MINI), - MENU_SUBMENU(KHUI_MENU_COLUMNS), MENU_SUBMENU(KHUI_MENU_LAYOUT), + MENU_ACTION(KHUI_ACTION_VIEW_ALL_IDS), + MENU_SUBMENU(KHUI_MENU_COLUMNS), #if 0 /* not implemented yet */ MENU_SUBMENU(KHUI_MENU_TOOLBARS), diff --git a/src/windows/identity/uilib/actions.csv b/src/windows/identity/uilib/actions.csv index b3f6e1f26..f764e92d3 100644 --- a/src/windows/identity/uilib/actions.csv +++ b/src/windows/identity/uilib/actions.csv @@ -23,6 +23,7 @@ KHUI_ACTION_LAYOUT_LOC,KHUI_ACTIONTYPE_TRIGGER | KHUI_ACTIONTYPE_TOGGLE,,0,0,0,0 KHUI_ACTION_LAYOUT_CUST,KHUI_ACTIONTYPE_TRIGGER | KHUI_ACTIONTYPE_TOGGLE,,0,0,0,0,0,IDS_ACTION_LAYOUT_CUST,0,0,0 KHUI_ACTION_LAYOUT_MINI,KHUI_ACTIONTYPE_TRIGGER | KHUI_ACTIONTYPE_TOGGLE,,0,0,0,0,0,IDS_ACTION_LAYOUT_MINI,0,0,0 KHUI_ACTION_TB_STANDARD,KHUI_ACTIONTYPE_TRIGGER | KHUI_ACTIONTYPE_TOGGLE,,0,0,0,0,0,IDS_ACTION_TB_STANDARD,0,0,KHUI_ACTIONSTATE_CHECKED|KHUI_ACTIONSTATE_DISABLED +KHUI_ACTION_VIEW_ALL_IDS,KHUI_ACTIONTYPE_TRIGGER | KHUI_ACTIONTYPE_TOGGLE,,0,0,0,0,0,IDS_ACTION_VIEW_ALL_IDS,0,0,0 KHUI_ACTION_DEBUG_WINDOW,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_DEBUG_WINDOW,0,IDH_ACTION_DEBUG_WINDOW,KHUI_ACTIONSTATE_DISABLED KHUI_ACTION_VIEW_REFRESH,KHUI_ACTIONTYPE_TRIGGER,,IDB_VW_REFRESH,0,0,IDB_VW_REFRESH_SM,0,IDS_ACTION_VIEW_REFRESH,IDS_ACTIONT_VIEW_REFRESH,IDH_ACTION_VIEW_REFRESH,0 KHUI_ACTION_OPT_IDENTS,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_OPT_IDENTS,IDS_ACTIONT_OPT_IDENTS,IDH_ACTION_OPT_INIT,0 diff --git a/src/windows/identity/uilib/khactiondef.h b/src/windows/identity/uilib/khactiondef.h index 08dbad2ad..c60595360 100644 --- a/src/windows/identity/uilib/khactiondef.h +++ b/src/windows/identity/uilib/khactiondef.h @@ -70,6 +70,7 @@ #define KHUI_ACTION_DESTROY_ALL (KHUI_ACTION_BASE + 34) #define KHUI_ACTION_UICB (KHUI_ACTION_BASE + 35) #define KHUI_ACTION_LAYOUT_MINI (KHUI_ACTION_BASE + 36) +#define KHUI_ACTION_VIEW_ALL_IDS (KHUI_ACTION_BASE + 37) /*@}*/ /*! \name Pseudo actions -- 2.26.2