diff --git a/resources/languages/resources.properties b/resources/languages/resources.properties index 4322e6616..fb3ca58bb 100644 --- a/resources/languages/resources.properties +++ b/resources/languages/resources.properties @@ -394,7 +394,8 @@ service.gui.UNKNOWN=Unknown user service.gui.UNREGISTERED_MESSAGE=Unable to connect the following account: User name: {0}, Server name: {1}. You are currently offline. service.gui.VIEW=&View service.gui.VIEW_HISTORY=View &history -service.gui.VIEW_STYLEBAR=View &style bar +service.gui.VIEW_SMILEYS=View &smileys +service.gui.VIEW_STYLEBAR=View style &bar service.gui.VIEW_TOOLBAR=View &toolbar service.gui.WARNING=Warning service.gui.YES=Yes diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java index 9249b2439..30d0a1608 100755 --- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java @@ -703,7 +703,10 @@ private String formatMessage(String message, message = processImgTags(processBrTags(message)); } - return processSmileys(message, contentType); + if (ConfigurationManager.isShowSmileys()) + message = processSmileys(message, contentType); + + return message; } /** diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java index 61497180d..e71d3bd1e 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java @@ -218,11 +218,11 @@ public void setToolbarVisible(boolean b) public void setStylebarVisible(boolean b) { ChatPanel p = this.getCurrentChatPanel(); - + // Set the value for the current chat panel if (p != null) p.setStylebarVisible(b); - + // if there is tabs, set it for all for (int i = 0, imax = this.getChatTabCount(); i < imax; i++) { diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/menus/OptionsMenu.java b/src/net/java/sip/communicator/impl/gui/main/chat/menus/OptionsMenu.java index f81abc1b1..98182c60e 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/menus/OptionsMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/menus/OptionsMenu.java @@ -7,7 +7,6 @@ package net.java.sip.communicator.impl.gui.main.chat.menus; -import java.awt.*; import java.awt.event.*; import javax.swing.*; @@ -20,21 +19,26 @@ * The OptionMenu is a menu in the chat window menu bar. * * @author Damien Roth + * @author Yana Stamcheva */ public class OptionsMenu extends SIPCommMenu implements ActionListener { private ChatWindow chatWindow = null; - + private JCheckBoxMenuItem viewToolBar = new JCheckBoxMenuItem( GuiActivator.getResources().getI18NString("service.gui.VIEW_TOOLBAR")); private static final String ACTCMD_VIEW_TOOLBAR = "ACTCMD_VIEW_TOOLBAR"; - + private JCheckBoxMenuItem viewStyleBar = new JCheckBoxMenuItem( GuiActivator.getResources().getI18NString("service.gui.VIEW_STYLEBAR")); private static final String ACTCMD_VIEW_STYLEBAR = "ACTCMD_VIEW_STYLEBAR"; - + + private JCheckBoxMenuItem viewSmileys = new JCheckBoxMenuItem( + GuiActivator.getResources().getI18NString("service.gui.VIEW_SMILEYS")); + private static final String ACTCMD_VIEW_SMILEYS = "ACTCMD_VIEW_SMILEYS"; + /** * Creates an instance of HelpMenu. * @param chatWindow The parent MainFrame. @@ -47,45 +51,59 @@ public OptionsMenu(ChatWindow chatWindow) this.setMnemonic( GuiActivator.getResources().getI18nMnemonic("service.gui.TOOLS")); this.setOpaque(false); - + this.viewToolBar.setActionCommand(ACTCMD_VIEW_TOOLBAR); this.viewToolBar.addActionListener(this); this.add(this.viewToolBar); - + this.viewStyleBar.setActionCommand(ACTCMD_VIEW_STYLEBAR); this.viewStyleBar.addActionListener(this); this.add(this.viewStyleBar); - + + this.viewSmileys.setActionCommand(ACTCMD_VIEW_SMILEYS); + this.viewSmileys.addActionListener(this); + this.add(this.viewSmileys); + initValues(); } - + + /** + * Initializes the values of menu items. + */ private void initValues() { this.viewToolBar.setSelected( ConfigurationManager.isChatToolbarVisible()); this.viewStyleBar.setSelected( ConfigurationManager.isChatStylebarVisible()); + this.viewSmileys.setSelected( + ConfigurationManager.isShowSmileys()); } /** * Handles the ActionEvent when one of the menu items is * selected. + * @param e the ActionEvent that notified us */ public void actionPerformed(ActionEvent e) { String action = e.getActionCommand(); - + if (action.equals(ACTCMD_VIEW_TOOLBAR)) { - this.chatWindow.setToolbarVisible(this.viewToolBar.isSelected()); + this.chatWindow.setToolbarVisible(viewToolBar.isSelected()); ConfigurationManager - .setChatToolbarVisible(this.viewToolBar.isSelected()); + .setChatToolbarVisible(viewToolBar.isSelected()); } else if (action.equals(ACTCMD_VIEW_STYLEBAR)) { - this.chatWindow.setStylebarVisible(this.viewStyleBar.isSelected()); + this.chatWindow.setStylebarVisible(viewStyleBar.isSelected()); ConfigurationManager - .setChatStylebarVisible(this.viewStyleBar.isSelected()); + .setChatStylebarVisible(viewStyleBar.isSelected()); + } + else if (action.equals(ACTCMD_VIEW_SMILEYS)) + { + ConfigurationManager.setShowSmileys(viewSmileys.isSelected()); } } } diff --git a/src/net/java/sip/communicator/impl/gui/utils/ConfigurationManager.java b/src/net/java/sip/communicator/impl/gui/utils/ConfigurationManager.java index 81e54bbef..71a58cb9c 100644 --- a/src/net/java/sip/communicator/impl/gui/utils/ConfigurationManager.java +++ b/src/net/java/sip/communicator/impl/gui/utils/ConfigurationManager.java @@ -26,47 +26,116 @@ public class ConfigurationManager */ private static boolean autoPopupNewMessage = false; + /** + * The send message command. ENTER ou Ctrl-ENTER + */ private static String sendMessageCommand; + /** + * Indicates if the call panel is shown. + */ private static boolean isCallPanelShown = true; + /** + * Indicates if the offline contacts are shown. + */ private static boolean isShowOffline = true; + /** + * Indicates if the application main window is visible by default. + */ private static boolean isApplicationVisible = true; + /** + * Indicates if the quit warning should be shown. + */ private static boolean isQuitWarningShown = true; + /** + * Indicates if typing notifications should be sent. + */ private static boolean isSendTypingNotifications; + /** + * Indicates if confirmation should be requested before really moving a + * contact. + */ private static boolean isMoveContactConfirmationRequested = true; + /** + * Indicates if tabs in chat window are enabled. + */ private static boolean isMultiChatWindowEnabled; + /** + * Indicates if history logging is enabled. + */ private static boolean isHistoryLoggingEnabled; + /** + * Indicates if the history should be shown in the chat window. + */ private static boolean isHistoryShown; + /** + * The size of the chat history to show in chat window. + */ private static int chatHistorySize; + /** + * The size of the chat write area. + */ private static int chatWriteAreaSize; + /** + * The transparency of the window. + */ private static int windowTransparency; + /** + * Indicates if transparency is enabled. + */ private static boolean isTransparentWindowEnabled; + /** + * Indicates if the window is decorated. + */ private static boolean isWindowDecorated; + /** + * Indicates if the chat tool bar is visible. + */ private static boolean isChatToolbarVisible; + /** + * Indicates if the chat style bar is visible. + */ private static boolean isChatStylebarVisible; + /** + * Indicates if the smileys are shown. + */ + private static boolean isShowSmileys; + + /** + * The last directory used in file transfer. + */ private static String sendFileLastDir; + /** + * The configuration service. + */ private static ConfigurationService configService = GuiActivator.getConfigurationService(); + /** + * The parent of the last contact. + */ private static String lastContactParent = null; + /** + * The last conference call provider. + */ private static ProtocolProviderService lastCallConferenceProvider = null; /** @@ -322,6 +391,12 @@ public static void loadGuiConfigurations() "net.java.sip.communicator.impl.gui.chat.ChatWindow.showStylebar", true); + // Load the "isShowSmileys" property + isShowSmileys + = configService.getBoolean( + "net.java.sip.communicator.impl.gui.chat.ChatWindow.showSmileys", + true); + // Load the "lastContactParent" property. lastContactParent = configService.getString( "net.java.sip.communicator.impl.gui.addcontact.lastContactParent"); @@ -486,6 +561,17 @@ public static boolean isChatStylebarVisible() return isChatStylebarVisible; } + /** + * Returns true if the "isShowSmileys" property is + * true, otherwise - returns false.. + * @return true if the "isShowSmileys" property is + * true, otherwise - returns false. + */ + public static boolean isShowSmileys() + { + return isShowSmileys; + } + /** * Return the "sendMessageCommand" property that was saved previously * through the ConfigurationService. Indicates to the user @@ -747,7 +833,22 @@ public static void setChatToolbarVisible(boolean isVisible) "net.java.sip.communicator.impl.gui.chat.ChatWindow.showToolbar", Boolean.toString(isChatToolbarVisible)); } - + + /** + * Updates the "isShowSmileys" property through the + * ConfigurationService. + * + * @param isVisible indicates if the smileys are visible + */ + public static void setShowSmileys(boolean isVisible) + { + isShowSmileys = isVisible; + + configService.setProperty( + "net.java.sip.communicator.impl.gui.chat.ChatWindow.showSmileys", + Boolean.toString(isShowSmileys)); + } + /** * Updates the "isChatStylebarVisible" property through the * ConfigurationService.