[Modconf-commits] r180 - in trunk/modconf: . debian modules

Frank Lichtenheld djpig@costa.debian.org
Sat, 07 May 2005 01:08:36 +0000


Author: djpig
Date: 2005-05-07 01:08:36 +0000 (Sat, 07 May 2005)
New Revision: 180

Modified:
   trunk/modconf/debian/changelog
   trunk/modconf/modconf
   trunk/modconf/modules/dialog
   trunk/modconf/modules/params
   trunk/modconf/modules/util
Log:
Don't jump to the top of the main menu after returning from
a sub menu (Closes: #175385, #232670)


Modified: trunk/modconf/debian/changelog
===================================================================
--- trunk/modconf/debian/changelog	2005-05-07 00:57:46 UTC (rev 179)
+++ trunk/modconf/debian/changelog	2005-05-07 01:08:36 UTC (rev 180)
@@ -6,6 +6,8 @@
     been done if there weren't a typo in the var...
   * Also use the --libdir option to find the modules, not
     only the eval files
+  * Don't jump to the top of the main menu after returning from
+    a sub menu (Closes: #175385, #232670)
 
  -- Frank Lichtenheld <djpig@debian.org>  Sat,  7 May 2005 02:45:48 +0200
 

Modified: trunk/modconf/modconf
===================================================================
--- trunk/modconf/modconf	2005-05-07 00:57:46 UTC (rev 179)
+++ trunk/modconf/modconf	2005-05-07 01:08:36 UTC (rev 180)
@@ -111,7 +111,7 @@
 
   machine=`uname -m`
   
-  echo 'menu "$text" "$msg_Select_Category" \' > $TempFile
+  echo 'menu "$text" "$msg_Select_Category" "@DEFAULTITEM@" \' > $TempFile
   echo '"$msg_Exit" "$msg_Finished_these" \'  >> $TempFile
   if [ "$machine" = "s390" ]; then
     echo '" " " " \' >> $TempFile
@@ -119,13 +119,13 @@
   fi
   echo '" " " " \' >> $TempFile
 
-  for directory in $dir_descrs; do
-    if [ ! -d $Dir_Prefix/$directory ] && [ $Source = mounted ]; then
+  for dir in $dir_descrs; do
+    if [ ! -d $Dir_Prefix/$dir ] && [ $Source = mounted ]; then
       continue;
     fi
 
     if [ -n "$Restrict_Section" ]; then
-      if in_list $directory $Restrict_Section; then
+      if in_list $dir $Restrict_Section; then
         true
       else
         continue
@@ -134,22 +134,24 @@
 
     local help=""
     local summary=""
-    tdir=`echo $directory | tr / _`
+    tdir=`echo $dir | tr / _`
 
     eval "summary=$`echo dir_descr_$tdir`"
 
     summary=$(echo $summary | sed -e 's/^-\(.*\)/\1/')
-    echo "\"$directory\"" \\ >> $TempFile
+    echo "\"$dir\"" \\ >> $TempFile
     echo "\"$summary."\" \\ >> $TempFile
   done
   echo "" >> $TempFile
+  
+  while true; do
+    local directory status defaultitem
 
-  while true; do
-    local directory status
     if [ -n "$One_Restricted_Section" ]; then
       directory=$One_Restricted_Section
     else
-      directory="`. $TempFile`"
+      sed -e "s#@DEFAULTITEM@#$defaultitem#" $TempFile > $TempFile6
+      directory="`. $TempFile6`"
       if [ $? -ne 0 ]; then return 1; fi
     fi
 
@@ -165,6 +167,7 @@
       $EDITOR $MODUTILSDIR/0chandev.chandev
       ;;
     *)
+      defaultitem="$directory"
       module_directory_menu "$directory" \
        "$msg_Select_modules_l" "`eval echo \\\"$msg_Select_modules\\\"`"
       if [ -n "$One_Restricted_Section" ]; then
@@ -191,7 +194,7 @@
 . "$ModuleHelpDir/util"
 . "$ModuleHelpDir/dialog"
 
-trap "rm -f $TempFile $TempFile1 $TempFile2 $TempFile3 $TempFile4 $TempFile5" 0 9 15
+trap "rm -f $TempFile $TempFile1 $TempFile2 $TempFile3 $TempFile4 $TempFile5 $TempFile6" 0 9 15
 
 source_eval
 

Modified: trunk/modconf/modules/dialog
===================================================================
--- trunk/modconf/modules/dialog	2005-05-07 00:57:46 UTC (rev 179)
+++ trunk/modconf/modules/dialog	2005-05-07 01:08:36 UTC (rev 180)
@@ -27,9 +27,21 @@
 # Make any dialogue box, with default settings and backtitle from
 # $BACKTITLE in the environment.
 #
-# dialog --type arg arg ...
+# dialog [options] -- --type arg arg ...
 #
 dialogBox () {
+  local args
+
+  while true; do
+      if [ "$1" = "--" ]; then
+	  shift
+	  break
+      else
+	  args="$args $1"
+	  shift
+      fi
+  done
+
   local type="$1"
   shift
   local title=""
@@ -52,7 +64,7 @@
   # do not confuse whiptail with different LC_* vars, we do not need
   # LC_MESSAGES at this point anyways
   unset LC_MESSAGES || true
-  $DIALOG_TEST $DIALOG_COMMAND $DIALOG_OPTIONS --title "$title" \
+  $DIALOG_TEST $DIALOG_COMMAND $DIALOG_OPTIONS $args --title "$title" \
      --backtitle "$backtitle" "$type" "$text " 0 0 "$@" 2>&1 1>$ttydev
   
   return $?
@@ -63,34 +75,40 @@
 # fileBox filename [title]
 #
 fileBox () {
-  dialogBox --textbox "$1" "$2"
+  dialogBox -- --textbox "$1" "$2"
 }
 
 msgBox () {
-  dialogBox --msgbox "$1" "$2"
+  dialogBox -- --msgbox "$1" "$2"
 }
 
 infoBox () {
-  dialogBox --infobox "$1" "$2"
+  dialogBox -- --infobox "$1" "$2"
 }
 
 yesNoBox () {
-  dialogBox --yesno "$1" "$2"
+  dialogBox -- --yesno "$1" "$2"
   return $?
 }
 
 inputBox () {
-  dialogBox --inputbox "$1" "$2" "$3" "$4"
+  dialogBox -- --inputbox "$1" "$2" "$3" "$4"
   return $?
 }
 
-# menu text title tag1 item1 ...
+# menu text title defaultitem tag1 item1 ...
 menu () {
   local text="$1"
   shift
   local title="$1"
   shift
-  dialogBox --menu "$text" "$title" 0 "$@"
+  local defaultitem="$1"
+  shift
+  if [ -z "$defaultitem" ]; then
+      dialogBox -- --menu "$text" "$title" 0 "$@"
+  else
+      dialogBox --default-item "$defaultitem" -- --menu "$text" "$title" 0 "$@"
+  fi
   return $?
 }
 
@@ -100,7 +118,7 @@
   shift
   local title="$1"
   shift
-  dialogBox --checklist "$text" "$title" 0 "$@"
+  dialogBox -- --checklist "$text" "$title" 0 "$@"
   return $?
 }
 
@@ -110,7 +128,7 @@
   shift
   local title="$1"
   shift
-  dialogBox --radiolist "$text" "$title" 0 "$@"
+  dialogBox -- --radiolist "$text" "$title" 0 "$@"
   return $?
 }
 

Modified: trunk/modconf/modules/params
===================================================================
--- trunk/modconf/modules/params	2005-05-07 00:57:46 UTC (rev 179)
+++ trunk/modconf/modules/params	2005-05-07 01:08:36 UTC (rev 180)
@@ -36,6 +36,7 @@
     readonly TempFile3=`tempfile`
     readonly TempFile4=`tempfile`
     readonly TempFile5=`tempfile`
+    readonly TempFile6=`tempfile`
 else 
     readonly TempFile="/tmp/`echo $0|$sed -e 's/^.*\///'`.$$"
     readonly TempFile1="/tmp/`echo $0|$sed -e 's/^.*\///'`.$$.1"
@@ -43,6 +44,7 @@
     readonly TempFile3="/tmp/`echo $0|$sed -e 's/^.*\///'`.$$.3"
     readonly TempFile4="/tmp/`echo $0|$sed -e 's/^.*\///'`.$$.4"
     readonly TempFile5="/tmp/`echo $0|$sed -e 's/^.*\///'`.$$.5"
+    readonly TempFile6="/tmp/`echo $0|$sed -e 's/^.*\///'`.$$.6"
 fi
 
 KernelVersion=$(uname -r)

Modified: trunk/modconf/modules/util
===================================================================
--- trunk/modconf/modules/util	2005-05-07 00:57:46 UTC (rev 179)
+++ trunk/modconf/modules/util	2005-05-07 01:08:36 UTC (rev 180)
@@ -172,10 +172,11 @@
   local title="$3"
 
   while true; do
+    local defaultitem
 
     build_lists
 
-    echo 'menu "$text" "$title" \' > $TempFile1
+    echo 'menu "$text" "$title" "$defaultitem" \' > $TempFile1
     echo '"$msg_Exit" "   $msg_Finished_these" \' >> $TempFile1
     echo '" " " " \' >> $TempFile1
     
@@ -193,6 +194,7 @@
       "$msg_Exit")
         return 0;;
       *)
+        defaultitem=result
         if [ $Source = floppy ]; then
           local list
           eval "list=$`echo dir_content_$directory`"