diff options
author | George Hazan <ghazan@miranda.im> | 2018-07-11 17:09:17 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-07-11 17:09:17 +0300 |
commit | b2c91edc9646daa331de71d589e4fec6bdef4945 (patch) | |
tree | 847a77d0686d26e25b126313fbaa8262c81f8d1a /plugins/CloudFile/src | |
parent | ae081843e9663b3cb36b17309fbce1d2967315f1 (diff) |
GUI change:
- methods OnInitDialog, OnApply & OnClose of CDlgBase now return true if successful. return of false prevents a dialog from being loaded or left respectively;
- massive code cleaning considering the 'virtual' attribute of overridden methods;
- also fixes #1476 (Don't close "Create new account" window if user not set account name)
Diffstat (limited to 'plugins/CloudFile/src')
-rw-r--r-- | plugins/CloudFile/src/oauth.cpp | 3 | ||||
-rw-r--r-- | plugins/CloudFile/src/oauth.h | 2 | ||||
-rw-r--r-- | plugins/CloudFile/src/options.cpp | 9 | ||||
-rw-r--r-- | plugins/CloudFile/src/options.h | 6 |
4 files changed, 12 insertions, 8 deletions
diff --git a/plugins/CloudFile/src/oauth.cpp b/plugins/CloudFile/src/oauth.cpp index abda807772..e62629fcd8 100644 --- a/plugins/CloudFile/src/oauth.cpp +++ b/plugins/CloudFile/src/oauth.cpp @@ -11,13 +11,14 @@ COAuthDlg::COAuthDlg(CCloudService *service, const char *authUrl, CCloudService: m_ok.OnClick = Callback(this, &COAuthDlg::Ok_OnClick); } -void COAuthDlg::OnInitDialog() +bool COAuthDlg::OnInitDialog() { CCtrlLabel &ctrl = *(CCtrlLabel*)FindControl(IDC_AUTH_TEXT); ptrW format(ctrl.GetText()); wchar_t text[MAX_PATH]; mir_snwprintf(text, (const wchar_t*)format, m_service->GetUserName()); ctrl.SetText(text); + return true; } void COAuthDlg::Code_OnChange(CCtrlBase*) diff --git a/plugins/CloudFile/src/oauth.h b/plugins/CloudFile/src/oauth.h index 7c71cf005c..2b32ecbd9b 100644 --- a/plugins/CloudFile/src/oauth.h +++ b/plugins/CloudFile/src/oauth.h @@ -11,7 +11,7 @@ class COAuthDlg : public CDlgBase CCtrlButton m_ok; protected: - void OnInitDialog() override; + bool OnInitDialog() override; void Code_OnChange(CCtrlBase*); void Ok_OnClick(CCtrlButton*); diff --git a/plugins/CloudFile/src/options.cpp b/plugins/CloudFile/src/options.cpp index df6563b99c..ee3aaec11e 100644 --- a/plugins/CloudFile/src/options.cpp +++ b/plugins/CloudFile/src/options.cpp @@ -17,7 +17,7 @@ COptionsMainDlg::COptionsMainDlg() CreateLink(m_urlCopyToClipboard, "UrlCopyToClipboard", DBVT_BYTE, 0); } -void COptionsMainDlg::OnInitDialog() +bool COptionsMainDlg::OnInitDialog() { CDlgBase::OnInitDialog(); @@ -50,9 +50,10 @@ void COptionsMainDlg::OnInitDialog() m_doNothingOnConflict.SetState(TRUE); break; } + return true; } -void COptionsMainDlg::OnApply() +bool COptionsMainDlg::OnApply() { int iItem = m_defaultService.GetCurSel(); CCloudService *service = (CCloudService*)m_defaultService.GetItemData(iItem); @@ -67,6 +68,7 @@ void COptionsMainDlg::OnApply() db_set_b(NULL, MODULENAME, "ConflictStrategy", OnConflict::REPLACE); else db_unset(NULL, MODULENAME, "ConflictStrategy"); + return true; } ///////////////////////////////////////////////////////////////////////////////// @@ -96,11 +98,12 @@ CAccountManagerDlg::CAccountManagerDlg(CCloudService *service) m_revokeAccess.OnClick = Callback(this, &CAccountManagerDlg::RevokeAccess_OnClick); } -void CAccountManagerDlg::OnInitDialog() +bool CAccountManagerDlg::OnInitDialog() { ptrA token(m_proto->getStringA("TokenSecret")); m_requestAccess.Enable(!token); m_revokeAccess.Enable(token); + return true; } void CAccountManagerDlg::RequestAccess_OnClick(CCtrlButton*) diff --git a/plugins/CloudFile/src/options.h b/plugins/CloudFile/src/options.h index 30f6600f68..aaf1440def 100644 --- a/plugins/CloudFile/src/options.h +++ b/plugins/CloudFile/src/options.h @@ -15,8 +15,8 @@ private: CCtrlCheck m_urlCopyToClipboard; protected: - void OnInitDialog(); - void OnApply(); + bool OnInitDialog() override; + bool OnApply() override; public: COptionsMainDlg(); @@ -31,7 +31,7 @@ private: CCtrlButton m_revokeAccess; protected: - void OnInitDialog(); + bool OnInitDialog() override; void RequestAccess_OnClick(CCtrlButton*); void RevokeAccess_OnClick(CCtrlButton*); |