diff options
Diffstat (limited to 'protocols/JabberG')
-rw-r--r-- | protocols/JabberG/res/jabber.rc | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_iqid_muc.cpp | 33 |
2 files changed, 19 insertions, 16 deletions
diff --git a/protocols/JabberG/res/jabber.rc b/protocols/JabberG/res/jabber.rc index 51f66f62f2..a5733f1ccd 100644 --- a/protocols/JabberG/res/jabber.rc +++ b/protocols/JabberG/res/jabber.rc @@ -391,7 +391,7 @@ EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CONTROLPARENT CAPTION "JID List"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- CONTROL "",IDC_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_NOLABELWRAP | LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,5,5,198,136
+ CONTROL "",IDC_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_NOLABELWRAP | LVS_AUTOARRANGE | LVS_SORTASCENDING | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,5,5,198,136
EDITTEXT IDC_FILTER,5,147,161,12,ES_AUTOHSCROLL
CONTROL "Apply Filter",IDC_BTN_FILTERAPPLY,"MButtonClass",WS_TABSTOP,171,146,16,14
CONTROL "Reset Filter",IDC_BTN_FILTERRESET,"MButtonClass",WS_TABSTOP,187,146,16,14
diff --git a/protocols/JabberG/src/jabber_iqid_muc.cpp b/protocols/JabberG/src/jabber_iqid_muc.cpp index 9f1bcf7d1f..791b271b85 100644 --- a/protocols/JabberG/src/jabber_iqid_muc.cpp +++ b/protocols/JabberG/src/jabber_iqid_muc.cpp @@ -89,18 +89,12 @@ class CJabberMucJidListDlg : public CJabberDlgBase m_list.DeleteAllItems();
}
- void FillJidList()
+ void FillJidList(bool bFilter)
{
- wchar_t *filter = nullptr;
- if (GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_FILTER), GWLP_USERDATA)) {
- int filterLength = GetWindowTextLength(GetDlgItem(m_hwnd, IDC_FILTER)) + 1;
- filter = (wchar_t *)_alloca(filterLength * sizeof(wchar_t));
- GetDlgItemText(m_hwnd, IDC_FILTER, filter, filterLength);
- }
-
if (!m_info)
return;
+ ptrW filter(bFilter ? edtFilter.GetText() : nullptr);
m_list.SendMsg(WM_SETREDRAW, FALSE, 0);
FreeList();
@@ -162,6 +156,7 @@ class CJabberMucJidListDlg : public CJabberDlgBase JABBER_MUC_JIDLIST_INFO *m_info;
+ CCtrlEdit edtFilter;
CCtrlButton btnReset, btnApply;
CCtrlListView m_list;
@@ -171,7 +166,8 @@ public: m_info(pInfo),
m_list(this, IDC_LIST),
btnApply(this, IDC_BTN_FILTERAPPLY),
- btnReset(this, IDC_BTN_FILTERRESET)
+ btnReset(this, IDC_BTN_FILTERRESET),
+ edtFilter(this, IDC_FILTER)
{
m_list.OnClick = Callback(this, &CJabberMucJidListDlg::list_OnClick);
@@ -210,6 +206,16 @@ public: return true;
}
+ bool OnApply() override
+ {
+ if (GetFocus() == edtFilter.GetHwnd()) {
+ ptrW wszFilter(edtFilter.GetText());
+ FillJidList(mir_wstrlen(wszFilter) != 0);
+ return false;
+ }
+ return true;
+ }
+
void OnDestroy() override
{
Utils_SaveWindowPosition(m_hwnd, 0, m_proto->m_szModuleName, "jidListWnd_");
@@ -268,8 +274,7 @@ public: }
SetWindowText(m_hwnd, title);
- SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_FILTER), GWLP_USERDATA, 0);
- FillJidList();
+ FillJidList(false);
}
void list_OnClick(CCtrlListView::TEventInfo*)
@@ -325,14 +330,12 @@ public: void onClick_Apply(CCtrlButton*)
{
- SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_FILTER), GWLP_USERDATA, 1);
- FillJidList();
+ FillJidList(true);
}
void onClick_Reset(CCtrlButton*)
{
- SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_FILTER), GWLP_USERDATA, 0);
- FillJidList();
+ FillJidList(false);
}
};
|