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/moduletree.cpp | 6 ++--- plugins/DbEditorPP/src/settinglist.cpp | 4 ++++ plugins/DbEditorPP/src/watchedvars.cpp | 41 +++++++++++++++------------------- 3 files changed, 25 insertions(+), 26 deletions(-) diff --git a/plugins/DbEditorPP/src/moduletree.cpp b/plugins/DbEditorPP/src/moduletree.cpp index 04963061d0..d9fd92d8b0 100644 --- a/plugins/DbEditorPP/src/moduletree.cpp +++ b/plugins/DbEditorPP/src/moduletree.cpp @@ -304,7 +304,6 @@ void replaceTreeItem(MCONTACT hContact, const char* module, const char* newModul void __cdecl PopulateModuleTreeThreadFunc(LPVOID param) { - TVINSERTSTRUCT tvi; char SelectedModule[FLD_SIZE] = ""; char SelectedSetting[FLD_SIZE] = ""; @@ -323,7 +322,7 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID param) Select = 0; - switch ((int)param) { + switch ((INT_PTR)param) { case 1: // restore after rebuild if (HTREEITEM item = TreeView_GetSelection(hwnd2Tree)) { TCHAR text[FLD_SIZE]; @@ -362,7 +361,8 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID param) break; } - if ((int)param != 4) { // do not rebuild on just going to another setting + if ((INT_PTR)param != 4) { // do not rebuild on just going to another setting + TVINSERTSTRUCT tvi; if (!EnumModules(&modlist)) return; diff --git a/plugins/DbEditorPP/src/settinglist.cpp b/plugins/DbEditorPP/src/settinglist.cpp index 51098328c9..8cc403ca01 100644 --- a/plugins/DbEditorPP/src/settinglist.cpp +++ b/plugins/DbEditorPP/src/settinglist.cpp @@ -892,6 +892,10 @@ void SettingsListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to newSetting(info.hContact, info.module, DBVT_ASCIIZ); return; + case MENU_ADD_UNICODE: + newSetting(info.hContact, info.module, DBVT_WCHAR); + return; + case MENU_ADD_BLOB: newSetting(info.hContact, info.module, DBVT_BLOB); return; 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