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/Watrack_MPD/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/Watrack_MPD/src')
-rwxr-xr-x | plugins/Watrack_MPD/src/options.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/plugins/Watrack_MPD/src/options.cpp b/plugins/Watrack_MPD/src/options.cpp index c05fffc223..652e2766a7 100755 --- a/plugins/Watrack_MPD/src/options.cpp +++ b/plugins/Watrack_MPD/src/options.cpp @@ -22,7 +22,8 @@ public: COptWaMpdDlg() : CDlgBase(g_plugin, IDD_OPT_WA_MPD), edit_PORT(this, IDC_PORT), edit_SERVER(this, IDC_SERVER), edit_PASSWORD(this, IDC_PASSWORD) {} - virtual void OnInitDialog() override + + bool OnInitDialog() override { edit_PORT.SetInt(db_get_w(NULL, MODULENAME, "Port", 6600)); wchar_t *tmp = UniGetContactSettingUtf(NULL, MODULENAME, "Server", L"127.0.0.1"); @@ -31,8 +32,10 @@ public: tmp = UniGetContactSettingUtf(NULL, MODULENAME, "Password", L""); edit_PASSWORD.SetText(tmp); mir_free(tmp); + return true; } - virtual void OnApply() override + + bool OnApply() override { db_set_w(NULL, MODULENAME, "Port", (WORD)edit_PORT.GetInt()); gbPort = edit_PORT.GetInt(); @@ -40,7 +43,9 @@ public: mir_wstrcpy(gbHost, edit_SERVER.GetText()); db_set_ws(NULL, MODULENAME, "Password", edit_PASSWORD.GetText()); mir_wstrcpy(gbPassword, edit_PASSWORD.GetText()); + return true; } + private: CCtrlSpin edit_PORT; CCtrlEdit edit_SERVER, edit_PASSWORD; |