From 54a9d50daf120ec738ecba5cc9541e992e800407 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 3 Feb 2023 19:45:48 +0300 Subject: Telegram: fix for options --- protocols/Telegram/src/options.cpp | 18 ++++++++++++++++-- protocols/Telegram/src/resource.h | 3 ++- 2 files changed, 18 insertions(+), 3 deletions(-) (limited to 'protocols/Telegram/src') diff --git a/protocols/Telegram/src/options.cpp b/protocols/Telegram/src/options.cpp index e66da19f0c..d3823c1df1 100644 --- a/protocols/Telegram/src/options.cpp +++ b/protocols/Telegram/src/options.cpp @@ -44,6 +44,8 @@ public: if (bFullDlg) CreateLink(chkUsePopups, ppro->m_bUsePopups); + + cmbCountry.OnChange = Callback(this, &COptionsDlg::onChange_Country); } bool OnInitDialog() override @@ -58,14 +60,15 @@ public: if (countryCode == m_proto->m_iCountry) cmbCountry.SetCurSel(idx); } - + + onChange_Country(0); return true; } bool OnApply() override { int iCountry = cmbCountry.GetCurData(); - if (iCountry == 9999 || mir_wstrlen(m_proto->m_szOwnPhone)) { + if (iCountry == 9999 || !mir_wstrlen(m_proto->m_szOwnPhone)) { SetFocus(edtPhone.GetHwnd()); return false; } @@ -76,6 +79,17 @@ public: Clist_GroupCreate(0, m_proto->m_wszDefaultGroup); return true; } + + void onChange_Country(CCtrlCombo *) + { + CMStringA buf; + int iCode = cmbCountry.GetCurData(); + if (iCode == 9999) + buf = "---"; + else + buf.Format("+%d", iCode); + SetDlgItemTextA(m_hwnd, IDC_CODE, buf); + } }; ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/protocols/Telegram/src/resource.h b/protocols/Telegram/src/resource.h index 4c8deb0dcd..5e63e34081 100644 --- a/protocols/Telegram/src/resource.h +++ b/protocols/Telegram/src/resource.h @@ -20,6 +20,7 @@ #define IDC_STATUS1 1010 #define IDC_STATUS2 1011 #define IDC_COUNTRY 1012 +#define IDC_CODE 1013 // Next default values for new objects // @@ -27,7 +28,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 106 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1013 +#define _APS_NEXT_CONTROL_VALUE 1014 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif -- cgit v1.2.3