From bfa87af56480a56464b448541b321e5fe1a86303 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Sat, 15 Aug 2015 15:20:24 +0000 Subject: DBEditor: - Fixed context menu git-svn-id: http://svn.miranda-ng.org/main/trunk@14961 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/DbEditorPP/src/watchedvars.cpp | 41 +++++++++++++++------------------- 1 file changed, 18 insertions(+), 23 deletions(-) (limited to 'plugins/DbEditorPP/src/watchedvars.cpp') diff --git a/plugins/DbEditorPP/src/watchedvars.cpp b/plugins/DbEditorPP/src/watchedvars.cpp index 0fa41b0532..982eb423f1 100644 --- a/plugins/DbEditorPP/src/watchedvars.cpp +++ b/plugins/DbEditorPP/src/watchedvars.cpp @@ -74,37 +74,31 @@ void freeWatchListItem(int item) void addwatchtolist(HWND hwnd, struct DBsetting *lParam) { - LVITEM lvItem; - int index; - DBVARIANT *dbv = &(lParam->dbv); - MCONTACT hContact = lParam->hContact; - - char *module = lParam->module; - char *setting = lParam->setting; - if (!module) return; + if (!lParam->module) return; + LVITEM lvItem; lvItem.lParam = (LPARAM)lParam->hContact; lvItem.mask = LVIF_TEXT | LVIF_PARAM; lvItem.iItem = 0; lvItem.iSubItem = 0; - if (!setting) // add every item in the module and return + if (!lParam->setting) // add every item in the module and return { ModuleSettingLL settinglist; - struct DBsetting dummy = {0}; - ModSetLinkLinkItem *setting; - if (IsModuleEmpty(hContact, module) || !EnumSettings(hContact, module, &settinglist)) return; + if (IsModuleEmpty(lParam->hContact, lParam->module) || !EnumSettings(lParam->hContact, lParam->module, &settinglist)) + return; - dummy.hContact = hContact; - dummy.module = module; - setting = settinglist.first; - while (setting) + struct DBsetting dummy = {0}; + dummy.hContact = lParam->hContact; + dummy.module = lParam->module; + + for (ModSetLinkLinkItem *setting = settinglist.first; setting; setting = setting->next) { dummy.setting = setting->name; addwatchtolist(hwnd, &dummy); - setting = (ModSetLinkLinkItem *)setting->next; + } FreeModuleSettingLL(&settinglist); return; @@ -112,18 +106,19 @@ void addwatchtolist(HWND hwnd, struct DBsetting *lParam) db_free(&(lParam->dbv)); - db_get_s(hContact, module, setting, &(lParam->dbv), 0); + if (db_get_s(lParam->hContact, lParam->module, lParam->setting, &(lParam->dbv), 0)) + return; TCHAR data[32], tmp[16], name[NAME_SIZE]; - GetContactName(hContact, NULL, name, _countof(name)); + GetContactName(lParam->hContact, NULL, name, _countof(name)); lvItem.pszText = name; - index = ListView_InsertItem(hwnd, &lvItem); + int index = ListView_InsertItem(hwnd, &lvItem); ListView_SetItemText(hwnd, index, 0, lvItem.pszText); - ListView_SetItemTextA(hwnd, index, 1, module); - ListView_SetItemTextA(hwnd, index, 2, setting); + ListView_SetItemTextA(hwnd, index, 1, lParam->module); + ListView_SetItemTextA(hwnd, index, 2, lParam->setting); ListView_SetItemText(hwnd, index, 4, DBVType(dbv->type)); data[0] = 0; @@ -167,7 +162,7 @@ void addwatchtolist(HWND hwnd, struct DBsetting *lParam) break; } case DBVT_DELETED: - if (IsResidentSetting(module, setting)) + if (IsResidentSetting(lParam->module, lParam->setting)) ListView_SetItemText(hwnd, index, 3, TranslateT("*** resident ***")); break; } // switch -- cgit v1.2.3