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

yanas at dev.java.net yanas at dev.java.net
Tue Apr 17 16:09:45 CEST 2007


User: yanas   
Date: 2007-04-17 14:09:45+0000
Modified:
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/chat/menus/SettingsMenu.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/utils/ConfigurationManager.java

Log:
 save the "enableSendTypingNotifications" property through the ConfigurationService

File Changes:

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

File [changed]: SettingsMenu.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/chat/menus/SettingsMenu.java?r1=1.2&r2=1.3
Delta lines:  +26 -38
---------------------
--- SettingsMenu.java	2007-04-13 14:03:59+0000	1.2
+++ SettingsMenu.java	2007-04-17 14:09:42+0000	1.3
@@ -1,6 +1,7 @@
 package net.java.sip.communicator.impl.gui.main.chat.menus;
 
 import java.awt.event.*;
+
 import javax.swing.*;
 
 import net.java.sip.communicator.impl.gui.*;
@@ -68,35 +69,6 @@
         this.autoPopupItem.setMnemonic(
             autoPopupString.getMnemonic());
                 
-        ConfigurationService configService
-            = GuiActivator.getConfigurationService();
-        
-        String messageCommand = configService.getString(
-            "net.java.sip.communicator.impl.gui.sendMessageCommand");
-        
-        String autoPopup = configService.getString(
-            "net.java.sip.communicator.impl.gui.autoPopupNewMessage");
-
-        String typingNotif = configService.getString(
-            "net.java.sip.communicator.impl.gui.autoPopupNewMessage");
-
-        if(messageCommand == null || messageCommand.equalsIgnoreCase("enter"))
-            this.sendingMessageCommandItem.setSelected(false);
-        else
-            this.sendingMessageCommandItem.setSelected(true);
-    
-        if(autoPopup == null || autoPopup.equalsIgnoreCase("yes"))
-            this.autoPopupItem.setSelected(true);
-        else
-            this.autoPopupItem.setSelected(false);
-        
-        this.init();
-    }
-    
-    /**
-     * Initializes this menu by adding all menu items.
-     */
-    private void init(){
         this.add(typingNotificationsItem);
         this.add(sendingMessageCommandItem);
         this.add(autoPopupItem);
@@ -104,6 +76,19 @@
         this.typingNotificationsItem.addActionListener(this);
         this.sendingMessageCommandItem.addActionListener(this);
         this.autoPopupItem.addActionListener(this);
+        
+        this.autoPopupItem.setSelected(
+                ConfigurationManager.isAutoPopupNewMessage());
+        
+        this.typingNotificationsItem.setSelected(
+                ConfigurationManager.isSendTypingNotifications());
+        
+        if(ConfigurationManager.getSendMessageCommand()
+                == ConfigurationManager.ENTER_COMMAND)   
+            this.sendingMessageCommandItem.setSelected(true);
+        else
+            this.sendingMessageCommandItem.setSelected(false);
+        
     }
 
     /**
@@ -114,16 +99,19 @@
         
         if (item.getName().equals("typingNotifications"))
         {            
-            if (item.isSelected()) {
-                chatWindow.enableTypingNotification(true);
-            }
-            else {
-                chatWindow.enableTypingNotification(false);
-            }
+            ConfigurationManager.setSendTypingNotifications(item.isSelected());
         }
         else if (item.getName().equals("sendingMessageCommand"))
         {   
-            chatWindow.changeSendCommand(!item.isSelected());
+            chatWindow.getCurrentChatPanel().getChatWritePanel()
+                .changeSendCommand(!item.isSelected());
+            
+            if(!item.isSelected())
+                ConfigurationManager.setSendMessageCommand(
+                        ConfigurationManager.ENTER_COMMAND);
+            else
+                ConfigurationManager.setSendMessageCommand(
+                        ConfigurationManager.ENTER_COMMAND);
         }
         else if (item.getName().equals("autopopup"))
         {

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

File [changed]: ConfigurationManager.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/utils/ConfigurationManager.java?r1=1.2&r2=1.3
Delta lines:  +61 -10
---------------------
--- ConfigurationManager.java	2007-04-13 14:03:57+0000	1.2
+++ ConfigurationManager.java	2007-04-17 14:09:42+0000	1.3
@@ -11,17 +11,25 @@
 
 public class ConfigurationManager
 {
+    public static final String ENTER_COMMAND = "Enter";
+    
+    public static final String CTRL_ENTER_COMMAND = "Ctrl-Enter";
+    
     /**
      * Indicates whether the message automatic popup is enabled.
      */
     private static boolean autoPopupNewMessage;
 
+    private static String sendMessageCommand;
+
     private static boolean isCallPanelShown;
     
     private static boolean isShowOffline;
     
     private static boolean isApplicationVisible;
     
+    private static boolean isSendTypingNotifications;
+    
     private static ConfigurationService configService
         = GuiActivator.getConfigurationService();
     
@@ -30,34 +38,49 @@
         String autoPopup = configService.getString(
             "net.java.sip.communicator.impl.gui.autoPopupNewMessage");
         
-        String callPanelShown = configService.getString(
-            "net.java.sip.communicator.impl.gui.showCallPanel");
-    
-        String showOffline = configService.getString(
-            "net.java.sip.communicator.impl.gui.showOffline");
-        
-        String isVisible = configService.getString(
-            "net.java.sip.communicator.impl.systray.showApplication");
-    
         if(autoPopup == null || autoPopup.equalsIgnoreCase("yes"))
             autoPopupNewMessage = true;
         else
             autoPopupNewMessage = false;
         
+        String messageCommand = configService.getString(
+            "net.java.sip.communicator.impl.gui.sendMessageCommand");
+    
+        if(messageCommand == null || messageCommand != "")
+            sendMessageCommand = messageCommand;
+    
+        String callPanelShown = configService.getString(
+            "net.java.sip.communicator.impl.gui.showCallPanel");
+    
         if(callPanelShown != null && callPanelShown != "")
         {
             isCallPanelShown = new Boolean(callPanelShown).booleanValue();
         }
         
+        String showOffline = configService.getString(
+            "net.java.sip.communicator.impl.gui.showOffline");
+        
         if(showOffline != null && showOffline != "")
         {
             isShowOffline = new Boolean(showOffline).booleanValue();
         }
 
+        String isVisible = configService.getString(
+            "net.java.sip.communicator.impl.systray.showApplication");
+        
         if(isVisible != null && isVisible != "")
         {
             isApplicationVisible = new Boolean(isVisible).booleanValue();
         }
+
+        String isSendTypingNotif = configService.getString(
+            "net.java.sip.communicator.impl.gui.sendTypingNotifications");
+        
+        if(isSendTypingNotif != null && isSendTypingNotif != "")
+        {
+            isSendTypingNotifications
+                = new Boolean(isSendTypingNotif).booleanValue();
+        }
     }
     
     public static boolean isAutoPopupNewMessage()
@@ -80,6 +103,16 @@
         return isApplicationVisible;
     }
 
+    public static boolean isSendTypingNotifications()
+    {
+        return isSendTypingNotifications;
+    }
+    
+    public static String getSendMessageCommand()
+    {
+        return sendMessageCommand;
+    }
+
     public static void setAutoPopupNewMessage(boolean autoPopupNewMessage)
     {
         ConfigurationManager.autoPopupNewMessage = autoPopupNewMessage;
@@ -120,4 +153,22 @@
                 "net.java.sip.communicator.impl.systray.showApplication",
                 new Boolean(isVisible));
     }
+    
+    public static void setSendTypingNotifications(boolean isSendTypingNotif)
+    {
+        isSendTypingNotifications = isSendTypingNotif;
+            
+        configService.setProperty(
+                "net.java.sip.communicator.impl.gui.sendTypingNotifications",
+                new Boolean(isSendTypingNotif));
+    }
+    
+    public static void setSendMessageCommand(String newMessageCommand)
+    {
+        sendMessageCommand = newMessageCommand;
+        
+        configService.setProperty(
+                "net.java.sip.communicator.impl.gui.sendMessageCommand",
+                newMessageCommand);
+    }
 }




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