summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/JabberG/res/jabber.rc4
-rw-r--r--protocols/JabberG/src/jabber_vcard.cpp50
2 files changed, 24 insertions, 30 deletions
diff --git a/protocols/JabberG/res/jabber.rc b/protocols/JabberG/res/jabber.rc
index 034d758c03..125cf58d12 100644
--- a/protocols/JabberG/res/jabber.rc
+++ b/protocols/JabberG/res/jabber.rc
@@ -218,7 +218,7 @@ BEGIN
LTEXT "ZIP:",IDC_STATIC,5,63,59,8
EDITTEXT IDC_ZIP,67,61,58,12,ES_AUTOHSCROLL
LTEXT "Country:",IDC_STATIC,5,77,59,8
- COMBOBOX IDC_COUNTRY,67,75,91,172,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_COUNTRY,67,75,91,172,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
END
IDD_VCARD_PERSONAL DIALOGEX 0, 0, 222, 132
@@ -269,7 +269,7 @@ BEGIN
LTEXT "ZIP:",IDC_STATIC,5,103,60,8
EDITTEXT IDC_ZIP,67,101,58,12,ES_AUTOHSCROLL
LTEXT "Country:",IDC_STATIC,5,116,60,8
- COMBOBOX IDC_COUNTRY,67,115,91,172,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_COUNTRY,67,115,91,172,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
END
IDD_VCARD_CONTACT DIALOGEX 0, 0, 222, 132
diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp
index aad0f8d9be..ff7f3e9212 100644
--- a/protocols/JabberG/src/jabber_vcard.cpp
+++ b/protocols/JabberG/src/jabber_vcard.cpp
@@ -165,22 +165,22 @@ struct JabberVcardPersonalDlg : public JabberVcardBaseDlg
/////////////////////////////////////////////////////////////////////////////////////////
// Home vcard dialog
-struct JabberVcardHomeDlg : public JabberVcardBaseDlg
+class JabberVcardHomeDlg : public JabberVcardBaseDlg
{
+ CCtrlCombo countries;
+
+public:
JabberVcardHomeDlg(CJabberProto *_ppro) :
- JabberVcardBaseDlg(_ppro, IDD_VCARD_HOME, 1)
+ JabberVcardBaseDlg(_ppro, IDD_VCARD_HOME, 1),
+ countries(this, IDC_COUNTRY)
{
}
bool OnInitDialog() override
{
- for (int i = 0; i < g_cbCountries; i++) {
- if (g_countries[i].id != 0xFFFF && g_countries[i].id != 0) {
- wchar_t *country = mir_a2u(g_countries[i].szName);
- SendDlgItemMessage(m_hwnd, IDC_COUNTRY, CB_ADDSTRING, 0, (LPARAM)TranslateW(country));
- mir_free(country);
- }
- }
+ for (int i = 0; i < g_cbCountries; i++)
+ if (g_countries[i].id != 0xFFFF && g_countries[i].id != 0)
+ countries.AddString(TranslateW(_A2T(g_countries[i].szName)), i);
return JabberVcardBaseDlg::OnInitDialog();
}
@@ -194,7 +194,7 @@ struct JabberVcardHomeDlg : public JabberVcardBaseDlg
SetDialogField(IDC_ZIP, "ZIP");
CMStringW buf(ppro->getMStringW("Country"));
- SendDlgItemMessage(m_hwnd, IDC_COUNTRY, CB_SELECTSTRING, -1, LPARAM(TranslateW(buf.c_str())));
+ countries.SelectString(TranslateW(buf.c_str()));
return false;
}
@@ -206,10 +206,7 @@ struct JabberVcardHomeDlg : public JabberVcardBaseDlg
SaveDialogField(IDC_STATE, "State");
SaveDialogField(IDC_ZIP, "ZIP");
- int i = SendDlgItemMessage(m_hwnd, IDC_COUNTRY, CB_GETCURSEL, 0, 0);
- wchar_t *country = mir_a2u((i) ? g_countries[i + 2].szName : g_countries[1].szName);
- ppro->setWString("Country", country);
- mir_free(country);
+ ppro->setWString("Country", _A2T(g_countries[countries.GetCurData()].szName));
return JabberVcardBaseDlg::OnApply();
}
@@ -218,22 +215,22 @@ struct JabberVcardHomeDlg : public JabberVcardBaseDlg
/////////////////////////////////////////////////////////////////////////////////////////
// Work vcard dialog
-struct JabberVcardWorkDlg : public JabberVcardBaseDlg
+class JabberVcardWorkDlg : public JabberVcardBaseDlg
{
+ CCtrlCombo countries;
+
+public:
JabberVcardWorkDlg(CJabberProto *_ppro) :
- JabberVcardBaseDlg(_ppro, IDD_VCARD_WORK, 2)
+ JabberVcardBaseDlg(_ppro, IDD_VCARD_WORK, 2),
+ countries(this, IDC_COUNTRY)
{
}
bool OnInitDialog() override
{
- for (int i = 0; i < g_cbCountries; i++) {
- if (g_countries[i].id != 0xFFFF && g_countries[i].id != 0) {
- wchar_t *country = mir_a2u(g_countries[i].szName);
- SendDlgItemMessage(m_hwnd, IDC_COUNTRY, CB_ADDSTRING, 0, (LPARAM)TranslateW(country));
- mir_free(country);
- }
- }
+ for (int i = 0; i < g_cbCountries; i++)
+ if (g_countries[i].id != 0xFFFF && g_countries[i].id != 0)
+ countries.AddString(TranslateW(_A2T(g_countries[i].szName)), i);
return JabberVcardBaseDlg::OnInitDialog();
}
@@ -250,7 +247,7 @@ struct JabberVcardWorkDlg : public JabberVcardBaseDlg
SetDialogField(IDC_ZIP, "CompanyZIP");
CMStringW buf(ppro->getMStringW("CompanyCountry"));
- SendDlgItemMessage(m_hwnd, IDC_COUNTRY, CB_SELECTSTRING, -1, LPARAM(TranslateW(buf.c_str())));
+ countries.SelectString(TranslateW(buf.c_str()));
return false;
}
@@ -265,10 +262,7 @@ struct JabberVcardWorkDlg : public JabberVcardBaseDlg
SaveDialogField(IDC_STATE, "CompanyState");
SaveDialogField(IDC_ZIP, "CompanyZIP");
- int i = SendDlgItemMessage(m_hwnd, IDC_COUNTRY, CB_GETCURSEL, 0, 0);
- wchar_t *country = mir_a2u((i) ? g_countries[i + 2].szName : g_countries[1].szName);
- ppro->setWString("CompanyCountry", country);
- mir_free(country);
+ ppro->setWString("CompanyCountry", _A2T(g_countries[countries.GetCurData()].szName));
return JabberVcardBaseDlg::OnApply();
}