Author: remi
Date: 2008-12-17 11:07:25 +0100 (Wed, 17 Dec 2008)
New Revision: 3144
Added:
software_suite_v2/software/gadgets/tuxdroid-gadget-gmail/trunk/tuxdroid-gadget-gmail/sources/net/karmaLab/tuxDroid/gadgets/BareBonesBrowserLaunch.java
Log:
* added a webbrowser launcher
Added:
software_suite_v2/software/gadgets/tuxdroid-gadget-gmail/trunk/tuxdroid-gadget-gmail/sources/net/karmaLab/tuxDroid/gadgets/BareBonesBrowserLaunch.java
===================================================================
---
software_suite_v2/software/gadgets/tuxdroid-gadget-gmail/trunk/tuxdroid-gadget-gmail/sources/net/karmaLab/tuxDroid/gadgets/BareBonesBrowserLaunch.java
(rev 0)
+++
software_suite_v2/software/gadgets/tuxdroid-gadget-gmail/trunk/tuxdroid-gadget-gmail/sources/net/karmaLab/tuxDroid/gadgets/BareBonesBrowserLaunch.java
2008-12-17 10:07:25 UTC (rev 3144)
@@ -0,0 +1,53 @@
+/////////////////////////////////////////////////////////
+// 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 //
+/////////////////////////////////////////////////////////
+
+package net.karmaLab.tuxDroid.gadgets;
+
+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/gadgets/tuxdroid-gadget-gmail/trunk/tuxdroid-gadget-gmail/sources/net/karmaLab/tuxDroid/gadgets/BareBonesBrowserLaunch.java
___________________________________________________________________
Name: svn:keywords
+ Id
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn