pull up r19983 from trunk
authorTom Yu <tlyu@mit.edu>
Mon, 1 Oct 2007 23:14:34 +0000 (23:14 +0000)
committerTom Yu <tlyu@mit.edu>
Mon, 1 Oct 2007 23:14:34 +0000 (23:14 +0000)
 r19983@cathode-dark-space:  jaltman | 2007-09-26 23:42:20 -0400
 ticket: 5724

 Add a "Set default" sub menu to the Network Identity Manager
 notification icon context menu.  The submenu will display a list of
 identities that the user can select as the default identity.

 Each identity that is displayed in the sub menu will be colored the
 same way it is colored in the basic view to provide a hint as to the
 state of the credentials belonging to the identity.

ticket: 5724
version_fixed: 1.6.3

git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-6@20053 dc483132-0cff-0310-8789-dd5450dbe970

12 files changed:
src/windows/identity/ui/credfuncs.c
src/windows/identity/ui/credfuncs.h
src/windows/identity/ui/credwnd.c
src/windows/identity/ui/credwnd.h
src/windows/identity/ui/images/enabled.ico
src/windows/identity/ui/lang/en_us/khapp.rc
src/windows/identity/ui/mainmenu.c
src/windows/identity/ui/resource.h
src/windows/identity/uilib/action.c
src/windows/identity/uilib/actions.csv
src/windows/identity/uilib/intaction.h
src/windows/identity/uilib/khactiondef.h

index b90d9a60d9558beb78867d77de661df6fe3b30b7..c8b6727b8aff00020738efdd883368c9a4f8c414 100644 (file)
@@ -555,6 +555,11 @@ void khm_cred_set_default(void)
     khui_context_release(&ctx);
 }
 
+void khm_cred_set_default_identity(khm_handle identity)
+{
+    kcdb_identity_set_default(identity);
+}
+
 void khm_cred_destroy_creds(khm_boolean sync, khm_boolean quiet)
 {
     khui_action_context * pctx;
index 0a4e2531a6d36af8c58a75fb54ac3eb8707273c0..9bc2890896f5f61b31ba8389e288c0103ffb0af9 100644 (file)
@@ -59,6 +59,8 @@ khm_cred_obtain_new_creds_for_ident(khm_handle ident, wchar_t * title);
 void 
 khm_cred_set_default(void);
 
+void khm_cred_set_default_identity(khm_handle identity);
+
 void 
 khm_cred_change_password(wchar_t * window_title);
 
index 2f36f330e0c32090aeaa38adf2036784e7905610..1148a9b779af783fee4caeff2ba84c15af52604d 100644 (file)
@@ -5714,6 +5714,136 @@ khm_credwnd_proc(HWND hwnd,
     return DefWindowProc(hwnd,uMsg,wParam,lParam);
 }
 
+void
+khm_measure_identity_menu_item(HWND hwnd, LPMEASUREITEMSTRUCT lpm, khui_action * act)
+{
+    wchar_t * cap;
+    HDC hdc;
+    SIZE sz;
+    size_t len;
+    HFONT hf_old;
+
+    sz.cx = MENU_SIZE_ICON_X;
+    sz.cy = MENU_SIZE_ICON_Y;
+
+    cap = act->caption;
+#ifdef DEBUG
+    assert(cap);
+#endif
+    hdc = GetDC(khm_hwnd_main);
+#ifdef DEBUG
+    assert(hdc);
+#endif
+
+    StringCchLength(cap, KHUI_MAXCCH_NAME, &len);
+
+    hf_old = SelectFont(hdc, (HFONT) GetStockObject(DEFAULT_GUI_FONT));
+
+    GetTextExtentPoint32(hdc, cap, (int) len, &sz);
+
+    SelectFont(hdc, hf_old);
+
+    ReleaseDC(khm_hwnd_main, hdc);
+
+    lpm->itemWidth = sz.cx + sz.cy * 3 / 2 + GetSystemMetrics(SM_CXSMICON);
+    lpm->itemHeight = sz.cy * 3 / 2;
+}
+
+void
+khm_draw_identity_menu_item(HWND hwnd, LPDRAWITEMSTRUCT lpd, khui_action * act)
+{
+    khui_credwnd_tbl * tbl;
+    khm_handle ident;
+    khm_size i;
+    size_t count = 0;
+    COLORREF old_clr;
+    wchar_t * cap;
+    size_t len;
+    int margin;
+    SIZE sz;
+    HBRUSH hbr;
+    COLORREF text_clr;
+    khm_int32 idflags;
+    khm_int32 expflags;
+
+    tbl = (khui_credwnd_tbl *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);
+    if (tbl == NULL)
+        return;
+
+    ident = act->data;
+    cap = act->caption;
+#ifdef DEBUG
+    assert(ident != NULL);
+    assert(cap != NULL);
+#endif
+
+    for (i=0; i < tbl->n_idents; i++) {
+        if (kcdb_identity_is_equal(tbl->idents[i].ident, ident)) {
+            count = tbl->idents[i].credcount;
+            break;
+        }
+    }
+
+    expflags = cw_get_buf_exp_flags(tbl, ident);
+
+    text_clr = tbl->cr_hdr_normal;
+
+    if (lpd->itemState & (ODS_HOTLIGHT | ODS_SELECTED)) {
+        hbr = GetSysColorBrush(COLOR_HIGHLIGHT);
+        text_clr = GetSysColor(COLOR_HIGHLIGHTTEXT);
+    } else if (count == 0) {
+        hbr = tbl->hb_hdr_bg;
+    } else if (expflags == CW_EXPSTATE_EXPIRED) {
+        hbr = tbl->hb_hdr_bg_exp;
+    } else if (expflags == CW_EXPSTATE_WARN) {
+        hbr = tbl->hb_hdr_bg_warn;
+    } else if (expflags == CW_EXPSTATE_CRITICAL) {
+        hbr = tbl->hb_hdr_bg_crit;
+    } else {
+        hbr = tbl->hb_hdr_bg_cred;
+    }
+
+    FillRect(lpd->hDC, &lpd->rcItem, hbr);
+
+    SetBkMode(lpd->hDC, TRANSPARENT);
+
+    old_clr = SetTextColor(lpd->hDC, text_clr);
+
+    StringCchLength(cap, KHUI_MAXCCH_NAME, &len);
+
+    GetTextExtentPoint32(lpd->hDC, cap, (int) len, &sz);
+    margin = sz.cy / 4;
+
+    TextOut(lpd->hDC, lpd->rcItem.left + margin * 2 + GetSystemMetrics(SM_CXSMICON),
+            lpd->rcItem.top + margin, cap, (int) len);
+
+    SetTextColor(lpd->hDC, old_clr);
+
+    kcdb_identity_get_flags(ident, &idflags);
+
+    if (idflags & KCDB_IDENT_FLAG_DEFAULT) {
+        HICON hic;
+
+        hic = (HICON) LoadImage(khm_hInstance, MAKEINTRESOURCE(IDI_ENABLED),
+                                IMAGE_ICON,
+                                GetSystemMetrics(SM_CXSMICON),
+                                GetSystemMetrics(SM_CYSMICON),
+                                LR_DEFAULTCOLOR);
+        if (hic) {
+            DrawIconEx(lpd->hDC,
+                       lpd->rcItem.left + margin,
+                       lpd->rcItem.top + margin,
+                       hic,
+                       GetSystemMetrics(SM_CXSMICON),
+                       GetSystemMetrics(SM_CYSMICON),
+                       0,
+                       hbr,
+                       DI_NORMAL);
+            DestroyIcon(hic);
+        }
+    }
+}
+
 void 
 khm_register_credwnd_class(void) {
     WNDCLASSEX wcx;
index 6849f9f0255084a2cedd3a91d1ace0335d8d8a1c..7f9071014499fdbc5c77b992b6bf9bd7f0ac0da7 100644 (file)
@@ -299,4 +299,8 @@ void    khm_get_cw_element_font(HDC hdc, wchar_t * name, BOOL use_default,
 
 void    khm_set_cw_element_font(wchar_t * name, LOGFONT * pfont);
 
+void    khm_draw_identity_menu_item(HWND hwnd, LPDRAWITEMSTRUCT lpd, khui_action * act);
+
+void    khm_measure_identity_menu_item(HWND hwnd, LPMEASUREITEMSTRUCT lpm, khui_action * act);
+
 #endif
index 22821a8b78a4e279660ef206e3b920dc4946d893..fc83ad85844df78657b89c0f1a89df059cd8704d 100644 (file)
Binary files a/src/windows/identity/ui/images/enabled.ico and b/src/windows/identity/ui/images/enabled.ico differ
index 02fa984c34aff6d941c48dd42dc48f370d7a338a..4dc9f733b05d37e131d7b6fe30ee59217bd47817 100644 (file)
@@ -714,6 +714,7 @@ BEGIN
     IDS_WTPOST_PASSWORD     " - Changing password"
     IDS_CTX_PROC_PASSWORD   "Changing password for %1!s!"
     IDS_NC_PWD_FAILED_TITLE "Failed to change password"
+    IDS_MENU_SETDEF         "Set default"
     IDS_PACTION_NEXT        "Next alert"
     IDS_ERR_TITLE_NO_IDENTPRO "Cannot proceed without identity provider"
 END
@@ -837,10 +838,12 @@ BEGIN
     IDS_CW_TYPEF            "(%s)"
     IDS_CW_EXPIREF          "Expires in %s"
     IDS_CW_EXPIRED          "(Expired)"
+    IDS_IDACTIONT_SETDEF    "Set %s as default identity"
 END
 
 STRINGTABLE 
 BEGIN
+    IDS_IDACTION_SETDEF     "%s"
     IDS_ACTION_VIEW_ALL_IDS "All identities"
 END
 
@@ -862,3 +865,4 @@ END
 
 
 
+
index 7ae6e33f1a9a83e7b3f06563e648da20e7933576..8645dc7bc64f821fbc7f7557e4b1ba889f438af5 100644 (file)
@@ -139,19 +139,27 @@ void add_action_to_menu(HMENU hm, khui_action * act,
     } else {
         khui_menu_def * def;
 
-        khm_get_action_caption(act->cmd, buf, sizeof(buf));
+        if (act->type == KHUI_ACTIONTYPE_IDENTITY) {
+            mii.fMask = MIIM_FTYPE | MIIM_ID | MIIM_DATA;
+            mii.fType = MFT_OWNERDRAW;
 
-        if(khui_get_cmd_accel_string(act->cmd, accel, 
-                                     ARRAYLENGTH(accel))) {
-            StringCbCat(buf, sizeof(buf), L"\t");
-            StringCbCat(buf, sizeof(buf), accel);
-        }
+            mii.dwTypeData = 0;
+            mii.dwItemData = 0;
+        } else {
+            khm_get_action_caption(act->cmd, buf, sizeof(buf));
 
-        mii.fMask = MIIM_FTYPE | MIIM_STRING | MIIM_ID;
-        mii.fType = MFT_STRING;
+            if(khui_get_cmd_accel_string(act->cmd, accel, 
+                                         ARRAYLENGTH(accel))) {
+                StringCbCat(buf, sizeof(buf), L"\t");
+                StringCbCat(buf, sizeof(buf), accel);
+            }
 
-        mii.dwTypeData = buf;
-        mii.cch = (int) wcslen(buf);
+            mii.fMask = MIIM_FTYPE | MIIM_STRING | MIIM_ID;
+            mii.fType = MFT_STRING;
+
+            mii.dwTypeData = buf;
+            mii.cch = (int) wcslen(buf);
+        }
 
         mii.wID = act->cmd;
 
@@ -391,48 +399,61 @@ LRESULT khm_menu_activate(int menu_id) {
 }
 
 LRESULT khm_menu_measure_item(WPARAM wParam, LPARAM lParam) {
-    /* all menu icons have a fixed size */
     LPMEASUREITEMSTRUCT lpm = (LPMEASUREITEMSTRUCT) lParam;
-    lpm->itemWidth = MENU_SIZE_ICON_X;
-    lpm->itemHeight = MENU_SIZE_ICON_Y;
+    khui_action * act;
+
+    act = khui_find_action(lpm->itemID);
+    if (act && act->type == KHUI_ACTIONTYPE_IDENTITY) {
+        khm_measure_identity_menu_item(khm_hwnd_main_cred, lpm, act);
+    } else {
+        lpm->itemWidth = MENU_SIZE_ICON_X;
+        lpm->itemHeight = MENU_SIZE_ICON_Y;
+    }
     return TRUE;
 }
 
 LRESULT khm_menu_draw_item(WPARAM wParam, LPARAM lParam) {
     LPDRAWITEMSTRUCT lpd;
     khui_action * act;
-    int resid;
-    int iidx;
-    UINT style;
 
     lpd = (LPDRAWITEMSTRUCT) lParam;
     act = khui_find_action(lpd->itemID);
 
-    resid = 0;
-    if((lpd->itemState & ODS_DISABLED) || (lpd->itemState & ODS_GRAYED)) {
-        resid = act->ib_icon_dis;
-    }
-    if(!resid)
-        resid = act->ib_icon;
+    if (act && act->type == KHUI_ACTIONTYPE_IDENTITY) {
 
-    if(!resid) /* nothing to draw */
-        return TRUE;
+        khm_draw_identity_menu_item(khm_hwnd_main_cred, lpd, act);
+
+    } else {
+        int resid;
+        int iidx;
+        UINT style;
+
+        resid = 0;
+        if((lpd->itemState & ODS_DISABLED) || (lpd->itemState & ODS_GRAYED)) {
+            resid = act->ib_icon_dis;
+        }
+        if(!resid)
+            resid = act->ib_icon;
+
+        if(!resid) /* nothing to draw */
+            return TRUE;
 
     
-    iidx = khui_get_icon_index(resid);
-    if(iidx == -1)
-        return TRUE;
+        iidx = khui_get_icon_index(resid);
+        if(iidx == -1)
+            return TRUE;
 
 
-    style = ILD_TRANSPARENT;
-    if(lpd->itemState & ODS_HOTLIGHT || lpd->itemState & ODS_SELECTED) {
-        style |= ILD_SELECTED;
-    }
+        style = ILD_TRANSPARENT;
+        if(lpd->itemState & ODS_HOTLIGHT || lpd->itemState & ODS_SELECTED) {
+            style |= ILD_SELECTED;
+        }
     
-    khui_ilist_draw(il_icon, 
-                    iidx, 
-                    lpd->hDC, 
-                    lpd->rcItem.left, lpd->rcItem.top, style);
+        khui_ilist_draw(il_icon, 
+                        iidx, 
+                        lpd->hDC, 
+                        lpd->rcItem.left, lpd->rcItem.top, style);
+    }
 
     return TRUE;
 }
@@ -636,6 +657,7 @@ struct identity_action_map {
     khm_int32  renew_cmd;
     khm_int32  destroy_cmd;
     khm_int32  new_cmd;
+    khm_int32  setdef_cmd;
     int        refreshcycle;
 };
 
@@ -727,6 +749,19 @@ create_identity_cmd_map(khm_handle ident) {
         khui_action_create(actionname, caption, tooltip, NULL,
                            KHUI_ACTIONTYPE_TRIGGER, NULL);
 
+    /* set default */
+    GETFORMAT(IDS_IDACTIONT_SETDEF);
+    EXPFORMAT(tooltip, idname);
+
+    GETFORMAT(IDS_IDACTION_SETDEF);
+    EXPFORMAT(caption, idname);
+
+    StringCbPrintf(actionname, sizeof(actionname), L"E:%s", idname);
+
+    actmap->setdef_cmd =
+        khui_action_create(actionname, caption, tooltip, ident,
+                           KHUI_ACTIONTYPE_IDENTITY, NULL);
+
     actmap->refreshcycle = idcmd_refreshcycle;
 
 #undef GETFORMAT
@@ -749,9 +784,13 @@ purge_identity_cmd_map(void) {
 
             khui_action_delete(id_action_map[i].renew_cmd);
             khui_action_delete(id_action_map[i].destroy_cmd);
+            khui_action_delete(id_action_map[i].new_cmd);
+            khui_action_delete(id_action_map[i].setdef_cmd);
 
             id_action_map[i].renew_cmd = 0;
             id_action_map[i].destroy_cmd = 0;
+            id_action_map[i].new_cmd = 0;
+            id_action_map[i].setdef_cmd = 0;
         }
     }
 }
@@ -798,6 +837,18 @@ khm_get_identity_destroy_action(khm_handle ident) {
         return 0;
 }
 
+khm_int32
+khm_get_identity_setdef_action(khm_handle ident) {
+    struct identity_action_map * map;
+
+    map = get_identity_cmd_map(ident);
+
+    if (map)
+        return map->setdef_cmd;
+    else
+        return 0;
+}
+
 khm_int32
 khm_get_identity_new_creds_action(khm_handle ident) {
     struct identity_action_map * map;
@@ -814,6 +865,7 @@ void
 khm_refresh_identity_menus(void) {
     khui_menu_def * renew_def = NULL;
     khui_menu_def * dest_def = NULL;
+    khui_menu_def * setdef_def = NULL;
     wchar_t * idlist = NULL;
     wchar_t * idname = NULL;
     khm_size cb = 0;
@@ -823,10 +875,14 @@ khm_refresh_identity_menus(void) {
     khm_handle csp_cw = NULL;
     khm_int32 idflags;
     khm_int32 def_sticky = 0;
+    khm_int32 all_identities = 0;
     khm_boolean sticky_done = FALSE;
+    khm_boolean added_dest = FALSE;
+    khm_boolean added_setdef = FALSE;
 
     if (KHM_SUCCEEDED(khc_open_space(NULL, L"CredWindow", 0, &csp_cw))) {
         khc_read_int32(csp_cw, L"DefaultSticky", &def_sticky);
+        khc_read_int32(csp_cw, L"ViewAllIdents", &all_identities);
         khc_close_space(csp_cw);
         csp_cw = NULL;
     }
@@ -843,7 +899,7 @@ khm_refresh_identity_menus(void) {
         idlist = NULL;
         cb = 0;
 
-        rv = kcdb_identity_enum(KCDB_IDENT_FLAG_ACTIVE | KCDB_IDENT_FLAG_EMPTY,
+        rv = kcdb_identity_enum(KCDB_IDENT_FLAG_ACTIVE,
                                 KCDB_IDENT_FLAG_ACTIVE,
                                 NULL,
                                 &cb,
@@ -856,7 +912,7 @@ khm_refresh_identity_menus(void) {
         assert(idlist);
 #endif
 
-        rv = kcdb_identity_enum(KCDB_IDENT_FLAG_ACTIVE | KCDB_IDENT_FLAG_EMPTY,
+        rv = kcdb_identity_enum(KCDB_IDENT_FLAG_ACTIVE,
                                 KCDB_IDENT_FLAG_ACTIVE,
                                 idlist,
                                 &cb,
@@ -874,23 +930,13 @@ khm_refresh_identity_menus(void) {
 
     } while(TRUE);
 
-    if (idlist != NULL && n_idents > 0) {
-        khui_enable_action(KHUI_MENU_RENEW_CRED, TRUE);
-        khui_enable_action(KHUI_MENU_DESTROY_CRED, TRUE);
-        khui_enable_action(KHUI_ACTION_RENEW_CRED, TRUE);
-        khui_enable_action(KHUI_ACTION_DESTROY_CRED, TRUE);
-    } else {
-        khui_enable_action(KHUI_MENU_RENEW_CRED, FALSE);
-        khui_enable_action(KHUI_MENU_DESTROY_CRED, FALSE);
-        khui_enable_action(KHUI_ACTION_RENEW_CRED, FALSE);
-        khui_enable_action(KHUI_ACTION_DESTROY_CRED, FALSE);
-    }
-
     renew_def = khui_find_menu(KHUI_MENU_RENEW_CRED);
     dest_def = khui_find_menu(KHUI_MENU_DESTROY_CRED);
+    setdef_def = khui_find_menu(KHUI_MENU_SETDEF);
 #ifdef DEBUG
     assert(renew_def);
     assert(dest_def);
+    assert(setdef_def);
 #endif
 
     t = khui_menu_get_size(renew_def);
@@ -905,6 +951,12 @@ khm_refresh_identity_menus(void) {
         t--;
     }
 
+    t = khui_menu_get_size(setdef_def);
+    while(t) {
+        khui_menu_remove_action(setdef_def, 0);
+        t--;
+    }
+
     if (idlist != NULL && n_idents > 1) {
         khui_menu_insert_action(renew_def, 0, KHUI_ACTION_RENEW_ALL, 0);
         khui_menu_insert_action(renew_def, 1, KHUI_MENU_SEP, 0);
@@ -924,14 +976,6 @@ khm_refresh_identity_menus(void) {
             continue;
         }
 
-        khui_menu_insert_action(renew_def, 1000,
-                                khm_get_identity_renew_action(identity),
-                                0);
-
-        khui_menu_insert_action(dest_def, 1000,
-                                khm_get_identity_destroy_action(identity),
-                                0);
-
         idflags = 0;
         kcdb_identity_get_flags(identity, &idflags);
 
@@ -939,12 +983,56 @@ khm_refresh_identity_menus(void) {
             kcdb_identity_set_flags(identity,
                                     KCDB_IDENT_FLAG_STICKY,
                                     KCDB_IDENT_FLAG_STICKY);
+            idflags |= KCDB_IDENT_FLAG_STICKY;
             sticky_done = TRUE;
         }
+
+        if (!(idflags & KCDB_IDENT_FLAG_EMPTY)) {
+            khui_menu_insert_action(renew_def, 1000,
+                                    khm_get_identity_renew_action(identity),
+                                    0);
+
+            khui_menu_insert_action(dest_def, 1000,
+                                    khm_get_identity_destroy_action(identity),
+                                    0);
+            added_dest = TRUE;
+        }
+
+        if (all_identities ||
+            !(idflags & KCDB_IDENT_FLAG_EMPTY) ||
+            (idflags & KCDB_IDENT_FLAG_STICKY)) {
+
+            khui_menu_insert_action(setdef_def, 1000,
+                                    khm_get_identity_setdef_action(identity),
+                                    0);
+            added_setdef = TRUE;
+        }
+
+        kcdb_identity_release(identity);
     }
 
-    if (idlist)
+    if (idlist) {
         PFREE(idlist);
+        idlist = NULL;
+    }
+
+    if (added_dest) {
+        khui_enable_action(KHUI_MENU_RENEW_CRED, TRUE);
+        khui_enable_action(KHUI_MENU_DESTROY_CRED, TRUE);
+        khui_enable_action(KHUI_ACTION_RENEW_CRED, TRUE);
+        khui_enable_action(KHUI_ACTION_DESTROY_CRED, TRUE);
+    } else {
+        khui_enable_action(KHUI_MENU_RENEW_CRED, FALSE);
+        khui_enable_action(KHUI_MENU_DESTROY_CRED, FALSE);
+        khui_enable_action(KHUI_ACTION_RENEW_CRED, FALSE);
+        khui_enable_action(KHUI_ACTION_DESTROY_CRED, FALSE);
+    }
+
+    if (added_setdef) {
+        khui_enable_action(KHUI_MENU_SETDEF, TRUE);
+    } else {
+        khui_enable_action(KHUI_MENU_SETDEF, FALSE);
+    }
 
     purge_identity_cmd_map();
 
@@ -1002,6 +1090,12 @@ khm_check_identity_menu_action(khm_int32 act_id) {
                                                     NULL);
                 return TRUE;
             }
+
+            if (id_action_map[i].setdef_cmd == act_id) {
+                khm_cred_set_default_identity(id_action_map[i].identity);
+
+                return TRUE;
+            }
         }
     }
 
index 1a75a3cb5ca2f515252dfaaa1c96ea4be5808d54..19cd49de6e53edba0ad5e8716dc7abbf68549d03 100644 (file)
 #define IDS_WTPOST_PASSWORD             218
 #define IDS_CTX_PROC_PASSWORD           219
 #define IDS_NC_PWD_FAILED_TITLE         220
+#define IDS_MENU_SETDEF                 221
 #define IDS_PACTION_NEXT                222
 #define IDS_ERR_TITLE_NO_IDENTPRO       223
 #define IDS_ERR_MSG_NO_IDENTPRO         224
 #define IDS_CW_TYPEF                    316
 #define IDS_CW_EXPIREF                  317
 #define IDS_CW_EXPIRED                  318
+#define IDS_IDACTIONT_SETDEF            319
+#define IDS_IDACTION_SETDEF             320
 #define IDS_ACTION_VIEW_ALL_IDS         321
 #define IDC_NC_CREDTEXT_LABEL           1009
 #define IDC_NC_CREDTEXT                 1012
index 700c13b72eeed6cd21e11d2bc61ed37d1e90f6da..a47683171bbe04132d2e141245438def0d13604d 100644 (file)
@@ -162,6 +162,8 @@ khui_action_ref khui_menu_ico_ctx_min[] = {
     MENU_ACTION(KHUI_ACTION_IMPORT),
     MENU_SUBMENU(KHUI_MENU_DESTROY_CRED),
     MENU_SEP(),
+    MENU_SUBMENU(KHUI_MENU_SETDEF),
+    MENU_SEP(),
     MENU_ACTION(KHUI_ACTION_PASSWD_ID),
     MENU_SEP(),
     MENU_ACTION(KHUI_ACTION_HELP_CTX),
@@ -179,6 +181,8 @@ khui_action_ref khui_menu_ico_ctx_normal[] = {
     MENU_ACTION(KHUI_ACTION_IMPORT),
     MENU_SUBMENU(KHUI_MENU_DESTROY_CRED),
     MENU_SEP(),
+    MENU_SUBMENU(KHUI_MENU_SETDEF),
+    MENU_SEP(),
     MENU_ACTION(KHUI_ACTION_PASSWD_ID),
     MENU_SEP(),
     MENU_ACTION(KHUI_ACTION_HELP_CTX),
@@ -208,6 +212,10 @@ khui_action_ref khui_menu_renew_cred[] = {
     MENU_END()
 };
 
+khui_action_ref khui_menu_setdef[] = {
+    MENU_END()
+};
+
 khui_action_ref khui_pmenu_tok_sel[] = {
     MENU_ACTION(KHUI_ACTION_RENEW_CRED),
     MENU_ACTION(KHUI_ACTION_DESTROY_CRED),
@@ -233,6 +241,7 @@ khui_menu_def khui_all_menus[] = {
     CONSTMENU(KHUI_MENU_COLUMNS, KHUI_MENUSTATE_CONSTANT | KHUI_MENUSTATE_SYSTEM, khui_menu_columns),
     CONSTMENU(KHUI_MENU_RENEW_CRED, KHUI_MENUSTATE_CONSTANT | KHUI_MENUSTATE_SYSTEM, khui_menu_renew_cred),
     CONSTMENU(KHUI_MENU_DESTROY_CRED, KHUI_MENUSTATE_CONSTANT | KHUI_MENUSTATE_SYSTEM, khui_menu_destroy_cred),
+    CONSTMENU(KHUI_MENU_SETDEF, KHUI_MENUSTATE_CONSTANT | KHUI_MENUSTATE_SYSTEM, khui_menu_setdef),
 
     /* toolbars */
     CONSTMENU(KHUI_TOOLBAR_STANDARD, KHUI_MENUSTATE_CONSTANT | KHUI_MENUSTATE_SYSTEM, khui_toolbar_standard),
@@ -307,7 +316,8 @@ khui_action_create(const wchar_t * name,
         !caption ||
         FAILED(StringCchLength(caption, KHUI_MAXCCH_SHORT_DESC, &s)) ||
         (tooltip && FAILED(StringCchLength(tooltip, KHUI_MAXCCH_SHORT_DESC, &s))) ||
-        (type != KHUI_ACTIONTYPE_TRIGGER && type != KHUI_ACTIONTYPE_TOGGLE)) {
+        (type != KHUI_ACTIONTYPE_TRIGGER && type != KHUI_ACTIONTYPE_TOGGLE &&
+         type != KHUI_ACTIONTYPE_IDENTITY)) {
         return 0;
     }
 
index f764e92d396485c5ad1840019b871043e5938e23..dc6286bf262393682106f2233fab14113ce69ff3 100644 (file)
@@ -9,6 +9,7 @@ KHUI_MENU_TOOLBARS,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_MENU_TOOLBARS,0,0,0
 KHUI_MENU_COLUMNS,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_CHOOSE_COLS,0,IDH_ACTION_CHOOSE_COLS,0
 KHUI_MENU_DESTROY_CRED,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_MENU_DESTROY_CRED,0,0,0
 KHUI_MENU_RENEW_CRED,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_MENU_RENEW_CRED,0,0,0
+KHUI_MENU_SETDEF,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_MENU_SETDEF,0,0,0
 KHUI_ACTION_PROPERTIES,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_PROPERTIES,IDS_ACTIONT_PROPERTIES,IDH_ACTION_PROPERTIES,0
 KHUI_ACTION_EXIT,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_EXIT,IDS_ACTIONT_EXIT,IDH_ACTION_EXIT,0
 KHUI_ACTION_SET_DEF_ID,KHUI_ACTIONTYPE_TRIGGER | KHUI_ACTIONTYPE_TOGGLE,,0,0,0,0,0,IDS_ACTION_SET_DEF_ID,IDS_ACTIONT_SET_DEF_ID,IDH_ACTION_SET_DEF_ID,0
index 2b7aa973a3bb18b0a07d2adab175b04af0e5c04d..5753a56de08646d04d2b594aff5ad9406bec14be 100644 (file)
@@ -103,6 +103,10 @@ typedef struct tag_khui_action {
                                   KHUI_ACTIONSTATE_* */
 } khui_action;
 
+
+#define KHUI_ACTIONTYPE_IDENTITY 0x00010000
+
+
 /*@}*/
 
 #endif
index c60595360e6686571563fed60a5ca0c440c13a1a..33d8347ebff9d0b0d89a3b6448755046094be8fb 100644 (file)
@@ -144,6 +144,7 @@ Stock menus.
 
 #define KHUI_MENU_DESTROY_CRED (KHUI_MENU_BASE + 16)
 #define KHUI_MENU_RENEW_CRED (KHUI_MENU_BASE + 17)
+#define KHUI_MENU_SETDEF    (KHUI_MENU_BASE + 18)
 
 /*@}*/