summaryrefslogtreecommitdiff
path: root/src/gui/windows/charselectdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/windows/charselectdialog.cpp')
-rw-r--r--src/gui/windows/charselectdialog.cpp41
1 files changed, 25 insertions, 16 deletions
diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp
index 66e7a886d..c7a2e0eef 100644
--- a/src/gui/windows/charselectdialog.cpp
+++ b/src/gui/windows/charselectdialog.cpp
@@ -47,6 +47,7 @@
#include "net/character.h"
#include "net/charserverhandler.h"
#include "net/logindata.h"
+#include "net/loginhandler.h"
#ifdef TMWA_SUPPORT
#include "net/net.h"
#endif // TMWA_SUPPORT
@@ -71,9 +72,13 @@ CharSelectDialog::CharSelectDialog(LoginData &data) :
ActionListener(),
KeyListener(),
mLoginData(&data),
- // TRANSLATORS: char select dialog. button.
- mSwitchLoginButton(new Button(this, _("Switch"), "switch",
- BUTTON_SKIN, this)),
+ mSwitchLoginButton(new Button(this,
+ (loginHandler != nullptr && loginHandler->getWorlds().size() > 1)
+ // TRANSLATORS: char select dialog. button.
+ ? _("Switch World") : _("Logout"),
+ "switch",
+ BUTTON_SKIN,
+ this)),
// TRANSLATORS: char select dialog. button.
mChangePasswordButton(new Button(this, _("Password"), "change_password",
BUTTON_SKIN, this)),
@@ -102,11 +107,11 @@ CharSelectDialog::CharSelectDialog(LoginData &data) :
placer = getPlacer(0, 0);
// disable logout using -S
- int row = 0;
+ int column = 0;
if (!settings.options.uniqueSession)
- placer(row++, 0, mSwitchLoginButton, 1, 1);
- placer(row++, 0, mChangePasswordButton, 1, 1);
- placer(row++, 0, mDeleteButton, 1, 1);
+ placer(column++, 0, mSwitchLoginButton, 1, 1);
+ placer(column++, 0, mChangePasswordButton, 1, 1);
+ placer(column++, 0, mDeleteButton, 1, 1);
#ifdef TMWA_SUPPORT
if (Net::getNetworkType() != ServerType::TMWATHENA)
#endif
@@ -117,7 +122,7 @@ CharSelectDialog::CharSelectDialog(LoginData &data) :
"rename",
BUTTON_SKIN,
this);
- placer(row++, 0, mRenameButton, 1, 1);
+ placer(column++, 0, mRenameButton, 1, 1);
}
#ifdef TMWA_SUPPORT
if (serverFeatures->havePincode())
@@ -129,9 +134,9 @@ CharSelectDialog::CharSelectDialog(LoginData &data) :
"changepin",
BUTTON_SKIN,
this);
- placer(row++, 0, mChangePinButton, 1, 1);
+ placer(column++, 0, mChangePinButton, 1, 1);
}
- placer(row++, 0, mInfoButton, 1, 1);
+ placer(column++, 0, mInfoButton, 1, 1);
for (int i = 0; i < CAST_S32(mLoginData->characterSlots); i++)
{
@@ -307,12 +312,16 @@ void CharSelectDialog::action(const ActionEvent &event)
return;
if ((mDeleteDialog != nullptr) && mDeleteIndex != -1)
{
+ const Net::Character *const character
+ = mCharacterEntries[mDeleteIndex]->getCharacter();
if (serverFeatures->haveEmailOnDelete())
{
attemptCharacterDelete(mDeleteIndex, mDeleteDialog->getText());
mDeleteDialog = nullptr;
}
- else if (mDeleteDialog->getText() == LoginDialog::savedPassword)
+ else if (character != nullptr &&
+ character->dummy != nullptr &&
+ mDeleteDialog->getText() == character->dummy->getName())
{
attemptCharacterDelete(mDeleteIndex, "");
mDeleteDialog = nullptr;
@@ -323,7 +332,7 @@ void CharSelectDialog::action(const ActionEvent &event)
// TRANSLATORS: error header
_("Error"),
// TRANSLATORS: error message
- _("Incorrect password"),
+ _("Incorrect character name"),
// TRANSLATORS: ok dialog button
_("OK"),
DialogType::ERROR,
@@ -497,11 +506,11 @@ void CharSelectDialog::askPasswordForDeletion(const int index)
{
CREATEWIDGETV(mDeleteDialog, TextDialog,
// TRANSLATORS: char deletion question.
- _("Enter password for deleting character"),
+ _("Enter character name to confirm deleting the character"),
// TRANSLATORS: email label.
- _("Enter password:"),
+ _("Enter character name:"),
this,
- true);
+ false);
}
mDeleteDialog->setActionEventId("try delete character");
mDeleteDialog->addActionListener(this);
@@ -616,7 +625,7 @@ bool CharSelectDialog::selectByName(const std::string &name,
void CharSelectDialog::close()
{
- client->setState(State::SWITCH_LOGIN);
+ client->setState(State::SWITCH_WORLD);
Window::close();
}