diff --git a/src/states_screens/dialogs/login_dialog.cpp b/src/states_screens/dialogs/login_dialog.cpp index b8afdaec4..5fa71c86d 100644 --- a/src/states_screens/dialogs/login_dialog.cpp +++ b/src/states_screens/dialogs/login_dialog.cpp @@ -70,6 +70,8 @@ LoginDialog::LoginDialog(const Message message_type) : m_message_widget = getWidget("message"); assert(m_message_widget != NULL); + m_options_widget = getWidget("options"); + assert(m_options_widget != NULL); m_sign_in_widget = getWidget("sign_in"); assert(m_sign_in_widget != NULL); m_recovery_widget = getWidget("recovery"); @@ -126,15 +128,12 @@ GUIEngine::EventPropagation LoginDialog::processEvent(const std::string& eventSo void LoginDialog::onEnterPressedInternal() { - //If enter was pressed while none of the other widgets are focused, then interpret as "signin" press. + + //If enter was pressed while none of the buttons was focused interpret as sign_in event const int playerID = PLAYER_ID_GAME_MASTER; - if (!GUIEngine::isFocusedForPlayer(m_recovery_widget, playerID) && - !GUIEngine::isFocusedForPlayer(m_register_widget, playerID) && - !GUIEngine::isFocusedForPlayer(m_as_guest_widget, playerID) && - !GUIEngine::isFocusedForPlayer(m_cancel_widget, playerID)) - { - processEvent("sign_in"); - } + if (GUIEngine::isFocusedForPlayer(m_options_widget, playerID)) + return; + processEvent("sign_in"); } // ----------------------------------------------------------------------------- diff --git a/src/states_screens/dialogs/login_dialog.hpp b/src/states_screens/dialogs/login_dialog.hpp index 37a2cc918..73a424523 100644 --- a/src/states_screens/dialogs/login_dialog.hpp +++ b/src/states_screens/dialogs/login_dialog.hpp @@ -24,6 +24,7 @@ #include "guiengine/modaldialog.hpp" #include "guiengine/widgets/text_box_widget.hpp" #include "guiengine/widgets/icon_button_widget.hpp" +#include "guiengine/widgets/ribbon_widget.hpp" #include "guiengine/widgets/label_widget.hpp" /** @@ -43,6 +44,7 @@ private: GUIEngine::TextBoxWidget * m_password_widget; GUIEngine::LabelWidget * m_message_widget; + GUIEngine::RibbonWidget * m_options_widget; GUIEngine::IconButtonWidget * m_sign_in_widget; GUIEngine::IconButtonWidget * m_recovery_widget; GUIEngine::IconButtonWidget * m_register_widget; diff --git a/src/states_screens/dialogs/registration_dialog.cpp b/src/states_screens/dialogs/registration_dialog.cpp index 3e0c6f95e..28417888c 100644 --- a/src/states_screens/dialogs/registration_dialog.cpp +++ b/src/states_screens/dialogs/registration_dialog.cpp @@ -147,7 +147,7 @@ bool RegistrationDialog::processInfoEvent(const std::string& eventSource){ m_password_confirm = getWidget("password_confirm")->getText().trim(); m_email = getWidget("email")->getText().trim(); m_email_confirm = getWidget("email_confirm")->getText().trim(); - //FIXME More validation of registration information (Though all validation should happen at the server too!) + //FIXME More validation of registration information if (m_password != m_password_confirm) { getWidget("info")->setText(_("Passwords don't match!"), false); @@ -260,17 +260,18 @@ GUIEngine::EventPropagation RegistrationDialog::processEvent(const std::string& void RegistrationDialog::onEnterPressedInternal() { - //If enter was pressed while "cancel" nor "previous" was selected, then interpret as "next" press. + //If enter was pressed while no button was focused, then interpret as "next" press. const int playerID = PLAYER_ID_GAME_MASTER; bool interpret_as_next = true; - ButtonWidget* button = getWidget("cancel"); - assert(button != NULL); - interpret_as_next = interpret_as_next && !GUIEngine::isFocusedForPlayer(button, playerID); + ButtonWidget * cancel_widget = getWidget("cancel"); + ButtonWidget * next_widget = getWidget("next"); + interpret_as_next = interpret_as_next && + !GUIEngine::isFocusedForPlayer(next_widget, playerID) && + !GUIEngine::isFocusedForPlayer(cancel_widget, playerID); if (interpret_as_next && m_phase == Terms) { - button = getWidget("previous"); - assert(button != NULL); - interpret_as_next = interpret_as_next && !GUIEngine::isFocusedForPlayer(button, playerID); + ButtonWidget * previous_widget = getWidget("previous"); + interpret_as_next = interpret_as_next && !GUIEngine::isFocusedForPlayer(previous_widget, playerID); } if (interpret_as_next) {