Pārlūkot izejas kodu

Encryption keys menu style

Bob Mottram 7 gadus atpakaļ
vecāks
revīzija
4a3eb2cdb0
1 mainītis faili ar 19 papildinājumiem un 26 dzēšanām
  1. 19
    26
      src/freedombone-controlpanel-user

+ 19
- 26
src/freedombone-controlpanel-user Parādīt failu

732
 function menu_encryption_keys {
732
 function menu_encryption_keys {
733
     while true
733
     while true
734
     do
734
     do
735
-        data=$(mktemp 2>/dev/null)
736
-        dialog --backtitle $"Freedombone User Control Panel" \
737
-               --title $"My Encryption Keys" \
738
-               --radiolist $"Choose an operation:" 19 70 11 \
739
-               1 $"Show your PGP/GPG key" off \
740
-               2 $"Show your full PGP/GPG key, including private key" off \
741
-               3 $"Publish your PGP/GPG key so that others can find it" off \
742
-               4 $"Add someone's PGP/GPG key" off \
743
-               5 $"Remove someone's PGP/GPG key" off \
744
-               6 $"Sign a PGP/GPG key or website domain" off \
745
-               7 $"Refresh your PGP/GPG keys" off \
746
-               8 $"Add an ssh key for logging in" off \
747
-               9 $"Remove an ssh key for logging in" off \
748
-               10 $"Set the trust level for a PGP/GPG key" off \
749
-               11 $"Back to main menu" on 2> "$data"
750
-        sel=$?
751
-        case $sel in
752
-            1) rm -f "$data"
753
-               break;;
754
-            255) rm -f "$data"
755
-                 break;;
756
-        esac
757
-        case $(cat "$data") in
735
+        W=(1 $"Show your PGP/GPG key"
736
+           2 $"Show your full PGP/GPG key, including private key"
737
+           3 $"Publish your PGP/GPG key so that others can find it"
738
+           4 $"Add someone's PGP/GPG key"
739
+           5 $"Remove someone's PGP/GPG key"
740
+           6 $"Sign a PGP/GPG key or website domain"
741
+           7 $"Refresh your PGP/GPG keys"
742
+           8 $"Add an ssh key for logging in"
743
+           9 $"Remove an ssh key for logging in"
744
+           10 $"Set the trust level for a PGP/GPG key")
745
+
746
+        # shellcheck disable=SC2068
747
+        selection=$(dialog --backtitle $"Freedombone User Control Panel" --title $"My Encryption Keys" --menu $"Choose an operation, or ESC for main menu:" 14 70 7 "${W[@]}" 3>&2 2>&1 1>&3)
748
+
749
+        if [ ! "$selection" ]; then
750
+            break
751
+        fi
752
+
753
+        case $selection in
758
             1) show_gpg_key;;
754
             1) show_gpg_key;;
759
             2) show_full_gpg_key;;
755
             2) show_full_gpg_key;;
760
             3) publish_gpg_key;;
756
             3) publish_gpg_key;;
765
             8) add_ssh_key;;
761
             8) add_ssh_key;;
766
             9) remove_ssh_key;;
762
             9) remove_ssh_key;;
767
             10) gpg_key_trust;;
763
             10) gpg_key_trust;;
768
-            11) rm -f "$data"
769
-                break;;
770
         esac
764
         esac
771
-        rm -f "$data"
772
     done
765
     done
773
 }
766
 }
774
 
767