summaryrefslogtreecommitdiff
path: root/src/gui/customserverdialog.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-11-23 19:01:08 +0100
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2012-01-10 20:32:02 +0100
commit8cf8f82d0b933dab43372fb0afdda58687ce6af6 (patch)
tree740af7cb3f148b60839d1304791bdb0046161a53 /src/gui/customserverdialog.cpp
parent98be39a094cc20f513da1847c553513682e4eeae (diff)
downloadmana-8cf8f82d0b933dab43372fb0afdda58687ce6af6.tar.gz
mana-8cf8f82d0b933dab43372fb0afdda58687ce6af6.tar.bz2
mana-8cf8f82d0b933dab43372fb0afdda58687ce6af6.tar.xz
mana-8cf8f82d0b933dab43372fb0afdda58687ce6af6.zip
Added a modify button to the server dialog.
This was righteously requested by Ablu as missing when dealing with one's own entries. Reviewed-by: Ablu
Diffstat (limited to 'src/gui/customserverdialog.cpp')
-rw-r--r--src/gui/customserverdialog.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/gui/customserverdialog.cpp b/src/gui/customserverdialog.cpp
index 304665d6..589440a2 100644
--- a/src/gui/customserverdialog.cpp
+++ b/src/gui/customserverdialog.cpp
@@ -44,9 +44,10 @@ std::string TypeListModel::getElementAt(int elementIndex)
return "Unknown";
}
-CustomServerDialog::CustomServerDialog(ServerDialog *parent):
+CustomServerDialog::CustomServerDialog(ServerDialog *parent, int index):
Window(_("Add a custom Server"), true, static_cast<Window*>(parent)),
- mServerDialog(parent)
+ mServerDialog(parent),
+ mIndex(index)
{
setWindowName("CustomServerDialog");
@@ -110,6 +111,18 @@ CustomServerDialog::CustomServerDialog(ServerDialog *parent):
loadWindowState();
+ // Add the entry's info when in modify mode.
+ if (index > -1)
+ {
+ const ServerInfo &serverInfo = mServerDialog->mServers[index];
+ mNameField->setText(serverInfo.name);
+ mDescriptionField->setText(serverInfo.description);
+ mServerAddressField->setText(serverInfo.hostname);
+ mPortField->setText(toString(serverInfo.port));
+ mTypeField->setSelected(serverInfo.type ? ServerInfo::MANASERV :
+ ServerInfo::TMWATHENA);
+ }
+
setVisible(true);
mNameField->requestFocus();
@@ -169,7 +182,7 @@ void CustomServerDialog::action(const gcn::ActionEvent &event)
serverInfo.save = true;
//Add server
- mServerDialog->saveCustomServers(serverInfo);
+ mServerDialog->saveCustomServers(serverInfo, mIndex);
scheduleDelete();
}
}