Adds a configuration property allowing to enable/disable add/remove contact functionality from provisioning.

cusax-fix
Yana Stamcheva 15 years ago
parent eaa0616e04
commit 76cecff08d

@ -47,7 +47,9 @@ public CommonRightButtonMenu(MainFrame mainFrame)
{
this.mainFrame = mainFrame;
this.add(addContactItem);
if (!ConfigurationManager.isAddContactDisabled())
this.add(addContactItem);
this.add(createGroupItem);
this.addContactItem.setMnemonic(GuiActivator.getResources()

@ -65,7 +65,8 @@ public GroupRightButtonMenu(MainFrame mainFrame, MetaContactGroup group)
this.group = group;
this.mainFrame = mainFrame;
this.add(addContactItem);
if (!ConfigurationManager.isAddContactDisabled())
this.add(addContactItem);
this.addSeparator();

@ -464,11 +464,14 @@ private void init()
addSeparator();
add(addContactItem);
if (!ConfigurationManager.isAddContactDisabled())
add(addContactItem);
addSeparator();
add(removeContactMenu);
if (!ConfigurationManager.isRemoveContactDisabled())
add(removeContactMenu);
add(renameContactItem);
addSeparator();

@ -79,8 +79,12 @@ private void initItems()
if (cDetail != null)
add(initCallMenu());
addContactComponent
= TreeContactList.createAddContactMenu(sourceContact);
// Only create the menu if the add contact functionality is enabled.
if (!ConfigurationManager.isAddContactDisabled())
{
addContactComponent
= TreeContactList.createAddContactMenu(sourceContact);
}
if (addContactComponent != null)
add(addContactComponent);

@ -15,6 +15,7 @@
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.main.*;
import net.java.sip.communicator.impl.gui.main.call.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.util.skin.*;
import net.java.sip.communicator.util.swing.*;
import net.java.sip.communicator.util.swing.event.*;
@ -65,14 +66,6 @@ public UnknownContactPanel(MainFrame window)
this.add(mainPanel, BorderLayout.NORTH);
addContact.setAlignmentX(JButton.CENTER_ALIGNMENT);
callContact.setAlignmentX(JButton.CENTER_ALIGNMENT);
addContact.setMnemonic(GuiActivator.getResources()
.getI18nMnemonic("service.gui.ADD_CONTACT"));
callContact.setMnemonic(GuiActivator.getResources()
.getI18nMnemonic("service.gui.CALL_CONTACT"));
initTextArea(parentWindow.getCurrentSearchText());
mainPanel.add(textArea, BorderLayout.CENTER);
@ -80,7 +73,34 @@ public UnknownContactPanel(MainFrame window)
TransparentPanel buttonPanel
= new TransparentPanel(new GridLayout(0, 1));
buttonPanel.add(addContact);
if (!ConfigurationManager.isAddContactDisabled())
{
addContact.setAlignmentX(JButton.CENTER_ALIGNMENT);
addContact.setMnemonic(GuiActivator.getResources()
.getI18nMnemonic("service.gui.ADD_CONTACT"));
buttonPanel.add(addContact);
addContact.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
AddContactDialog dialog
= new AddContactDialog(parentWindow);
dialog.setContactAddress(
parentWindow.getCurrentSearchText());
dialog.setVisible(true);
}
});
}
callContact.setAlignmentX(JButton.CENTER_ALIGNMENT);
callContact.setMnemonic(GuiActivator.getResources()
.getI18nMnemonic("service.gui.CALL_CONTACT"));
buttonPanel.add(callContact);
TransparentPanel southPanel
@ -89,18 +109,6 @@ public UnknownContactPanel(MainFrame window)
mainPanel.add(southPanel, BorderLayout.SOUTH);
addContact.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
AddContactDialog dialog
= new AddContactDialog(parentWindow);
dialog.setContactAddress(parentWindow.getCurrentSearchText());
dialog.setVisible(true);
}
});
callContact.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)

@ -80,10 +80,6 @@ public FileMenu(MainFrame parentWindow)
super(GuiActivator.getResources().getI18NString("service.gui.FILE"));
ResourceManagementService resources = GuiActivator.getResources();
newAccountMenuItem = new JMenuItem(
resources.getI18NString("service.gui.NEW_ACCOUNT"));
addContactItem = new JMenuItem(
resources.getI18NString("service.gui.ADD_CONTACT") + "...");
createGroupItem = new JMenuItem(
resources.getI18NString("service.gui.CREATE_GROUP"));
myChatRoomsItem = new JMenuItem(
@ -95,11 +91,37 @@ public FileMenu(MainFrame parentWindow)
.getBoolean(ConfigurationFrame.SHOW_ACCOUNT_CONFIG_PROPERTY, true);
if (showAccountConfig.booleanValue())
{
newAccountMenuItem = new JMenuItem(
resources.getI18NString("service.gui.NEW_ACCOUNT"));
this.add(newAccountMenuItem);
newAccountMenuItem.setName("newAccount");
newAccountMenuItem.addActionListener(this);
newAccountMenuItem.setMnemonic(resources
.getI18nMnemonic("service.gui.NEW_ACCOUNT"));
}
this.addSeparator();
this.add(addContactItem);
if (!ConfigurationManager.isAddContactDisabled())
{
addContactItem = new JMenuItem(
resources.getI18NString("service.gui.ADD_CONTACT") + "...");
this.add(addContactItem);
addContactItem.setName("addContact");
addContactItem.addActionListener(this);
addContactItem.setMnemonic(resources
.getI18nMnemonic("service.gui.ADD_CONTACT"));
}
this.add(createGroupItem);
this.addSeparator();
@ -114,22 +136,15 @@ public FileMenu(MainFrame parentWindow)
//this.addContactItem.setIcon(new ImageIcon(ImageLoader
// .getImage(ImageLoader.ADD_CONTACT_16x16_ICON)));
newAccountMenuItem.setName("newAccount");
addContactItem.setName("addContact");
createGroupItem.setName("createGroup");
myChatRoomsItem.setName("myChatRooms");
newAccountMenuItem.addActionListener(this);
addContactItem.addActionListener(this);
createGroupItem.addActionListener(this);
myChatRoomsItem.addActionListener(this);
this.setMnemonic(resources
.getI18nMnemonic("service.gui.FILE"));
newAccountMenuItem.setMnemonic(resources
.getI18nMnemonic("service.gui.NEW_ACCOUNT"));
addContactItem.setMnemonic(resources
.getI18nMnemonic("service.gui.ADD_CONTACT"));
createGroupItem.setMnemonic(resources
.getI18nMnemonic("service.gui.CREATE_GROUP"));
myChatRoomsItem.setMnemonic(resources
@ -141,12 +156,16 @@ public FileMenu(MainFrame parentWindow)
*/
public void loadSkin()
{
newAccountMenuItem.setIcon(
new ImageIcon(ImageLoader.getImage(
ImageLoader.ADD_ACCOUNT_MENU_ICON)));
addContactItem.setIcon(
new ImageIcon(ImageLoader.getImage(
ImageLoader.ADD_CONTACT_16x16_ICON)));
if (newAccountMenuItem != null)
newAccountMenuItem.setIcon(
new ImageIcon(ImageLoader.getImage(
ImageLoader.ADD_ACCOUNT_MENU_ICON)));
if (addContactItem != null)
addContactItem.setIcon(
new ImageIcon(ImageLoader.getImage(
ImageLoader.ADD_CONTACT_16x16_ICON)));
createGroupItem.setIcon(
new ImageIcon(ImageLoader.getImage(
ImageLoader.GROUPS_16x16_ICON)));

@ -125,6 +125,16 @@ public class ConfigurationManager
*/
private static boolean isShowSmileys;
/**
* Indicates if the add contact functionality is disabled.
*/
private static boolean isAddContactDisabled;
/**
* Indicates if the remove contact functionality is disabled.
*/
private static boolean isRemoveContactDisabled;
/**
* The last directory used in file transfer.
*/
@ -431,7 +441,22 @@ public static void loadGuiConfigurations()
// Load the "sendFileLastDir" property.
sendFileLastDir = configService.getString(
"net.java.sip.communicator.impl.gui.chat.filetransfer.SEND_FILE_LAST_DIR");
"net.java.sip.communicator.impl.gui.chat.filetransfer." +
"SEND_FILE_LAST_DIR");
// Load the "ADD_CONTACT_DISABLED" property.
isAddContactDisabled
= configService.getBoolean(
"net.java.sip.communicator.impl.gui.main.contactlist." +
"CONTACT_ADD_DISABLED",
false);
// Load the "REMOVE_CONTACT_DISABLED" property.
isRemoveContactDisabled
= configService.getBoolean(
"net.java.sip.communicator.impl.gui.main.contactlist." +
"CONTACT_REMOVE_DISABLED",
false);
}
/**
@ -613,6 +638,28 @@ public static boolean isShowSmileys()
return isShowSmileys;
}
/**
* Returns <code>true</code> if the "ADD_CONTACT_DISABLED" property is
* true, otherwise - returns <code>false</code>..
* @return <code>true</code> if the "ADD_CONTACT_DISABLED" property is
* true, otherwise - returns <code>false</code>.
*/
public static boolean isAddContactDisabled()
{
return isAddContactDisabled;
}
/**
* Returns <code>true</code> if the "REMOVE_CONTACT_DISABLED" property is
* true, otherwise - returns <code>false</code>..
* @return <code>true</code> if the "REMOVE_CONTACT_DISABLED" property is
* true, otherwise - returns <code>false</code>.
*/
public static boolean isRemoveContactDisabled()
{
return isRemoveContactDisabled;
}
/**
* Return the "sendMessageCommand" property that was saved previously
* through the <tt>ConfigurationService</tt>. Indicates to the user
@ -623,7 +670,7 @@ public static String getSendMessageCommand()
{
return sendMessageCommand;
}
/**
* Return the "lastContactParent" property that was saved previously
* through the <tt>ConfigurationService</tt>. Indicates

Loading…
Cancel
Save