diff options
author | George Hazan <ghazan@miranda.im> | 2021-04-10 20:57:40 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-04-10 20:57:40 +0300 |
commit | 03993769c47dc2d3229002439272454186d29bf8 (patch) | |
tree | b47734c2c494ad64f8bf7136c529045e681edb26 /plugins/DbEditorPP | |
parent | 51c57792d3b6754ea1d90f5a68b2eabc521c0722 (diff) |
fixes #2841 (DbEditor: allow to delete contacts from right panel)
Diffstat (limited to 'plugins/DbEditorPP')
-rw-r--r-- | plugins/DbEditorPP/src/settinglist.cpp | 35 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/version.h | 2 |
2 files changed, 29 insertions, 8 deletions
diff --git a/plugins/DbEditorPP/src/settinglist.cpp b/plugins/DbEditorPP/src/settinglist.cpp index 96264fd906..be155a86c8 100644 --- a/plugins/DbEditorPP/src/settinglist.cpp +++ b/plugins/DbEditorPP/src/settinglist.cpp @@ -126,25 +126,46 @@ void DeleteSettingsFromList(MCONTACT hContact, const char *module, const char *s if (g_plugin.bWarnOnDelete) {
wchar_t text[MSG_SIZE];
- mir_snwprintf(text, TranslateT("Are you sure you want to delete setting(s): %d?"), count);
+ if (info.hContact == 0)
+ mir_snwprintf(text, TranslateT("Are you sure you want to delete %d contact(s)?"), count);
+ else
+ mir_snwprintf(text, TranslateT("Are you sure you want to delete %d setting(s)?"), count);
if (dlg(text, MB_YESNO | MB_ICONEXCLAMATION) == IDNO)
return;
}
- if (count == 1)
- db_unset(hContact, module, setting);
- else {
+ if (hContact == 0) {
int items = ListView_GetItemCount(hwnd2List);
for (int i = 0; i < items;) {
if (ListView_GetItemState(hwnd2List, i, LVIS_SELECTED)) {
- char text[FLD_SIZE];
- if (ListView_GetItemTextA(hwnd2List, i, 0, text, _countof(text)))
- db_unset(hContact, module, text);
+ LVITEM lvi = {};
+ lvi.mask = LVIF_PARAM;
+ lvi.iItem = i;
+ if (ListView_GetItem(hwnd2List, &lvi)) {
+ db_delete_contact(MCONTACT(lvi.lParam));
+ ListView_DeleteItem(hwnd2List, i);
+ }
items--;
}
else i++;
}
}
+ else {
+ if (count == 1)
+ db_unset(hContact, module, setting);
+ else {
+ int items = ListView_GetItemCount(hwnd2List);
+ for (int i = 0; i < items;) {
+ if (ListView_GetItemState(hwnd2List, i, LVIS_SELECTED)) {
+ char text[FLD_SIZE];
+ if (ListView_GetItemTextA(hwnd2List, i, 0, text, _countof(text)))
+ db_unset(hContact, module, text);
+ items--;
+ }
+ else i++;
+ }
+ }
+ }
if (ListView_GetItemCount(hwnd2List) == 0)
replaceTreeItem(hContact, module, nullptr);
diff --git a/plugins/DbEditorPP/src/version.h b/plugins/DbEditorPP/src/version.h index f731cc7a12..5d41638d3e 100644 --- a/plugins/DbEditorPP/src/version.h +++ b/plugins/DbEditorPP/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 4 #define __MINOR_VERSION 0 #define __RELEASE_NUM 2 -#define __BUILD_NUM 1 +#define __BUILD_NUM 2 #include <stdver.h> |