- Fix a problem with the name of the first Dict contact

- New feature: show/hide toolbar and stylebar in the chat window
cusax-fix
Damien Roth 17 years ago
parent ad0f39d8a2
commit 2f721c50e3

@ -303,6 +303,8 @@ service.gui.MSG_DELIVERY_UNKNOWN_ERROR=Unknown error has occured while deliverin
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_TOOLBAR=View &toolbar
service.gui.WARNING=Warning
service.gui.YES=Yes
service.gui.YESTERDAY=Yesterday

@ -253,6 +253,8 @@ service.gui.MSG_DELIVERY_UNKNOWN_ERROR=Une erreur inconnue est survenue pendant
service.gui.UNREGISTERED_MESSAGE=Impossible de se connecter avec le compte : Nom d''utilisateur : {0}, Nom du serveur : {1}. Vous êtes actuellement "déconnecté".
service.gui.VIEW=&Voir
service.gui.VIEW_HISTORY=Voir l'&historique
service.gui.VIEW_STYLEBAR=Afficher la barre de &style
service.gui.VIEW_TOOLBAR=Afficher la barre d'ou&tils
service.gui.WARNING=Attention
service.gui.YES=Oui
service.gui.YESTERDAY=Hier

@ -242,6 +242,16 @@ public ChatSession getChatSession()
{
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.

@ -136,6 +136,8 @@ public void stateChanged(ChangeEvent evt)
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 void setHierarchicallyOpaque(boolean isOpaque)
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)

@ -87,6 +87,7 @@ public ChatWritePanel(ChatPanel panel)
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 ChatWritePanel(ChatPanel panel)
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.

@ -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 MessageWindowMenuBar(ChatWindow parentWindow)
fileMenu = new FileMenu(this.parentWindow);
editMenu = new EditMenu(this.parentWindow);
optionsMenu = new OptionsMenu(this.parentWindow);
helpMenu = new HelpMenu(this.parentWindow);
@ -90,6 +94,8 @@ private void init()
this.add(fileMenu);
this.add(editMenu);
this.add(optionsMenu);
this.add(helpMenu);
}

@ -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());
}
}
}

@ -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 static void loadGuiConfigurations()
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 static boolean isWindowDecorated()
{
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 static void setTransparentWindowEnabled(boolean isTransparent)
"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 @@ else if (evt.getPropertyName().equals(
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);
}
}
}
}

@ -160,7 +160,7 @@ private void createDefaultContact(AccountID accountID)
// 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.

Loading…
Cancel
Save