summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-05-29 13:55:57 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-05-29 13:55:57 +0300
commit8b9fc123189ad55d05b1135ccfc415bc35423178 (patch)
treee74b563cf0b28a01fadc5cdc567c8246ebc2d0ec /plugins
parent272f823326621602b806c4a60944c37cff195545 (diff)
fixes #4373 (NewStory: кнопка Delete не работает после удаления события)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/NewStory/src/history_control.cpp53
1 files changed, 27 insertions, 26 deletions
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp
index d041679001..468591f541 100644
--- a/plugins/NewStory/src/history_control.cpp
+++ b/plugins/NewStory/src/history_control.cpp
@@ -390,36 +390,37 @@ void NewstoryListData::DeleteItems(void)
nSelected++;
CDeleteEventsDlg dlg(m_hContact, nSelected);
- if (IDOK != dlg.DoModal())
- return;
-
- g_plugin.bDisableDelete = true;
-
- int firstSel = -1, flags = 0;
- if (dlg.bDelHistory)
- flags |= CDF_DEL_HISTORY;
- if (dlg.bForEveryone)
- flags |= CDF_FOR_EVERYONE;
+ if (IDOK == dlg.DoModal()) {
+ g_plugin.bDisableDelete = true;
+
+ int firstSel = -1, flags = 0;
+ if (dlg.bDelHistory)
+ flags |= CDF_DEL_HISTORY;
+ if (dlg.bForEveryone)
+ flags |= CDF_FOR_EVERYONE;
+
+ for (int i = totalCount - 1; i >= 0; i--) {
+ auto *p = GetItem(i);
+ if (!p->m_bSelected)
+ continue;
+
+ if (p->dbe.getEvent())
+ db_event_delete(p->dbe.getEvent(), flags);
+ items.remove(i);
+ totalCount--;
+ firstSel = i;
+ }
- for (int i = totalCount - 1; i >= 0; i--) {
- auto *p = GetItem(i);
- if (!p->m_bSelected)
- continue;
+ g_plugin.bDisableDelete = false;
- if (p->dbe.getEvent())
- db_event_delete(p->dbe.getEvent(), flags);
- items.remove(i);
- totalCount--;
- firstSel = i;
+ if (firstSel != -1) {
+ SetCaret(firstSel, false);
+ SetSelection(firstSel, firstSel);
+ FixScrollPosition(true);
+ }
}
- g_plugin.bDisableDelete = false;
-
- if (firstSel != -1) {
- SetCaret(firstSel, false);
- SetSelection(firstSel, firstSel);
- FixScrollPosition(true);
- }
+ ::SetFocus(m_hwnd);
}
/////////////////////////////////////////////////////////////////////////////////////////