summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/windows/editserverdialog.cpp9
-rw-r--r--src/gui/windows/editserverdialog.h2
-rw-r--r--src/gui/windows/serverdialog.cpp14
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;
}