CFlashExpert: Add return value to showMTDSelector() & showFileSelector()

Origin commit data
------------------
Commit: 720f52c0a0
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2013-09-26 (Thu, 26 Sep 2013)
This commit is contained in:
Michael Liebmann
2013-09-26 02:50:48 +02:00
parent 0dadd08c80
commit 1a4b568ceb
2 changed files with 14 additions and 13 deletions

View File

@@ -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; int shortcut = 0;
@@ -698,11 +698,12 @@ void CFlashExpert::showMTDSelector(const std::string & actionkey)
if (actionkey == "writemtd") if (actionkey == "writemtd")
mtdselector->addItem(new CMenuForwarderNonLocalized("systemFS with settings", true, NULL, this, "writemtd10", CRCInput::convertDigitToKey(shortcut++))); mtdselector->addItem(new CMenuForwarderNonLocalized("systemFS with settings", true, NULL, this, "writemtd10", CRCInput::convertDigitToKey(shortcut++)));
#endif #endif
mtdselector->exec(NULL,""); int res = mtdselector->exec(NULL,"");
delete mtdselector; 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); 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); fileselector->addIntroItems(LOCALE_FLASHUPDATE_FILESELECTOR, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL);
@@ -729,12 +730,14 @@ void CFlashExpert::showFileSelector(const std::string & actionkey)
} }
free(namelist); free(namelist);
} }
fileselector->exec(NULL,""); int res = fileselector->exec(NULL,"");
delete fileselector; delete fileselector;
return res;
} }
int CFlashExpert::exec(CMenuTarget* parent, const std::string & actionKey) int CFlashExpert::exec(CMenuTarget* parent, const std::string & actionKey)
{ {
int res = menu_return::RETURN_REPAINT;
if(parent) if(parent)
parent->hide(); parent->hide();
@@ -742,13 +745,13 @@ int CFlashExpert::exec(CMenuTarget* parent, const std::string & actionKey)
readmtd(-1); readmtd(-1);
} }
else if(actionKey=="writeflash") { else if(actionKey=="writeflash") {
showFileSelector(""); res = showFileSelector("");
} }
else if(actionKey=="readflashmtd") { else if(actionKey=="readflashmtd") {
showMTDSelector("readmtd"); res = showMTDSelector("readmtd");
} }
else if(actionKey=="writeflashmtd") { else if(actionKey=="writeflashmtd") {
showMTDSelector("writemtd"); res = showMTDSelector("writemtd");
} }
else { else {
int iReadmtd = -1; int iReadmtd = -1;
@@ -774,10 +777,8 @@ int CFlashExpert::exec(CMenuTarget* parent, const std::string & actionKey)
selectedMTD=-1; selectedMTD=-1;
} }
} }
hide(); res = menu_return::RETURN_REPAINT;
return menu_return::RETURN_EXIT_ALL;
} }
hide(); hide();
return menu_return::RETURN_REPAINT; return res;
} }

View File

@@ -72,8 +72,8 @@ class CFlashExpert : public CProgressWindow
int selectedMTD; int selectedMTD;
int width; int width;
void showMTDSelector(const std::string & actionkey); int showMTDSelector(const std::string & actionkey);
void showFileSelector(const std::string & actionkey); int showFileSelector(const std::string & actionkey);
bool checkSize(int mtd, std::string &backupFile); bool checkSize(int mtd, std::string &backupFile);
void readmtd(int readmtd); void readmtd(int readmtd);