Add a "View all identities" option to the view menu of Network
authorJeffrey Altman <jaltman@secure-endpoints.com>
Thu, 27 Sep 2007 03:38:54 +0000 (03:38 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Thu, 27 Sep 2007 03:38:54 +0000 (03:38 +0000)
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
src/windows/identity/ui/credwnd.h
src/windows/identity/ui/lang/en_us/khapp.rc
src/windows/identity/ui/mainwnd.c
src/windows/identity/ui/resource.h
src/windows/identity/ui/uiconfig.csv
src/windows/identity/uilib/action.c
src/windows/identity/uilib/actions.csv
src/windows/identity/uilib/khactiondef.h

index f3ace70b8ef6494fb5d84d1136f704dad87ee0ea..2f36f330e0c32090aeaa38adf2036784e7905610 100644 (file)
@@ -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:
index f47f62f6530947e459d9c5e053fca617a6504c9b..6849f9f0255084a2cedd3a91d1ace0335d8d8a1c 100644 (file)
@@ -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
index cfdbe488da81f46895862eab66025c76c5b9a637..02fa984c34aff6d941c48dd42dc48f370d7a338a 100644 (file)
@@ -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
 
 
 
+
index 91eeceaf4f48697bc91fe7be76dc35dae633e517..42fcd193c39675961f7b3b3143fb7a32545041a1 100644 (file)
@@ -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) {
index e88564e30a9357c0759f2ada1d8a13a7db5e5ecb..1a75a3cb5ca2f515252dfaaa1c96ea4be5808d54 100644 (file)
 #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
index 6fb931dfd4a58e657de877c7932a76ac323ab742..3a8006f55bb4140bd450f3752f467e4788949c74 100644 (file)
@@ -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,
index 9fd859839bc0a17c0d88342159aeca15ca2494a4..700c13b72eeed6cd21e11d2bc61ed37d1e90f6da 100644 (file)
@@ -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),
index b3f6e1f2689e5862d582009d2462685d1817d9b9..f764e92d396485c5ad1840019b871043e5938e23 100644 (file)
@@ -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
index 08dbad2ad3f1c2485dbb52bd1b53074bee3d8550..c60595360e6686571563fed60a5ca0c440c13a1a 100644 (file)
@@ -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