From 720f52c0a0b5ccda24a5cee52f22da23119fdaca Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Thu, 26 Sep 2013 02:50:48 +0200 Subject: [PATCH] CFlashExpert: Add return value to showMTDSelector() & showFileSelector() --- src/gui/update.cpp | 23 ++++++++++++----------- src/gui/update.h | 4 ++-- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/gui/update.cpp b/src/gui/update.cpp index d4d63a9da..c286283b9 100644 --- a/src/gui/update.cpp +++ b/src/gui/update.cpp @@ -664,7 +664,7 @@ void CFlashExpert::writemtd(const std::string & filename, int mtdNumber) } } -void CFlashExpert::showMTDSelector(const std::string & actionkey) +int CFlashExpert::showMTDSelector(const std::string & actionkey) { int shortcut = 0; @@ -698,11 +698,12 @@ void CFlashExpert::showMTDSelector(const std::string & actionkey) if (actionkey == "writemtd") mtdselector->addItem(new CMenuForwarderNonLocalized("systemFS with settings", true, NULL, this, "writemtd10", CRCInput::convertDigitToKey(shortcut++))); #endif - mtdselector->exec(NULL,""); + int res = mtdselector->exec(NULL,""); delete mtdselector; + return res; } -void CFlashExpert::showFileSelector(const std::string & actionkey) +int CFlashExpert::showFileSelector(const std::string & actionkey) { CMenuWidget* fileselector = new CMenuWidget(LOCALE_SERVICEMENU_UPDATE, NEUTRINO_ICON_UPDATE, width, MN_WIDGET_ID_FILESELECTOR); fileselector->addIntroItems(LOCALE_FLASHUPDATE_FILESELECTOR, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL); @@ -729,12 +730,14 @@ void CFlashExpert::showFileSelector(const std::string & actionkey) } free(namelist); } - fileselector->exec(NULL,""); + int res = fileselector->exec(NULL,""); delete fileselector; + return res; } int CFlashExpert::exec(CMenuTarget* parent, const std::string & actionKey) { + int res = menu_return::RETURN_REPAINT; if(parent) parent->hide(); @@ -742,13 +745,13 @@ int CFlashExpert::exec(CMenuTarget* parent, const std::string & actionKey) readmtd(-1); } else if(actionKey=="writeflash") { - showFileSelector(""); + res = showFileSelector(""); } else if(actionKey=="readflashmtd") { - showMTDSelector("readmtd"); + res = showMTDSelector("readmtd"); } else if(actionKey=="writeflashmtd") { - showMTDSelector("writemtd"); + res = showMTDSelector("writemtd"); } else { int iReadmtd = -1; @@ -774,10 +777,8 @@ int CFlashExpert::exec(CMenuTarget* parent, const std::string & actionKey) selectedMTD=-1; } } - hide(); - return menu_return::RETURN_EXIT_ALL; + res = menu_return::RETURN_REPAINT; } - hide(); - return menu_return::RETURN_REPAINT; + return res; } diff --git a/src/gui/update.h b/src/gui/update.h index ae9e436d5..1992b6aca 100644 --- a/src/gui/update.h +++ b/src/gui/update.h @@ -72,8 +72,8 @@ class CFlashExpert : public CProgressWindow int selectedMTD; int width; - void showMTDSelector(const std::string & actionkey); - void showFileSelector(const std::string & actionkey); + int showMTDSelector(const std::string & actionkey); + int showFileSelector(const std::string & actionkey); bool checkSize(int mtd, std::string &backupFile); void readmtd(int readmtd);