//open a message dialog with three buttons, //yes: applies networksettings and exit network setup //no: saves networksettings and exit network setup //back: exit message dialog, goes back to network setup int CNetworkSetup::saveChangesDialog() { if (!checkForIP()) return 1; // Save the settings after changes, if user wants to! int result = ShowLocalizedMessage(LOCALE_MAINSETTINGS_NETWORK, LOCALE_NETWORKMENU_APPLY_SETTINGS_NOW, CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo | CMessageBox::mbBack, NEUTRINO_ICON_QUESTION, width); switch(result) { case CMessageBox::mbrYes: applyNetworkSettings(); return 0; break; case CMessageBox::mbrNo: saveNetworkSettings(true); return 0; break; default: restoreNetworkSettings(true); return 1; break; } }
//saves settings and apply void CNetworkSetup::applyNetworkSettings() { printf("[network setup] apply network settings...\n"); if (!checkForIP()) return; CHintBox hintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_NETWORKMENU_APPLY_SETTINGS)); // UTF-8 hintBox.paint(); networkConfig->stopNetwork(); saveNetworkSettings(); networkConfig->startNetwork(); hintBox.hide(); }
int CNetworkSetup::exec(CMenuTarget* parent, const std::string &actionKey) { int res = menu_return::RETURN_REPAINT; if (parent) { parent->hide(); } if(actionKey=="networkapply") { applyNetworkSettings(); return res; } else if(actionKey=="networktest") { printf("[network setup] doing network test...\n"); testNetworkSettings(); return res; } else if(actionKey=="networkshow") { dprintf(DEBUG_INFO, "show current network settings...\n"); showCurrentNetworkSettings(); return res; } else if(actionKey=="networksave") { saveNetworkSettings(); return res; } printf("[neutrino] init network setup...\n"); res = showNetworkSetup(); return res; }