瀏覽代碼

Encryption keys menu style

Bob Mottram 7 年之前
父節點
當前提交
4a3eb2cdb0
共有 1 個文件被更改,包括 19 次插入26 次删除
  1. 19
    26
      src/freedombone-controlpanel-user

+ 19
- 26
src/freedombone-controlpanel-user 查看文件

@@ -732,29 +732,25 @@ function gpg_key_trust {
732 732
 function menu_encryption_keys {
733 733
     while true
734 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 754
             1) show_gpg_key;;
759 755
             2) show_full_gpg_key;;
760 756
             3) publish_gpg_key;;
@@ -765,10 +761,7 @@ function menu_encryption_keys {
765 761
             8) add_ssh_key;;
766 762
             9) remove_ssh_key;;
767 763
             10) gpg_key_trust;;
768
-            11) rm -f "$data"
769
-                break;;
770 764
         esac
771
-        rm -f "$data"
772 765
     done
773 766
 }
774 767