From 2cbcf7b143b413bd8b1d61cde0cf30c46623869a Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 4 Apr 2018 12:33:00 +0100 Subject: [PATCH] Edith configuration menu style --- src/freedombone-app-edith | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/src/freedombone-app-edith b/src/freedombone-app-edith index 307c42e5..a43b384f 100755 --- a/src/freedombone-app-edith +++ b/src/freedombone-app-edith @@ -131,29 +131,22 @@ function edith_browse { } function configure_interactive_edith { + W=(1 $"Enable login" + 2 $"Browse notes") + while true do - data=$(mktemp 2>/dev/null) - dialog --backtitle $"Freedombone Control Panel" \ - --title $"Edith" \ - --radiolist $"Choose an operation:" 10 50 3 \ - 1 $"Enable login" off \ - 2 $"Browse notes" off \ - 3 $"Exit" on 2> "$data" - sel=$? - case $sel in - 1) rm -f "$data" - break;; - 255) rm -f "$data" - break;; - esac - case $(cat "$data") in + # shellcheck disable=SC2068 + selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"Edith" --menu $"Choose an operation, or ESC to exit:" 10 60 2 "${W[@]}" 3>&2 2>&1 1>&3) + + if [ ! "$selection" ]; then + break + fi + + case $selection in 1) edith_enable_login;; 2) edith_browse;; - 3) rm -f "$data" - break;; esac - rm -f "$data" done }