summaryrefslogtreecommitdiff
path: root/src/gui/windows
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
parenta3310b047fb85052429a979eb0ebd02d47c43964 (diff)
downloadplus-829709f07a16e945af416cb1df23d0fcefdba8e0.tar.gz
plus-829709f07a16e945af416cb1df23d0fcefdba8e0.tar.bz2
plus-829709f07a16e945af416cb1df23d0fcefdba8e0.tar.xz
plus-829709f07a16e945af416cb1df23d0fcefdba8e0.zip
eathena: allow delete characters if account have non default email.
Diffstat (limited to 'src/gui/windows')
-rw-r--r--src/gui/windows/charselectdialog.cpp57
-rw-r--r--src/gui/windows/charselectdialog.h3
2 files changed, 40 insertions, 20 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);
diff --git a/src/gui/windows/charselectdialog.h b/src/gui/windows/charselectdialog.h
index 0f3529fc0..ca7d6111c 100644
--- a/src/gui/windows/charselectdialog.h
+++ b/src/gui/windows/charselectdialog.h
@@ -94,7 +94,8 @@ class CharSelectDialog final : public Window,
void setName(const int id, const std::string &newName);
private:
- void attemptCharacterDelete(const int index);
+ void attemptCharacterDelete(const int index,
+ const std::string &email);
void attemptCharacterSelect(const int index);