summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-08-02 17:51:50 +0300
committerAndrei Karas <akaras@inbox.ru>2016-08-02 17:51:50 +0300
commite63db2551051c143681bdb6f254ad4d7d426772f (patch)
tree987dde969b9dabb25f1bb722c60ddf7fd92f948b
parent4f7b21282f34f38090cb6e25c60f80264192faea (diff)
downloadplus-e63db2551051c143681bdb6f254ad4d7d426772f.tar.gz
plus-e63db2551051c143681bdb6f254ad4d7d426772f.tar.bz2
plus-e63db2551051c143681bdb6f254ad4d7d426772f.tar.xz
plus-e63db2551051c143681bdb6f254ad4d7d426772f.zip
Remove unused unregister dialog and states for it.
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/Makefile.am2
-rw-r--r--src/client.cpp35
-rw-r--r--src/enums/state.h3
-rw-r--r--src/gui/windows/charselectdialog.cpp5
-rw-r--r--src/gui/windows/unregisterdialog.cpp165
-rw-r--r--src/gui/windows/unregisterdialog.h70
7 files changed, 0 insertions, 282 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 587603771..c173c726a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -522,8 +522,6 @@ SET(SRCS
gui/touchactiondata.h
gui/windows/tradewindow.cpp
gui/windows/tradewindow.h
- gui/windows/unregisterdialog.cpp
- gui/windows/unregisterdialog.h
gui/windows/updaterwindow.cpp
gui/windows/updaterwindow.h
gui/userpalette.cpp
diff --git a/src/Makefile.am b/src/Makefile.am
index d0bd729ea..7ec48c7fe 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1076,8 +1076,6 @@ manaplus_SOURCES += main.cpp \
gui/windowmenu.h \
gui/windows/tradewindow.cpp \
gui/windows/tradewindow.h \
- gui/windows/unregisterdialog.cpp \
- gui/windows/unregisterdialog.h \
gui/windows/updaterwindow.cpp \
gui/windows/updaterwindow.h \
gui/windows/whoisonline.cpp \
diff --git a/src/client.cpp b/src/client.cpp
index 04a58ad55..761a1424f 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -69,7 +69,6 @@
#include "gui/windows/registerdialog.h"
#include "gui/windows/serverdialog.h"
#include "gui/windows/setupwindow.h"
-#include "gui/windows/unregisterdialog.h"
#include "gui/windows/updaterwindow.h"
#include "gui/windows/quitdialog.h"
#include "gui/windows/worldselectdialog.h"
@@ -1612,40 +1611,6 @@ int Client::gameExec()
mCurrentDialog = nullptr; // OkDialog deletes itself
break;
- case State::UNREGISTER:
- logger->log1("State: UNREGISTER");
- CREATEWIDGETV(mCurrentDialog,
- UnRegisterDialog,
- loginData);
- break;
-
- case State::UNREGISTER_ATTEMPT:
- logger->log1("State: UNREGISTER ATTEMPT");
- if (loginHandler)
- {
- loginHandler->unregisterAccount(
- loginData.username,
- loginData.password);
- }
- break;
-
- case State::UNREGISTER_SUCCESS:
- logger->log1("State: UNREGISTER SUCCESS");
- if (loginHandler)
- loginHandler->disconnect();
-
- mCurrentDialog = DialogsManager::openErrorDialog(
- // TRANSLATORS: unregister message header
- _("Unregister Successful"),
- // TRANSLATORS: unregister message text
- _("Farewell, come back any time..."),
- Modal_true);
- loginData.clear();
- // The errorlistener sets the state to State::CHOOSE_SERVER
- mCurrentDialog->addActionListener(&errorListener);
- mCurrentDialog = nullptr; // OkDialog deletes itself
- break;
-
case State::SWITCH_SERVER:
BLOCK_START("Client::gameExec State::SWITCH_SERVER")
logger->log1("State: SWITCH SERVER");
diff --git a/src/enums/state.h b/src/enums/state.h
index 4f3e24082..53b188ea9 100644
--- a/src/enums/state.h
+++ b/src/enums/state.h
@@ -58,9 +58,6 @@ enumStart(State)
CHANGEEMAIL,
CHANGEEMAIL_ATTEMPT,
CHANGEEMAIL_SUCCESS,
- UNREGISTER, // 25
- UNREGISTER_ATTEMPT,
- UNREGISTER_SUCCESS,
SWITCH_SERVER,
SWITCH_LOGIN,
SWITCH_CHARACTER, // 30
diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp
index 56b0c5930..860c27570 100644
--- a/src/gui/windows/charselectdialog.cpp
+++ b/src/gui/windows/charselectdialog.cpp
@@ -276,11 +276,6 @@ void CharSelectDialog::action(const ActionEvent &event)
{
client->setState(State::CHANGEEMAIL);
}
- else if (eventId == "unregister")
- {
- charServerHandler->clear();
- client->setState(State::UNREGISTER);
- }
else if (eventId == "try delete character")
{
if (mDeleteDialog && mDeleteIndex != -1)
diff --git a/src/gui/windows/unregisterdialog.cpp b/src/gui/windows/unregisterdialog.cpp
deleted file mode 100644
index 849ff16a3..000000000
--- a/src/gui/windows/unregisterdialog.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * The ManaPlus Client
- * Copyright (C) 2004-2009 The Mana World Development Team
- * Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011-2016 The ManaPlus Developers
- *
- * This file is part of The ManaPlus Client.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "gui/windows/unregisterdialog.h"
-
-#include "client.h"
-
-#include "gui/windows/okdialog.h"
-
-#include "gui/widgets/button.h"
-#include "gui/widgets/createwidget.h"
-#include "gui/widgets/label.h"
-#include "gui/widgets/passwordfield.h"
-
-#include "listeners/wrongdatanoticelistener.h"
-
-#include "net/logindata.h"
-#include "net/loginhandler.h"
-
-#include "utils/delete2.h"
-#include "utils/gettext.h"
-
-#include <sstream>
-
-#include "debug.h"
-
-UnRegisterDialog::UnRegisterDialog(LoginData &data) :
- // TRANSLATORS: unregister dialog name
- Window(_("Unregister"), Modal_true, nullptr, "unregister.xml"),
- ActionListener(),
- mLoginData(&data),
- mPasswordField(new PasswordField(this, mLoginData->password)),
- // TRANSLATORS: unregister dialog. button.
- mUnRegisterButton(new Button(this, _("Unregister"), "unregister", this)),
- // TRANSLATORS: unregister dialog. button.
- mCancelButton(new Button(this, _("Cancel"), "cancel", this)),
- mWrongDataNoticeListener(new WrongDataNoticeListener)
-{
-}
-
-void UnRegisterDialog::postInit()
-{
- Window::postInit();
- // TRANSLATORS: unregister dialog. label.
- Label *const userLabel = new Label(this, strprintf(_("Name: %s"),
- mLoginData->username.c_str()));
- // TRANSLATORS: unregister dialog. label.
- Label *const passwordLabel = new Label(this, _("Password:"));
-
- const int width = 210;
- const int height = 80;
- setContentSize(width, height);
-
- userLabel->setPosition(5, 5);
- userLabel->setWidth(width - 5);
- mPasswordField->setPosition(
- 68, userLabel->getY() + userLabel->getHeight() + 7);
- mPasswordField->setWidth(130);
-
- passwordLabel->setPosition(5, mPasswordField->getY() + 1);
-
- mCancelButton->setPosition(
- width - 5 - mCancelButton->getWidth(),
- height - 5 - mCancelButton->getHeight());
- mUnRegisterButton->setPosition(
- mCancelButton->getX() - 5 - mUnRegisterButton->getWidth(),
- mCancelButton->getY());
-
- add(userLabel);
- add(passwordLabel);
- add(mPasswordField);
- add(mUnRegisterButton);
- add(mCancelButton);
-
- center();
- setVisible(Visible_true);
- mPasswordField->requestFocus();
- mPasswordField->setActionEventId("cancel");
-}
-
-UnRegisterDialog::~UnRegisterDialog()
-{
- delete2(mWrongDataNoticeListener);
-}
-
-void UnRegisterDialog::action(const ActionEvent &event)
-{
- const std::string &eventId = event.getId();
- if (eventId == "cancel")
- {
- client->setState(State::CHAR_SELECT);
- }
- else if (eventId == "unregister")
- {
- const std::string username = mLoginData->username;
- const std::string &password = mPasswordField->getText();
- logger->log("UnregisterDialog::unregistered, Username is %s",
- username.c_str());
-
- std::stringstream errorMsg;
- bool error = false;
-
- const unsigned int min = loginHandler->getMinPasswordLength();
- const unsigned int max = loginHandler->getMaxPasswordLength();
-
- if (password.length() < min)
- {
- // TRANSLATORS: unregister dialog. error message.
- errorMsg << strprintf(_("The password needs to be at least %u "
- "characters long."), min);
- error = true;
- }
- else if (password.length() > max)
- {
- // TRANSLATORS: unregister dialog. error message.
- errorMsg << strprintf(_("The password needs to be less than "
- "%u characters long."), max);
- error = true;
- }
-
- if (error)
- {
- mWrongDataNoticeListener->setTarget(this->mPasswordField);
-
- OkDialog *const dlg = CREATEWIDGETR(OkDialog,
- // TRANSLATORS: unregister dialog. error message.
- _("Error"),
- errorMsg.str(),
- // TRANSLATORS: ok dialog button
- _("OK"),
- DialogType::ERROR,
- Modal_true,
- ShowCenter_true,
- nullptr,
- 260);
- dlg->addActionListener(mWrongDataNoticeListener);
- }
- else
- {
- // No errors detected, unregister the new user.
- mUnRegisterButton->setEnabled(false);
- mLoginData->password = password;
- client->setState(State::UNREGISTER_ATTEMPT);
- }
- }
-}
diff --git a/src/gui/windows/unregisterdialog.h b/src/gui/windows/unregisterdialog.h
deleted file mode 100644
index aaba439ad..000000000
--- a/src/gui/windows/unregisterdialog.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * The ManaPlus Client
- * Copyright (C) 2004-2009 The Mana World Development Team
- * Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011-2016 The ManaPlus Developers
- *
- * This file is part of The ManaPlus Client.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GUI_WINDOWS_UNREGISTERDIALOG_H
-#define GUI_WINDOWS_UNREGISTERDIALOG_H
-
-#include "gui/widgets/window.h"
-
-#include "listeners/actionlistener.h"
-
-class Button;
-class LoginData;
-class TextField;
-class WrongDataNoticeListener;
-
-/**
- * The Unregister dialog.
- *
- * \ingroup Interface
- */
-class UnRegisterDialog final : public Window,
- public ActionListener
-{
- public:
- /**
- * Constructor
- *
- * @see Window::Window
- */
- explicit UnRegisterDialog(LoginData &loginData);
-
- A_DELETE_COPY(UnRegisterDialog)
-
- ~UnRegisterDialog();
-
- void postInit() override final;
-
- /**
- * Called when receiving actions from the widgets.
- */
- void action(const ActionEvent &event) override final;
-
- private:
- LoginData *mLoginData A_NONNULLPOINTER;
- TextField *mPasswordField A_NONNULLPOINTER;
- Button *mUnRegisterButton A_NONNULLPOINTER;
- Button *mCancelButton A_NONNULLPOINTER;
- WrongDataNoticeListener *mWrongDataNoticeListener A_NONNULLPOINTER;
-};
-
-#endif // GUI_WINDOWS_UNREGISTERDIALOG_H