diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 5c1083695..f1c36c592 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -436,6 +436,7 @@ filesystem.is.utf8 Dateisystem filesystem.is.utf8.option.iso8859.1 ISO-8859-1 filesystem.is.utf8.option.utf8 UTF-8 flashupdate.actionreadflash lese Flash +flashupdate.apply_settings Sollen die aktuellen Einstellungen in das neue Image übernommen werden? flashupdate.cantopenfile kann Datei nicht öffnen flashupdate.cantopenmtd kann MTD nicht öffnen flashupdate.checkupdate_internet Online nach Updates suchen diff --git a/data/locale/english.locale b/data/locale/english.locale index 5642348c2..dfdada318 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -436,6 +436,7 @@ filesystem.is.utf8 file system filesystem.is.utf8.option.iso8859.1 ISO-8859-1 filesystem.is.utf8.option.utf8 UTF-8 flashupdate.actionreadflash reading +flashupdate.apply_settings Import current settings into new image? flashupdate.cantopenfile can't open file flashupdate.cantopenmtd can't open MTD flashupdate.checkupdate_internet Check for online updates diff --git a/src/gui/ext_update.cpp b/src/gui/ext_update.cpp index 6b6f911a8..c8763de72 100644 --- a/src/gui/ext_update.cpp +++ b/src/gui/ext_update.cpp @@ -121,30 +121,38 @@ bool CExtUpdate::ErrorReset(bool modus, const std::string & msg1, const std::str return false; } -bool CExtUpdate::writemtdExt(const std::string & filename) +bool CExtUpdate::applySettings(const std::string & filename, int mode) { if(!FileHelpers) FileHelpers = new CFileHelpers(); - imgFilename = (std::string)g_settings.update_dir + "/" + FILESYSTEM_ENCODING_TO_UTF8_STRING(filename); + + if (mode == MODE_EXPERT) + imgFilename = (std::string)g_settings.update_dir + "/" + FILESYSTEM_ENCODING_TO_UTF8_STRING(filename); + else + imgFilename = FILESYSTEM_ENCODING_TO_UTF8_STRING(filename); + DBG_TIMER_START() - bool ret = writemtdExt(); + bool ret = applySettings(); DBG_TIMER_STOP("Image editing") if (!ret) { if (mtdRamError != "") DisplayErrorMessage(mtdRamError.c_str()); } else { - if ((mtdNumber < 3) || (mtdNumber > 4)) { - const char *err = "invalid mtdNumber\n"; - printf(err); - DisplayErrorMessage(err); - WRITE_UPDATE_LOG("ERROR: %s", err); - return false; + if (mode == MODE_EXPERT) { + if ((mtdNumber < 3) || (mtdNumber > 4)) { + const char *err = "invalid mtdNumber\n"; + printf(err); + DisplayErrorMessage(err); + WRITE_UPDATE_LOG("ERROR: %s", err); + return false; + } } ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_SUCCESSFULLY), CMessageBox::mbrOk, CMessageBox::mbOk, NEUTRINO_ICON_INFO); WRITE_UPDATE_LOG("\n"); WRITE_UPDATE_LOG("##### Settings taken. #####\n"); - CFlashExpert::getInstance()->writemtd(filename, mtdNumber); + if (mode == MODE_EXPERT) + CFlashExpert::getInstance()->writemtd(filename, mtdNumber); } return ret; } @@ -166,7 +174,7 @@ bool CExtUpdate::isMtdramLoad() return ret; } -bool CExtUpdate::writemtdExt() +bool CExtUpdate::applySettings() { if(!hintBox) hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_PROCESSED)); diff --git a/src/gui/ext_update.h b/src/gui/ext_update.h index a588cb890..9f0ee6744 100644 --- a/src/gui/ext_update.h +++ b/src/gui/ext_update.h @@ -55,7 +55,7 @@ class CExtUpdate std::string mountPkt; CFileHelpers* FileHelpers; - bool writemtdExt(void); + bool applySettings(void); bool readBackupList(const std::string & dstPath); bool copyFileList(const std::string & fileList, const std::string & dstPath); bool readConfig(const std::string & Config); @@ -69,11 +69,16 @@ class CExtUpdate void updateLog(const char *buf); public: + enum + { + MODE_EXPERT = 0, + MODE_SOFTUPDATE = 1 + }; CExtUpdate(); ~CExtUpdate(); static CExtUpdate* getInstance(); - bool writemtdExt(const std::string & filename); + bool applySettings(const std::string & filename, int mode); bool ErrorReset(bool modus, const std::string & msg1="", const std::string & msg2=""); }; diff --git a/src/gui/update.cpp b/src/gui/update.cpp index 61c971baa..591dcaba9 100644 --- a/src/gui/update.cpp +++ b/src/gui/update.cpp @@ -451,16 +451,20 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &) CNeutrinoApp::getInstance()->exec(NULL, "savesettings"); sleep(2); //flash it... -#ifdef DEBUG1 - if(1) -#else - if(!ft.program(filename, 80, 100)) -#endif - { - hide(); - ShowHintUTF(LOCALE_MESSAGEBOX_ERROR, ft.getErrorMessage().c_str()); // UTF-8 + + if (ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_APPLY_SETTINGS), CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo, NEUTRINO_ICON_UPDATE) == CMessageBox::mbrYes) + if (!CExtUpdate::getInstance()->applySettings(filename, CExtUpdate::MODE_SOFTUPDATE)) return menu_return::RETURN_REPAINT; - } + +#ifdef DEBUG1 + if(1) { +#else + if(!ft.program(filename, 80, 100)) { +#endif + hide(); + ShowHintUTF(LOCALE_MESSAGEBOX_ERROR, ft.getErrorMessage().c_str()); // UTF-8 + return menu_return::RETURN_REPAINT; + } //status anzeigen showGlobalStatus(100); @@ -690,7 +694,7 @@ int CFlashExpert::exec(CMenuTarget* parent, const std::string & actionKey) showFileSelector(""); } else { if(selectedMTD == 10) { - CExtUpdate::getInstance()->writemtdExt(actionKey); + CExtUpdate::getInstance()->applySettings(actionKey, CExtUpdate::MODE_EXPERT); } else if(selectedMTD==-1) { writemtd(actionKey, MTD_OF_WHOLE_IMAGE); diff --git a/src/system/locals.h b/src/system/locals.h index 0a6b67178..e7ade5664 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -463,6 +463,7 @@ typedef enum LOCALE_FILESYSTEM_IS_UTF8_OPTION_ISO8859_1, LOCALE_FILESYSTEM_IS_UTF8_OPTION_UTF8, LOCALE_FLASHUPDATE_ACTIONREADFLASH, + LOCALE_FLASHUPDATE_APPLY_SETTINGS, LOCALE_FLASHUPDATE_CANTOPENFILE, LOCALE_FLASHUPDATE_CANTOPENMTD, LOCALE_FLASHUPDATE_CHECKUPDATE_INTERNET, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index fc38e3589..e9822fb95 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -463,6 +463,7 @@ const char * locale_real_names[] = "filesystem.is.utf8.option.iso8859.1", "filesystem.is.utf8.option.utf8", "flashupdate.actionreadflash", + "flashupdate.apply_settings", "flashupdate.cantopenfile", "flashupdate.cantopenmtd", "flashupdate.checkupdate_internet",