return o;\r
}\r
\r
+/* buf is a handle to a credential or an identity. the kcdb_buf_*\r
+ functions work with either. */\r
khm_int32 \r
-cw_get_cred_exp_flags(khui_credwnd_tbl * tbl, khm_handle cred)\r
+cw_get_buf_exp_flags(khui_credwnd_tbl * tbl, khm_handle buf)\r
{\r
khm_int32 flags;\r
long s;\r
- FILETIME ft;\r
+ FILETIME ft_expire;\r
+ FILETIME ft_current;\r
+ FILETIME ft_difference;\r
khm_size cbsize;\r
\r
- cbsize = sizeof(ft);\r
- if(KHM_FAILED(kcdb_cred_get_attr(cred, KCDB_ATTR_TIMELEFT, NULL, &ft, &cbsize)))\r
+ cbsize = sizeof(ft_expire);\r
+ if(KHM_FAILED(kcdb_buf_get_attr(buf, KCDB_ATTR_EXPIRE, NULL,\r
+ &ft_expire, &cbsize)))\r
return 0;\r
\r
- s = FtIntervalToSeconds(&ft);\r
+ GetSystemTimeAsFileTime(&ft_current);\r
+ ft_difference = FtSub(&ft_expire, &ft_current);\r
+\r
+ s = FtIntervalToSeconds(&ft_difference);\r
\r
flags = 0;\r
if(s < 0)\r
if(!(r->flags & KHUI_CW_ROW_CRED))\r
return; /* we only know what to do with cred rows */\r
\r
- nflags = cw_get_cred_exp_flags(tbl, (khm_handle) r->data);\r
+ nflags = cw_get_buf_exp_flags(tbl, (khm_handle) r->data);\r
if((r->flags & CW_EXPSTATE_MASK) != nflags) {\r
/* flags have changed */\r
/* the outline needs to be updated */\r
}\r
visible = visible && (ol->flags & KHUI_CW_O_EXPAND);\r
selected = (selected || (ol->flags & KHUI_CW_O_SELECTED));\r
+\r
+ /* if the outline node is for an identity, then we have to\r
+ check the expiration state for the identity. */\r
+\r
+ if (ol->attr_id == KCDB_ATTR_ID) {\r
+ khm_handle ident = (khm_handle) ol->data;\r
+\r
+ flags = cw_get_buf_exp_flags(tbl, ident);\r
+\r
+ if (flags) {\r
+ ol->flags |= flags;\r
+ ol->flags |= KHUI_CW_O_SHOWFLAG;\r
+ }\r
+ }\r
}\r
\r
/* we need to do this here too just in case we were already at\r
if (ol)\r
visible = visible && (ol->flags & KHUI_CW_O_EXPAND);\r
\r
- flags = cw_get_cred_exp_flags(tbl, thiscred);\r
+ flags = cw_get_buf_exp_flags(tbl, thiscred);\r
expstate |= flags;\r
\r
if(visible) {\r
tbl->rows[n_rows].idx_end = i;\r
\r
n_rows++;\r
- } else if(flags) {\r
- khui_credwnd_outline *to;\r
- /* the row that is flagged is not visible. We need to send\r
- the flag upstream until we hit a visible outline node */\r
- to = ol;\r
- while(to && !(to->flags & KHUI_CW_O_VISIBLE)) {\r
- to = TPARENT(to);\r
- }\r
- if(to) {\r
- to->flags |= KHUI_CW_O_SHOWFLAG;\r
- }\r
- }\r
-\r
- /* and we propagate the flags upstream */\r
- if(flags) {\r
- khui_credwnd_outline *to;\r
-\r
- to = ol;\r
- while(to) {\r
- if((to->flags & CW_EXPSTATE_MASK) < flags) {\r
- to->flags = (to->flags & ~CW_EXPSTATE_MASK) | flags;\r
- }\r
- to = TPARENT(to);\r
- }\r
}\r
\r
if(prevcred)\r
wp = MK_SHIFT;\r
else if (LOWORD(wParam) == KHUI_PACTION_UP_TOGGLE)\r
wp = 0; //MK_CONTROL;\r
+ else {\r
#ifdef DEBUG\r
- else\r
assert(FALSE);\r
#endif\r
+ }\r
\r
cw_select_row(tbl, new_row, wp);\r
cw_ensure_row_visible(hwnd, tbl, new_row);\r
wp = MK_SHIFT;\r
else if (LOWORD(wParam) == KHUI_PACTION_DOWN_TOGGLE)\r
wp = 0; //MK_CONTROL;\r
+ else {\r
#ifdef DEBUG\r
- else\r
assert(FALSE);\r
#endif\r
+ }\r
+\r
cw_select_row(tbl, new_row, wp);\r
cw_ensure_row_visible(hwnd, tbl, new_row);\r
}\r