From 9cbca4642e49aadb3e5e6b6055261590d754629d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 18 Oct 2013 01:33:58 +0300 Subject: move virtual member calls from editserverdialog constuctor into postInit. --- src/gui/windows/editserverdialog.cpp | 9 ++++++--- src/gui/windows/editserverdialog.h | 2 ++ src/gui/windows/serverdialog.cpp | 14 ++++++++++---- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/gui/windows/editserverdialog.cpp b/src/gui/windows/editserverdialog.cpp index 2a6814525..1aafa11f0 100644 --- a/src/gui/windows/editserverdialog.cpp +++ b/src/gui/windows/editserverdialog.cpp @@ -185,9 +185,6 @@ EditServerDialog::EditServerDialog(ServerDialog *const parent, } setLocationRelativeTo(getParentWindow()); - setVisible(true); - - mNameField->requestFocus(); } EditServerDialog::~EditServerDialog() @@ -195,6 +192,12 @@ EditServerDialog::~EditServerDialog() delete mTypeListModel; } +void EditServerDialog::postInit() +{ + setVisible(true); + mNameField->requestFocus(); +} + void EditServerDialog::action(const gcn::ActionEvent &event) { const std::string &eventId = event.getId(); diff --git a/src/gui/windows/editserverdialog.h b/src/gui/windows/editserverdialog.h index 6ab784eb3..dd69b9771 100644 --- a/src/gui/windows/editserverdialog.h +++ b/src/gui/windows/editserverdialog.h @@ -85,6 +85,8 @@ class EditServerDialog final : public Window, ~EditServerDialog(); + void postInit() override; + /** * Called when receiving actions from the widgets. */ diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index d69471eac..3b0f9e6c9 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -414,13 +414,16 @@ void ServerDialog::action(const gcn::ActionEvent &event) } else if (eventId == "addEntry") { - new EditServerDialog(this, ServerInfo(), -1); + (new EditServerDialog(this, ServerInfo(), -1))->postInit(); } else if (eventId == "editEntry") { const int index = mServersList->getSelected(); if (index >= 0) - new EditServerDialog(this, mServers.at(index), index); + { + (new EditServerDialog(this, mServers.at(index), + index))->postInit(); + } } else if (eventId == "remove") { @@ -451,7 +454,7 @@ void ServerDialog::keyPressed(gcn::KeyEvent &keyEvent) return; case Input::KEY_GUI_INSERT: - new EditServerDialog(this, ServerInfo(), -1); + (new EditServerDialog(this, ServerInfo(), -1))->postInit(); return; case Input::KEY_GUI_DELETE: @@ -470,7 +473,10 @@ void ServerDialog::keyPressed(gcn::KeyEvent &keyEvent) { const int index = mServersList->getSelected(); if (index >= 0) - new EditServerDialog(this, mServers.at(index), index); + { + (new EditServerDialog(this, mServers.at(index), + index))->postInit(); + } return; } -- cgit v1.2.3-70-g09d2