#include<khmapp.h>
#include<assert.h>
+#if _WIN32_WINNT >= 0x0501
+#include<uxtheme.h>
+#endif
static khui_config_node
get_window_node(HWND hwnd) {
#ifdef DEBUG
assert(hwnd_panel);
#endif
+#if _WIN32_WINNT >= 0x0501
+ EnableThemeDialogTexture(hwnd_panel, ETDT_ENABLETAB);
+#endif
ShowWindow(hwnd_panel, SW_HIDE);
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;
assert(!(flags & KCDB_IDENT_FLAG_CONFIG));
#endif
+ d->purged = TRUE;
+
} else {
if (d->saved.monitor != d->work.monitor)
d->applied = TRUE;
- if (d->hwnd)
+ if (d->hwnd && !d->removed)
PostMessage(d->hwnd, KHUI_WM_CFG_NOTIFY,
MAKEWPARAM(0, WMCFG_UPDATE_STATE), 0);
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);
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,
StringCbPrintf(err_msg, sizeof(err_msg), fmt, rv);
kcdb_identity_release(ident);
+ ident = NULL;
goto show_failure;
}
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. */
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: