Author: jerome
Date: 2008-09-22 10:47:04 +0200 (Mon, 22 Sep 2008)
New Revision: 1948

Added:
   
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/BareBonesBrowserLaunch.java
Modified:
   
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Object/View/TuxAttitunesListView.java
   
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/OnlineViewer.java
Log:
* Modified the way to launch default browser ( in the hope to completely remove 
JDIC ).

Modified: 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Object/View/TuxAttitunesListView.java
===================================================================
--- 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Object/View/TuxAttitunesListView.java
        2008-09-22 08:39:58 UTC (rev 1947)
+++ 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Object/View/TuxAttitunesListView.java
        2008-09-22 08:47:04 UTC (rev 1948)
@@ -258,19 +258,23 @@
                        
                        if(!(attPath == null)){
                                if (tux.server.getConnected())
-                               {
+                               {
+                                       System.out.println("server ok");
                                        tux.dongle.waitConnected(2.0);
                                        if (tux.dongle.getConnected())
-                                       {
+                                       {
+                                               System.out.println("dongle ok");
                                                tux.radio.waitConnected(2.0);
                                                if (tux.radio.getConnected())
                                                {
                                                        //Verifying if language 
is installed.
+                                                       
System.out.println("radio ok");
                                                        
if(!TuxLanguagesMenu.isInstalledLocutorLanguage(lang
                                                                        , 
(List<String>)tux.tts.getVoices())){
                                                                
                                                                String message 
= language.attituneinvalidTTS();
                                                                
if(this.showErrorMessages)
+                                                                       
System.out.println("freeze before");
                                                                        
JOptionPane.showMessageDialog(this.jTable, message, 
                                                                                
paneTitle, JOptionPane.ERROR_MESSAGE);
                                                                        
changes.firePropertyChange("AttituneError", null, null);

Added: 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/BareBonesBrowserLaunch.java
===================================================================
--- 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/BareBonesBrowserLaunch.java
                            (rev 0)
+++ 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/BareBonesBrowserLaunch.java
    2008-09-22 08:47:04 UTC (rev 1948)
@@ -0,0 +1,53 @@
+package com.tuxdroid.cc.Utils;
+
+/////////////////////////////////////////////////////////
+// Bare Bones Browser Launch //
+// Version 1.5 //
+// December 10, 2005 //
+// Supports: Mac OS X, GNU/Linux, Unix, Windows XP //
+// Example Usage: //
+// String url = "http://www.centerkey.com/";; //
+// BareBonesBrowserLaunch.openURL(url); //
+// Public Domain Software -- Free to Use as You Like //
+/////////////////////////////////////////////////////////
+
+import java.lang.reflect.Method;
+
+public class BareBonesBrowserLaunch
+{
+
+       @SuppressWarnings("unchecked")
+       public static void openURL(String url)
+       {
+               String osName = System.getProperty("os.name");
+               try
+               {
+                       if (osName.startsWith("Mac OS"))
+                       {
+                               Class fileMgr = 
Class.forName("com.apple.eio.FileManager");
+                               Method openURL = 
fileMgr.getDeclaredMethod("openURL",
+                                       new Class[] {String.class});
+                               openURL.invoke(null, new Object[] {url});
+                       }
+                       else if (osName.startsWith("Windows"))
+                               Runtime.getRuntime().exec("rundll32 
url.dll,FileProtocolHandler " + url);
+                       else
+                       { //assume Unix or Linux
+                               String[] browsers = {
+                                               "firefox", "opera", 
"konqueror", "epiphany", "mozilla", "netscape" };
+                               String browser = null;
+                               for (int count = 0; count < browsers.length && 
browser == null; count++)
+                                       if (Runtime.getRuntime().exec(
+                                                       new String[] {"which", 
browsers[count]}).waitFor() == 0)
+                                               browser = browsers[count];
+                               if (browser == null)
+                                       throw new Exception("Could not find web 
browser");
+                               else
+                                       Runtime.getRuntime().exec(new String[] 
{browser, url});
+                       }
+               }
+               catch (Exception e)
+               {
+               }
+       }
+}


Property changes on: 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/BareBonesBrowserLaunch.java
___________________________________________________________________
Name: svn:executable
   + *

Modified: 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/OnlineViewer.java
===================================================================
--- 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/OnlineViewer.java
      2008-09-22 08:39:58 UTC (rev 1947)
+++ 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/OnlineViewer.java
      2008-09-22 08:47:04 UTC (rev 1948)
@@ -22,12 +22,8 @@
 
 package com.tuxdroid.cc.Utils;
 
-import java.net.MalformedURLException;
-import java.net.URL;
+import com.tuxdroid.cc.Utils.BareBonesBrowserLaunch;
 
-import org.jdesktop.jdic.desktop.Desktop;
-import org.jdesktop.jdic.desktop.DesktopException;
-
 public class OnlineViewer{
        
        private String url = null;
@@ -37,14 +33,7 @@
        }
        
        public void display(){
-               
-               try {
-                       Desktop.browse(new URL(this.url)); //open URL in 
default browser
-               } catch (DesktopException e) {
-                       e.printStackTrace();
-               } catch(MalformedURLException e){
-                       e.printStackTrace();
-               }
+               BareBonesBrowserLaunch.openURL(url);
        }
        
 }


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to