@@ -17,6 +17,7 @@
|
||||
|
||||
#include "states_screens/user_screen.hpp"
|
||||
|
||||
#include "addons/news_manager.hpp"
|
||||
#include "audio/sfx_manager.hpp"
|
||||
#include "challenges/unlock_manager.hpp"
|
||||
#include "config/player_manager.hpp"
|
||||
@@ -26,6 +27,7 @@
|
||||
#include "guiengine/widgets/label_widget.hpp"
|
||||
#include "guiengine/widgets/list_widget.hpp"
|
||||
#include "guiengine/widgets/text_box_widget.hpp"
|
||||
#include "online/request_manager.hpp"
|
||||
#include "states_screens/dialogs/message_dialog.hpp"
|
||||
#include "states_screens/dialogs/kart_color_slider_dialog.hpp"
|
||||
#include "states_screens/dialogs/recovery_dialog.hpp"
|
||||
@@ -326,18 +328,49 @@ void BaseUserScreen::eventCallback(Widget* widget,
|
||||
}
|
||||
else if (name == "online")
|
||||
{
|
||||
// If online access is not allowed, do not accept an online account
|
||||
// but advice the user where to enable this option.
|
||||
// If online access is not allowed,
|
||||
// give the player the choice to enable this option.
|
||||
if (m_online_cb->getState())
|
||||
{
|
||||
if (UserConfigParams::m_internet_status ==
|
||||
Online::RequestManager::IPERM_NOT_ALLOWED)
|
||||
{
|
||||
m_info_widget->setText(
|
||||
_("Internet access is disabled, please enable it in the options"),
|
||||
true);
|
||||
irr::core::stringw message =
|
||||
_("Internet access is disabled. Do you want to enable it ?");
|
||||
|
||||
class ConfirmInternet : public MessageDialog::IConfirmDialogListener
|
||||
{
|
||||
BaseUserScreen *m_parent_screen;
|
||||
private:
|
||||
GUIEngine::CheckBoxWidget *m_cb;
|
||||
public:
|
||||
virtual void onConfirm()
|
||||
{
|
||||
UserConfigParams::m_internet_status =
|
||||
Online::RequestManager::IPERM_ALLOWED;
|
||||
#ifndef SERVER_ONLY
|
||||
NewsManager::get()->init(false);
|
||||
#endif
|
||||
m_parent_screen->makeEntryFieldsVisible();
|
||||
ModalDialog::dismiss();
|
||||
} // onConfirm
|
||||
virtual void onCancel()
|
||||
{
|
||||
m_cb->setState(false);
|
||||
m_parent_screen->makeEntryFieldsVisible();
|
||||
ModalDialog::dismiss();
|
||||
} // onCancel
|
||||
// ------------------------------------------------------------
|
||||
ConfirmInternet(BaseUserScreen *parent, GUIEngine::CheckBoxWidget *online_cb)
|
||||
{
|
||||
m_parent_screen = parent;
|
||||
m_cb = online_cb;
|
||||
}
|
||||
}; // ConfirmInternet
|
||||
|
||||
SFXManager::get()->quickSound( "anvil" );
|
||||
m_online_cb->setState(false);
|
||||
new MessageDialog(message, MessageDialog::MESSAGE_DIALOG_CONFIRM,
|
||||
new ConfirmInternet(this, m_online_cb), true);
|
||||
}
|
||||
}
|
||||
makeEntryFieldsVisible();
|
||||
|
||||
Reference in New Issue
Block a user