Author: jerome
Date: 2009-01-23 12:25:59 +0100 (Fri, 23 Jan 2009)
New Revision: 3521

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/Object/Playlist/RemotePlaylist.java
   
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Object/PseudoFileBrowser/FileBrowser.java
   
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/settings/Settings.java
   
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/settings/XMLReader.java
Log:
* Fixed a bug copying from alerts to favorites when no parameters was 
registered...

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
     2009-01-23 08:47:54 UTC (rev 3520)
+++ 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/CcInterface.java
     2009-01-23 11:25:59 UTC (rev 3521)
@@ -1603,27 +1603,34 @@
         * This procedure delete current selected gadget or attitune.
         */
        public void delete_current(){
-               if((CcCommons.type != CcConstants.TYPE_REMOTELIST) && 
(CcCommons.type != CcConstants.TYPE_ALERT)){
+               if((CcCommons.type != CcConstants.TYPE_REMOTELIST) && 
(CcCommons.type != CcConstants.TYPE_ALERT))
+               {
                        fileBrowser.delete_current(CcCommons.type, 
CcCommons.view);
-                       if(CcCommons.type == CcConstants.TYPE_ATTITUNES){
-                               
if(this.savedProperties.containsKey("attitune")){
+                       if(CcCommons.type == CcConstants.TYPE_ATTITUNES)
+                       {
+                               if(this.savedProperties.containsKey("attitune"))
+                               {
                                        this.savedProperties.put("attitune", 
new JPanel[]{new TuxDegradeePanel()});
                                }
                        }
-                       else if(CcCommons.type == CcConstants.TYPE_GADGETS){
-                               if(this.savedProperties.containsKey("gadget")){
+                       else if(CcCommons.type == CcConstants.TYPE_GADGETS)
+                       {
+                               if(this.savedProperties.containsKey("gadget"))
+                               {
                                        this.savedProperties.put("gadget", new 
JPanel[]{new TuxDegradeePanel(),
                                                                                
                                                new TuxDegradeePanel()});
                                }
                        }
                        
                }
-               else if(CcCommons.type == CcConstants.TYPE_REMOTELIST){
+               else if(CcCommons.type == CcConstants.TYPE_REMOTELIST)
+               {
                        Object[] datas = 
remotePlaylist.getDatasAtSelectedIndex();
                        CcCommons.settings.removeFromRemoteList(datas);
                        remotePlaylist.refresh();
                }
-               else if(CcCommons.type == CcConstants.TYPE_ALERT){
+               else if(CcCommons.type == CcConstants.TYPE_ALERT)
+               {
                        Object[] datas = 
alertPlaylist.getDatasAtSelectedIndex(); 
                        CcCommons.settings.removeFromAlertList(datas);
                        alertPlaylist.refresh();
@@ -1842,11 +1849,12 @@
                        String[] values = (String[])arg0.getNewValue();
                        CcCommons.settings.setAlertNameValue(values[0], 
values[1]);
                }
-               //XXX 
+               
                else 
if(arg0.getPropertyName().equalsIgnoreCase("Alert-Value-Changed")){
                        final String kind = alertPlaylist.getSelectedItemKind();
                        
                        final JButton validate = new JButton();
+                       validate.setName("validate");
                        final JButton test = new JButton();
                        final String sub = 
CcCommons.language.getMenuSubDirectory();
                        validate.setIcon(new 
ImageIcon(CcCommons.targetClass.getResource(sub + "apply.png")));
@@ -1889,6 +1897,7 @@
                                        public void 
mouseReleased(java.awt.event.MouseEvent event){
                                                validate.setIcon(new 
ImageIcon(CcCommons.targetClass.getResource(sub + "apply.png")));
                                        }
+                                       
                                        public void 
mousePressed(java.awt.event.MouseEvent event){
                                        
                                                validate.setIcon(new 
ImageIcon(CcCommons.targetClass.getResource(sub + "apply_down.png")));
@@ -2480,15 +2489,22 @@
                
                //Create action with a gadget.
                else if(CcCommons.type == CcConstants.TYPE_GADGETS){
-                       if(this.playlistDragToIndex == 0){
+                       if(this.playlistDragToIndex == 0)
+                       {
                                Object[] datas = 
fileBrowser.getDatasAsRemoteStruct(CcConstants.TYPE_GADGETS, CcCommons.view);
                                datas = CcInterfaceFunctions.rename(datas, 
alertPlaylist.datasToDisplay);
                                CcCommons.settings.addToAlertList(datas, null);
                                
alertPlaylist.setDatas(CcCommons.settings.getAlertListDatas());
                                this.showPlaylist(0);
+                               final GadgetObject gdg = 
fileBrowser.getGadgetInstanceByPath(alertPlaylist.getPath());
+                               final GadgetInstanceParameters parameters = 
gdg.parameters.getValues();
+                               String uid = 
CcCommons.settings.getUID(datas[0].toString());
+                               CcCommons.settings.registerGadgetParameter(uid, 
parameters, gdg);
                        }
                        
-                       else if(this.playlistDragToIndex == 1){
+                       else if(this.playlistDragToIndex == 1)
+                       {
+                               //Getting gadget parameters panel.
                                Object[] datas = 
fileBrowser.getDatasAsRemoteStruct(CcConstants.TYPE_GADGETS, CcCommons.view);
                                datas = CcInterfaceFunctions.rename(datas, 
remotePlaylist.datasToDisplay);
                                CcCommons.settings.addToRemoteList(datas);
@@ -2496,14 +2512,19 @@
                                this.showPlaylist(1);
                        }
                }
-               
-               else if(CcCommons.type == CcConstants.TYPE_ALERT){
-                       if(this.playlistDragToIndex == 1){ //then alert to 
remote copy.
+               //XXX
+               else if(CcCommons.type == CcConstants.TYPE_ALERT)
+               {
+                       if(this.playlistDragToIndex == 1)
+                       { //then alert to remote copy.
                                
CcCommons.settings.registerAlertAsRemote(CcCommons.settings.getUID(alertPlaylist.getSelectedName()));
                                
remotePlaylist.setDatas(CcCommons.settings.getRemoteListDatas());
                                remotePlaylist.refresh();
                                this.showPlaylist(1);
-                       }else{ //then simple copy from remote, to remote.
+                       }
+                       else
+                       { 
+                               //then simple copy from remote, to remote.
                                
CcCommons.settings.copyAlert(CcCommons.settings.getUID(alertPlaylist.getSelectedName()));
                                
alertPlaylist.setDatas(CcCommons.settings.getAlertListDatas());
                                alertPlaylist.refresh();

Modified: 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Object/Playlist/RemotePlaylist.java
===================================================================
--- 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Object/Playlist/RemotePlaylist.java
  2009-01-23 08:47:54 UTC (rev 3520)
+++ 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Object/Playlist/RemotePlaylist.java
  2009-01-23 11:25:59 UTC (rev 3521)
@@ -79,6 +79,13 @@
        }
        
        
+       //Removes all entries by gadget name.
+       public void removeAllByGadgetName(String gdgName)
+       {
+               
+       }
+       
+       
        public void refresh()
        {
                if(this.playlist.getSelectedRow() != -1)

Modified: 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Object/PseudoFileBrowser/FileBrowser.java
===================================================================
--- 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Object/PseudoFileBrowser/FileBrowser.java
    2009-01-23 08:47:54 UTC (rev 3520)
+++ 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Object/PseudoFileBrowser/FileBrowser.java
    2009-01-23 11:25:59 UTC (rev 3521)
@@ -730,26 +730,34 @@
 
                
                public void delete_current(byte type, byte view){
-                       if(type == FileBrowser.GADGETS_TYPE){
+                       if(type == FileBrowser.GADGETS_TYPE)
+                       {
                                String gdgName = null;
                                String gdgPath = null;
-                               if(view == FileBrowser.LIST_VIEW){
+                               if(view == FileBrowser.LIST_VIEW)
+                               {
                                        gdgName = 
this.getGadgetNameAtSelectedIndex().toString();
                                        gdgPath = 
gadgetsListView.getSelectedGadgetPath();
                                }
-                               else if(view == FileBrowser.THUMBNAIL_VIEW){
+                               else if(view == FileBrowser.THUMBNAIL_VIEW)
+                               {
                                        gdgName = 
thumbnailGadgets.getSelectedGadget().getName();
                                        gdgPath = 
thumbnailGadgets.getSelectedGadget().getPath();
                                }
-                               if(gdgPath != null){
+                               if(gdgPath != null)
+                               {
                                        File f = new File(gdgPath);
-                                       if(f.exists()){
+                                       if(f.exists())
+                                       {
                                                String realName = f.getName() + 
".tgf";
                                                String p = 
CcCommons.MyTuxGadgetsDirectory.getAbsolutePath() + File.separator + realName;
                                                File deleting = new File(p);
-                                               if(deleting.exists()){
+                                               if(deleting.exists())
+                                               {
                                                        deleting.delete();
-                                               }
+                                               }
+                                               
+                                               
CcCommons.settings.deleteFromPlaylists(p);
                                        }
                                }
                                

Modified: 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/settings/Settings.java
===================================================================
--- 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/settings/Settings.java
       2009-01-23 08:47:54 UTC (rev 3520)
+++ 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/settings/Settings.java
       2009-01-23 11:25:59 UTC (rev 3521)
@@ -36,7 +36,11 @@
 import com.tuxdroid.cc.gadget.GadgetObject;
 
 public class Settings {
-       /** Flag that indicate if setting file has to be created **/
+       /** Flag that indicate if setting file has to be created **/
+       
+       public static final byte alerts = 0;
+       public static final byte favorites = 1;
+       
        private boolean newXmlFile = false;
        
        //Public object xml reader and writer.
@@ -257,6 +261,16 @@
                writer.removeFromRemoteList(datas);
        }
        
+       
+       /**
+        * Delete an instance from all lists.
+        * @param instancePath
+        */
+       public void deleteFromPlaylists(String instancePath)
+       {
+               //TODO
+       }
+       
        public void addToAlertList(Object[] datas, Object[] config){
                writer.saveToAlertList(datas, config);
        }

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-23 08:47:54 UTC (rev 3520)
+++ 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/settings/XMLReader.java
      2009-01-23 11:25:59 UTC (rev 3521)
@@ -571,20 +571,22 @@
        
        
        public boolean haveConfigRemoted(String name){
+               try{
                NodeList attElem = 
this.getDocument().getElementsByTagName("remoted");
                for(int i=0; i < attElem.getLength(); i++){
                        String regName = 
attElem.item(i).getAttributes().getNamedItem("name").getTextContent();
                        String type = 
attElem.item(i).getAttributes().getNamedItem("type").getTextContent();
                        if(regName.equals(name) && 
type.toLowerCase().equals("gadget")){
                                Element oneObjectDatas = 
(Element)attElem.item(i);
-                               try{
+                               
                                        NodeList conf = 
oneObjectDatas.getElementsByTagName("Parameters");
                                        
conf.item(0).getAttributes().getNamedItem("value");
                                        return true;
-                               }catch(Exception except){
-                                       return false;
+                               
                                }
                        }
+               }catch(Exception except){
+                       return false;
                }
                return false;
        }


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