//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(); }
//open a message dialog with buttons, //yes: applies networksettings and exit network setup //no: ask to restore networksettings, and return to menu int CNetworkSetup::saveChangesDialog() { // Save the settings after changes, if user wants to! int result = ShowMsg(LOCALE_MAINSETTINGS_NETWORK, g_Locale->getText(LOCALE_NETWORKMENU_APPLY_SETTINGS_NOW), CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo , NEUTRINO_ICON_QUESTION, width); switch(result) { case CMessageBox::mbrYes: if (!checkForIP()) return menu_return::RETURN_REPAINT; return exec(NULL, "networkapply"); break; case CMessageBox::mbrNo: //no return exec(NULL, "restore"); break; } return menu_return::RETURN_REPAINT; }