[sip-comm-cvs] CVS update: /sip-communicator/src/net/java/sip/communicator/impl/gui/main/presence/, /sip-communicator/src/net/java/sip/communicator/impl/gui/main/

yanas at dev.java.net yanas at dev.java.net
Tue Apr 17 16:07:55 CEST 2007


User: yanas   
Date: 2007-04-17 14:07:55+0000
Modified:
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/presence/SimpleStatusSelectorBox.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/presence/PresenceStatusSelectorBox.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/presence/StatusSelectorBox.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/MainFrame.java

Log:
 move "saveStatusInformation" method from MainFrame to the StatusSelectorBox

File Changes:

Directory: /sip-communicator/src/net/java/sip/communicator/impl/gui/main/presence/
==================================================================================

File [changed]: SimpleStatusSelectorBox.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/presence/SimpleStatusSelectorBox.java?r1=1.13&r2=1.14
Delta lines:  +7 -8
-------------------
--- SimpleStatusSelectorBox.java	2007-02-27 15:31:12+0000	1.13
+++ SimpleStatusSelectorBox.java	2007-04-17 14:07:52+0000	1.14
@@ -118,15 +118,14 @@
         JMenuItem menuItem = (JMenuItem) e.getSource();
         String itemName = menuItem.getName();
 
-        if(itemName.equals(Constants.ONLINE_STATUS)) {
+        if(itemName.equals(Constants.ONLINE_STATUS))
+        {
             if(!protocolProvider.isRegistered()) {
                 this.mainFrame.getLoginManager().login(protocolProvider);
             }
-            
-            mainFrame.saveStatusInformation(
-                protocolProvider, Constants.ONLINE_STATUS);
         }
-        else {
+        else
+        {
             if(    !protocolProvider.getRegistrationState()
                             .equals(RegistrationState.UNREGISTERED)
                 && !protocolProvider.getRegistrationState()
@@ -143,11 +142,11 @@
                             + " due to the following exception: " + e1);
                 }
             }
+        }
             
-            mainFrame.saveStatusInformation(
+        saveStatusInformation(
                 protocolProvider, Constants.OFFLINE_STATUS);
         }
-    }
 
 
     /**

File [changed]: PresenceStatusSelectorBox.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/presence/PresenceStatusSelectorBox.java?r1=1.16&r2=1.17
Delta lines:  +1 -1
-------------------
--- PresenceStatusSelectorBox.java	2007-04-16 12:55:34+0000	1.16
+++ PresenceStatusSelectorBox.java	2007-04-17 14:07:52+0000	1.17
@@ -176,7 +176,7 @@
                             }
                         }
                         
-                        mainFrame.saveStatusInformation(
+                        saveStatusInformation(
                                 protocolProvider, status.getStatusName());
                         
                         break;

File [changed]: StatusSelectorBox.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/presence/StatusSelectorBox.java?r1=1.3&r2=1.4
Delta lines:  +59 -1
--------------------
--- StatusSelectorBox.java	2007-01-04 11:00:10+0000	1.3
+++ StatusSelectorBox.java	2007-04-17 14:07:52+0000	1.4
@@ -7,8 +7,11 @@
 package net.java.sip.communicator.impl.gui.main.presence;
 
 import java.awt.image.*;
+import java.util.*;
 
+import net.java.sip.communicator.impl.gui.*;
 import net.java.sip.communicator.impl.gui.customcontrols.*;
+import net.java.sip.communicator.service.configuration.*;
 import net.java.sip.communicator.service.protocol.*;
 
 public abstract class StatusSelectorBox extends SIPCommMenu
@@ -20,4 +23,59 @@
     public int getAccountIndex(){return -1;}
     
     public void setAccountIndex(int index){}    
+    
+    /**
+     * Saves the last status for all accounts. This information is used
+     * on loging. Each time user logs in he's logged with the same status
+     * as he was the last time before closing the application.
+     */
+    protected void saveStatusInformation(ProtocolProviderService protocolProvider,
+            String statusName)
+    {
+        ConfigurationService configService
+            = GuiActivator.getConfigurationService();
+
+        String prefix = "net.java.sip.communicator.impl.gui.accounts";
+
+        List accounts = configService
+                .getPropertyNamesByPrefix(prefix, true);
+
+        boolean savedAccount = false;
+        Iterator accountsIter = accounts.iterator();
+
+        while(accountsIter.hasNext()) {
+            String accountRootPropName
+                = (String) accountsIter.next();
+
+            String accountUID
+                = configService.getString(accountRootPropName);
+
+            if(accountUID.equals(protocolProvider
+                    .getAccountID().getAccountUniqueID())) {
+
+                configService.setProperty(
+                        accountRootPropName + ".lastAccountStatus",
+                        statusName);
+
+                savedAccount = true;
+            }
+        }
+
+        if(!savedAccount) {
+            String accNodeName
+                = "acc" + Long.toString(System.currentTimeMillis());
+
+            String accountPackage
+                = "net.java.sip.communicator.impl.gui.accounts."
+                        + accNodeName;
+
+            configService.setProperty(accountPackage,
+                    protocolProvider.getAccountID().getAccountUniqueID());
+
+            configService.setProperty(
+                    accountPackage+".lastAccountStatus",
+                    statusName);
+        }
+
+    }
 }

Directory: /sip-communicator/src/net/java/sip/communicator/impl/gui/main/
=========================================================================

File [changed]: MainFrame.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/MainFrame.java?r1=1.94&r2=1.95
Delta lines:  +5 -62
--------------------
--- MainFrame.java	2007-04-16 09:37:33+0000	1.94
+++ MainFrame.java	2007-04-17 14:07:52+0000	1.95
@@ -23,13 +23,11 @@
 import net.java.sip.communicator.impl.gui.main.chat.conference.*;
 import net.java.sip.communicator.impl.gui.main.chatroomslist.*;
 import net.java.sip.communicator.impl.gui.main.contactlist.*;
-import net.java.sip.communicator.impl.gui.main.contactlist.ContactListPanel.*;
 import net.java.sip.communicator.impl.gui.main.login.*;
 import net.java.sip.communicator.impl.gui.main.menus.*;
 import net.java.sip.communicator.impl.gui.main.presence.*;
 import net.java.sip.communicator.impl.gui.utils.*;
 import net.java.sip.communicator.service.configuration.*;
-import net.java.sip.communicator.service.configuration.PropertyVetoException;
 import net.java.sip.communicator.service.contactlist.*;
 import net.java.sip.communicator.service.protocol.*;
 import net.java.sip.communicator.service.protocol.event.*;
@@ -576,8 +574,8 @@
             ContactPresenceStatusListener
     {
         public void contactPresenceStatusChanged(
-                ContactPresenceStatusChangeEvent evt) {
-
+                ContactPresenceStatusChangeEvent evt)
+        {
             ContactListPanel clistPanel = tabbedPane.getContactListPanel();
 
             Contact sourceContact = evt.getSourceContact();
@@ -675,61 +673,6 @@
     }
 
     /**
-     * Saves the last status for all accounts. This information is used
-     * on loging. Each time user logs in he's logged with the same status
-     * as he was the last time before closing the application.
-     */
-    public void saveStatusInformation(ProtocolProviderService protocolProvider,
-            String statusName)
-    {
-        ConfigurationService configService
-            = GuiActivator.getConfigurationService();
-
-        String prefix = "net.java.sip.communicator.impl.gui.accounts";
-
-        List accounts = configService
-                .getPropertyNamesByPrefix(prefix, true);
-
-        boolean savedAccount = false;
-        Iterator accountsIter = accounts.iterator();
-
-        while(accountsIter.hasNext()) {
-            String accountRootPropName
-                = (String) accountsIter.next();
-
-            String accountUID
-                = configService.getString(accountRootPropName);
-
-            if(accountUID.equals(protocolProvider
-                    .getAccountID().getAccountUniqueID())) {
-
-                configService.setProperty(
-                        accountRootPropName + ".lastAccountStatus",
-                        statusName);
-
-                savedAccount = true;
-            }
-        }
-
-        if(!savedAccount) {
-            String accNodeName
-                = "acc" + Long.toString(System.currentTimeMillis());
-
-            String accountPackage
-                = "net.java.sip.communicator.impl.gui.accounts."
-                        + accNodeName;
-
-            configService.setProperty(accountPackage,
-                    protocolProvider.getAccountID().getAccountUniqueID());
-
-            configService.setProperty(
-                    accountPackage+".lastAccountStatus",
-                    statusName);
-        }
-
-    }
-
-    /**
      * Returns the class that manages user login.
      * @return the class that manages user login.
      */




---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe at sip-communicator.dev.java.net
For additional commands, e-mail: cvs-help at sip-communicator.dev.java.net





More information about the commits mailing list