diff options
author | George Hazan <ghazan@miranda.im> | 2020-06-10 22:02:52 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-06-10 22:02:52 +0300 |
commit | 210acddc8bc8d48c7a3d71c09db0eed3f5a9c2b0 (patch) | |
tree | 2a1041f133ed8884f7f979ea085482f245bd85fc | |
parent | a5f518e4cbfd3b47c62d2ef5b524ae1252af9e35 (diff) |
fixes #2438 (Jabber: списки приватности странно себя ведут) + some another DoModal() calls cleaning
-rw-r--r-- | plugins/Dbx_mdbx/src/dbcrypt.cpp | 2 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/options.cpp | 11 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_privacy.cpp | 52 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_chatrooms.cpp | 3 | ||||
-rw-r--r-- | protocols/Steam/src/steam_login.cpp | 6 | ||||
-rw-r--r-- | src/mir_app/src/db_ini.cpp | 16 | ||||
-rw-r--r-- | src/mir_app/src/proto_opts.cpp | 2 |
7 files changed, 47 insertions, 45 deletions
diff --git a/plugins/Dbx_mdbx/src/dbcrypt.cpp b/plugins/Dbx_mdbx/src/dbcrypt.cpp index 1b22fa6618..037cd655dc 100644 --- a/plugins/Dbx_mdbx/src/dbcrypt.cpp +++ b/plugins/Dbx_mdbx/src/dbcrypt.cpp @@ -233,7 +233,7 @@ int CDbxMDBX::InitCrypt() if (!m_crypto->setKey((const BYTE*)value.iov_base, value.iov_len)) {
CEnterPasswordDialog dlg(this);
while (true) {
- if (dlg.DoModal() != IDOK)
+ if (!dlg.DoModal())
return 4;
m_crypto->setPassword(pass_ptrA(mir_utf8encodeW(dlg.m_newPass)));
diff --git a/protocols/ICQ-WIM/src/options.cpp b/protocols/ICQ-WIM/src/options.cpp index 649f70efef..bf9426e790 100644 --- a/protocols/ICQ-WIM/src/options.cpp +++ b/protocols/ICQ-WIM/src/options.cpp @@ -35,6 +35,7 @@ public: bool OnInitDialog() override { + m_proto->m_bDlgActive = true; chkSave.SetState(m_proto->getBool("RememberPass")); Window_SetIcon_IcoLib(m_hwnd, m_proto->m_hProtoIcon); return true; @@ -47,6 +48,11 @@ public: EndModal(true); return true; } + + void OnDestroy() override + { + m_proto->m_bDlgActive = false; + } }; bool CIcqProto::RetrievePassword() @@ -67,10 +73,7 @@ bool CIcqProto::RetrievePassword() if (m_bDlgActive) return false; - m_bDlgActive = true; - bool bRet = CIcqEnterLoginDlg(this).DoModal() == IDOK; - m_bDlgActive = false; - return bRet; + return CIcqEnterLoginDlg(this).DoModal(); } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp index 5c9cfb9eff..9a415c336c 100644 --- a/protocols/JabberG/src/jabber_privacy.cpp +++ b/protocols/JabberG/src/jabber_privacy.cpp @@ -1666,8 +1666,7 @@ public: CPrivacyList *pList = GetSelectedList(m_hwnd);
if (pList && pRule) {
CJabberDlgPrivacyRule dlgPrivacyRule(m_proto, m_hwnd, pRule);
- int nResult = dlgPrivacyRule.DoModal();
- if (nResult) {
+ if (dlgPrivacyRule.DoModal()) {
pList->SetModified();
::PostMessage(m_hwnd, WM_PROTO_REFRESH, 0, 0);
}
@@ -1683,8 +1682,7 @@ public: if (pList) {
CPrivacyListRule* pRule = new CPrivacyListRule(m_proto, Jid, "", FALSE);
CJabberDlgPrivacyRule dlgPrivacyRule(m_proto, m_hwnd, pRule);
- int nResult = dlgPrivacyRule.DoModal();
- if (nResult) {
+ if (dlgPrivacyRule.DoModal()) {
pList->AddRule(pRule);
pList->Reorder();
pList->SetModified();
@@ -1752,35 +1750,36 @@ public: // FIXME: line length is hard coded in dialog procedure
CJabberDlgPrivacyAddList dlgPrivacyAddList(m_proto, m_hwnd);
int nRetVal = dlgPrivacyAddList.DoModal();
- if (nRetVal && mir_strlen(dlgPrivacyAddList.szLine)) {
- mir_cslockfull lck(m_proto->m_privacyListManager.m_cs);
-
- CPrivacyList *pList = m_proto->m_privacyListManager.FindList(dlgPrivacyAddList.szLine);
- if (pList == nullptr) {
- m_proto->m_privacyListManager.AddList(dlgPrivacyAddList.szLine);
- pList = m_proto->m_privacyListManager.FindList(dlgPrivacyAddList.szLine);
- if (pList) {
- pList->SetModified(TRUE);
- pList->SetLoaded(TRUE);
- }
- }
- if (pList)
- pList->SetDeleted(FALSE);
- int nSelected = SendDlgItemMessage(m_hwnd, IDC_LB_LISTS, LB_SELECTSTRING, -1, (LPARAM)dlgPrivacyAddList.szLine);
- if (nSelected == CB_ERR) {
- nSelected = SendDlgItemMessage(m_hwnd, IDC_LB_LISTS, LB_ADDSTRING, 0, (LPARAM)dlgPrivacyAddList.szLine);
- SendDlgItemMessage(m_hwnd, IDC_LB_LISTS, LB_SETITEMDATA, nSelected, (LPARAM)pList);
- SendDlgItemMessage(m_hwnd, IDC_LB_LISTS, LB_SETCURSEL, nSelected, 0);
+ if (!nRetVal || !mir_strlen(dlgPrivacyAddList.szLine))
+ return;
+
+ mir_cslock lck(m_proto->m_privacyListManager.m_cs);
+
+ CPrivacyList *pList = m_proto->m_privacyListManager.FindList(dlgPrivacyAddList.szLine);
+ if (pList == nullptr) {
+ m_proto->m_privacyListManager.AddList(dlgPrivacyAddList.szLine);
+ pList = m_proto->m_privacyListManager.FindList(dlgPrivacyAddList.szLine);
+ if (pList) {
+ pList->SetModified(TRUE);
+ pList->SetLoaded(TRUE);
}
+ }
+ if (pList)
+ pList->SetDeleted(FALSE);
- lck.unlock();
- PostMessage(m_hwnd, WM_PROTO_REFRESH, 0, 0);
+ int nSelected = SendDlgItemMessage(m_hwnd, IDC_LB_LISTS, LB_SELECTSTRING, -1, (LPARAM)dlgPrivacyAddList.szLine);
+ if (nSelected == CB_ERR) {
+ nSelected = SendDlgItemMessage(m_hwnd, IDC_LB_LISTS, LB_ADDSTRING, 0, (LPARAM)dlgPrivacyAddList.szLine);
+ SendDlgItemMessage(m_hwnd, IDC_LB_LISTS, LB_SETITEMDATA, nSelected, (LPARAM)pList);
+ SendDlgItemMessage(m_hwnd, IDC_LB_LISTS, LB_SETCURSEL, nSelected, 0);
}
+
+ PostMessage(m_hwnd, WM_PROTO_REFRESH, 0, 0);
}
void btnRemoveList_OnClick(CCtrlButton*)
{
- mir_cslockfull lck(m_proto->m_privacyListManager.m_cs);
+ mir_cslock lck(m_proto->m_privacyListManager.m_cs);
CPrivacyList *pList = GetSelectedList(m_hwnd);
if (pList) {
@@ -1795,7 +1794,6 @@ public: pList->SetModified();
}
- lck.unlock();
PostMessage(m_hwnd, WM_PROTO_REFRESH, 0, 0);
}
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 4034dddfa0..5afffbceac 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -117,10 +117,9 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam) case 10:
{
CSkypeInviteDlg dlg(this);
- if (dlg.DoModal()) {
+ if (dlg.DoModal())
if (dlg.m_hContact != NULL)
PushRequest(new InviteUserToChatRequest(chat_id, getId(dlg.m_hContact), "User"));
- }
}
break;
diff --git a/protocols/Steam/src/steam_login.cpp b/protocols/Steam/src/steam_login.cpp index b0bccc5d45..37e046c262 100644 --- a/protocols/Steam/src/steam_login.cpp +++ b/protocols/Steam/src/steam_login.cpp @@ -119,7 +119,7 @@ void CSteamProto::OnGotCaptcha(const HttpResponse &response, void *arg) } CSteamCaptchaDialog captchaDialog(this, response.Content, response.Content.size()); - if (captchaDialog.DoModal() != DIALOG_RESULT_OK) { + if (!captchaDialog.DoModal()) { DeleteAuthSettings(); SetStatus(ID_STATUS_OFFLINE); return; @@ -191,7 +191,7 @@ void CSteamProto::OnAuthorizationError(const JSONNode &root) delSetting("TwoFactorCode"); CSteamTwoFactorDialog twoFactorDialog(this); - if (twoFactorDialog.DoModal() != DIALOG_RESULT_OK) { + if (!twoFactorDialog.DoModal()) { DeleteAuthSettings(); SetStatus(ID_STATUS_OFFLINE); return; @@ -223,7 +223,7 @@ void CSteamProto::OnAuthorizationError(const JSONNode &root) return; CSteamGuardDialog guardDialog(this, domain.c_str()); - if (guardDialog.DoModal() != DIALOG_RESULT_OK) { + if (!guardDialog.DoModal()) { DeleteAuthSettings(); SetStatus(ID_STATUS_OFFLINE); return; diff --git a/src/mir_app/src/db_ini.cpp b/src/mir_app/src/db_ini.cpp index 31d65c2627..2580d8eb3d 100644 --- a/src/mir_app/src/db_ini.cpp +++ b/src/mir_app/src/db_ini.cpp @@ -46,16 +46,17 @@ protected: m_iniName.SetText(m_szIniPath);
wchar_t szSecurity[11];
- const wchar_t *pszSecurityInfo;
-
Profile_GetSetting(L"AutoExec/Warn", szSecurity, L"notsafe");
+
+ const wchar_t *pszSecurityInfo;
if (!mir_wstrcmpi(szSecurity, L"all"))
pszSecurityInfo = LPGENW("Security systems to prevent malicious changes are in place and you will be warned before every change that is made.");
else if (!mir_wstrcmpi(szSecurity, L"onlyunsafe"))
pszSecurityInfo = LPGENW("Security systems to prevent malicious changes are in place and you will be warned before changes that are known to be unsafe.");
else if (!mir_wstrcmpi(szSecurity, L"none"))
pszSecurityInfo = LPGENW("Security systems to prevent malicious changes have been disabled. You will receive no further warnings.");
- else pszSecurityInfo = nullptr;
+ else
+ pszSecurityInfo = nullptr;
if (pszSecurityInfo)
m_securityInfo.SetText(TranslateW(pszSecurityInfo));
@@ -70,7 +71,7 @@ protected: void NoToAll_OnClick(CCtrlBase*)
{
- Close();
+ EndModal(IDC_NOTOALL);
}
public:
@@ -135,13 +136,14 @@ protected: bool OnInitDialog() override
{
char szSettingName[256];
- const wchar_t *pszSecurityInfo;
m_iniName.SetText(m_warnInfo->szIniPath);
mir_strcpy(szSettingName, m_warnInfo->szSection);
mir_strcat(szSettingName, " / ");
mir_strcat(szSettingName, m_warnInfo->szName);
m_settingName.SetTextA(szSettingName);
m_newValue.SetTextA(m_warnInfo->szValue);
+
+ const wchar_t *pszSecurityInfo;
if (IsInSpaceSeparatedList(m_warnInfo->szSection, m_warnInfo->szSafeSections))
pszSecurityInfo = LPGENW("This change is known to be safe.");
else if (IsInSpaceSeparatedList(m_warnInfo->szSection, m_warnInfo->szUnsafeSections))
@@ -158,9 +160,9 @@ protected: m_warnInfo->warnNoMore = m_noWarn.GetState();
}
- void YesNo_OnClick(CCtrlBase*)
+ void YesNo_OnClick(CCtrlBase *pButton)
{
- Close();
+ EndModal(pButton->GetCtrlId());
}
public:
diff --git a/src/mir_app/src/proto_opts.cpp b/src/mir_app/src/proto_opts.cpp index ba09d8cf6f..1f5913d960 100644 --- a/src/mir_app/src/proto_opts.cpp +++ b/src/mir_app/src/proto_opts.cpp @@ -489,7 +489,7 @@ public: void OnAdd(CCtrlButton*)
{
- if (IDOK == CAccountFormDlg(this, PRAC_ADDED, nullptr).DoModal()) {
+ if (CAccountFormDlg(this, PRAC_ADDED, nullptr).DoModal()) {
m_iPrevSel = -1;
Refresh();
}
|