summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-02-03 19:45:48 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-02-03 19:45:48 +0300
commit54a9d50daf120ec738ecba5cc9541e992e800407 (patch)
tree4af1fa92b0c7af6583077ad220eca2c296eb351f
parent97aaa26b16121281291acf58c26e1032a24d85bf (diff)
Telegram: fix for options
-rw-r--r--protocols/Telegram/res/resource.rc23
-rw-r--r--protocols/Telegram/src/options.cpp18
-rw-r--r--protocols/Telegram/src/resource.h3
3 files changed, 31 insertions, 13 deletions
diff --git a/protocols/Telegram/res/resource.rc b/protocols/Telegram/res/resource.rc
index 1fff0c80ce..34e18a009d 100644
--- a/protocols/Telegram/res/resource.rc
+++ b/protocols/Telegram/res/resource.rc
@@ -65,10 +65,11 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 400, 0, 0x0
BEGIN
- LTEXT "Country",IDC_STATIC,0,8,89,8
+ LTEXT "Country:",IDC_STATIC,0,8,89,8
COMBOBOX IDC_COUNTRY,96,5,86,12,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+ RTEXT "",IDC_CODE,95,22,23,13,0,WS_EX_CLIENTEDGE
LTEXT "Phone number:",IDC_STATIC,0,25,89,10
- EDITTEXT IDC_PHONE,96,22,86,12,ES_AUTOHSCROLL
+ EDITTEXT IDC_PHONE,122,22,58,12,ES_AUTOHSCROLL
LTEXT "Default group:",IDC_STATIC,0,42,89,10
EDITTEXT IDC_DEFGROUP,96,39,86,12,ES_AUTOHSCROLL
LTEXT "Device name:",IDC_STATIC,0,59,89,10
@@ -82,15 +83,17 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- LTEXT "Phone number:",IDC_STATIC,5,6,79,10
- COMBOBOX IDC_COUNTRY,88,5,103,12,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
- EDITTEXT IDC_PHONE,195,5,103,12,ES_AUTOHSCROLL
- LTEXT "Default group:",IDC_STATIC,5,24,79,10
- EDITTEXT IDC_DEFGROUP,87,23,211,12,ES_AUTOHSCROLL
- LTEXT "Device name:",IDC_STATIC,5,43,79,10
- EDITTEXT IDC_DEVICE_NAME,87,41,211,12,ES_AUTOHSCROLL
+ LTEXT "Country:",IDC_STATIC,5,8,79,8
+ COMBOBOX IDC_COUNTRY,87,6,211,12,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+ LTEXT "Phone number:",IDC_STATIC,5,25,79,10
+ RTEXT "",IDC_CODE,88,24,32,13,0,WS_EX_CLIENTEDGE
+ EDITTEXT IDC_PHONE,126,24,172,12,ES_AUTOHSCROLL
+ LTEXT "Default group:",IDC_STATIC,5,43,79,10
+ EDITTEXT IDC_DEFGROUP,87,42,211,12,ES_AUTOHSCROLL
+ LTEXT "Device name:",IDC_STATIC,5,62,79,10
+ EDITTEXT IDC_DEVICE_NAME,87,60,211,12,ES_AUTOHSCROLL
CONTROL "Do not open chat windows on creation",IDC_HIDECHATS,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,64,294,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,83,294,10
END
IDD_OPTIONS_ADV DIALOGEX 0, 0, 310, 86
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