Author: jerome
Date: 2008-08-18 10:55:02 +0200 (Mon, 18 Aug 2008)
New Revision: 1549

Added:
   
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/OnlineViewer.java
Modified:
   
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/CcInterface.java
Log:
* Added Online viewer that allow to launch default native browser. (Help menu 
completed : access to Online help, Online FAQ and User Report from cc).

Modified: 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/CcInterface.java
===================================================================
--- 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/CcInterface.java
     2008-08-18 08:07:08 UTC (rev 1548)
+++ 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/CcInterface.java
     2008-08-18 08:55:02 UTC (rev 1549)
@@ -95,6 +95,7 @@
 import com.tuxdroid.cc.Utils.CCRemoteActions;
 import com.tuxdroid.cc.Utils.GadgetAlertPanel;
 import com.tuxdroid.cc.Utils.GadgetObject;
+import com.tuxdroid.cc.Utils.OnlineViewer;
 import com.tuxdroid.cc.Utils.ResizeThread;
 import com.tuxdroid.cc.Utils.Settings;
 import com.tuxdroid.cc.Utils.SimpleAlertSettings;
@@ -778,18 +779,26 @@
                        functions.mask(helpMenu, new Rectangle(p.x, p.y, 53, 
24), 
                                        
getClass().getResource(path+"help.png"));
                        popupHelpMenu = new JPopupMenu();
-                       //Adding items.
-                       popupHelpMenu.add(new 
JMenuItem(language.getMenuHelpOnlineHelp()));
+                       //Adding items.
+                       JMenuItem help = new 
JMenuItem(language.getMenuHelpOnlineHelp());
+                       help.addMouseListener(new 
OpenLinkListener("http://www.tuxisalive.com/getting-started";));
+                       popupHelpMenu.add(help);
                        
                        //Create a new MenuListener.
                        URL one = getClass().getResource(path+"help.png");
                        URL two = getClass().getResource(path+"help_over.png");
                        URL three = getClass().getResource(path+"help.png");
                        popupHelpMenu.addPopupMenuListener(new 
MenuListener(one, two, three, 
-                                                                               
                            helpMenu));
+                                                                               
                            helpMenu));
                        
-                       popupHelpMenu.add(new 
JMenuItem(language.getMenuHelpOnlineFAQ()));
-                       popupHelpMenu.add(new 
JMenuItem(language.getMenuHelpReportBug()));
+                       JMenuItem onlineFaq = new 
JMenuItem(language.getMenuHelpOnlineFAQ());
+                       onlineFaq.addMouseListener(new 
OpenLinkListener("http://www.tuxisalive.com/documentation/faq";));
+                       popupHelpMenu.add(onlineFaq);
+                       
+                       JMenuItem reportBug = new 
JMenuItem(language.getMenuHelpReportBug());
+                       reportBug.addMouseListener(new 
OpenLinkListener("http://www.tuxisalive.com/developers/users-reports";));
+                       popupHelpMenu.add(reportBug);
+                       
                        popupHelpMenu.add(new 
JMenuItem(language.getMenuHelpAbout()));
                        helpMenu.addMouseListener(new 
java.awt.event.MouseAdapter() {
                                public void 
mousePressed(java.awt.event.MouseEvent e) {
@@ -3038,4 +3047,18 @@
        }
 }
 
+private class OpenLinkListener extends java.awt.event.MouseAdapter{
+       
+       String url;
+       
+       public OpenLinkListener(String url){
+               this.url = url;
+       }
+       
+       public void mousePressed(java.awt.event.MouseEvent event){
+               new OnlineViewer(this.url).display();
+       }
+       
+}
+
 }
\ No newline at end of file

Added: 
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
                              (rev 0)
+++ 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/OnlineViewer.java
      2008-08-18 08:55:02 UTC (rev 1549)
@@ -0,0 +1,50 @@
+/* This file is part of "TuxDroid Control Center".
+ *    Copyright 2008, kysoh
+ *    Author : Conan Jerome
+ *    eMail  : [EMAIL PROTECTED]
+ *    Site   : http://www.kysoh.com/
+ *
+ * "TuxDroid Control Center" is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * "TuxDroid Control Center" is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with "TuxDroid Control Center"; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package com.tuxdroid.cc.Utils;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.jdesktop.jdic.desktop.Desktop;
+import org.jdesktop.jdic.desktop.DesktopException;
+
+public class OnlineViewer{
+       
+       private String url = null;
+       
+       public OnlineViewer(String url){
+               this.url = url;
+       }
+       
+       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();
+               }
+       }
+       
+}


-------------------------------------------------------------------------
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