diff options
author | George Hazan <ghazan@miranda.im> | 2020-07-23 14:15:06 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-07-23 14:15:06 +0300 |
commit | bc8768c453fade64f20ff18c24092a41f94993a0 (patch) | |
tree | 908a832615b7dab0ff09c70d1c70e39bf3ff247e /src/mir_app | |
parent | db937fbda0117e8bec530e7deda7b94eea106e78 (diff) |
fixes #2493 (Проблема с Юникодом в диалоге добавления контакта)
Diffstat (limited to 'src/mir_app')
-rw-r--r-- | src/mir_app/src/findadd.cpp | 8 | ||||
-rw-r--r-- | src/mir_app/src/meta_services.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/proto_opts.cpp | 10 | ||||
-rw-r--r-- | src/mir_app/src/searchresults.cpp | 11 |
4 files changed, 13 insertions, 18 deletions
diff --git a/src/mir_app/src/findadd.cpp b/src/mir_app/src/findadd.cpp index 8b3ebfd63f..c4d33c788f 100644 --- a/src/mir_app/src/findadd.cpp +++ b/src/mir_app/src/findadd.cpp @@ -491,11 +491,11 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (protoCaps & PF1_USERIDISEMAIL && dat->showProtoId) { dat->showProtoId = 0; dat->showEmail = 1; } if (dat->showProtoId) { - char *szUniqueId = (char*)CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0); - if (szUniqueId) - SetDlgItemTextA(hwndDlg, IDC_BYPROTOID, szUniqueId); + wchar_t *wszUniqueId = (wchar_t *)CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0); + if (wszUniqueId) + SetDlgItemTextW(hwndDlg, IDC_BYPROTOID, wszUniqueId); else - SetDlgItemText(hwndDlg, IDC_BYPROTOID, TranslateT("Handle")); + SetDlgItemTextW(hwndDlg, IDC_BYPROTOID, TranslateT("Handle")); if (protoCaps & PF1_NUMERICUSERID) SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PROTOID), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PROTOID), GWL_STYLE) | ES_NUMBER); diff --git a/src/mir_app/src/meta_services.cpp b/src/mir_app/src/meta_services.cpp index 1e3560fd28..f8119452c3 100644 --- a/src/mir_app/src/meta_services.cpp +++ b/src/mir_app/src/meta_services.cpp @@ -71,7 +71,7 @@ INT_PTR Meta_GetCaps(WPARAM wParam, LPARAM) return 2000;
case PFLAG_UNIQUEIDTEXT:
- return (INT_PTR)"Metacontact";
+ return (INT_PTR)L"Metacontact";
}
return 0;
}
diff --git a/src/mir_app/src/proto_opts.cpp b/src/mir_app/src/proto_opts.cpp index 1f5913d960..969e9411ea 100644 --- a/src/mir_app/src/proto_opts.cpp +++ b/src/mir_app/src/proto_opts.cpp @@ -700,13 +700,15 @@ BOOL CAccountListCtrl::OnDrawItem(DRAWITEMSTRUCT *lps) lps->rcItem.top += sz.cy + 2;
if (acc->ppro && Proto_IsProtocolLoaded(acc->szProtoName)) {
- char *szIdName = (char *)acc->ppro->GetCaps(PFLAG_UNIQUEIDTEXT, 0);
- ptrW tszIdName(szIdName ? mir_a2u(szIdName) : mir_wstrdup(TranslateT("Account ID")));
+ wchar_t *wszIdName = (wchar_t *)acc->ppro->GetCaps(PFLAG_UNIQUEIDTEXT, 0);
+ if (wszIdName == nullptr)
+ wszIdName = TranslateT("Account ID");
+
ptrW tszUniqueID(Contact_GetInfo(CNF_UNIQUEID, 0, acc->szModuleName));
if (tszUniqueID != nullptr)
- text.Format(L"%s: %s", tszIdName.get(), tszUniqueID.get());
+ text.Format(L"%s: %s", wszIdName, tszUniqueID.get());
else
- text.Format(L"%s: %s", tszIdName.get(), TranslateT("<unknown>"));
+ text.Format(L"%s: %s", wszIdName, TranslateT("<unknown>"));
}
else text.Format(TranslateT("Protocol is not loaded."));
diff --git a/src/mir_app/src/searchresults.cpp b/src/mir_app/src/searchresults.cpp index a904f7984d..38232205d1 100644 --- a/src/mir_app/src/searchresults.cpp +++ b/src/mir_app/src/searchresults.cpp @@ -66,8 +66,6 @@ void LoadColumnSizes(HWND hwndResults, const char *szProto) int columnOrder[NUM_COLUMNID];
bool colOrdersValid = true;
for (int i = 0; i < NUM_COLUMNID; i++) {
- bool bNeedsFree = false;
-
lvc.mask = LVCF_TEXT | LVCF_WIDTH;
if (szColumnNames[i] != nullptr)
lvc.pszText = TranslateW(szColumnNames[i]);
@@ -76,10 +74,8 @@ void LoadColumnSizes(HWND hwndResults, const char *szProto) lvc.pszText = L"ID";
if (szProto) {
INT_PTR ret = CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0);
- if (ret != CALLSERVICE_NOTFOUND) {
- bNeedsFree = true;
- lvc.pszText = mir_a2u((char*)ret);
- }
+ if (ret != CALLSERVICE_NOTFOUND)
+ lvc.pszText = (wchar_t*)ret;
}
}
else lvc.mask &= ~LVCF_TEXT;
@@ -90,9 +86,6 @@ void LoadColumnSizes(HWND hwndResults, const char *szProto) lvc.cx = db_get_w(0, "FindAdd", szSetting, defaultColumnSizes[i]);
ListView_InsertColumn(hwndResults, i, (LPARAM)&lvc);
- if (bNeedsFree)
- mir_free(lvc.pszText);
-
mir_snprintf(szSetting, "ColOrder%d", i);
columnOrder[i] = db_get_b(0, "FindAdd", szSetting, -1);
if (columnOrder[i] == -1 || columnOrder[i] >= NUM_COLUMNID)
|