Magellan Linux

Diff of /mcore-src/trunk/mcore-tools/src/modules/idesk/idesk.control.class.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2546 by niro, Wed Sep 16 11:16:27 2015 UTC revision 2572 by niro, Thu Sep 17 10:33:31 2015 UTC
# Line 1  Line 1 
1  # $Id$  # $Id$
2    
3  # control_input_keymap $serial  push_config idesk_icon
 control_input_keymap()  
 {  
  local serial="${CLASS_ARGV[0]}"  
  push_config_input_keymap "${serial}"  
 }  
   
 push_config_input_keymap()  
 {  
  local serial="$1"  
  local value  
   
  value=$(mysqldo "select keymap from cfg_input where serial='${serial}'")  
  control_client "${serial}" set input.keymap "${value}"  
 }  
4    
5  help_idesk_icon()  help_idesk_icon()
6  {  {
7   local serial="${CLASS_ARGV[0]}"   local serial="${CLASS_ARGV[0]}"
8   control_client "${serial}" help idesk.icon   control_client "${serial}" help idesk.icon
   
  mecho "get idesk.icon"  
  mecho " Shows all configured icons."  
  mecho  
  mecho "set idesk.icon [action] [name] [command] [icon] [filename] [x,y] [width,height] [default-icon]"  
  mecho " Adds or deletes an desktop icon."  
  mecho " [actions]:"  
  mecho "   add         - adds an icon"  
  mecho "   del         - deletes an icon"  
  mecho "                 if no [name] given, all desktop icons will be deleted"  
  mecho  
  mecho "   name         - Name of the icon"  
  mecho "   command      - command which will be run"  
  mecho "   icon         - icon pixmap [optional]"  
  mecho "   filename     - filename of the icon [optional]"  
  mecho "   x,y          - x,y position of the icon on the desktop [optional]"  
  mecho "   width,height - width and height of the icon [optional]"  
  mecho "   default-icon - default icon which will be selected if the icon pixmap was not found [optional]"  
9  }  }
10    
11  set_idesk_icon()  set_idesk_icon()
# Line 81  set_idesk_icon() Line 49  set_idesk_icon()
49   ;;   ;;
50   esac   esac
51    
52     if [[ -z ${name} ]]
53     then
54     eecho "No name given"
55     return 1
56     fi
57    
58   id=$(mysqldo "select id from cfg_idesk_icon where serial='${serial}' and name='${name}';")   id=$(mysqldo "select id from cfg_idesk_icon where serial='${serial}' and name='${name}';")
59   if [[ -n ${id} ]]   if [[ -n ${id} ]]
60   then   then
# Line 94  set_idesk_icon() Line 68  set_idesk_icon()
68  control_idesk_icon()  control_idesk_icon()
69  {  {
70   local serial="${CLASS_ARGV[0]}"   local serial="${CLASS_ARGV[0]}"
71     push_config_idesk_icon "${serial}"
72    }
73    
74    push_config_idesk_icon()
75    {
76     local serial="$1"
77   local values   local values
78   local id   local id
79     local xypos
80     local widthheight
81    
82   values=$(mysqldo "select id from cfg_idesk_icon where serial='${serial}';")   values=$(mysqldo "select id from cfg_idesk_icon where serial='${serial}';")
83   for id in ${values}   for id in ${values}
# Line 106  control_idesk_icon() Line 88  control_idesk_icon()
88   eecho "Name must not be empty id->'${id}'"   eecho "Name must not be empty id->'${id}'"
89   continue   continue
90   fi   fi
  if [[ -z ${cfg_idesk_icon_command} ]]  
  then  
  eecho "Command must not be empty id->'${id}'"  
  continue  
  fi  
91   if [[ -z ${cfg_idesk_icon_enabled} ]]   if [[ -z ${cfg_idesk_icon_enabled} ]]
92   then   then
93   eecho "Enabled must not be empty id->'${id}'"   eecho "Enabled must not be empty id->'${id}'"
# Line 118  control_idesk_icon() Line 95  control_idesk_icon()
95   fi   fi
96   if [[ ${cfg_idesk_icon_enabled} = 1 ]]   if [[ ${cfg_idesk_icon_enabled} = 1 ]]
97   then   then
98   control_client "${serial}" set idesk.icon add "${cfg_idesk_icon_name}" "${cfg_idesk_icon_command}" "${cfg_idesk_icon_icon}" "${cfg_idesk_icon_filename}" "${cfg_idesk_icon_xpos},${cfg_idesk_icon_ypos}" "${cfg_idesk_icon_width},${cfg_idesk_icon_height}" "${cfg_idesk_icon_default_icon}"   if [[ -n ${cfg_idesk_icon_xpos} ]] && [[ -n ${cfg_idesk_icon_ypos} ]]
99     then
100     xypos="${cfg_idesk_icon_xpos},${cfg_idesk_icon_ypos}"
101     fi
102     if [[ -n ${width} ]] && [[ -n ${height} ]]
103     then
104     widthheight="${cfg_idesk_icon_width},${cfg_idesk_icon_height}"
105     fi
106     control_client "${serial}" set idesk.icon add "${cfg_idesk_icon_name}" "${cfg_idesk_icon_command}" "${cfg_idesk_icon_icon}" "${cfg_idesk_icon_filename}" "${xypos}" "${widthheight}" "${cfg_idesk_icon_default_icon}"
107   elif [[ ${cfg_idesk_icon_enabled} = 0 ]]   elif [[ ${cfg_idesk_icon_enabled} = 0 ]]
108     then
109   control_client "${serial}" set idesk.icon del "${cfg_idesk_icon_name}"   control_client "${serial}" set idesk.icon del "${cfg_idesk_icon_name}"
110   # remove from database too   # remove from database too
111   mysqldo "delete from cfg_idesk_icon where id='${id}';"   mysqldo "delete from cfg_idesk_icon where id='${id}';"

Legend:
Removed from v.2546  
changed lines
  Added in v.2572