From 405f1a1f9238fa24f749350a762695ad6e42361f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 19 Jul 2012 18:18:58 +0000 Subject: quick search code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@1049 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/clist/clcutils.cpp | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'src/modules/clist/clcutils.cpp') diff --git a/src/modules/clist/clcutils.cpp b/src/modules/clist/clcutils.cpp index 6323d4c863..dc3acdfe9e 100644 --- a/src/modules/clist/clcutils.cpp +++ b/src/modules/clist/clcutils.cpp @@ -369,21 +369,28 @@ int fnFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int prefi continue; } if (group->cl.items[group->scanIndex]->type != CLCIT_DIVIDER) { - if ((prefixOk && !_tcsnicmp(text, group->cl.items[group->scanIndex]->szText, testlen)) || - ( !prefixOk && !lstrcmpi(text, group->cl.items[group->scanIndex]->szText))) { - ClcGroup *contactGroup = group; - int contactScanIndex = group->scanIndex; - for (; group; group = group->parent) - cli.pfnSetGroupExpand(hwnd, dat, group, 1); - return cli.pfnGetRowsPriorTo(&dat->list, contactGroup, contactScanIndex); - } - if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) { - if ( !(dat->exStyle & CLS_EX_QUICKSEARCHVISONLY) || group->cl.items[group->scanIndex]->group->expanded) { - group = group->cl.items[group->scanIndex]->group; - group->scanIndex = 0; - continue; - } + bool show; + if (dat->filterSearch) { + TCHAR *lowered_szText = CharLowerW(NEWTSTR_ALLOCA(group->cl.items[group->scanIndex]->szText)); + TCHAR *lowered_text = CharLowerW(NEWTSTR_ALLOCA(text)); + show = _tcsstr(lowered_szText, lowered_text) != NULL; + } + else show = ((prefixOk && !_tcsnicmp(text, group->cl.items[group->scanIndex]->szText, testlen)) || ( !prefixOk && !lstrcmpi(text, group->cl.items[group->scanIndex]->szText))); + + if (show) { + ClcGroup *contactGroup = group; + int contactScanIndex = group->scanIndex; + for (; group; group = group->parent) + cli.pfnSetGroupExpand(hwnd, dat, group, 1); + return cli.pfnGetRowsPriorTo(&dat->list, contactGroup, contactScanIndex); + } + if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) { + if ( !(dat->exStyle & CLS_EX_QUICKSEARCHVISONLY) || group->cl.items[group->scanIndex]->group->expanded) { + group = group->cl.items[group->scanIndex]->group; + group->scanIndex = 0; + continue; } + } } group->scanIndex++; } -- cgit v1.2.3