From 6ef6635ad3d5e8f6440e9ac2b67f1db8589e77b5 Mon Sep 17 00:00:00 2001 From: Dees_Troy Date: Thu, 21 Feb 2013 08:26:57 -0600 Subject: Check for root and root perms and offer to install/fix Also fix sort order for file selector by date and file sizes Change-Id: Idff9fe4232c19d4ed1082e78fabe6f921aa0a114 --- gui/action.cpp | 58 +++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 19 deletions(-) (limited to 'gui/action.cpp') diff --git a/gui/action.cpp b/gui/action.cpp index f1dac1c9b..ca968d088 100644 --- a/gui/action.cpp +++ b/gui/action.cpp @@ -341,26 +341,16 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */) DataManager::GetValue(TW_SIMULATE_ACTIONS, simulate); - if (function == "reboot") - { - //curtainClose(); this sometimes causes a crash - - sync(); - - if (arg == "recovery") - TWFunc::tw_reboot(rb_recovery); - else if (arg == "poweroff") - TWFunc::tw_reboot(rb_poweroff); - else if (arg == "bootloader") - TWFunc::tw_reboot(rb_bootloader); - else if (arg == "download") - TWFunc::tw_reboot(rb_download); - else - TWFunc::tw_reboot(rb_system); + if (function == "reboot") + { + //curtainClose(); this sometimes causes a crash - // This should never occur - return -1; - } + sync(); + DataManager::SetValue("tw_gui_done", 1); + DataManager::SetValue("tw_reboot_arg", arg); + + return 0; + } if (function == "home") { PageManager::SelectPackage("TWRP"); @@ -1143,6 +1133,36 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */) } } } + if (function == "installsu") + { + int op_status = 0; + + operation_start("Install SuperSU"); + if (simulate) { + simulate_progress_bar(); + } else { + if (!TWFunc::Install_SuperSU()) + op_status = 1; + } + + operation_end(op_status, simulate); + return 0; + } + if (function == "fixsu") + { + int op_status = 0; + + operation_start("Fixing Superuser Permissions"); + if (simulate) { + simulate_progress_bar(); + } else { + if (!TWFunc::Fix_su_Perms()) + op_status = 1; + } + + operation_end(op_status, simulate); + return 0; + } } else { -- cgit v1.2.3