aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java
diff options
context:
space:
mode:
authorDamien Roth <damien.roth@gmail.com>2009-03-25 16:01:19 +0000
committerDamien Roth <damien.roth@gmail.com>2009-03-25 16:01:19 +0000
commit2f721c50e3a24547b7a778ad8d3e4e8e5a000470 (patch)
tree9a5755beab19c65aeacb18b733654456a587d919 /src/net/java
parentad0f39d8a2d43e853bfc631d7bf2742b1e62fc82 (diff)
downloadjitsi-2f721c50e3a24547b7a778ad8d3e4e8e5a000470.zip
jitsi-2f721c50e3a24547b7a778ad8d3e4e8e5a000470.tar.gz
jitsi-2f721c50e3a24547b7a778ad8d3e4e8e5a000470.tar.bz2
- Fix a problem with the name of the first Dict contact
- New feature: show/hide toolbar and stylebar in the chat window
Diffstat (limited to 'src/net/java')
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java10
-rwxr-xr-xsrc/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java34
-rwxr-xr-xsrc/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java11
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/chat/menus/MessageWindowMenuBar.java6
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/chat/menus/OptionsMenu.java92
-rw-r--r--src/net/java/sip/communicator/impl/gui/utils/ConfigurationManager.java86
-rw-r--r--src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderFactoryDictImpl.java2
7 files changed, 240 insertions, 1 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java
index a3ebc0e..df7b1ed 100644
--- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java
+++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java
@@ -242,6 +242,16 @@ public class ChatPanel
{
return chatSession;
}
+
+ /**
+ * Shows or hides the Stylebar depending on the value of parameter b.
+ *
+ * @param b if true, makes the Stylebar visible, otherwise hides the Stylebar
+ */
+ public void setStylebarVisible(boolean b)
+ {
+ this.writeMessagePanel.setStylebarVisible(b);
+ }
/**
* Runs clean-up for associated resources which need explicit disposal (e.g.
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 663d7d3..409eb3e 100755
--- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java
+++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java
@@ -136,6 +136,8 @@ public class ChatWindow
mainToolBar = new ExtendedMainToolBar(this);
else
mainToolBar = new MainToolBar(this);
+
+ mainToolBar.setVisible(ConfigurationManager.isChatToolbarVisible());
Component logoBar = LogoBar.createInstance();
if (logoBar != null)
@@ -189,6 +191,38 @@ public class ChatWindow
mainPanel.setOpaque(isOpaque);
statusBarPanel.setOpaque(isOpaque);
}
+
+ /**
+ * Shows or hides the Toolbar depending on the value of parameter b.
+ *
+ * @param b if true, makes the Toolbar visible, otherwise hides the Toolbar
+ */
+ public void setToolbarVisible(boolean b)
+ {
+ this.mainToolBar.setVisible(b);
+ }
+
+ /**
+ * Shows or hides the Stylebar depending on the value of parameter b.
+ *
+ * @param b if true, makes the Stylebar visible, otherwise hides the Stylebar
+ */
+ 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
+ int i, imax = this.getChatTabCount();
+ for (i=0; i<imax; i++)
+ {
+ p = (ChatPanel) this.chatTabbedPane.getComponentAt(i);
+ p.setStylebarVisible(b);
+ }
+ }
/*
* (non-Javadoc)
diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java
index 8dbbda4..43cbc66 100755
--- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java
+++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java
@@ -87,6 +87,7 @@ public class ChatWritePanel
this.editorPane.setTransferHandler(new ChatWritePanelTransferHandler());
this.editTextToolBar = new EditTextToolBar(this);
+ this.editTextToolBar.setVisible(ConfigurationManager.isChatStylebarVisible());
this.add(editTextToolBar, BorderLayout.NORTH);
this.add(scrollPane, BorderLayout.CENTER);
@@ -117,6 +118,16 @@ public class ChatWritePanel
this.changeSendCommand((messageCommand == null || messageCommand
.equalsIgnoreCase("enter")));
}
+
+ /**
+ * Shows or hides the Stylebar depending on the value of parameter b.
+ *
+ * @param b if true, makes the Stylebar visible, otherwise hides the Stylebar
+ */
+ public void setStylebarVisible(boolean b)
+ {
+ this.editTextToolBar.setVisible(b);
+ }
/**
* Runs clean-up for associated resources which need explicit disposal (e.g.
diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/menus/MessageWindowMenuBar.java b/src/net/java/sip/communicator/impl/gui/main/chat/menus/MessageWindowMenuBar.java
index 2f5a368..cfa3c2a 100644
--- a/src/net/java/sip/communicator/impl/gui/main/chat/menus/MessageWindowMenuBar.java
+++ b/src/net/java/sip/communicator/impl/gui/main/chat/menus/MessageWindowMenuBar.java
@@ -36,6 +36,8 @@ public class MessageWindowMenuBar
private FileMenu fileMenu;
private EditMenu editMenu;
+
+ private OptionsMenu optionsMenu;
private final HelpMenu helpMenu;
@@ -58,6 +60,8 @@ public class MessageWindowMenuBar
fileMenu = new FileMenu(this.parentWindow);
editMenu = new EditMenu(this.parentWindow);
+
+ optionsMenu = new OptionsMenu(this.parentWindow);
helpMenu = new HelpMenu(this.parentWindow);
@@ -90,6 +94,8 @@ public class MessageWindowMenuBar
this.add(fileMenu);
this.add(editMenu);
+
+ this.add(optionsMenu);
this.add(helpMenu);
}
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
new file mode 100644
index 0000000..78946b6
--- /dev/null
+++ b/src/net/java/sip/communicator/impl/gui/main/chat/menus/OptionsMenu.java
@@ -0,0 +1,92 @@
+/*
+ * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package net.java.sip.communicator.impl.gui.main.chat.menus;
+
+import java.awt.*;
+import java.awt.event.*;
+
+import javax.swing.*;
+
+import net.java.sip.communicator.impl.gui.*;
+import net.java.sip.communicator.impl.gui.customcontrols.*;
+import net.java.sip.communicator.impl.gui.main.chat.*;
+import net.java.sip.communicator.impl.gui.utils.ConfigurationManager;
+/**
+ * The <tt>OptionMenu</tt> is a menu in the chat window menu bar.
+ *
+ * @author Damien Roth
+ */
+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";
+
+ /**
+ * Creates an instance of <tt>HelpMenu</tt>.
+ * @param chatWindow The parent <tt>MainFrame</tt>.
+ */
+ public OptionsMenu(ChatWindow chatWindow)
+ {
+ super(GuiActivator.getResources().getI18NString("service.gui.OPTIONS"));
+ this.chatWindow = chatWindow;
+
+ this.setOpaque(false);
+
+ this.setForeground(new Color(
+ GuiActivator.getResources()
+ .getColor("service.gui.CHAT_MENU_FOREGROUND")));
+
+ this.setMnemonic(
+ GuiActivator.getResources().getI18nMnemonic("service.gui.OPTIONS"));
+
+ 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);
+
+ initValues();
+ }
+
+ private void initValues()
+ {
+ this.viewToolBar.setSelected(ConfigurationManager.isChatToolbarVisible());
+ this.viewStyleBar.setSelected(ConfigurationManager.isChatStylebarVisible());
+ }
+
+ /**
+ * Handles the <tt>ActionEvent</tt> when one of the menu items is
+ * selected.
+ */
+ public void actionPerformed(ActionEvent e)
+ {
+ String action = e.getActionCommand();
+
+ if (action.equals(ACTCMD_VIEW_TOOLBAR))
+ {
+ this.chatWindow.setToolbarVisible(this.viewToolBar.isSelected());
+ ConfigurationManager.setChatToolbarVisible(this.viewToolBar.isSelected());
+ }
+ else if (action.equals(ACTCMD_VIEW_STYLEBAR))
+ {
+ this.chatWindow.setStylebarVisible(this.viewStyleBar.isSelected());
+ ConfigurationManager.setChatStylebarVisible(this.viewStyleBar.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 777152d..c6ca843 100644
--- a/src/net/java/sip/communicator/impl/gui/utils/ConfigurationManager.java
+++ b/src/net/java/sip/communicator/impl/gui/utils/ConfigurationManager.java
@@ -52,6 +52,10 @@ public class ConfigurationManager
private static boolean isWindowDecorated;
+ private static boolean isChatToolbarVisible;
+
+ private static boolean isChatStylebarVisible;
+
private static ConfigurationService configService
= GuiActivator.getConfigurationService();
@@ -285,6 +289,24 @@ public class ConfigurationManager
isWindowDecorated
= Boolean.parseBoolean(isWindowDecoratedString);
}
+
+ // Load the "isChatToolbarVisible" property
+ String chatToolbarVisible = configService.getString(
+ "net.java.sip.communicator.impl.gui.chat.ChatWindow.showToolbar");
+
+ if(chatToolbarVisible != null && chatToolbarVisible.length() > 0)
+ isChatToolbarVisible = Boolean.parseBoolean(chatToolbarVisible);
+ else
+ isChatToolbarVisible = true;
+
+ // Load the "isChatToolbarVisible" property
+ String chatStylebarVisible = configService.getString(
+ "net.java.sip.communicator.impl.gui.chat.ChatWindow.showStylebar");
+
+ if(chatStylebarVisible != null && chatStylebarVisible.length() > 0)
+ isChatStylebarVisible = Boolean.parseBoolean(chatStylebarVisible);
+ else
+ isChatStylebarVisible = true;
// Load the "lastContactParent" property.
lastContactParent = configService.getString(
@@ -423,6 +445,28 @@ public class ConfigurationManager
{
return isWindowDecorated;
}
+
+ /**
+ * Returns <code>true</code> if the "isChatToolbarVisible" property is
+ * true, otherwise - returns <code>false</code>..
+ * @return <code>true</code> if the "isChatToolbarVisible" property is
+ * true, otherwise - returns <code>false</code>.
+ */
+ public static boolean isChatToolbarVisible()
+ {
+ return isChatToolbarVisible;
+ }
+
+ /**
+ * Returns <code>true</code> if the "isChatStylebarVisible" property is
+ * true, otherwise - returns <code>false</code>..
+ * @return <code>true</code> if the "isChatStylebarVisible" property is
+ * true, otherwise - returns <code>false</code>.
+ */
+ public static boolean isChatStylebarVisible()
+ {
+ return isChatStylebarVisible;
+ }
/**
* Return the "sendMessageCommand" property that was saved previously
@@ -601,6 +645,36 @@ public class ConfigurationManager
"impl.gui.IS_TRANSPARENT_WINDOW_ENABLED",
Boolean.toString(isTransparentWindowEnabled));
}
+
+ /**
+ * Updates the "isChatToolbarVisible" property through the
+ * <tt>ConfigurationService</tt>.
+ *
+ * @param isVisible indicates if the chat toolbar is visible.
+ */
+ public static void setChatToolbarVisible(boolean isVisible)
+ {
+ isChatToolbarVisible = isVisible;
+
+ configService.setProperty(
+ "net.java.sip.communicator.impl.gui.chat.ChatWindow.showToolbar",
+ Boolean.toString(isChatToolbarVisible));
+ }
+
+ /**
+ * Updates the "isChatStylebarVisible" property through the
+ * <tt>ConfigurationService</tt>.
+ *
+ * @param isVisible indicates if the chat stylebar is visible.
+ */
+ public static void setChatStylebarVisible(boolean isVisible)
+ {
+ isChatStylebarVisible = isVisible;
+
+ configService.setProperty(
+ "net.java.sip.communicator.impl.gui.chat.ChatWindow.showStylebar",
+ Boolean.toString(isChatStylebarVisible));
+ }
/**
* Saves a chat room through the <tt>ConfigurationService</tt>.
@@ -949,6 +1023,18 @@ public class ConfigurationManager
windowTransparency
= new Integer(windowTransparencyString).intValue();
}
+ else if (evt.getPropertyName().equals(
+ "net.java.sip.communicator.impl.gui.chat.ChatWindow.showStylebar"))
+ {
+ String chatBarString = (String) evt.getNewValue();
+ isChatStylebarVisible = Boolean.parseBoolean(chatBarString);
+ }
+ else if (evt.getPropertyName().equals(
+ "net.java.sip.communicator.impl.gui.chat.ChatWindow.showToolbar"))
+ {
+ String chatBarString = (String) evt.getNewValue();
+ isChatToolbarVisible = Boolean.parseBoolean(chatBarString);
+ }
}
}
}
diff --git a/src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderFactoryDictImpl.java b/src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderFactoryDictImpl.java
index 417ab0f..7b2a821 100644
--- a/src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderFactoryDictImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderFactoryDictImpl.java
@@ -160,7 +160,7 @@ public class ProtocolProviderFactoryDictImpl
// Gets contact name
String contactName = DictActivator.getResources()
- .getI18NString("dict.plugin.dictaccregwizz.ANY_DICTIONARY_FORM",
+ .getI18NString("plugin.dictaccregwizz.ANY_DICTIONARY_FORM",
new String[] {accountID.getUserID()});
// Gets the MetaContactGroup for the "dictionaries" group.