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
diff --git a/gui/action.cpp b/gui/action.cpp
index f1dac1c..ca968d0 100644
--- a/gui/action.cpp
+++ b/gui/action.cpp
@@ -341,26 +341,16 @@
 
 	DataManager::GetValue(TW_SIMULATE_ACTIONS, simulate);
 
-    if (function == "reboot")
-    {
-        //curtainClose(); this sometimes causes a crash
+	if (function == "reboot")
+	{
+	        //curtainClose(); this sometimes causes a crash
 
-        sync();
+		sync();
+		DataManager::SetValue("tw_gui_done", 1);
+		DataManager::SetValue("tw_reboot_arg", arg);
 
-		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);
-
-        // This should never occur
-        return -1;
-    }
+		return 0;
+	}
     if (function == "home")
     {
         PageManager::SelectPackage("TWRP");
@@ -1143,6 +1133,36 @@
 				}
 			}
 		}
+		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
     {