From: Tom Yu Date: Fri, 28 Sep 2007 23:36:15 +0000 (+0000) Subject: pull up r19853 from trunk X-Git-Tag: krb5-1.6.3-beta2~77 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=af4c6b704d7e0917a6efc3d819bb987228e63933;p=krb5.git pull up r19853 from trunk r19853@cathode-dark-space: jaltman | 2007-08-24 10:23:14 -0400 ticket: new subject: NIM: Identity Configuration Panel Fixes component: windows In the identity configuration panel of Network Identity Manager, the user can specify a new identity which can then be configured. The existing code didn't check if the identity specified by the user already exists. The patch adds the check. If the identity already exists, the user is notified as such. Another bug prevented the user from configuring an identity that was added back in following the deletion of the same identity during the same session. The deleted status of the identity was not reset when it was added back. Additionally, this patch adds code that has already been added to the new credentials dialog to apply Windows XP theme textures to the child dialogs used as tab panels in the configuration dialog. Child dialogs don't automatically adjust the theme settings based on whether it is nested inside a tab control. The theme must be applied manually. ticket: 5674 version_fixed: 1.6.3 git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-6@19988 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/windows/identity/ui/cfg_identities_wnd.c b/src/windows/identity/ui/cfg_identities_wnd.c index 5e3079224..46efe242b 100644 --- a/src/windows/identity/ui/cfg_identities_wnd.c +++ b/src/windows/identity/ui/cfg_identities_wnd.c @@ -26,6 +26,9 @@ #include #include +#if _WIN32_WINNT >= 0x0501 +#include +#endif static khui_config_node get_window_node(HWND hwnd) { @@ -93,6 +96,9 @@ add_subpanels(HWND hwnd, #ifdef DEBUG assert(hwnd_panel); #endif +#if _WIN32_WINNT >= 0x0501 + EnableThemeDialogTexture(hwnd_panel, ETDT_ENABLETAB); +#endif ShowWindow(hwnd_panel, SW_HIDE); @@ -299,8 +305,9 @@ typedef struct tag_ident_data { wchar_t * idname; int lv_idx; - BOOL removed; + BOOL removed; /* this identity was marked for removal */ BOOL applied; + BOOL purged; /* this identity was actually removed */ khm_int32 flags; @@ -456,6 +463,8 @@ write_params_ident(ident_data * d) { assert(!(flags & KCDB_IDENT_FLAG_CONFIG)); #endif + d->purged = TRUE; + } else { if (d->saved.monitor != d->work.monitor) @@ -478,7 +487,7 @@ write_params_ident(ident_data * d) { d->applied = TRUE; - if (d->hwnd) + if (d->hwnd && !d->removed) PostMessage(d->hwnd, KHUI_WM_CFG_NOTIFY, MAKEWPARAM(0, WMCFG_UPDATE_STATE), 0); @@ -965,6 +974,7 @@ khm_cfg_add_ident_proc(HWND hwnd, khm_handle csp_ident = NULL; khm_size cb; khm_int32 rv = KHM_ERROR_SUCCESS; + khm_int32 flags = 0; d = (add_ident_data *)(LONG_PTR) GetWindowLongPtr(hwnd, DWLP_USER); @@ -990,6 +1000,23 @@ khm_cfg_add_ident_proc(HWND hwnd, cb = sizeof(idname); kcdb_identity_get_name(ident, idname, &cb); + /* check if the identity is already in the + configuration */ + if (KHM_SUCCEEDED(kcdb_identity_get_flags(ident, &flags)) && + (flags & KCDB_IDENT_FLAG_CONFIG)) { + + wchar_t fmt[256]; + + LoadString(khm_hInstance, IDS_CFG_IDNAME_EXT, + fmt, ARRAYLENGTH(fmt)); + StringCbPrintf(err_msg, sizeof(err_msg), fmt, idname); + + kcdb_identity_release(ident); + ident = NULL; + + goto show_failure; + } + /* now we have to create the identity configuration. */ if (KHM_FAILED(rv = kcdb_identity_get_config(ident, KHM_FLAG_CREATE, @@ -1001,6 +1028,7 @@ khm_cfg_add_ident_proc(HWND hwnd, StringCbPrintf(err_msg, sizeof(err_msg), fmt, rv); kcdb_identity_release(ident); + ident = NULL; goto show_failure; } @@ -1247,8 +1275,17 @@ find_ident_by_node(khui_config_node node) { break; } - if (i < (int)cfg_idents.n_idents) + if (i < (int)cfg_idents.n_idents) { + if (cfg_idents.idents[i].purged) { + /* we are re-creating a purged identity */ + cfg_idents.idents[i].purged = FALSE; + cfg_idents.idents[i].removed = FALSE; + cfg_idents.idents[i].applied = FALSE; + + read_params_ident(&cfg_idents.idents[i]); + } return &cfg_idents.idents[i]; + } /* there is no identity data for this configuration node. We try to create it. */ @@ -1463,11 +1500,14 @@ khm_cfg_id_tab_proc(HWND hwnd, cont = (BOOL *) lParam; d = find_ident_by_node(idata->ctx_node); write_params_ident(d); - if (d->removed && cont) - *cont = FALSE; - khui_cfg_set_flags_inst(idata, KHUI_CNFLAG_APPLIED, - KHUI_CNFLAG_APPLIED | - KHUI_CNFLAG_MODIFIED); + if (d->removed) { + if (cont) + *cont = FALSE; + } else { + khui_cfg_set_flags_inst(idata, KHUI_CNFLAG_APPLIED, + KHUI_CNFLAG_APPLIED | + KHUI_CNFLAG_MODIFIED); + } break; case WMCFG_UPDATE_STATE: