From b2c91edc9646daa331de71d589e4fec6bdef4945 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 11 Jul 2018 17:09:17 +0300 Subject: 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) --- plugins/StopSpamPlus/src/options.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'plugins/StopSpamPlus/src') diff --git a/plugins/StopSpamPlus/src/options.cpp b/plugins/StopSpamPlus/src/options.cpp index 0d9d4431bf..568479c6dc 100644 --- a/plugins/StopSpamPlus/src/options.cpp +++ b/plugins/StopSpamPlus/src/options.cpp @@ -29,9 +29,10 @@ public: CreateLink(chk6, g_sets.HistLog); } - virtual void OnInitDialog() override + bool OnInitDialog() override { edtDescr.SetText(pluginDescription); + return true; } }; @@ -63,10 +64,11 @@ public: CreateLink(edtDivider, g_sets.AnswSplitString); } - virtual void OnInitDialog() override + bool OnInitDialog() override { variables_skin_helpbutton(m_hwnd, IDC_VARS); btnHelp.Enable(ServiceExists(MS_VARS_FORMATSTRING)); + return true; } void onHelp(CCtrlButton*) @@ -100,7 +102,7 @@ public: m_accounts.OnItemChanged = Callback(this, &COptAccountDlg::list_OnItemChanged); } - virtual void OnInitDialog() override + bool OnInitDialog() override { m_accounts.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES); m_accounts.DeleteAllItems(); @@ -124,9 +126,10 @@ public: int idx = m_accounts.InsertItem(&item); m_accounts.SetCheckState(idx, g_sets.ProtoDisabled(pa->szModuleName)); } + return true; } - virtual void OnApply() override + bool OnApply() override { std::ostringstream out; @@ -143,6 +146,7 @@ public: } g_sets.DisabledProtoList = (char*)out.str().c_str(); + return true; } void list_OnItemChanged(CCtrlListView::TEventInfo*) -- cgit v1.2.3