summaryrefslogtreecommitdiff
path: root/src/gui/windows/charselectdialog.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-01-04 18:54:18 +0300
committerAndrei Karas <akaras@inbox.ru>2015-01-04 18:54:18 +0300
commit829709f07a16e945af416cb1df23d0fcefdba8e0 (patch)
tree1a40a1dd51724970b71c8833f27d18a39b38a62f /src/gui/windows/charselectdialog.cpp
parenta3310b047fb85052429a979eb0ebd02d47c43964 (diff)
downloadmanaplus-829709f07a16e945af416cb1df23d0fcefdba8e0.tar.gz
manaplus-829709f07a16e945af416cb1df23d0fcefdba8e0.tar.bz2
manaplus-829709f07a16e945af416cb1df23d0fcefdba8e0.tar.xz
manaplus-829709f07a16e945af416cb1df23d0fcefdba8e0.zip
eathena: allow delete characters if account have non default email.
Diffstat (limited to 'src/gui/windows/charselectdialog.cpp')
-rw-r--r--src/gui/windows/charselectdialog.cpp57
1 files changed, 38 insertions, 19 deletions
diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp
index 77cbe28cb..b6bc5c83e 100644
--- a/src/gui/windows/charselectdialog.cpp
+++ b/src/gui/windows/charselectdialog.cpp
@@ -297,20 +297,27 @@ void CharSelectDialog::action(const ActionEvent &event)
}
else if (eventId == "try delete character")
{
- if (mDeleteDialog && mDeleteIndex != -1 && mDeleteDialog->getText()
- == LoginDialog::savedPassword)
+ if (mDeleteDialog && mDeleteIndex != -1)
{
- attemptCharacterDelete(mDeleteIndex);
- mDeleteDialog = nullptr;
- }
- else
- {
- // TRANSLATORS: error message
- new OkDialog(_("Error"), _("Incorrect password"),
- // TRANSLATORS: ok dialog button
- _("OK"),
- DialogType::ERROR,
- true, true, nullptr, 260);
+ if (serverFeatures->haveEmailOnDelete())
+ {
+ attemptCharacterDelete(mDeleteIndex, mDeleteDialog->getText());
+ mDeleteDialog = nullptr;
+ }
+ else if (mDeleteDialog->getText() == LoginDialog::savedPassword)
+ {
+ attemptCharacterDelete(mDeleteIndex, "");
+ mDeleteDialog = nullptr;
+ }
+ else
+ {
+ // TRANSLATORS: error message
+ new OkDialog(_("Error"), _("Incorrect password"),
+ // TRANSLATORS: ok dialog button
+ _("OK"),
+ DialogType::ERROR,
+ true, true, nullptr, 260);
+ }
}
mDeleteIndex = -1;
}
@@ -428,7 +435,8 @@ void CharSelectDialog::keyPressed(KeyEvent &event)
/**
* Communicate character deletion to the server.
*/
-void CharSelectDialog::attemptCharacterDelete(const int index)
+void CharSelectDialog::attemptCharacterDelete(const int index,
+ const std::string &email)
{
if (mLocked)
return;
@@ -436,7 +444,8 @@ void CharSelectDialog::attemptCharacterDelete(const int index)
if (mCharacterEntries[index])
{
mCharServerHandler->deleteCharacter(
- mCharacterEntries[index]->getCharacter());
+ mCharacterEntries[index]->getCharacter(),
+ email);
}
lock();
}
@@ -444,10 +453,20 @@ void CharSelectDialog::attemptCharacterDelete(const int index)
void CharSelectDialog::askPasswordForDeletion(const int index)
{
mDeleteIndex = index;
- mDeleteDialog = new TextDialog(
- // TRANSLATORS: char deletion question.
- _("Enter password for deleting character"), _("Enter password:"),
- this, true);
+ if (serverFeatures->haveEmailOnDelete())
+ {
+ mDeleteDialog = new TextDialog(
+ // TRANSLATORS: char deletion question.
+ _("Enter your email for deleting character"), _("Enter email:"),
+ this, false);
+ }
+ else
+ {
+ mDeleteDialog = new TextDialog(
+ // TRANSLATORS: char deletion question.
+ _("Enter password for deleting character"), _("Enter password:"),
+ this, true);
+ }
mDeleteDialog->postInit();
mDeleteDialog->setActionEventId("try delete character");
mDeleteDialog->addActionListener(this);