summaryrefslogtreecommitdiff
path: root/plugins/NotesAndReminders
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-09-12 12:55:45 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-09-12 12:55:45 +0300
commit204888102bbc85dee1780c5ca02ffb3f1cb2ce65 (patch)
treed43dfaf3a424b2041e3f4c64f42987d78c11a2d7 /plugins/NotesAndReminders
parent8f010ca870666ea136890d8c6317d0092cbe30ab (diff)
fixes #4655 (Notes and Reminders: список напоминаний не реагирует на кнопку Delete)
Diffstat (limited to 'plugins/NotesAndReminders')
-rw-r--r--plugins/NotesAndReminders/src/reminders.cpp75
1 files changed, 43 insertions, 32 deletions
diff --git a/plugins/NotesAndReminders/src/reminders.cpp b/plugins/NotesAndReminders/src/reminders.cpp
index 9759e1873b..446f1b5c6b 100644
--- a/plugins/NotesAndReminders/src/reminders.cpp
+++ b/plugins/NotesAndReminders/src/reminders.cpp
@@ -1509,6 +1509,14 @@ static void EditReminder(REMINDERDATA *p)
/////////////////////////////////////////////////////////////////////////////////////////
+static INT_PTR CALLBACK ListWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ if (msg == WM_KEYDOWN && wParam == VK_DELETE)
+ PostMessage(GetParent(hwnd), WM_COMMAND, ID_CONTEXTMENUREMINDER_DELETE, 0);
+
+ return mir_callNextSubclass(hwnd, ListWindowProc, msg, wParam, lParam);
+}
+
class CReminderListDlg : public CDlgBase
{
typedef CDlgBase CSuper;
@@ -1587,9 +1595,10 @@ public:
pListDialog = this;
Window_SetIcon_IcoLib(m_hwnd, iconList[6].hIcolib);
- TranslateDialogDefault(m_hwnd);
SetDlgItemTextA(m_hwnd, IDC_REMINDERDATA, "");
+ mir_subclassWindow(m_list.GetHwnd(), ListWindowProc);
+
int cx1 = 150, cx2 = 205;
ptrA colWidth(g_plugin.getStringA("ColWidth"));
if (colWidth != 0) {
@@ -1682,38 +1691,8 @@ public:
ClientToScreen(m_list.GetHwnd(), &pt);
TranslateMenu(FhMenu);
- int iSel = TrackPopupMenu(FhMenu, TPM_RETURNCMD | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, m_hwnd, nullptr);
+ TrackPopupMenu(FhMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, m_hwnd, nullptr);
DestroyMenu(hMenuLoad);
-
- switch(iSel) {
- case ID_CONTEXTMENUREMINDER_EDIT:
- idx = m_list.GetSelectionMark();
- if (idx != -1)
- EditReminder(getData(idx));
- break;
-
- case ID_CONTEXTMENUREMINDER_NEW:
- PluginMenuCommandNewReminder(0, 0);
- break;
-
- case ID_CONTEXTMENUREMINDER_DELETEALL:
- if (arReminders.getCount() && IDOK == MessageBox(m_hwnd, TranslateT("Are you sure you want to delete all reminders?"), _A2W(SECTIONNAME), MB_OKCANCEL)) {
- SetDlgItemTextA(m_hwnd, IDC_REMINDERDATA, "");
- DeleteReminders();
- RefreshList();
- }
- break;
-
- case ID_CONTEXTMENUREMINDER_DELETE:
- idx = m_list.GetSelectionMark();
- if (idx != -1 && IDOK == MessageBox(m_hwnd, TranslateT("Are you sure you want to delete this reminder?"), _A2W(SECTIONNAME), MB_OKCANCEL)) {
- SetDlgItemTextA(m_hwnd, IDC_REMINDERDATA, "");
- DeleteReminder(getData(idx));
- JustSaveReminders();
- RefreshList();
- }
- break;
- }
}
void Reload()
@@ -1760,6 +1739,38 @@ public:
}
}
break;
+
+ case WM_COMMAND:
+ int idx;
+ switch (wParam) {
+ case ID_CONTEXTMENUREMINDER_EDIT:
+ idx = m_list.GetSelectionMark();
+ if (idx != -1)
+ EditReminder(getData(idx));
+ break;
+
+ case ID_CONTEXTMENUREMINDER_NEW:
+ PluginMenuCommandNewReminder(0, 0);
+ break;
+
+ case ID_CONTEXTMENUREMINDER_DELETEALL:
+ if (arReminders.getCount() && IDOK == MessageBox(m_hwnd, TranslateT("Are you sure you want to delete all reminders?"), _A2W(SECTIONNAME), MB_OKCANCEL)) {
+ SetDlgItemTextA(m_hwnd, IDC_REMINDERDATA, "");
+ DeleteReminders();
+ RefreshList();
+ }
+ break;
+
+ case ID_CONTEXTMENUREMINDER_DELETE:
+ idx = m_list.GetSelectionMark();
+ if (idx != -1 && IDOK == MessageBox(m_hwnd, TranslateT("Are you sure you want to delete this reminder?"), _A2W(SECTIONNAME), MB_OKCANCEL)) {
+ SetDlgItemTextA(m_hwnd, IDC_REMINDERDATA, "");
+ DeleteReminder(getData(idx));
+ JustSaveReminders();
+ RefreshList();
+ }
+ break;
+ }
}
return CSuper::DlgProc(msg, wParam, lParam);