From 090b8d7b62b44ec13157566746a7c3cffecc7865 Mon Sep 17 00:00:00 2001 From: Tom Yu Date: Mon, 1 Oct 2007 23:54:39 +0000 Subject: [PATCH] pull up r20032 from trunk r20032@cathode-dark-space: jaltman | 2007-10-01 01:29:38 -0400 ticket: 5783 The credentials display in Network Identity Manager colors the background of identity headings based on the expiration state of the credentials that belong to the identity. This patch changes the behavior to color these headings based on the existence and expiration state of identity credentials. With this change, only identities that have valid identity credentials will appear in green. The same logic is used when drawing the menu items in the "Set default" sub-menu in the notification icon. ticket: 5783 version_fixed: 1.6.3 git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-6@20073 dc483132-0cff-0310-8789-dd5450dbe970 --- src/windows/identity/ui/credwnd.c | 33 ++++++++++++++++++------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/windows/identity/ui/credwnd.c b/src/windows/identity/ui/credwnd.c index 913503f04..5b275eb1c 100644 --- a/src/windows/identity/ui/credwnd.c +++ b/src/windows/identity/ui/credwnd.c @@ -2498,6 +2498,7 @@ cw_draw_header(HDC hdc, khui_credwnd_outline * o; int selected = 0; khm_int32 idf = 0; + khui_credwnd_ident * cwi = NULL; /* each header consists of a couple of widgets and some text */ /* we need to figure out the background color first */ @@ -2511,6 +2512,7 @@ cw_draw_header(HDC hdc, khm_handle ident = o->data; kcdb_identity_get_flags(ident, &idf); + cwi = cw_find_ident(tbl, ident); } selected = o->flags & KHUI_CW_O_SELECTED; @@ -2525,7 +2527,8 @@ cw_draw_header(HDC hdc, hbr = tbl->hb_hdr_bg_crit_s; else if ((o->flags & CW_EXPSTATE_MASK) == CW_EXPSTATE_WARN) hbr = tbl->hb_hdr_bg_warn_s; - else if ((colattr == KCDB_ATTR_ID_NAME) && !(o->flags & KHUI_CW_O_EMPTY)) + else if ((colattr == KCDB_ATTR_ID_NAME) && !(o->flags & KHUI_CW_O_EMPTY) && + cwi && cwi->id_credcount > 0) hbr = tbl->hb_hdr_bg_cred_s; else hbr = tbl->hb_hdr_bg_s; @@ -2536,7 +2539,8 @@ cw_draw_header(HDC hdc, hbr = tbl->hb_hdr_bg_crit; else if ((o->flags & CW_EXPSTATE_MASK) == CW_EXPSTATE_WARN) hbr = tbl->hb_hdr_bg_warn; - else if ((colattr == KCDB_ATTR_ID_NAME) && !(o->flags & KHUI_CW_O_EMPTY)) + else if ((colattr == KCDB_ATTR_ID_NAME) && !(o->flags & KHUI_CW_O_EMPTY) && + cwi && cwi->id_credcount > 0) hbr = tbl->hb_hdr_bg_cred; else hbr = tbl->hb_hdr_bg; @@ -2613,7 +2617,8 @@ cw_draw_header(HDC hdc, } else { khui_ilist_draw_id(tbl->ilist, - ((o->flags & KHUI_CW_O_EMPTY)? + (((o->flags & KHUI_CW_O_EMPTY) || + cwi == NULL || cwi->id_credcount == 0)? IDB_ID_DIS_SM: IDB_ID_SM), hdc, @@ -2658,15 +2663,12 @@ cw_draw_header(HDC hdc, wchar_t typestr[128]; int cx_id; SIZE size; - khui_credwnd_ident * cwi; /* expanded view */ #ifdef DEBUG assert(colattr == KCDB_ATTR_ID_NAME); #endif - cwi = cw_find_ident(tbl, o->data); - CopyRect(&tr, r); tr.bottom -= (tr.bottom - tr.top) / 2; /* drawing two lines of text */ @@ -5791,7 +5793,6 @@ 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; @@ -5814,10 +5815,14 @@ khm_draw_identity_menu_item(HWND hwnd, LPDRAWITEMSTRUCT lpd, khui_action * act) 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; + { + khui_credwnd_ident * cwi; + + cwi = cw_find_ident(tbl, ident); + if (cwi) { + count = cwi->id_credcount; + } else { + count = 0; } } @@ -5828,16 +5833,16 @@ khm_draw_identity_menu_item(HWND hwnd, LPDRAWITEMSTRUCT lpd, khui_action * act) 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 { + } else if (count > 0) { hbr = tbl->hb_hdr_bg_cred; + } else { + hbr = tbl->hb_hdr_bg; } FillRect(lpd->hDC, &lpd->rcItem, hbr); -- 2.26.2