From 2ac735d0ec439c011d154938794fad2ec94f8a27 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Fri, 16 Nov 2012 19:47:25 +0400 Subject: [PATCH] gui/update.cpp: add local variable for update mode --- src/gui/update.cpp | 18 ++++++++++++------ src/gui/update.h | 1 + 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/gui/update.cpp b/src/gui/update.cpp index e64dfb39b..86a30055f 100644 --- a/src/gui/update.cpp +++ b/src/gui/update.cpp @@ -287,9 +287,9 @@ bool CFlashUpdate::checkVersion4Update() CFlashVersionInfo * versionInfo; neutrino_locale_t msg_body; #ifdef DEBUG -printf("[update] mode is %d\n", g_settings.softupdate_mode); +printf("[update] mode is %d\n", softupdate_mode); #endif - if(g_settings.softupdate_mode==1) //internet-update + if(softupdate_mode==1) //internet-update { if(!selectHttpImage()) return false; @@ -383,8 +383,14 @@ printf("[update] mode is %d\n", g_settings.softupdate_mode); return (ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, msg, CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo, NEUTRINO_ICON_UPDATE) == CMessageBox::mbrYes); // UTF-8 } -int CFlashUpdate::exec(CMenuTarget* parent, const std::string &) +int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey) { + printf("CFlashUpdate::exec: [%s]\n", actionKey.c_str()); + if (actionKey == "local") + softupdate_mode = 0; + else + softupdate_mode = 1; + if(parent) parent->hide(); @@ -410,7 +416,7 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &) paint(); showGlobalStatus(20); - if(g_settings.softupdate_mode==1) //internet-update + if(softupdate_mode==1) //internet-update { char const * fname = rindex(filename.c_str(), '/') +1; char fullname[255]; @@ -432,12 +438,12 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &) ft.setStatusViewer(this); showStatusMessageUTF(g_Locale->getText(LOCALE_FLASHUPDATE_MD5CHECK)); // UTF-8 - if((g_settings.softupdate_mode==1) && !ft.check_md5(filename, file_md5)) { + if((softupdate_mode==1) && !ft.check_md5(filename, file_md5)) { hide(); ShowHintUTF(LOCALE_MESSAGEBOX_ERROR, g_Locale->getText(LOCALE_FLASHUPDATE_MD5SUMERROR)); // UTF-8 return menu_return::RETURN_REPAINT; } - if(g_settings.softupdate_mode==1) { //internet-update + if(softupdate_mode==1) { //internet-update if ( ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, (fileType < '3') ? "Flash downloaded image ?" : "Install downloaded pack ?", CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo, NEUTRINO_ICON_UPDATE) != CMessageBox::mbrYes) // UTF-8 { hide(); diff --git a/src/gui/update.h b/src/gui/update.h index 487ff3eb8..8d9a30266 100644 --- a/src/gui/update.h +++ b/src/gui/update.h @@ -54,6 +54,7 @@ class CFlashUpdate : public CProgressWindow std::string installedVersion; std::string newVersion; int menu_ret; + int softupdate_mode; bool selectHttpImage(void); bool getUpdateImage(const std::string & version);