diff options
author | George Hazan <george.hazan@gmail.com> | 2024-04-17 14:10:15 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-04-17 14:10:15 +0300 |
commit | 59a8c98ac4f4b208a27eed43cc860c8e5a9c799b (patch) | |
tree | 3b59089e5758874d7833ce29ebda3a5a570a93df /src | |
parent | 654fd5f8cc5693b7cd7c47c9a485ff0eb98a71bb (diff) |
fixes #4353 (Поиск по всем сетям ведёт себя странно)
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_app/mir_app.vcxproj.filters | 21 | ||||
-rw-r--r-- | src/mir_app/src/findadd.cpp | 68 | ||||
-rw-r--r-- | src/mir_app/src/findadd.h | 20 |
3 files changed, 62 insertions, 47 deletions
diff --git a/src/mir_app/mir_app.vcxproj.filters b/src/mir_app/mir_app.vcxproj.filters index 35a50fb760..89c02483c7 100644 --- a/src/mir_app/mir_app.vcxproj.filters +++ b/src/mir_app/mir_app.vcxproj.filters @@ -32,9 +32,6 @@ <ClCompile Include="src\filter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\findadd.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\FontOptions.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -86,9 +83,6 @@ <ClCompile Include="src\popups.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\searchresults.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\skin2opts.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -434,14 +428,17 @@ <ClCompile Include="src\MHttpHeaders.cpp">
<Filter>Source Files\Netlib</Filter>
</ClCompile>
+ <ClCompile Include="src\findadd.cpp">
+ <Filter>Source Files\FindAdd</Filter>
+ </ClCompile>
+ <ClCompile Include="src\searchresults.cpp">
+ <Filter>Source Files\FindAdd</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\filter.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="src\findadd.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="src\FontService.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -499,6 +496,9 @@ <ClInclude Include="src\file.h">
<Filter>Source Files\File</Filter>
</ClInclude>
+ <ClInclude Include="src\findadd.h">
+ <Filter>Source Files\FindAdd</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="res\resource.rc">
@@ -546,5 +546,8 @@ <Filter Include="Source Files\File">
<UniqueIdentifier>{bf5fc3bb-4d3d-4237-a43b-94cb18041b25}</UniqueIdentifier>
</Filter>
+ <Filter Include="Source Files\FindAdd">
+ <UniqueIdentifier>{65ad8d13-2071-424c-b57a-436beaffbaa1}</UniqueIdentifier>
+ </Filter>
</ItemGroup>
</Project>
\ No newline at end of file diff --git a/src/mir_app/src/findadd.cpp b/src/mir_app/src/findadd.cpp index 3aa07ef97f..a7d49e656f 100644 --- a/src/mir_app/src/findadd.cpp +++ b/src/mir_app/src/findadd.cpp @@ -57,34 +57,38 @@ static int FindAddDlgResizer(HWND, LPARAM lParam, UTILRESIZECONTROL *urc) case IDC_PROTOIDGROUP: //the resize is always processed in template order
nextY = y = urc->rcItem.top;
- if (dat->showProtoId) nextY = y + urc->rcItem.bottom - urc->rcItem.top + 7;
+ if (dat->bShowProtoId)
+ nextY = y + urc->rcItem.bottom - urc->rcItem.top + 7;
break;
case IDC_EMAILGROUP:
oldTop = urc->rcItem.top;
y = nextY;
- if (dat->showEmail) nextY = y + urc->rcItem.bottom - urc->rcItem.top + 7;
+ if (dat->bShowEmail)
+ nextY = y + urc->rcItem.bottom - urc->rcItem.top + 7;
OffsetRect(&urc->rcItem, 0, y - oldTop);
return RD_ANCHORX_LEFT | RD_ANCHORY_CUSTOM;
case IDC_NAMEGROUP:
oldTop = urc->rcItem.top;
y = nextY;
- if (dat->showName) nextY = y + urc->rcItem.bottom - urc->rcItem.top + 7;
+ if (dat->bShowName)
+ nextY = y + urc->rcItem.bottom - urc->rcItem.top + 7;
OffsetRect(&urc->rcItem, 0, y - oldTop);
return RD_ANCHORX_LEFT | RD_ANCHORY_CUSTOM;
case IDC_ADVANCEDGROUP:
oldTop = urc->rcItem.top;
y = nextY;
- if (dat->showAdvanced) nextY = y + urc->rcItem.bottom - urc->rcItem.top + 7;
+ if (dat->bShowAdvanced)
+ nextY = y + urc->rcItem.bottom - urc->rcItem.top + 7;
OffsetRect(&urc->rcItem, 0, y - oldTop);
return RD_ANCHORX_LEFT | RD_ANCHORY_CUSTOM;
case IDC_TINYEXTENDEDGROUP:
oldTop = urc->rcItem.top;
y = nextY;
- if (dat->showTiny) {
+ if (dat->bShowTiny) {
int height = urc->dlgNewSize.cy - y - (urc->dlgOriginalSize.cy - urc->rcItem.bottom);
nextY = y + 200; //min height for custom dialog
urc->rcItem.top = urc->rcItem.bottom - height;
@@ -260,7 +264,7 @@ static void ShowTinySearchDlg(HWND hwndDlg, FindAddDlgData *dat) if (dat->hwndTinySearch)
ReposTinySearchDlg(hwndDlg, dat);
else
- dat->showTiny = false;
+ dat->bShowTiny = false;
}
ShowWindow(dat->hwndTinySearch, SW_SHOW);
}
@@ -466,31 +470,23 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP return 0;
case M_SETGROUPVISIBILITIES:
- dat->showAdvanced = dat->showEmail = dat->showName = dat->showProtoId = dat->showTiny = 0;
+ dat->bShowAdvanced = dat->bShowEmail = dat->bShowName = dat->bShowProtoId = dat->bShowTiny = false;
{
char *szProto = (char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), 0);
if (szProto == (char *)CB_ERR)
break;
+
if (szProto == nullptr) {
- for (auto &pa : g_arAccounts) {
- if (pa->IsEnabled()) {
- uint32_t protoCaps = (uint32_t)CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1);
- if (protoCaps & PF1_SEARCHBYEMAIL) dat->showEmail = 1;
- if (protoCaps & PF1_SEARCHBYNAME) dat->showName = 1;
- }
- }
+ for (auto &pa : g_arAccounts)
+ if (pa->IsEnabled())
+ dat->proto2show(pa->szModuleName);
+
+ if (dat->bShowProtoId)
+ SetDlgItemTextW(hwndDlg, IDC_BYPROTOID, TranslateT("Unique ID"));
}
else {
- uint32_t protoCaps = (uint32_t)CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1);
- if (protoCaps & PF1_BASICSEARCH) dat->showProtoId = 1;
- if (protoCaps & PF1_SEARCHBYEMAIL) dat->showEmail = 1;
- if (protoCaps & PF1_SEARCHBYNAME) dat->showName = 1;
-
- if (protoCaps & PF1_EXTSEARCHUI) dat->showAdvanced = 1;
- else if (protoCaps & PF1_EXTSEARCH) dat->showTiny = 1;
-
- if (protoCaps & PF1_USERIDISEMAIL && dat->showProtoId) { dat->showProtoId = 0; dat->showEmail = 1; }
- if (dat->showProtoId) {
+ auto protoCaps = dat->proto2show(szProto);
+ if (dat->bShowProtoId) {
wchar_t *wszUniqueId = (wchar_t *)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT);
if (wszUniqueId)
SetDlgItemTextW(hwndDlg, IDC_BYPROTOID, wszUniqueId);
@@ -504,14 +500,14 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP }
}
- if (dat->showTiny)
+ if (dat->bShowTiny)
ShowTinySearchDlg(hwndDlg, dat);
else if (dat->hwndTinySearch) {
DestroyWindow(dat->hwndTinySearch);
dat->hwndTinySearch = nullptr;
}
-#define en(id, t) ShowWindow( GetDlgItem(hwndDlg, IDC_##id), dat->show##t?SW_SHOW:SW_HIDE)
+#define en(id, t) ShowWindow( GetDlgItem(hwndDlg, IDC_##id), dat->bShow##t?SW_SHOW:SW_HIDE)
en(PROTOIDGROUP, ProtoId); en(BYPROTOID, ProtoId); en(PROTOID, ProtoId);
en(EMAILGROUP, Email); en(BYEMAIL, Email); en(EMAIL, Email);
en(NAMEGROUP, Name); en(BYNAME, Name);
@@ -521,17 +517,17 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP en(ADVANCEDGROUP, Advanced); en(BYADVANCED, Advanced); en(ADVANCED, Advanced);
en(BYCUSTOM, Tiny); en(TINYEXTENDEDGROUP, Tiny);
#undef en
- int checkmarkVisible = (dat->showAdvanced && IsDlgButtonChecked(hwndDlg, IDC_BYADVANCED)) ||
- (dat->showEmail && IsDlgButtonChecked(hwndDlg, IDC_BYEMAIL)) ||
- (dat->showTiny && IsDlgButtonChecked(hwndDlg, IDC_BYCUSTOM)) ||
- (dat->showName && IsDlgButtonChecked(hwndDlg, IDC_BYNAME)) ||
- (dat->showProtoId && IsDlgButtonChecked(hwndDlg, IDC_BYPROTOID));
+ int checkmarkVisible = (dat->bShowAdvanced && IsDlgButtonChecked(hwndDlg, IDC_BYADVANCED)) ||
+ (dat->bShowEmail && IsDlgButtonChecked(hwndDlg, IDC_BYEMAIL)) ||
+ (dat->bShowTiny && IsDlgButtonChecked(hwndDlg, IDC_BYCUSTOM)) ||
+ (dat->bShowName && IsDlgButtonChecked(hwndDlg, IDC_BYNAME)) ||
+ (dat->bShowProtoId && IsDlgButtonChecked(hwndDlg, IDC_BYPROTOID));
if (!checkmarkVisible) {
- if (dat->showProtoId) CheckSearchTypeRadioButton(hwndDlg, IDC_BYPROTOID);
- else if (dat->showEmail) CheckSearchTypeRadioButton(hwndDlg, IDC_BYEMAIL);
- else if (dat->showName) CheckSearchTypeRadioButton(hwndDlg, IDC_BYNAME);
- else if (dat->showAdvanced) CheckSearchTypeRadioButton(hwndDlg, IDC_BYADVANCED);
- else if (dat->showTiny) CheckSearchTypeRadioButton(hwndDlg, IDC_BYCUSTOM);
+ if (dat->bShowProtoId) CheckSearchTypeRadioButton(hwndDlg, IDC_BYPROTOID);
+ else if (dat->bShowEmail) CheckSearchTypeRadioButton(hwndDlg, IDC_BYEMAIL);
+ else if (dat->bShowName) CheckSearchTypeRadioButton(hwndDlg, IDC_BYNAME);
+ else if (dat->bShowAdvanced) CheckSearchTypeRadioButton(hwndDlg, IDC_BYADVANCED);
+ else if (dat->bShowTiny) CheckSearchTypeRadioButton(hwndDlg, IDC_BYCUSTOM);
}
SendMessage(hwndDlg, WM_SIZE, 0, 0);
diff --git a/src/mir_app/src/findadd.h b/src/mir_app/src/findadd.h index 985b372c97..d91f1d89ec 100644 --- a/src/mir_app/src/findadd.h +++ b/src/mir_app/src/findadd.h @@ -44,7 +44,6 @@ struct FindAddDlgData int bSortAscending;
int iLastColumnSortIndex;
HIMAGELIST himlComboIcons;
- int showProtoId, showEmail, showName, showAdvanced, showTiny;
int minDlgHeight;
int notSearchedYet;
struct ProtoSearchInfo *search;
@@ -53,7 +52,24 @@ struct FindAddDlgData int pivot;
HWND hwndAdvSearch;
HWND hwndTinySearch;
- BOOL bFlexSearchResult;
+ bool bFlexSearchResult, bShowProtoId, bShowEmail, bShowName, bShowAdvanced, bShowTiny;
+
+ uint32_t proto2show(const char *szProto)
+ {
+ uint32_t protoCaps = (uint32_t)CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1);
+ if (protoCaps & PF1_BASICSEARCH) bShowProtoId = 1;
+ if (protoCaps & PF1_SEARCHBYEMAIL) bShowEmail = 1;
+ if (protoCaps & PF1_SEARCHBYNAME) bShowName = 1;
+
+ if (protoCaps & PF1_EXTSEARCHUI) bShowAdvanced = 1;
+ else if (protoCaps & PF1_EXTSEARCH) bShowTiny = 1;
+
+ if (protoCaps & PF1_USERIDISEMAIL && bShowProtoId) {
+ bShowProtoId = 0;
+ bShowEmail = 1;
+ }
+ return protoCaps;
+ }
};
int CALLBACK SearchResultsCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
|