summaryrefslogtreecommitdiff
path: root/src/gui/login.h
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2007-03-22 00:47:41 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2007-03-22 00:47:41 +0000
commitcacb143040c018a24aed00c3ce1f513b75ec7f99 (patch)
tree22afb23dc50f2bad06abb0730f88745b09ff654a /src/gui/login.h
parent823aa330987205b251d9f662cfdd4c39149c6ec7 (diff)
downloadmana-cacb143040c018a24aed00c3ce1f513b75ec7f99.tar.gz
mana-cacb143040c018a24aed00c3ce1f513b75ec7f99.tar.bz2
mana-cacb143040c018a24aed00c3ce1f513b75ec7f99.tar.xz
mana-cacb143040c018a24aed00c3ce1f513b75ec7f99.zip
Only enable login button when a username, password and server are filled in.
Pass username, password and server on to the register dialog. Go back to login dialog when canceling registration. Fixed a crash caused by deleting an OkDialog twice (it also deletes itself). Made the register dialog a bit wider. Register dialog no longer clears username field when it is invalid.
Diffstat (limited to 'src/gui/login.h')
-rw-r--r--src/gui/login.h30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/gui/login.h b/src/gui/login.h
index 79e74e13..981665d5 100644
--- a/src/gui/login.h
+++ b/src/gui/login.h
@@ -26,6 +26,7 @@
#include <iosfwd>
#include <guichan/actionlistener.hpp>
+#include <guichan/keylistener.hpp>
#include "window.h"
#include "../guichanfwd.h"
@@ -33,22 +34,13 @@
class LoginData;
/**
- * Listener used for handling wrong data.
- */
-class WrongDataNoticeListener : public gcn::ActionListener {
- public:
- void setTarget(gcn::TextField *textField);
- void action(const gcn::ActionEvent &event);
- private:
- gcn::TextField *mTarget;
-};
-
-/**
* The login dialog.
*
* \ingroup Interface
*/
-class LoginDialog : public Window, public gcn::ActionListener {
+class LoginDialog : public Window, public gcn::ActionListener,
+ public gcn::KeyListener
+{
public:
/**
* Constructor
@@ -67,7 +59,19 @@ class LoginDialog : public Window, public gcn::ActionListener {
*/
void action(const gcn::ActionEvent &event);
+ /**
+ * Called when a key is pressed in one of the text fields.
+ */
+ void keyPressed(gcn::KeyEvent& keyEvent);
+
private:
+ /**
+ * Returns whether submit can be enabled. This is true in the login
+ * state, when all necessary fields have some text.
+ */
+ bool
+ canSubmit();
+
gcn::TextField *mUserField;
gcn::TextField *mPassField;
gcn::TextField *mServerField;
@@ -76,8 +80,6 @@ class LoginDialog : public Window, public gcn::ActionListener {
gcn::Button *mCancelButton;
gcn::Button *mRegisterButton;
- WrongDataNoticeListener *mWrongDataNoticeListener;
-
LoginData *mLoginData;
};