summaryrefslogtreecommitdiffstats
path: root/gui/action.cpp
diff options
context:
space:
mode:
authorbigbiff bigbiff <bigbiff@teamw.in>2016-09-06 03:04:51 +0200
committerEthan Yonker <dees_troy@teamw.in>2017-11-27 16:32:30 +0100
commit19fb79c722622ac4a068e258501ab4b161420cda (patch)
tree87791149590c18e019d20818dd61279e3b4829b2 /gui/action.cpp
parentImprove greek translation (diff)
downloadandroid_bootable_recovery-19fb79c722622ac4a068e258501ab4b161420cda.tar
android_bootable_recovery-19fb79c722622ac4a068e258501ab4b161420cda.tar.gz
android_bootable_recovery-19fb79c722622ac4a068e258501ab4b161420cda.tar.bz2
android_bootable_recovery-19fb79c722622ac4a068e258501ab4b161420cda.tar.lz
android_bootable_recovery-19fb79c722622ac4a068e258501ab4b161420cda.tar.xz
android_bootable_recovery-19fb79c722622ac4a068e258501ab4b161420cda.tar.zst
android_bootable_recovery-19fb79c722622ac4a068e258501ab4b161420cda.zip
Diffstat (limited to 'gui/action.cpp')
-rw-r--r--gui/action.cpp46
1 files changed, 31 insertions, 15 deletions
diff --git a/gui/action.cpp b/gui/action.cpp
index 05ae46515..039c4ef43 100644
--- a/gui/action.cpp
+++ b/gui/action.cpp
@@ -566,6 +566,7 @@ int GUIAction::reload(std::string arg __unused)
int GUIAction::readBackup(std::string arg __unused)
{
string Restore_Name;
+
DataManager::GetValue("tw_restore", Restore_Name);
PartitionManager.Set_Restore_Files(Restore_Name);
return 0;
@@ -1192,6 +1193,18 @@ int GUIAction::nandroid(std::string arg)
string auto_gen = gui_lookup("auto_generate", "(Auto Generate)");
if (Backup_Name == auto_gen || Backup_Name == gui_lookup("curr_date", "(Current Date)") || Backup_Name == "0" || Backup_Name == "(" || PartitionManager.Check_Backup_Name(true) == 0) {
ret = PartitionManager.Run_Backup(false);
+ DataManager::SetValue("tw_encrypt_backup", 0); // reset value so we don't encrypt every subsequent backup
+ if (!PartitionManager.stop_backup.get_value()) {
+ if (ret == false)
+ ret = 1; // 1 for failure
+ else
+ ret = 0; // 0 for success
+ DataManager::SetValue("tw_cancel_backup", 0);
+ } else {
+ DataManager::SetValue("tw_cancel_backup", 1);
+ gui_msg("backup_cancel=Backup Cancelled");
+ ret = 0;
+ }
} else {
operation_end(1);
return -1;
@@ -1199,25 +1212,28 @@ int GUIAction::nandroid(std::string arg)
DataManager::SetValue(TW_BACKUP_NAME, auto_gen);
} else if (arg == "restore") {
string Restore_Name;
+ int gui_adb_backup;
+
DataManager::GetValue("tw_restore", Restore_Name);
- ret = PartitionManager.Run_Restore(Restore_Name);
+ DataManager::GetValue("tw_enable_adb_backup", gui_adb_backup);
+ if (gui_adb_backup) {
+ DataManager::SetValue("tw_operation_state", 1);
+ if (TWFunc::stream_adb_backup(Restore_Name) == 0)
+ ret = 0; // success
+ else
+ ret = 1; // failure
+ DataManager::SetValue("tw_enable_adb_backup", 0);
+ ret = 0; // assume success???
+ } else {
+ if (PartitionManager.Run_Restore(Restore_Name))
+ ret = 0; // success
+ else
+ ret = 1; // failure
+ }
} else {
- operation_end(1);
+ operation_end(1); // invalid arg specified, fail
return -1;
}
- DataManager::SetValue("tw_encrypt_backup", 0);
- if (!PartitionManager.stop_backup.get_value()) {
- if (ret == false)
- ret = 1; // 1 for failure
- else
- ret = 0; // 0 for success
- DataManager::SetValue("tw_cancel_backup", 0);
- }
- else {
- DataManager::SetValue("tw_cancel_backup", 1);
- gui_msg("backup_cancel=Backup Cancelled");
- ret = 0;
- }
operation_end(ret);
return ret;
}