diff options
author | George Hazan <ghazan@miranda.im> | 2020-06-04 17:03:28 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-06-04 17:03:28 +0300 |
commit | f531ff887729783a7fe7a3e12ad12f658eefc7b0 (patch) | |
tree | 9e1844429448b6527ef7ca87163e44eafce250d8 /plugins/New_GPG | |
parent | 1c2e5d128a7176ae827dda1e2a8fcc64e772a148 (diff) |
UI classes:
- CDlgBase::m_bSucceeded variable introduced to check whether IDOK was pressed or not;
- unused/useless buttons with id=IDOK or IDCANCEL removed;
- brnOk.OnClick replaced with OnApply calls;
- unused/useless calls of EndDialog/EndModal removed;
- minor code cleaning
Diffstat (limited to 'plugins/New_GPG')
-rwxr-xr-x | plugins/New_GPG/src/ui.cpp | 25 | ||||
-rwxr-xr-x | plugins/New_GPG/src/ui.h | 6 |
2 files changed, 11 insertions, 20 deletions
diff --git a/plugins/New_GPG/src/ui.cpp b/plugins/New_GPG/src/ui.cpp index ebc2fa8fd6..3742d43b24 100755 --- a/plugins/New_GPG/src/ui.cpp +++ b/plugins/New_GPG/src/ui.cpp @@ -1192,13 +1192,9 @@ CDlgKeyPasswordMsgBox::CDlgKeyPasswordMsgBox(MCONTACT _hContact) : lbl_KEYID(this, IDC_KEYID), edit_KEY_PASSWORD(this, IDC_KEY_PASSWORD), chk_DEFAULT_PASSWORD(this, IDC_DEFAULT_PASSWORD), - chk_SAVE_PASSWORD(this, IDC_SAVE_PASSWORD), - btn_OK(this, IDOK), - btn_CANCEL(this, IDCANCEL) + chk_SAVE_PASSWORD(this, IDC_SAVE_PASSWORD) { hContact = _hContact; - btn_OK.OnClick = Callback(this, &CDlgKeyPasswordMsgBox::onClick_OK); - btn_CANCEL.OnClick = Callback(this, &CDlgKeyPasswordMsgBox::onClick_CANCEL); } bool CDlgKeyPasswordMsgBox::OnInitDialog() @@ -1213,13 +1209,7 @@ bool CDlgKeyPasswordMsgBox::OnInitDialog() return true; } -void CDlgKeyPasswordMsgBox::OnDestroy() -{ - mir_free(inkeyid); - Utils_SaveWindowPosition(m_hwnd, 0, MODULENAME, "PasswordWindow"); -} - -void CDlgKeyPasswordMsgBox::onClick_OK(CCtrlButton*) +bool CDlgKeyPasswordMsgBox::OnApply() { ptrW tmp(edit_KEY_PASSWORD.GetText()); if (tmp && tmp[0]) { @@ -1236,11 +1226,14 @@ void CDlgKeyPasswordMsgBox::onClick_OK(CCtrlButton*) globals.wszPassword = tmp; } mir_free(inkeyid); - DestroyWindow(m_hwnd); + return true; } -void CDlgKeyPasswordMsgBox::onClick_CANCEL(CCtrlButton*) +void CDlgKeyPasswordMsgBox::OnDestroy() { - globals._terminate = true; - DestroyWindow(m_hwnd); + if (!m_bSucceeded) + globals._terminate = true; + + mir_free(inkeyid); + Utils_SaveWindowPosition(m_hwnd, 0, MODULENAME, "PasswordWindow"); } diff --git a/plugins/New_GPG/src/ui.h b/plugins/New_GPG/src/ui.h index 6ab8c7111c..e5c0c2c5ad 100755 --- a/plugins/New_GPG/src/ui.h +++ b/plugins/New_GPG/src/ui.h @@ -164,15 +164,13 @@ class CDlgKeyPasswordMsgBox : public CDlgBase //always modal CCtrlData lbl_KEYID; CCtrlEdit edit_KEY_PASSWORD; CCtrlCheck chk_DEFAULT_PASSWORD, chk_SAVE_PASSWORD; - CCtrlButton btn_OK, btn_CANCEL; public: CDlgKeyPasswordMsgBox(MCONTACT _hContact); + bool OnInitDialog() override; + bool OnApply() override; void OnDestroy() override; - - void onClick_OK(CCtrlButton*); - void onClick_CANCEL(CCtrlButton*); }; #endif // UI_H
\ No newline at end of file |