From 28e1fda20433c9629ba13adfbd53a81d5baf9011 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 26 Nov 2023 18:43:41 +0300 Subject: =?UTF-8?q?fixes=20#3962=20(NewStory:=20=D0=BF=D1=80=D0=B8=20?= =?UTF-8?q?=D1=83=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8=D0=B8=20=D1=81=D0=BE?= =?UTF-8?q?=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D0=BF=D0=B0=D0=B4=D0=B0=D1=8E=D1=82=20=D1=81=D0=BE=D1=81=D0=B5?= =?UTF-8?q?=D0=B4=D0=BD=D0=B8=D0=B5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/NewStory/src/history_control.cpp | 17 ++++++++++------- plugins/NewStory/src/main.cpp | 2 +- plugins/NewStory/src/stdafx.h | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) (limited to 'plugins/NewStory/src') 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 HBRUSH hBackBrush; CMOption 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(); -- cgit v1.2.3