summaryrefslogtreecommitdiff
path: root/plugins/NotesAndReminders/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-03-17 21:44:20 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-03-17 21:44:20 +0300
commit20ced6c686de28ac1968e9f6eca6aa23d14deb1d (patch)
tree553c3162d2ef0609fc684581816c380ab02865f5 /plugins/NotesAndReminders/src
parent9df250ccbd2192ad3f0906e3714e97fa880f9882 (diff)
fixes #2776 (Notes and Reminders: добавить поиск по напоминалкам) + version bump
Diffstat (limited to 'plugins/NotesAndReminders/src')
-rw-r--r--plugins/NotesAndReminders/src/notes.cpp5
-rw-r--r--plugins/NotesAndReminders/src/reminders.cpp46
-rw-r--r--plugins/NotesAndReminders/src/resource.h13
-rw-r--r--plugins/NotesAndReminders/src/version.h2
4 files changed, 46 insertions, 20 deletions
diff --git a/plugins/NotesAndReminders/src/notes.cpp b/plugins/NotesAndReminders/src/notes.cpp
index 8e86a1ae6d..ef1c129635 100644
--- a/plugins/NotesAndReminders/src/notes.cpp
+++ b/plugins/NotesAndReminders/src/notes.cpp
@@ -1468,9 +1468,8 @@ public:
pListDialog = this;
Window_SetIcon_IcoLib(m_hwnd, iconList[13].hIcolib);
- SetWindowText(m_hwnd, LPGENW("Notes"));
-
- TranslateDialogDefault(m_hwnd);
+ ShowWindow(GetDlgItem(m_hwnd, IDC_FILTER), SW_HIDE);
+ SetWindowText(m_hwnd, TranslateT("Notes"));
SetDlgItemText(m_hwnd, IDC_REMINDERDATA, L"");
diff --git a/plugins/NotesAndReminders/src/reminders.cpp b/plugins/NotesAndReminders/src/reminders.cpp
index d7b72dc93d..5ccefc77b3 100644
--- a/plugins/NotesAndReminders/src/reminders.cpp
+++ b/plugins/NotesAndReminders/src/reminders.cpp
@@ -1526,14 +1526,25 @@ static void EditReminder(REMINDERDATA *p)
class CReminderListDlg : public CDlgBase
{
+ CMStringW m_wszFilter;
+
+ REMINDERDATA* getData(int idx)
+ {
+ return (REMINDERDATA*)m_list.GetItemData(idx);
+ }
+
void RefreshList()
{
m_list.DeleteAllItems();
int i = 0;
for (auto &pReminder : arReminders) {
+ if (!m_wszFilter.IsEmpty())
+ if (pReminder->wszText.Find(m_wszFilter, 0) == -1)
+ continue;
+
LV_ITEM lvTIt;
- lvTIt.mask = LVIF_TEXT;
+ lvTIt.mask = LVIF_TEXT | LVIF_PARAM;
wchar_t S1[128];
GetTriggerTimeString(&pReminder->When, S1, _countof(S1), TRUE);
@@ -1541,6 +1552,7 @@ class CReminderListDlg : public CDlgBase
lvTIt.iItem = i;
lvTIt.iSubItem = 0;
lvTIt.pszText = S1;
+ lvTIt.lParam = LPARAM(pReminder);
m_list.InsertItem(&lvTIt);
lvTIt.mask = LVIF_TEXT;
@@ -1553,17 +1565,22 @@ class CReminderListDlg : public CDlgBase
i++;
}
- m_list.SetItemState(0, LVIS_SELECTED, LVIS_SELECTED);
+ if (i > 0) {
+ m_list.SetItemState(0, LVIS_SELECTED, LVIS_SELECTED);
+ SetDlgItemTextW(m_hwnd, IDC_REMINDERDATA, getData(0)->wszText);
+ }
}
- CCtrlListView m_list;
+ CCtrlEdit edtFilter;
CCtrlButton btnNew;
+ CCtrlListView m_list;
public:
CReminderListDlg() :
CDlgBase(g_plugin, IDD_LISTREMINDERS),
m_list(this, IDC_LISTREMINDERS),
- btnNew(this, IDC_ADDNEWREMINDER)
+ btnNew(this, IDC_ADDNEWREMINDER),
+ edtFilter(this, IDC_FILTER)
{
SetMinSize(394, 300);
@@ -1572,6 +1589,8 @@ public:
m_list.OnBuildMenu = Callback(this, &CReminderListDlg::onContextMenu);
m_list.OnDoubleClick = Callback(this, &CReminderListDlg::list_onDblClick);
m_list.OnItemChanged = Callback(this, &CReminderListDlg::list_onItemChanged);
+
+ edtFilter.OnChange = Callback(this, &CReminderListDlg::onChange_Filter);
}
bool OnInitDialog() override
@@ -1630,6 +1649,9 @@ public:
case IDC_REMINDERDATA:
return RD_ANCHORX_WIDTH | RD_ANCHORY_BOTTOM;
+
+ case IDC_FILTER:
+ return RD_ANCHORX_LEFT | RD_ANCHORY_BOTTOM;
}
return RD_ANCHORX_RIGHT | RD_ANCHORY_BOTTOM;
}
@@ -1640,7 +1662,7 @@ public:
HMENU FhMenu = GetSubMenu(hMenuLoad, 0);
int idx = m_list.GetSelectionMark();
- REMINDERDATA *pReminder = (idx == -1) ? nullptr : arReminders[idx];
+ REMINDERDATA *pReminder = (idx == -1) ? nullptr : getData(idx);
MENUITEMINFO mii = {};
mii.cbSize = sizeof(mii);
@@ -1666,7 +1688,7 @@ public:
case ID_CONTEXTMENUREMINDER_EDIT:
idx = m_list.GetSelectionMark();
if (idx != -1)
- EditReminder(arReminders[idx]);
+ EditReminder(getData(idx));
break;
case ID_CONTEXTMENUREMINDER_NEW:
@@ -1685,7 +1707,7 @@ public:
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(arReminders[idx]);
+ DeleteReminder(getData(idx));
JustSaveReminders();
RefreshList();
}
@@ -1701,14 +1723,14 @@ public:
void list_onItemChanged(CCtrlListView::TEventInfo *ev)
{
- SetDlgItemTextW(m_hwnd, IDC_REMINDERDATA, arReminders[ev->nmlv->iItem]->wszText);
+ SetDlgItemTextW(m_hwnd, IDC_REMINDERDATA, getData(ev->nmlv->iItem)->wszText);
}
void list_onDblClick(CCtrlListView::TEventInfo*)
{
int i = m_list.GetSelectionMark();
if (i != -1)
- EditReminder(arReminders[i]);
+ EditReminder(getData(i));
}
void onClick_New(CCtrlButton *)
@@ -1716,6 +1738,12 @@ public:
PluginMenuCommandNewReminder(0, 0);
}
+ void onChange_Filter(CCtrlEdit *)
+ {
+ m_wszFilter = ptrW(edtFilter.GetText());
+ RefreshList();
+ }
+
INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
{
RECT rc;
diff --git a/plugins/NotesAndReminders/src/resource.h b/plugins/NotesAndReminders/src/resource.h
index 5538209feb..dcb67a72f6 100644
--- a/plugins/NotesAndReminders/src/resource.h
+++ b/plugins/NotesAndReminders/src/resource.h
@@ -59,17 +59,17 @@
#define IDC_BTN_BROWSEBROWSER 1032
#define IDC_CHECK_REPEAT 1033
#define IDC_LISTREMINDERS_HEADER 1034
+#define IDC_EDIT1 1034
+#define IDC_FILTER 1034
#define IDC_DATE 1035
#define IDC_LISTREMINDERS 1036
-
#define ID_CONTEXTMENUREMINDER_NEW 40001
-#define ID_CONTEXTMENUREMINDER_DELETE 40002
-#define ID_CONTEXTMENUREMINDER_DELETEALL 40003
-#define ID_CONTEXTMENUREMINDER_EDIT 40004
-
#define ID_CONTEXTMENUNOTE_REMOVENOTE 40001
+#define ID_CONTEXTMENUREMINDER_DELETE 40002
#define ID_CONTEXTMENUNOTE_HIDENOTE 40002
+#define ID_CONTEXTMENUREMINDER_DELETEALL 40003
#define ID_CONTEXTMENUNOTE_TOGGLEONTOP 40003
+#define ID_CONTEXTMENUREMINDER_EDIT 40004
#define ID_CONTEXTMENUNOTE_UNDO 40004
#define ID_CONTEXTMENUNOTE_COPY 40005
#define ID_CONTEXTMENUNOTE_PASTE 40006
@@ -85,7 +85,6 @@
#define ID_CONTEXTMENUNOTE_DELETEALLNOTES 40016
#define ID_CONTEXTMENUNOTE_VIEWNOTES 40017
#define ID_CONTEXTMENUNOTE_TOGGLEVISIBILITY 40018
-
#define ID_BACKGROUNDCOLOR_CUSTOM 40019
#define ID_BACKGROUNDCOLOR_RESET 40020
#define ID_TEXTCOLOR_CUSTOM 40021
@@ -99,7 +98,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 109
#define _APS_NEXT_COMMAND_VALUE 40030
-#define _APS_NEXT_CONTROL_VALUE 1034
+#define _APS_NEXT_CONTROL_VALUE 1035
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/plugins/NotesAndReminders/src/version.h b/plugins/NotesAndReminders/src/version.h
index 539b0614a7..c54bf2e367 100644
--- a/plugins/NotesAndReminders/src/version.h
+++ b/plugins/NotesAndReminders/src/version.h
@@ -1,6 +1,6 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 2
-#define __RELEASE_NUM 1
+#define __RELEASE_NUM 2
#define __BUILD_NUM 0
#include <stdver.h>