Author: jerome
Date: 2009-01-20 09:31:12 +0100 (Tue, 20 Jan 2009)
New Revision: 3485

Modified:
   
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/settings/XMLReader.java
   
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/tools/ToolTipSubMenu.java
Log:
* Fixed : #13 ?\226?\128?\148 Configuration du tooltip non sauvegard?\195?\169e 
(tooltip ).

Modified: 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/settings/XMLReader.java
===================================================================
--- 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/settings/XMLReader.java
      2009-01-19 14:05:32 UTC (rev 3484)
+++ 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/settings/XMLReader.java
      2009-01-20 08:31:12 UTC (rev 3485)
@@ -22,7 +22,9 @@
 
 package com.tuxdroid.cc.settings;
 
+import java.io.BufferedReader;
 import java.io.File;
+import java.io.FileReader;
 import java.io.IOException;
 import java.util.Hashtable;
 import java.util.Locale;
@@ -44,7 +46,9 @@
 
 public class XMLReader {
        /** xml file **/
-       private File xmlFile;
+       private File xmlFile;
+       private static File tooltipFile = new 
File(System.getProperty("user.home") + File.separator + "MyTux" + 
File.separator 
+                       + "TuxDroidSettings" + File.separator + "tooltipState");
        /** xml document representation **/
        private Document document;
        
@@ -673,16 +677,39 @@
        }
        
        
-       public boolean showTooltip(){
-               NodeList node = 
this.getDocument().getElementsByTagName("settings");
-               int index = 0;
-               Node oneObjectDatas = node.item(index);
+       public boolean showTooltip()
+       {
+               if(!tooltipFile.isFile())
+               {
+                       return true;
+               }
                
-               try{
-                       Element elem = (Element)oneObjectDatas;
-                       return 
Boolean.valueOf(elem.getElementsByTagName("ShowStartupHelp").item(0).getTextContent());
-               }
-               catch(Exception excep){
+               //getting line value here.
+               String line = "";
+               try
+               {
+                       BufferedReader buff = new BufferedReader(new 
FileReader(tooltipFile));
+
+                       try 
+                       {
+                               line = buff.readLine();
+                               
if(Boolean.valueOf(line.substring(line.indexOf("=") + 1 )))
+                               {
+                                       return true;
+                               }
+                               else
+                               {
+                                       return false;
+                               }
+                       } 
+                       finally 
+                       {
+                               buff.close();
+                       }
+                       
+               } 
+               catch (IOException ioe) 
+               {
                        return true;
                }
        }

Modified: 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/tools/ToolTipSubMenu.java
===================================================================
--- 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/tools/ToolTipSubMenu.java
    2009-01-19 14:05:32 UTC (rev 3484)
+++ 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/tools/ToolTipSubMenu.java
    2009-01-20 08:31:12 UTC (rev 3485)
@@ -22,6 +22,7 @@
 
 package com.tuxdroid.cc.tools;
 
+import java.io.File;
 import java.io.IOException;
 
 import javax.swing.JMenuItem;
@@ -35,7 +36,8 @@
        
        private static final long serialVersionUID = 1L;
 
-       public ToolTipSubMenu(String name){
+       public ToolTipSubMenu(String name)
+       {
                super();
                this.setText(name);
                this.addMouseListener(new java.awt.event.MouseAdapter(){
@@ -50,7 +52,8 @@
        }
        
        
-       public void checkState(){
+       public void checkState()
+       {
                CcCommons.logger.append("Check if control center has to start 
tooltip", true);
                //Check if tooltip is enable.
                if(CcCommons.settings.showTooltip()){
@@ -79,19 +82,26 @@
        }
        
        
-       public void run(){
+       public void run()
+       {
                CcCommons.logger.append("Starting tooltip", true);
+               String sepa = File.separator;
                CcCommons.isFrameworkBusy = true;
-               String path = System.getProperty("user.home") + 
"/MyTux/MyTuxTools/tooltip/tooltip.jar";
+               String path = System.getProperty("user.home") + sepa + "MyTux" 
+ sepa + "MyTuxTools" + sepa + "tooltip" + sepa + "tooltip.jar";
                String command = "";
-               if(SystemInformation.isUnix()){
+               
+               if(SystemInformation.isUnix())
+               {
                        
-                       command = String.format("java -jar %s" , path);
+                       command = String.format("java -jar %s %s %s" , path, 
CcCommons.settings.getLanguage(), CcCommons.settings.getCountry());
                }
-               else{
-                       command = String.format("java -jar \"%s\"" , path);
+               else
+               {
+                       command = String.format("java -Dtgp_lang=%s 
-Dtgp_country=%s -jar \"%s\"" , CcCommons.settings.getLanguage(), 
CcCommons.settings.getCountry(), path);
                }
                
+               System.out.println(command);
+               
                        Process p;
                        try {
                                CcCommons.isFrameworkBusy = true;


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to