Bladeren bron

Get the restore app name

Bob Mottram 8 jaren geleden
bovenliggende
commit
a1fcbfe42c
1 gewijzigde bestanden met toevoegingen van 17 en 3 verwijderingen
  1. 17
    3
      src/freedombone-controlpanel

+ 17
- 3
src/freedombone-controlpanel Bestand weergeven

@@ -912,23 +912,34 @@ function restore_data_from_storage {
912 912
     while true
913 913
     do
914 914
 
915
+        app_list=()
915 916
         n=1
916 917
         applist="$n $AllStr off"
917 918
         n=$[n+1]
919
+        app_list+=("$AllStr")
918 920
 
921
+        util_index=0
919 922
         for a in "${utils_installed[@]}"
920 923
         do
921 924
             applist="$applist $n $a off"
925
+            app_name=${utils_installed[util_index]}
922 926
             n=$[n+1]
927
+            util_index=$[util_index+1]
928
+            app_list+=("$app_name")
923 929
         done
924 930
 
931
+        app_index=0
925 932
         for a in "${APPS_INSTALLED_NAMES[@]}"
926 933
         do
927 934
             applist="$applist $n $a off"
928 935
             n=$[n+1]
936
+            app_name=${APPS_INSTALLED_NAMES[app_index]}
937
+            app_index=$[app_index+1]
938
+            app_list+=("$app_name")
929 939
         done
930 940
         applist="$applist $n $ExitStr on"
931 941
         n=$[n+1]
942
+        app_list+=("$ExitStr")
932 943
 
933 944
         choices=$(dialog --stdout --backtitle $"Freedombone" \
934 945
                          --title $"Restore apps" \
@@ -937,10 +948,12 @@ function restore_data_from_storage {
937 948
 
938 949
         sel=$?
939 950
         case $sel in
940
-            1) break;;
941
-            255) break;;
951
+            1) return;;
952
+            255) return;;
942 953
         esac
943
-        app_name=$(cat $data)
954
+        selected_index=$(cat $data)
955
+        selected_index=$[selected_index-1]
956
+        app_name=${app_list[$selected_index]}
944 957
 
945 958
         # exit
946 959
         if [[ "$app_name" == "$ExitStr" ]]; then
@@ -948,6 +961,7 @@ function restore_data_from_storage {
948 961
         fi
949 962
 
950 963
         clear
964
+        echo $"Selected $app_name"
951 965
 
952 966
         # Restore all
953 967
         if [[ "$app_name" == "$AllStr" ]]; then