diff options
author | George Hazan <george.hazan@gmail.com> | 2023-11-26 18:43:41 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-11-26 18:43:41 +0300 |
commit | 28e1fda20433c9629ba13adfbd53a81d5baf9011 (patch) | |
tree | a788cbe9e7648a7354a6cb03e13041671c378ba1 | |
parent | df3763bc4f1a82d8edecf25fcfa4e28cc4f17dd6 (diff) |
fixes #3962 (NewStory: при удалении сообщения пропадают соседние)
-rw-r--r-- | plugins/NewStory/src/history_control.cpp | 17 | ||||
-rw-r--r-- | plugins/NewStory/src/main.cpp | 2 | ||||
-rw-r--r-- | plugins/NewStory/src/stdafx.h | 2 |
3 files changed, 12 insertions, 9 deletions
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp index c698e436c4..05a59c7509 100644 --- a/plugins/NewStory/src/history_control.cpp +++ b/plugins/NewStory/src/history_control.cpp @@ -283,19 +283,22 @@ void NewstoryListData::DeleteItems(void) if (IDYES != MessageBoxW(m_hwnd, TranslateT("Are you sure to remove selected event(s)?"), _T(MODULETITLE), MB_YESNOCANCEL | MB_ICONQUESTION)) return; - db_set_safety_mode(false); + g_plugin.bDisableDelete = true; int firstSel = -1; for (int i = totalCount - 1; i >= 0; i--) { auto *p = GetItem(i); - if (p->hEvent && p->m_bSelected) { + if (!p->m_bSelected) + continue; + + if (p->hEvent) db_event_delete(p->hEvent); - items.remove(i); - totalCount--; - firstSel = i; - } + items.remove(i); + totalCount--; + firstSel = i; } - db_set_safety_mode(true); + + g_plugin.bDisableDelete = false; if (firstSel != -1) { SetCaret(firstSel, false); diff --git a/plugins/NewStory/src/main.cpp b/plugins/NewStory/src/main.cpp index 9f02dd23e4..dbcadd015e 100644 --- a/plugins/NewStory/src/main.cpp +++ b/plugins/NewStory/src/main.cpp @@ -107,7 +107,7 @@ static int evtEventAdded(WPARAM hContact, LPARAM lParam) static int evtEventDeleted(WPARAM hContact, LPARAM lParam) { - return SmartSendEvent(UM_REMOVEEVENT, hContact, lParam); + return (g_plugin.bDisableDelete) ? 0 : SmartSendEvent(UM_REMOVEEVENT, hContact, lParam); } static int evtEventEdited(WPARAM hContact, LPARAM lParam) diff --git a/plugins/NewStory/src/stdafx.h b/plugins/NewStory/src/stdafx.h index 56a9d9889a..5243753580 100644 --- a/plugins/NewStory/src/stdafx.h +++ b/plugins/NewStory/src/stdafx.h @@ -98,7 +98,7 @@ struct CMPlugin : public PLUGIN<CMPlugin> HBRUSH hBackBrush; CMOption<bool> bOptVScroll, bSortAscending; - bool bMsgGrouping, bDrawEdge, bHppCompat; // thesw options are a copy of static CMOption to keep performance high + bool bMsgGrouping, bDrawEdge, bHppCompat, bDisableDelete = false; // thesw options are a copy of static CMOption to keep performance high CMPlugin(); |