summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-02-06 00:40:31 +0300
committerAndrei Karas <akaras@inbox.ru>2013-02-06 00:40:31 +0300
commit16bc04769d0fdd319be5bcebddb49ddd87f76d94 (patch)
tree8a6561182c450e06be0405ced31982b81ea629ca /src
parentd514c4c7bc62061935579505b497307f89fc8db5 (diff)
downloadmanaplus-16bc04769d0fdd319be5bcebddb49ddd87f76d94.tar.gz
manaplus-16bc04769d0fdd319be5bcebddb49ddd87f76d94.tar.bz2
manaplus-16bc04769d0fdd319be5bcebddb49ddd87f76d94.tar.xz
manaplus-16bc04769d0fdd319be5bcebddb49ddd87f76d94.zip
Add support in register dialog for apply/close by keyboard
Default keys: enter and esc
Diffstat (limited to 'src')
-rw-r--r--src/gui/registerdialog.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/gui/registerdialog.cpp b/src/gui/registerdialog.cpp
index 40738abb2..d803bd89e 100644
--- a/src/gui/registerdialog.cpp
+++ b/src/gui/registerdialog.cpp
@@ -24,6 +24,8 @@
#include "client.h"
#include "configuration.h"
+#include "keydata.h"
+#include "keyevent.h"
#include "gui/logindialog.h"
#include "gui/okdialog.h"
@@ -270,7 +272,26 @@ void RegisterDialog::action(const gcn::ActionEvent &event)
void RegisterDialog::keyPressed(gcn::KeyEvent &keyEvent A_UNUSED)
{
- mRegisterButton->setEnabled(canSubmit());
+ if (keyEvent.isConsumed())
+ {
+ mRegisterButton->setEnabled(canSubmit());
+ return;
+ }
+ const int actionId = static_cast<KeyEvent*>(
+ &keyEvent)->getActionId();
+ if (actionId == static_cast<int>(Input::KEY_GUI_CANCEL))
+ {
+ action(gcn::ActionEvent(nullptr, mCancelButton->getActionEventId()));
+ }
+ else if (actionId == static_cast<int>(Input::KEY_GUI_SELECT)
+ || actionId == static_cast<int>(Input::KEY_GUI_SELECT2))
+ {
+ action(gcn::ActionEvent(nullptr, mRegisterButton->getActionEventId()));
+ }
+ else
+ {
+ mRegisterButton->setEnabled(canSubmit());
+ }
}
bool RegisterDialog::canSubmit() const