From 741d50e884d8a8b783b3980db775ebc07045a65a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 16 May 2014 19:33:44 +0300 Subject: Move wrongdatanoticelistener into separate file. --- src/gui/windows/changeemaildialog.cpp | 2 ++ src/gui/windows/changepassworddialog.cpp | 2 ++ src/gui/windows/registerdialog.cpp | 19 ++----------------- src/gui/windows/registerdialog.h | 20 +------------------- src/gui/windows/unregisterdialog.cpp | 2 ++ 5 files changed, 9 insertions(+), 36 deletions(-) (limited to 'src/gui') diff --git a/src/gui/windows/changeemaildialog.cpp b/src/gui/windows/changeemaildialog.cpp index 1e5b526d7..d95773cc7 100644 --- a/src/gui/windows/changeemaildialog.cpp +++ b/src/gui/windows/changeemaildialog.cpp @@ -31,6 +31,8 @@ #include "gui/widgets/label.h" #include "gui/widgets/textfield.h" +#include "listeners/wrongdatanoticelistener.h" + #include "net/logindata.h" #include "net/loginhandler.h" #include "net/net.h" diff --git a/src/gui/windows/changepassworddialog.cpp b/src/gui/windows/changepassworddialog.cpp index e8f6a5c0b..ccad64b69 100644 --- a/src/gui/windows/changepassworddialog.cpp +++ b/src/gui/windows/changepassworddialog.cpp @@ -32,6 +32,8 @@ #include "gui/widgets/label.h" #include "gui/widgets/layoutcell.h" +#include "listeners/wrongdatanoticelistener.h" + #include "net/logindata.h" #include "net/loginhandler.h" #include "net/net.h" diff --git a/src/gui/windows/registerdialog.cpp b/src/gui/windows/registerdialog.cpp index 0f0d85c9c..2ecf5fc87 100644 --- a/src/gui/windows/registerdialog.cpp +++ b/src/gui/windows/registerdialog.cpp @@ -28,6 +28,8 @@ #include "input/keydata.h" +#include "listeners/wrongdatanoticelistener.h" + #include "gui/windows/okdialog.h" #include "gui/widgets/button.h" @@ -46,23 +48,6 @@ #include "debug.h" -WrongDataNoticeListener::WrongDataNoticeListener(): - ActionListener(), - mTarget(nullptr) -{ -} - -void WrongDataNoticeListener::setTarget(TextField *const textField) -{ - mTarget = textField; -} - -void WrongDataNoticeListener::action(const ActionEvent &event) -{ - if (event.getId() == "ok" && mTarget) - mTarget->requestFocus(); -} - RegisterDialog::RegisterDialog(LoginData *const data) : // TRANSLATORS: register dialog name Window(_("Register"), false, nullptr, "register.xml"), diff --git a/src/gui/windows/registerdialog.h b/src/gui/windows/registerdialog.h index 90087b5e2..fc063ac14 100644 --- a/src/gui/windows/registerdialog.h +++ b/src/gui/windows/registerdialog.h @@ -32,25 +32,7 @@ class Button; class LoginData; class RadioButton; class TextField; - -/** - * Listener used while dealing with wrong data. It is used to direct the focus - * to the field which contained wrong data when the Ok button was pressed on - * the error notice. - */ -class WrongDataNoticeListener final : public ActionListener -{ - public: - WrongDataNoticeListener(); - - A_DELETE_COPY(WrongDataNoticeListener) - - void setTarget(TextField *const textField); - - void action(const ActionEvent &event) override final; - private: - TextField *mTarget; -}; +class WrongDataNoticeListener; /** * The registration dialog. diff --git a/src/gui/windows/unregisterdialog.cpp b/src/gui/windows/unregisterdialog.cpp index 8b9721f40..99336405c 100644 --- a/src/gui/windows/unregisterdialog.cpp +++ b/src/gui/windows/unregisterdialog.cpp @@ -31,6 +31,8 @@ #include "gui/widgets/label.h" #include "gui/widgets/passwordfield.h" +#include "listeners/wrongdatanoticelistener.h" + #include "net/logindata.h" #include "net/loginhandler.h" #include "net/net.h" -- cgit v1.2.3-70-g09d2