summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
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);
}
/////////////////////////////////////////////////////////////////////////////////////////