Allow flashing of images via the GUI

- Use the Images... button in the lower right of the zip install
  page
- Unify image flashing functions between restore and image flash
- boot and recovery partitions are flashable by default
- use fstab flag flashimg=1 or 0 to override defaults
- file system partitions are currently not flashable

Change-Id: I822dc446030543c55d2153e219d67a1292374ffc
diff --git a/gui/action.cpp b/gui/action.cpp
index 750d73b..96f6209 100644
--- a/gui/action.cpp
+++ b/gui/action.cpp
@@ -201,6 +201,7 @@
 		mf["decrypt_backup"] = &GUIAction::decrypt_backup;
 		mf["repair"] = &GUIAction::repair;
 		mf["changefilesystem"] = &GUIAction::changefilesystem;
+		mf["flashimage"] = &GUIAction::flashimage;
 	}
 
 	// First, get the action
@@ -1651,6 +1652,24 @@
 	return 0;
 }
 
+int GUIAction::flashimage(std::string arg)
+{
+	int op_status = 0;
+
+	operation_start("Flash Image");
+	string path, filename, full_filename;
+	DataManager::GetValue("tw_zip_location", path);
+	DataManager::GetValue("tw_file", filename);
+	full_filename = path + "/" + filename;
+	if (PartitionManager.Flash_Image(full_filename))
+		op_status = 0; // success
+	else
+		op_status = 1; // fail
+
+	operation_end(op_status);
+	return 0;
+}
+
 int GUIAction::getKeyByName(std::string key)
 {
 	if (key == "home")			return KEY_HOME;