Author: jerome
Date: 2009-01-27 09:15:35 +0100 (Tue, 27 Jan 2009)
New Revision: 3532

Modified:
   
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/CcInterface.java
Log:
Fixed : #14 ?\226?\128?\148 Inconsistency in gadget configuration for alerts 
<-> favs.

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-26 13:56:57 UTC (rev 3531)
+++ 
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/CcInterface.java
     2009-01-27 08:15:35 UTC (rev 3532)
@@ -167,14 +167,20 @@
        public TuxHelpPanel helpPanels;
        public TuxLanguagesMenu interfaceMenusLang;
        
+       //Selected favorites datas.
        protected GadgetPropertyEditor currentGadgetParameters;
        protected GadgetObject currentGadget;
        protected GadgetObject playedGadget;
+       public String currentRemoteSelectedGadget;
        
+       //Selected alert datas.
+       public String currentAlertSelected;
+       protected GadgetPropertyEditor currentGadgetAlertParameters;
+       protected GadgetObject currentGadgetAlert;
+       
+       //Scheduler datas.
        public String schedulerActionType = "gadget";
        public String schedulerAction = "none";
-       public String currentRemoteSelectedGadget;
-       
        public GadgetInstanceParameters schedulerGadgetParameters;
        public GadgetToken schedulerGadgetCommand;
        public GadgetPropertyEditor schedulerParametersEditor;
@@ -1287,6 +1293,7 @@
                if(CcCommons.type == CcConstants.TYPE_REMOTELIST) {
                        this.remotePlaylist.checkForEdition();
                        saveFavoritesParams();
+                       saveGadgetAlertDatas();
                }
                
                else if(CcCommons.type == CcConstants.TYPE_ALERT){
@@ -1394,6 +1401,7 @@
                if(CcCommons.type == CcConstants.TYPE_REMOTELIST) {
                        this.remotePlaylist.checkForEdition();
                        saveFavoritesParams();
+                       saveGadgetAlertDatas();
                }
                
                else if(CcCommons.type == CcConstants.TYPE_ALERT){
@@ -1401,7 +1409,10 @@
                }
                
                if (index <= 1){
-                       if(CcCommons.type == CcConstants.TYPE_REMOTELIST) 
saveFavoritesParams();
+                       if(CcCommons.type == CcConstants.TYPE_REMOTELIST) 
+                               saveFavoritesParams();
+                       if(CcCommons.type == CcConstants.TYPE_ALERT) 
+                               saveGadgetAlertDatas();
                        this.showFileBrowser(0);
                        this.maskPlaylists();
                        this.properties.setVisible(false);
@@ -1496,6 +1507,7 @@
                if(CcCommons.type == CcConstants.TYPE_REMOTELIST) {
                        this.remotePlaylist.checkForEdition();
                        saveFavoritesParams();
+                       saveGadgetAlertDatas();
                }
                
                else if(CcCommons.type == CcConstants.TYPE_ALERT){
@@ -1881,6 +1893,8 @@
                }
                
                else 
if(arg0.getPropertyName().equalsIgnoreCase("Alert-Value-Changed")){
+                       //Registering previous datas.
+                       this.saveGadgetAlertDatas();
                        final String kind = alertPlaylist.getSelectedItemKind();
                        
                        final JButton validate = new JButton();
@@ -2063,6 +2077,11 @@
                                
                                parameters.setGadget(gdg.getGadget());
                                
+                               //Registering gadget alert config.
+                               this.currentAlertSelected = uid;
+                               this.currentGadgetAlertParameters = parameters;
+                               this.currentGadgetAlert = gdg;
+                               
                                validate.addMouseListener(new 
java.awt.event.MouseAdapter(){
                                        
                                        String sub = 
CcCommons.language.getMenuSubDirectory();
@@ -2098,8 +2117,7 @@
                                                        UUID uid = 
UUID.randomUUID();
                                                        config[5] = uid;
                                                        
-                                                       try {
-                                                               
+                                                       try {//XXX
                                                                
CcCommons.settings.registerAlertConfiguration(config, 
alertPlaylist.getSelectedAlertIndex());
                                                                
CcCommons.settings.registerGadgetParameter(uid.toString(), 
parameters.getValues(), gdg);
                                                                
if(!type.equals("disable")) //then start scheduler task.
@@ -2468,7 +2486,23 @@
        }
        
        
+       
        /**
+        * Save the current gadget alert datas to do not push the apply button.
+        */
+       public void saveGadgetAlertDatas()
+       {
+               if(this.currentAlertSelected != null)
+               {
+                       
CcCommons.settings.registerGadgetParameter(this.currentAlertSelected, 
+                                       
this.currentGadgetAlertParameters.getValues(), this.currentGadgetAlert);
+               }
+               //Null value to avoid nullPointer exception on attitunes alerts.
+               this.currentAlertSelected = null;
+       }
+       
+       
+       /**
         * Add a favorites or an alert.
         * @param name
         */
@@ -2602,6 +2636,7 @@
                if(CcCommons.type == CcConstants.TYPE_REMOTELIST) {
                        this.remotePlaylist.checkForEdition();
                        saveFavoritesParams();
+                       saveGadgetAlertDatas();
                }
                
                else if(CcCommons.type == CcConstants.TYPE_ALERT){


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