summaryrefslogtreecommitdiff
path: root/src/gui/windows/charselectdialog.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-10-05 20:59:37 +0300
committerAndrei Karas <akaras@inbox.ru>2014-10-05 21:02:42 +0300
commit95532bf76d70bafbb7d0bc0e2dd0fc92fd7f74cf (patch)
tree53c227068936ed4690866f4e13b957678e181dac /src/gui/windows/charselectdialog.cpp
parentb0361de1fcfc26b4bb497473e9fe1ef0f5013c98 (diff)
downloadplus-95532bf76d70bafbb7d0bc0e2dd0fc92fd7f74cf.tar.gz
plus-95532bf76d70bafbb7d0bc0e2dd0fc92fd7f74cf.tar.bz2
plus-95532bf76d70bafbb7d0bc0e2dd0fc92fd7f74cf.tar.xz
plus-95532bf76d70bafbb7d0bc0e2dd0fc92fd7f74cf.zip
Add char rename button if server support it.
Diffstat (limited to 'src/gui/windows/charselectdialog.cpp')
-rw-r--r--src/gui/windows/charselectdialog.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp
index 5b4822a17..32a3ea410 100644
--- a/src/gui/windows/charselectdialog.cpp
+++ b/src/gui/windows/charselectdialog.cpp
@@ -32,6 +32,7 @@
#include "being/attributes.h"
+#include "listeners/charrenamelistener.h"
#include "listeners/pincodelistener.h"
#include "gui/dialogtype.h"
@@ -53,6 +54,7 @@
#include "net/logindata.h"
#include "net/loginhandler.h"
#include "net/registrationoptions.h"
+#include "net/serverfeatures.h"
#include "debug.h"
@@ -80,6 +82,8 @@ CharSelectDialog::CharSelectDialog(LoginData *const data) :
mInfoButton(new Button(this, _("Info"), "info", this)),
// TRANSLATORS: char select dialog. button.
mDeleteButton(new Button(this, _("Delete"), "delete", this)),
+ // TRANSLATORS: char select dialog. button.
+ mRenameButton(nullptr),
mCharacterView(nullptr),
mCharacterEntries(0),
mCharServerHandler(charServerHandler),
@@ -123,6 +127,12 @@ CharSelectDialog::CharSelectDialog(LoginData *const data) :
placer(n, 0, mDeleteButton);
n ++;
+ if (serverFeatures->haveCharRename())
+ {
+ mRenameButton = new Button(this, _("Rename"), "rename", this);
+ placer(n, 0, mRenameButton);
+ n ++;
+ }
placer(n, 0, mInfoButton);
n ++;
@@ -221,6 +231,18 @@ void CharSelectDialog::action(const ActionEvent &event)
(new CharDeleteConfirm(this, selected))->postInit();
return;
}
+ else if (eventId == "rename"
+ && mCharacterEntries[selected]->getCharacter())
+ {
+ LocalPlayer *const player = mCharacterEntries[
+ selected]->getCharacter()->dummy;
+ EditDialog *const dialog = new EditDialog(
+ _("Please enter new name"), player->getName(), "OK");
+ dialog->postInit();
+ charRenameListener.setId(player->getId());
+ charRenameListener.setDialog(dialog);
+ dialog->addActionListener(&charRenameListener);
+ }
else if (eventId == "info")
{
Net::Character *const character = mCharacterEntries[