From ff741d4148025ccb9d62a4dba9ebba4c7da34b5a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 8 Oct 2023 18:43:47 +0300 Subject: =?UTF-8?q?fixes=20#3715=20(YAMN:=20=D0=BD=D0=B5=D0=B2=D0=BE=D0=B7?= =?UTF-8?q?=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE=20=D0=B2=D1=8B=D0=B1=D1=80=D0=B0?= =?UTF-8?q?=D1=82=D1=8C=20=D0=BF=D1=80=D0=B8=D0=BB=D0=BE=D0=B6=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=B4=D0=BB=D1=8F=20=D0=B7=D0=B0=D0=BF=D1=83?= =?UTF-8?q?=D1=81=D0=BA=D0=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/YAMN/src/proto/pop3/pop3opt.cpp | 50 +++++++++++-------------------- 1 file changed, 18 insertions(+), 32 deletions(-) (limited to 'protocols/YAMN/src/proto/pop3') diff --git a/protocols/YAMN/src/proto/pop3/pop3opt.cpp b/protocols/YAMN/src/proto/pop3/pop3opt.cpp index 5966cc84cf..8f36604033 100644 --- a/protocols/YAMN/src/proto/pop3/pop3opt.cpp +++ b/protocols/YAMN/src/proto/pop3/pop3opt.cpp @@ -270,14 +270,10 @@ class CAccOptDlg : public CBaseOptionsDlg EnableWindow(GetDlgItem(m_hwnd, IDC_CHECKICO), bEnable); EnableWindow(GetDlgItem(m_hwnd, IDC_CHECKAPP), bEnable); EnableWindow(GetDlgItem(m_hwnd, IDC_CHECKKBN), bEnable); - EnableWindow(GetDlgItem(m_hwnd, IDC_BTNAPP), chkApp.IsChecked() && bEnable); - EnableWindow(GetDlgItem(m_hwnd, IDC_EDITAPP), chkApp.IsChecked() && bEnable); - EnableWindow(GetDlgItem(m_hwnd, IDC_EDITAPPPARAM), chkApp.IsChecked() && bEnable); EnableWindow(GetDlgItem(m_hwnd, IDC_CHECKNMSGP), bEnable); EnableWindow(GetDlgItem(m_hwnd, IDC_CHECKFSND), bEnable); EnableWindow(GetDlgItem(m_hwnd, IDC_CHECKFMSG), bEnable); EnableWindow(GetDlgItem(m_hwnd, IDC_CHECKFICO), bEnable); - EnableWindow(GetDlgItem(m_hwnd, IDC_CHECKSTART), bEnable); EnableWindow(GetDlgItem(m_hwnd, IDC_CHECKFORCE), bEnable); EnableWindow(GetDlgItem(m_hwnd, IDC_COMBOCP), bEnable); @@ -287,11 +283,19 @@ class CAccOptDlg : public CBaseOptionsDlg EnableWindow(GetDlgItem(m_hwnd, IDC_BTNSTATUS), bEnable); EnableWindow(GetDlgItem(m_hwnd, IDC_CHECKSSL), bEnable); EnableWindow(GetDlgItem(m_hwnd, IDC_CHECKAPOP), bEnable); - EnableWindow(GetDlgItem(m_hwnd, IDC_CHECKNOTLS), chkSsl.IsChecked() && bEnable); EnableWindow(GetDlgItem(m_hwnd, IDC_AUTOBODY), bEnable); EnableWindow(GetDlgItem(m_hwnd, IDC_CHECKCONTACT), bEnable); - EnableWindow(GetDlgItem(m_hwnd, IDC_CHECKCONTACTNICK), chkContact.IsChecked() && bEnable); - EnableWindow(GetDlgItem(m_hwnd, IDC_CHECKCONTACTNOEVENT), chkContact.IsChecked() && bEnable); + + EnableWindow(GetDlgItem(m_hwnd, IDC_CHECKNOTLS), chkSsl.IsChecked() && bEnable); + + bool bContactEnabled = chkContact.IsChecked() && bEnable; + EnableWindow(GetDlgItem(m_hwnd, IDC_CHECKCONTACTNICK), bContactEnabled); + EnableWindow(GetDlgItem(m_hwnd, IDC_CHECKCONTACTNOEVENT), bContactEnabled); + + bool bAppEnabled = chkApp.IsChecked() && bEnable; + EnableWindow(GetDlgItem(m_hwnd, IDC_BTNAPP), bAppEnabled); + EnableWindow(GetDlgItem(m_hwnd, IDC_EDITAPP), bAppEnabled); + EnableWindow(GetDlgItem(m_hwnd, IDC_EDITAPPPARAM), bAppEnabled); } public: @@ -312,7 +316,6 @@ public: cmbCP.OnSelChanged = Callback(this, &CAccOptDlg::onSelChange_CP); cmbAccount.OnChange = Callback(this, &CAccOptDlg::onChange_Account); - cmbAccount.OnKillFocus = Callback(this, &CAccOptDlg::onKillFocus_Account); cmbAccount.OnSelChanged = Callback(this, &CAccOptDlg::onSelChange_Account); chkApp.OnChange = Callback(this, &CAccOptDlg::onChangeApp); @@ -329,10 +332,7 @@ public: bool OnInitDialog() override { - EnableWindow(GetDlgItem(m_hwnd, IDC_BTNDEL), FALSE); - - DlgEnableAccount(false); - DlgShowAccount(0); + btnDel.Disable(); // Fill accounts { SReadGuard srb(POP3Plugin->AccountBrowserSO); @@ -341,6 +341,7 @@ public: cmbAccount.AddStringA(ActualAccount->Name); } cmbAccount.SetCurSel(0); + onSelChange_Account(0); // Fill code pages cmbCP.AddString(TranslateT("Default")); @@ -398,21 +399,6 @@ public: DlgEnableAccount(0 != GetDlgItemTextA(m_hwnd, IDC_COMBOACCOUNT, DlgInput, _countof(DlgInput))); } - void onKillFocus_Account(CCtrlCombo *) - { - GetDlgItemTextA(m_hwnd, IDC_COMBOACCOUNT, DlgInput, _countof(DlgInput)); - if (nullptr == (ActualAccount = (CPOP3Account*)FindAccountByName(POP3Plugin, DlgInput))) { - DlgSetItemText(m_hwnd, (WPARAM)IDC_STTIMELEFT, nullptr); - EnableWindow(GetDlgItem(m_hwnd, IDC_BTNDEL), FALSE); - DlgEnableAccount(mir_strlen(DlgInput) > 0); - } - else { - DlgShowAccount(ActualAccount); - DlgEnableAccount(true); - EnableWindow(GetDlgItem(m_hwnd, IDC_BTNDEL), TRUE); - } - } - void onSelChange_Account(CCtrlCombo *) { if (CB_ERR != (Result = cmbAccount.GetCurSel())) @@ -420,12 +406,12 @@ public: if ((Result == CB_ERR) || (nullptr == (ActualAccount = (CPOP3Account*)FindAccountByName(POP3Plugin, DlgInput)))) { DlgSetItemText(m_hwnd, (WPARAM)IDC_STTIMELEFT, nullptr); - EnableWindow(GetDlgItem(m_hwnd, IDC_BTNDEL), FALSE); + btnDel.Disable(); } else { DlgShowAccount(ActualAccount); DlgEnableAccount(true); - EnableWindow(GetDlgItem(m_hwnd, IDC_BTNDEL), TRUE); + btnDel.Enable(); } } @@ -468,7 +454,7 @@ public: DlgSetItemText(m_hwnd, (WPARAM)IDC_STTIMELEFT, nullptr); DlgShowAccount(0); DlgEnableAccount(true); - EnableWindow(GetDlgItem(m_hwnd, IDC_BTNDEL), FALSE); + btnDel.Disable(); DlgSetItemTextW(m_hwnd, IDC_EDITNAME, TranslateT("New Account")); int index = SendDlgItemMessage(m_hwnd, IDC_COMBOACCOUNT, CB_ADDSTRING, 0, (LPARAM)TranslateT("New Account")); @@ -508,7 +494,7 @@ public: void onClick_Del(CCtrlButton *) { GetDlgItemTextA(m_hwnd, IDC_COMBOACCOUNT, DlgInput, _countof(DlgInput)); - EnableWindow(GetDlgItem(m_hwnd, IDC_BTNDEL), FALSE); + btnDel.Disable(); if ((CB_ERR == (Result = SendDlgItemMessage(m_hwnd, IDC_COMBOACCOUNT, CB_GETCURSEL, 0, 0))) || (nullptr == (ActualAccount = (CPOP3Account*)FindAccountByName(POP3Plugin, DlgInput)))) return; @@ -698,7 +684,7 @@ public: (ActualAccount->BadConnectN.Flags & YAMN_ACC_POPC); } } - EnableWindow(GetDlgItem(m_hwnd, IDC_BTNDEL), TRUE); + btnDel.Enable(); DlgSetItemText(m_hwnd, (WPARAM)IDC_STTIMELEFT, nullptr); -- cgit v1.2.3