Removes the ConfigurationManager-s from impl.gui and plugin.generalconfig packages and create a NotificationUtils class that manages all common configuration properties and is accessible through the util package.

cusax-fix
Yana Stamcheva 13 years ago
parent 4f3d81f0cc
commit f87c4cf9ba

@ -11,7 +11,6 @@
import net.java.sip.communicator.impl.gui.main.account.*;
import net.java.sip.communicator.impl.gui.main.contactlist.*;
import net.java.sip.communicator.impl.gui.main.presence.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.browserlauncher.*;
import net.java.sip.communicator.service.callhistory.*;
import net.java.sip.communicator.service.contactlist.*;
@ -127,7 +126,7 @@ public void start(BundleContext bContext)
isStarted = true;
GuiActivator.bundleContext = bContext;
ConfigurationManager.loadGuiConfigurations();
ConfigurationUtils.loadGuiConfigurations();
try
{

@ -138,7 +138,7 @@ void loadApplicationGui()
// Initialize the single window container if we're in this case. This
// should be done before initializing the main window, because he'll
// search for it.
if (ConfigurationManager.isSingleWindowInterfaceEnabled())
if (ConfigurationUtils.isSingleWindowInterfaceEnabled())
singleWindowContainer = new SingleWindowContainer();
// Initialize the main window.
@ -170,7 +170,7 @@ void loadApplicationGui()
this.wizardContainer = new AccountRegWizardContainerImpl(mainFrame);
if (ConfigurationManager.isTransparentWindowEnabled())
if (ConfigurationUtils.isTransparentWindowEnabled())
{
try
{
@ -179,11 +179,11 @@ void loadApplicationGui()
catch (UnsupportedOperationException ex)
{
logger.error(ex.getMessage(), ex);
ConfigurationManager.setTransparentWindowEnabled(false);
ConfigurationUtils.setTransparentWindowEnabled(false);
}
}
if(ConfigurationManager.isApplicationVisible())
if(ConfigurationUtils.isApplicationVisible())
mainFrame.setFrameVisible(true);
SwingUtilities.invokeLater(new RunLoginGui());
@ -1148,7 +1148,7 @@ public void propertyChange(PropertyChangeEvent evt)
.showDialog();
}
ConfigurationManager.setTransparentWindowEnabled(false);
ConfigurationUtils.setTransparentWindowEnabled(false);
}
}
else if (propertyName.equals(

@ -22,7 +22,6 @@
import net.java.sip.communicator.impl.gui.main.contactlist.*;
import net.java.sip.communicator.impl.gui.main.menus.*;
import net.java.sip.communicator.impl.gui.main.presence.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.contacteventhandler.*;
import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.gui.*;
@ -180,7 +179,7 @@ public class MainFrame
*/
public MainFrame()
{
if (!ConfigurationManager.isWindowDecorated())
if (!ConfigurationUtils.isWindowDecorated())
{
this.setUndecorated(true);
}
@ -1724,7 +1723,7 @@ public boolean isFrameVisible()
*/
public void setFrameVisible(final boolean isVisible)
{
ConfigurationManager.setApplicationVisible(isVisible);
ConfigurationUtils.setApplicationVisible(isVisible);
SwingUtilities.invokeLater(new Runnable(){
public void run()
@ -1887,7 +1886,7 @@ protected void windowClosing(WindowEvent event)
{
public void run()
{
if (ConfigurationManager.isQuitWarningShown())
if (ConfigurationUtils.isQuitWarningShown())
{
MessageDialog dialog =
new MessageDialog(null,
@ -1897,12 +1896,12 @@ public void run()
"service.gui.HIDE_MAIN_WINDOW"), false);
if (dialog.showDialog() == MessageDialog.OK_DONT_ASK_CODE)
ConfigurationManager.setQuitWarningShown(false);
ConfigurationUtils.setQuitWarningShown(false);
}
}
});
ConfigurationManager.setApplicationVisible(false);
ConfigurationUtils.setApplicationVisible(false);
}
}

@ -19,7 +19,6 @@
import net.java.sip.communicator.impl.gui.main.call.*;
import net.java.sip.communicator.impl.gui.main.chat.*;
import net.java.sip.communicator.impl.gui.main.chat.toolBars.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
@ -282,7 +281,7 @@ public void openChat(ChatPanel chatPanel, boolean setSelected)
MainFrame mainWindow = GuiActivator.getUIService().getMainFrame();
if(mainWindow.getExtendedState() != JFrame.ICONIFIED)
{
if(ConfigurationManager.isAutoPopupNewMessage()
if(ConfigurationUtils.isAutoPopupNewMessage()
|| setSelected)
mainWindow.toFront();
}
@ -414,7 +413,7 @@ private Component createToolbar()
northPanel.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 0));
northPanel.setPreferredSize(new Dimension(500, 35));
northPanel.setVisible(ConfigurationManager.isChatToolbarVisible());
northPanel.setVisible(ConfigurationUtils.isChatToolbarVisible());
northPanel.add(mainToolBar, BorderLayout.EAST);
northPanel.add(contactPhotoPanel, BorderLayout.WEST);

@ -117,7 +117,7 @@ public NewAccountDialog()
mainPanel.add(buttonPanel, BorderLayout.SOUTH);
if (!ConfigurationManager.isAdvancedAccountConfigDisabled())
if (!ConfigurationUtils.isAdvancedAccountConfigDisabled())
{
buttonPanel.add(advancedButton, BorderLayout.WEST);
this.advancedButton.addActionListener(this);

@ -92,7 +92,7 @@ public void incomingCallReceivedInEventDispatchThread(CallEvent ev)
Call sourceCall = ev.getSourceCall();
boolean isVideoCall
= ev.isVideoCall()
&& ConfigurationManager.hasEnabledVideoFormat(
&& ConfigurationUtils.hasEnabledVideoFormat(
sourceCall.getProtocolProvider());
final ReceivedCallDialog receivedCallDialog
= new ReceivedCallDialog(
@ -783,7 +783,7 @@ public static void createCall( String callString,
callString = callString.trim();
// Removes special characters from phone numbers.
if (ConfigurationManager.isNormalizePhoneNumber())
if (ConfigurationUtils.isNormalizePhoneNumber())
callString = PhoneNumberI18nService.normalize(callString);
List<ProtocolProviderService> telephonyProviders
@ -1768,7 +1768,7 @@ public void run()
Contact contact = this.contact;
String stringContact = this.stringContact;
if (ConfigurationManager.isNormalizePhoneNumber())
if (ConfigurationUtils.isNormalizePhoneNumber())
{
if (contact != null)
{
@ -2099,7 +2099,7 @@ public void run()
String[] contactArray
= contactList.toArray(new String[contactList.size()]);
if (ConfigurationManager.isNormalizePhoneNumber())
if (ConfigurationUtils.isNormalizePhoneNumber())
normalizePhoneNumbers(contactArray);
/* Try to have a single Call per ProtocolProviderService. */
@ -2231,7 +2231,7 @@ public void run()
if (opSetVideoBridge == null || !opSetVideoBridge.isActive())
return;
if (ConfigurationManager.isNormalizePhoneNumber())
if (ConfigurationUtils.isNormalizePhoneNumber())
normalizePhoneNumbers(callees);
try

@ -14,6 +14,7 @@
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
/**
* The button responsible to start(the <tt>Call</tt> of) an associated
@ -71,7 +72,7 @@ public DesktopSharingButton(Call call, boolean fullScreen, boolean selected)
"service.gui.NO_DESKTOP_SHARING_FOR_PROTOCOL"));
desktopSharingAvailable = false;
}
else if(!ConfigurationManager.hasEnabledVideoFormat(
else if(!ConfigurationUtils.hasEnabledVideoFormat(
call.getProtocolProvider()))
{
setToolTipText(GuiActivator.getResources()

@ -11,6 +11,7 @@
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
import org.jitsi.service.neomedia.*;
import org.jitsi.service.neomedia.device.*;
@ -145,7 +146,7 @@ public void setEnabled(boolean enabled)
hasVideoTelephony = true;
}
if (!hasEnabledVideoFormat
&& ConfigurationManager.hasEnabledVideoFormat(
&& ConfigurationUtils.hasEnabledVideoFormat(
protocolProvider))
{
hasEnabledVideoFormat = true;

@ -148,7 +148,7 @@ public void actionPerformed(ActionEvent e)
// Store the last used account in order to pre-select it
// next time.
ConfigurationManager.setLastCallConferenceProvider(
ConfigurationUtils.setLastCallConferenceProvider(
preselectedProtocolProvider);
dispose();
@ -360,7 +360,7 @@ private void initAccountListData()
// Try to select the last used account if available.
ProtocolProviderService pps
= ConfigurationManager.getLastCallConferenceProvider();
= ConfigurationUtils.getLastCallConferenceProvider();
if (pps == null && conference != null)
{

@ -276,7 +276,7 @@ public void actionPerformed(ActionEvent e)
GuiActivator.getResources().getI18nMnemonic(
"service.gui.COPY_LINK"));
this.isSimpleTheme = ConfigurationManager.isChatSimpleThemeEnabled();
this.isSimpleTheme = ConfigurationUtils.isChatSimpleThemeEnabled();
/*
* When we append a new message (regardless of whether it is a string or
@ -1353,7 +1353,7 @@ public void clear()
this.document = (HTMLDocument) editorKit.createDefaultDocument();
Constants.loadSimpleStyle(
document.getStyleSheet(), chatTextPane.getFont());
this.isSimpleTheme = ConfigurationManager.isChatSimpleThemeEnabled();
this.isSimpleTheme = ConfigurationUtils.isChatSimpleThemeEnabled();
}
/**

@ -29,6 +29,7 @@
import net.java.sip.communicator.service.metahistory.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.Logger;
import net.java.sip.communicator.util.skin.*;
import net.java.sip.communicator.util.swing.*;
@ -828,7 +829,7 @@ public void run()
return;
}
if (ConfigurationManager.isHistoryShown() && !isHistoryLoaded)
if (ConfigurationUtils.isHistoryShown() && !isHistoryLoaded)
{
synchronized (incomingEventBuffer)
{
@ -1407,7 +1408,7 @@ public void run()
fileTransferTransport.getDisplayName(),
file);
if (ConfigurationManager.isHistoryShown() && !isHistoryLoaded)
if (ConfigurationUtils.isHistoryShown() && !isHistoryLoaded)
{
synchronized (incomingEventBuffer)
{
@ -1839,7 +1840,7 @@ public Object construct() throws Exception
// Load the last N=CHAT_HISTORY_SIZE messages from history.
historyList = chatSession.getHistory(
ConfigurationManager.getChatHistorySize());
ConfigurationUtils.getChatHistorySize());
return historyList;
}
@ -1983,7 +1984,7 @@ public void run()
writeMessagePanel.updateChatTransportStatus(chatTransport);
if(ConfigurationManager.isShowStatusChangedInChat())
if(ConfigurationUtils.isShowStatusChangedInChat())
{
// Show a status message to the user.
this.addMessage(
@ -1996,7 +1997,7 @@ public void run()
"text/plain");
}
if(ConfigurationManager.isMultiChatWindowEnabled())
if(ConfigurationUtils.isMultiChatWindowEnabled())
{
if (getChatContainer().getChatCount() > 0)
{
@ -2250,7 +2251,7 @@ public void run()
= new ReceiveFileConversationComponent(
this, fileTransferOpSet, request, date);
if (ConfigurationManager.isHistoryShown() && !isHistoryLoaded)
if (ConfigurationUtils.isHistoryShown() && !isHistoryLoaded)
{
synchronized (incomingEventBuffer)
{
@ -2558,7 +2559,7 @@ public void propertyChange(PropertyChangeEvent evt)
= messagePane.getHeight() - dividerLocation
- messagePane.getDividerSize();
ConfigurationManager
ConfigurationUtils
.setChatWriteAreaSize(writeAreaSize);
// writeMessagePanel.setPreferredSize(

@ -101,7 +101,7 @@ public class ChatWindow
*/
public ChatWindow()
{
if (!ConfigurationManager.isWindowDecorated())
if (!ConfigurationUtils.isWindowDecorated())
this.setUndecorated(true);
this.addWindowFocusListener(this);
@ -109,7 +109,7 @@ public ChatWindow()
this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
//If in mode TABBED_CHAT_WINDOW initialize the tabbed pane
if(ConfigurationManager.isMultiChatWindowEnabled())
if(ConfigurationUtils.isMultiChatWindowEnabled())
chatTabbedPane = new ConversationTabbedPane();
menuBar = new MessageWindowMenuBar(this);
@ -204,7 +204,7 @@ public MainToolBar getMainToolBar()
*/
public void addChat(final ChatPanel chatPanel)
{
if (ConfigurationManager.isMultiChatWindowEnabled())
if (ConfigurationUtils.isMultiChatWindowEnabled())
addChatTab(chatPanel);
else
addSimpleChat(chatPanel);
@ -230,7 +230,7 @@ private Component createToolBar()
mainToolBar = new MainToolBar(this);
boolean chatToolbarVisible
= ConfigurationManager.isChatToolbarVisible();
= ConfigurationUtils.isChatToolbarVisible();
if (OSUtils.IS_MAC)
{
@ -1133,7 +1133,7 @@ public void openChat(ChatPanel chatPanel, boolean setSelected)
if(getExtendedState() != JFrame.ICONIFIED)
{
if (ConfigurationManager.isAutoPopupNewMessage() || setSelected)
if (ConfigurationUtils.isAutoPopupNewMessage() || setSelected)
{
if (!isVisible())
setVisible(true);

@ -16,11 +16,11 @@
import net.java.sip.communicator.impl.gui.main.chat.conference.*;
import net.java.sip.communicator.impl.gui.main.chatroomslist.*;
import net.java.sip.communicator.impl.gui.main.contactlist.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.gui.event.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.Logger;
import org.jitsi.util.*;
@ -444,7 +444,7 @@ public ChatPanel getSelectedChat()
synchronized (chatSyncRoot)
{
if (ConfigurationManager.isMultiChatWindowEnabled())
if (ConfigurationUtils.isMultiChatWindowEnabled())
{
if (chatPanelsIter.hasNext())
{
@ -1015,7 +1015,7 @@ private ChatPanel createChat( MetaContact metaContact,
this.chatPanels.add(chatPanel);
}
if (ConfigurationManager.isHistoryShown())
if (ConfigurationUtils.isHistoryShown())
chatPanel.loadHistory(escapedMessageID);
fireChatCreated(chatPanel);
@ -1041,7 +1041,7 @@ private ChatContainer getChatContainer()
// If we're in a multi-window mode we have two possibilities - multi
// chat window or single chat windows.
if (ConfigurationManager.isMultiChatWindowEnabled())
if (ConfigurationUtils.isMultiChatWindowEnabled())
{
Iterator<ChatPanel> chatPanelsIter = chatPanels.iterator();
@ -1117,7 +1117,7 @@ private ChatPanel createChat( ChatRoomWrapper chatRoomWrapper,
this.chatPanels.add(chatPanel);
}
if (ConfigurationManager.isHistoryShown())
if (ConfigurationUtils.isHistoryShown())
chatPanel.loadHistory(escapedMessageID);
fireChatCreated(chatPanel);
@ -1150,7 +1150,7 @@ private ChatPanel createChat( AdHocChatRoomWrapper chatRoomWrapper,
this.chatPanels.add(chatPanel);
}
if (ConfigurationManager.isHistoryShown())
if (ConfigurationUtils.isHistoryShown())
chatPanel.loadHistory(escapedMessageID);
fireChatCreated(chatPanel);

@ -20,7 +20,6 @@
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.main.chat.conference.*;
import net.java.sip.communicator.impl.gui.main.chat.menus.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.gui.event.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
@ -103,7 +102,7 @@ public ChatWritePanel(ChatPanel panel)
centerPanel = createCenter();
int chatAreaSize = ConfigurationManager.getChatWriteAreaSize();
int chatAreaSize = ConfigurationUtils.getChatWriteAreaSize();
Dimension writeMessagePanelDefaultSize
= new Dimension(500, (chatAreaSize > 0) ? chatAreaSize : 28);
Dimension writeMessagePanelMinSize = new Dimension(500, 28);
@ -136,7 +135,7 @@ public ChatWritePanel(ChatPanel panel)
this.changeSendCommand((messageCommand == null || messageCommand
.equalsIgnoreCase("enter")));
if(ConfigurationManager.isFontSupportEnabled())
if(ConfigurationUtils.isFontSupportEnabled())
initDefaultFontConfiguration();
}
@ -145,20 +144,20 @@ public ChatWritePanel(ChatPanel panel)
*/
private void initDefaultFontConfiguration()
{
String fontFamily = ConfigurationManager.getChatDefaultFontFamily();
int fontSize = ConfigurationManager.getChatDefaultFontSize();
String fontFamily = ConfigurationUtils.getChatDefaultFontFamily();
int fontSize = ConfigurationUtils.getChatDefaultFontSize();
// Font family and size
if (fontFamily != null && fontSize > 0)
setFontFamilyAndSize(fontFamily, fontSize);
// Font style
setBoldStyleEnable(ConfigurationManager.isChatFontBold());
setItalicStyleEnable(ConfigurationManager.isChatFontItalic());
setUnderlineStyleEnable(ConfigurationManager.isChatFontUnderline());
setBoldStyleEnable(ConfigurationUtils.isChatFontBold());
setItalicStyleEnable(ConfigurationUtils.isChatFontItalic());
setUnderlineStyleEnable(ConfigurationUtils.isChatFontUnderline());
// Font color
Color fontColor = ConfigurationManager.getChatDefaultFontColor();
Color fontColor = ConfigurationUtils.getChatDefaultFontColor();
if (fontColor != null)
setFontColor(fontColor);
@ -530,7 +529,7 @@ private void redo()
*/
public void keyTyped(KeyEvent e)
{
if (ConfigurationManager.isSendTypingNotifications())
if (ConfigurationUtils.isSendTypingNotifications())
{
if (typingState != OperationSetTypingNotifications.STATE_TYPING)
{
@ -938,7 +937,7 @@ private Component createChatTransportSelectorBox()
chatPanel.getChatSession(),
chatPanel.getChatSession().getCurrentChatTransport());
if(ConfigurationManager.isHideAccountSelectionWhenPossibleEnabled()
if(ConfigurationUtils.isHideAccountSelectionWhenPossibleEnabled()
&& transportSelectorBox.getMenu().getItemCount() <= 1)
transportSelectorBox.setVisible(false);
}
@ -985,7 +984,7 @@ public void setTransportSelectorBoxVisible(boolean isVisible)
}
else
{
if( ConfigurationManager
if( ConfigurationUtils
.isHideAccountSelectionWhenPossibleEnabled()
&& transportSelectorBox.getMenu().getItemCount() <= 1)
{
@ -1045,7 +1044,7 @@ public void addChatTransport(ChatTransport chatTransport)
// it was hidden cause we wanted to hide when there is only one
// provider
if(!transportSelectorBox.isVisible()
&& ConfigurationManager
&& ConfigurationUtils
.isHideAccountSelectionWhenPossibleEnabled()
&& transportSelectorBox.getMenu().getItemCount() > 1)
{
@ -1087,7 +1086,7 @@ public void removeChatTransport(ChatTransport chatTransport)
transportSelectorBox.removeChatTransport(chatTransport);
if(transportSelectorBox.getMenu().getItemCount() == 1
&& ConfigurationManager.isHideAccountSelectionWhenPossibleEnabled())
&& ConfigurationUtils.isHideAccountSelectionWhenPossibleEnabled())
{
transportSelectorBox.setVisible(false);
}
@ -1128,12 +1127,12 @@ public void saveDefaultFontConfiguration( String fontFamily,
boolean isUnderline,
Color color)
{
ConfigurationManager.setChatDefaultFontFamily(fontFamily);
ConfigurationManager.setChatDefaultFontSize(fontSize);
ConfigurationManager.setChatFontIsBold(isBold);
ConfigurationManager.setChatFontIsItalic(isItalic);
ConfigurationManager.setChatFontIsUnderline(isUnderline);
ConfigurationManager.setChatDefaultFontColor(color);
ConfigurationUtils.setChatDefaultFontFamily(fontFamily);
ConfigurationUtils.setChatDefaultFontSize(fontSize);
ConfigurationUtils.setChatFontIsBold(isBold);
ConfigurationUtils.setChatFontIsItalic(isItalic);
ConfigurationUtils.setChatFontIsUnderline(isUnderline);
ConfigurationUtils.setChatDefaultFontColor(color);
}
/**

@ -124,7 +124,7 @@ public void setChatSession(ChatSession chatSession)
// cannot be saved with add contact dialog
if (!chatSession.isDescriptorPersistent()
&& !(chatSession instanceof ConferenceChatSession)
&& !ConfigurationManager.isAddContactDisabled())
&& !ConfigurationUtils.isAddContactDisabled())
this.add(addContactButton, 0);
else
this.remove(addContactButton);

@ -13,7 +13,7 @@
import javax.swing.event.*;
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
import org.jitsi.service.resources.*;
@ -169,13 +169,13 @@ public FontChooser()
private void initDefaults()
{
String defaultFontFamily
= ConfigurationManager.getChatDefaultFontFamily();
= ConfigurationUtils.getChatDefaultFontFamily();
int defaultFontSize
= ConfigurationManager.getChatDefaultFontSize();
= ConfigurationUtils.getChatDefaultFontSize();
Color defaultFontColor
= ConfigurationManager.getChatDefaultFontColor();
= ConfigurationUtils.getChatDefaultFontColor();
if (defaultFontFamily != null)
setFontFamily(defaultFontFamily);
@ -183,9 +183,9 @@ private void initDefaults()
if (defaultFontSize > 0)
setFontSize(defaultFontSize);
setBoldStyle(ConfigurationManager.isChatFontBold());
setItalicStyle(ConfigurationManager.isChatFontItalic());
setUnderlineStyle(ConfigurationManager.isChatFontUnderline());
setBoldStyle(ConfigurationUtils.isChatFontBold());
setItalicStyle(ConfigurationUtils.isChatFontItalic());
setUnderlineStyle(ConfigurationUtils.isChatFontUnderline());
if (defaultFontColor != null)
setColor(defaultFontColor);

@ -18,6 +18,7 @@
import net.java.sip.communicator.service.metahistory.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.util.*;
/**
* An implementation of the <tt>ChatSession</tt> interface that represents a
@ -111,7 +112,7 @@ public Collection<Object> getHistory(int count)
return metaHistory.findLast(
chatHistoryFilter,
metaContact,
ConfigurationManager.getChatHistorySize());
ConfigurationUtils.getChatHistorySize());
}
/**
@ -134,7 +135,7 @@ public Collection<Object> getHistoryBeforeDate(Date date, int count)
return metaHistory.findLastMessagesBefore(
chatHistoryFilter,
metaContact, date, ConfigurationManager.getChatHistorySize());
metaContact, date, ConfigurationUtils.getChatHistorySize());
}
/**
@ -157,7 +158,7 @@ public Collection<Object> getHistoryAfterDate(Date date, int count)
return metaHistory.findFirstMessagesAfter(
chatHistoryFilter,
metaContact, date, ConfigurationManager.getChatHistorySize());
metaContact, date, ConfigurationUtils.getChatHistorySize());
}
/**

@ -11,7 +11,6 @@
import javax.swing.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.util.*;
@ -97,8 +96,8 @@ public void run()
*/
private void checkImCaps()
{
if (ConfigurationManager.getChatDefaultFontFamily() != null
&& ConfigurationManager.getChatDefaultFontSize() > 0)
if (ConfigurationUtils.getChatDefaultFontFamily() != null
&& ConfigurationUtils.getChatDefaultFontSize() > 0)
{
OperationSetBasicInstantMessaging imOpSet
= contact.getProtocolProvider()

@ -12,11 +12,11 @@
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.main.chat.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.metahistory.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.service.protocol.globalstatus.*;
import net.java.sip.communicator.util.*;
/**
* An implementation of <tt>ChatSession</tt> for ad-hoc conference chatting.
@ -145,7 +145,7 @@ public Collection<Object> getHistory(int count)
return metaHistory.findLast(
chatHistoryFilter,
chatRoomWrapper.getAdHocChatRoom(),
ConfigurationManager.getChatHistorySize());
ConfigurationUtils.getChatHistorySize());
}
/**
@ -170,7 +170,7 @@ public Collection<Object> getHistoryBeforeDate(Date date, int count)
chatHistoryFilter,
chatRoomWrapper.getAdHocChatRoom(),
date,
ConfigurationManager.getChatHistorySize());
ConfigurationUtils.getChatHistorySize());
}
/**
@ -195,7 +195,7 @@ public Collection<Object> getHistoryAfterDate(Date date, int count)
chatHistoryFilter,
chatRoomWrapper.getAdHocChatRoom(),
date,
ConfigurationManager.getChatHistorySize());
ConfigurationUtils.getChatHistorySize());
}
/**

@ -9,7 +9,6 @@
import java.util.*;
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
@ -244,7 +243,7 @@ public void run()
if(chatRoomWrapper.isAutojoin())
{
String nickName =
ConfigurationManager.getChatRoomProperty(
ConfigurationUtils.getChatRoomProperty(
chatRoomWrapper.getParentProvider()
.getProtocolProvider(), chatRoomWrapper
.getChatRoomID(), "userNickName");
@ -281,7 +280,7 @@ public void run()
true);
String nickName =
ConfigurationManager.getChatRoomProperty(
ConfigurationUtils.getChatRoomProperty(
chatRoomWrapper.getParentProvider()
.getProtocolProvider(), chatRoomWrapper
.getChatRoomID(), "userNickName");

@ -82,7 +82,7 @@ public ChatRoomSubjectPanel(ConferenceChatSession chatSession)
ChatRoomMemberRole role = ((ChatRoomWrapper)chatSession.getDescriptor())
.getChatRoom().getUserRole();
if(!ConfigurationManager.isChatRoomConfigDisabled()
if(!ConfigurationUtils.isChatRoomConfigDisabled()
&& (role.equals(ChatRoomMemberRole.ADMINISTRATOR)
|| role.equals(ChatRoomMemberRole.MODERATOR)
|| role.equals(ChatRoomMemberRole.OWNER)))

@ -6,8 +6,8 @@
*/
package net.java.sip.communicator.impl.gui.main.chat.conference;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
/**
* The <tt>ChatRoomWrapper</tt> is the representation of the <tt>ChatRoom</tt>
@ -180,7 +180,7 @@ public boolean isAutojoin()
{
if(autoJoin == null)
{
String val = ConfigurationManager.getChatRoomProperty(
String val = ConfigurationUtils.getChatRoomProperty(
getParentProvider().getProtocolProvider(),
getChatRoomID(), AUTOJOIN_PROPERTY_NAME);
@ -206,7 +206,7 @@ public void setAutoJoin(boolean value)
{
setPersistent(true);
ConfigurationManager.saveChatRoom(
ConfigurationUtils.saveChatRoom(
getParentProvider().getProtocolProvider(),
getChatRoomID(),
getChatRoomID(),
@ -215,13 +215,13 @@ public void setAutoJoin(boolean value)
if(value)
{
ConfigurationManager.updateChatRoomProperty(
ConfigurationUtils.updateChatRoomProperty(
getParentProvider().getProtocolProvider(),
chatRoomID, AUTOJOIN_PROPERTY_NAME, Boolean.toString(autoJoin));
}
else
{
ConfigurationManager.updateChatRoomProperty(
ConfigurationUtils.updateChatRoomProperty(
getParentProvider().getProtocolProvider(),
chatRoomID, AUTOJOIN_PROPERTY_NAME, null);
}

@ -14,7 +14,6 @@
import net.java.sip.communicator.impl.gui.main.chat.history.*;
import net.java.sip.communicator.impl.gui.main.chatroomslist.*;
import net.java.sip.communicator.impl.gui.main.chatroomslist.joinforms.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
@ -1128,7 +1127,7 @@ public void leaveChatRoom(ChatRoomWrapper chatRoomWrapper)
// We save the choice of the user, before the chat room is really
// joined, because even the join fails we want the next time when
// we login to join this chat room automatically.
ConfigurationManager.updateChatRoomStatus(
ConfigurationUtils.updateChatRoomStatus(
chatRoomWrapper.getParentProvider().getProtocolProvider(),
chatRoomWrapper.getChatRoomID(),
GlobalStatusEnum.OFFLINE_STATUS);
@ -1525,7 +1524,7 @@ protected void done()
catch (ExecutionException ignore)
{}
ConfigurationManager.updateChatRoomStatus(
ConfigurationUtils.updateChatRoomStatus(
chatRoomWrapper.getParentProvider().getProtocolProvider(),
chatRoomWrapper.getChatRoomID(),
GlobalStatusEnum.ONLINE_STATUS);
@ -1662,7 +1661,7 @@ protected void done()
catch (ExecutionException ignore)
{}
ConfigurationManager.updateChatRoomStatus(
ConfigurationUtils.updateChatRoomStatus(
adHocChatRoomWrapper.getParentProvider().getProtocolProvider(),
adHocChatRoomWrapper.getAdHocChatRoomID(),
GlobalStatusEnum.ONLINE_STATUS);

@ -12,11 +12,11 @@
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.main.chat.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.metahistory.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.service.protocol.globalstatus.*;
import net.java.sip.communicator.util.*;
/**
* An implementation of <tt>ChatSession</tt> for conference chatting.
@ -96,7 +96,7 @@ public Object getDescriptor()
*/
public void dispose()
{
if(ConfigurationManager.isLeaveChatRoomOnWindowCloseEnabled())
if(ConfigurationUtils.isLeaveChatRoomOnWindowCloseEnabled())
{
ChatRoom chatRoom = chatRoomWrapper.getChatRoom();
chatRoom.removeMemberPresenceListener(this);
@ -181,7 +181,7 @@ public Collection<Object> getHistory(int count)
return metaHistory.findLast(
chatHistoryFilter,
chatRoomWrapper.getChatRoom(),
ConfigurationManager.getChatHistorySize());
ConfigurationUtils.getChatHistorySize());
}
/**
@ -231,7 +231,7 @@ public Collection<Object> getHistoryAfterDate(Date date, int count)
chatHistoryFilter,
chatRoomWrapper.getChatRoom(),
date,
ConfigurationManager.getChatHistorySize());
ConfigurationUtils.getChatHistorySize());
}
/**

@ -13,6 +13,7 @@
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.main.chat.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.skin.*;
import net.java.sip.communicator.util.swing.*;
@ -68,7 +69,7 @@ public EditMenu(ChatWindow chatWindow)
this.add(copyMenuItem);
this.add(pasteMenuItem);
if(ConfigurationManager.isFontSupportEnabled())
if(ConfigurationUtils.isFontSupportEnabled())
{
this.addSeparator();
this.fontDialogMenuItem.setName("font");

@ -15,6 +15,7 @@
import net.java.sip.communicator.impl.gui.main.chat.history.*;
import net.java.sip.communicator.impl.gui.main.chatroomslist.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.skin.*;
import net.java.sip.communicator.util.swing.*;
@ -57,7 +58,7 @@ public FileMenu(ChatWindow parentWindow)
this.setMnemonic(
GuiActivator.getResources().getI18nMnemonic("service.gui.FILE"));
if (!ConfigurationManager.isGoToChatroomDisabled())
if (!ConfigurationUtils.isGoToChatroomDisabled())
{
this.add(myChatRoomsItem);
}

@ -15,6 +15,7 @@
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.main.chat.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
/**
* The <tt>OptionMenu</tt> is a menu in the chat window menu bar.
@ -75,13 +76,13 @@ public OptionsMenu(ChatWindow chatWindow)
private void initValues()
{
this.viewToolBar.setSelected(
ConfigurationManager.isChatToolbarVisible());
ConfigurationUtils.isChatToolbarVisible());
this.viewSmileys.setSelected(
ConfigurationManager.isShowSmileys());
ConfigurationUtils.isShowSmileys());
this.chatSimpleTheme.setSelected(
ConfigurationManager.isChatSimpleThemeEnabled());
ConfigurationUtils.isChatSimpleThemeEnabled());
}
/**
@ -96,16 +97,16 @@ public void actionPerformed(ActionEvent e)
if (action.equals(ACTCMD_VIEW_TOOLBAR))
{
this.chatWindow.setToolbarVisible(viewToolBar.isSelected());
ConfigurationManager
ConfigurationUtils
.setChatToolbarVisible(viewToolBar.isSelected());
}
else if (action.equals(ACTCMD_VIEW_SMILEYS))
{
ConfigurationManager.setShowSmileys(viewSmileys.isSelected());
ConfigurationUtils.setShowSmileys(viewSmileys.isSelected());
}
else if (action.equals(ACTCMD_VIEW_SIMPLE_THEME))
{
ConfigurationManager.setChatSimpleThemeEnabled(
ConfigurationUtils.setChatSimpleThemeEnabled(
chatSimpleTheme.isSelected());
List<ChatPanel> currentChats = chatWindow.getChats();

@ -30,6 +30,7 @@
import net.java.sip.communicator.service.protocol.ServerStoredDetails.GenericDetail;
import net.java.sip.communicator.service.protocol.ServerStoredDetails.PagerDetail;
import net.java.sip.communicator.service.protocol.ServerStoredDetails.PhoneNumberDetail;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.skin.*;
import net.java.sip.communicator.util.swing.*;
import net.java.sip.communicator.util.swing.SwingWorker;
@ -182,7 +183,7 @@ protected void init()
// if we leave a chat room when we close the window
// there is no need for this button
if(!ConfigurationManager.isLeaveChatRoomOnWindowCloseEnabled())
if(!ConfigurationUtils.isLeaveChatRoomOnWindowCloseEnabled())
this.add(leaveChatRoomButton);
this.add(callButton);
@ -215,7 +216,7 @@ protected void init()
this.addSeparator();
if(ConfigurationManager.isFontSupportEnabled())
if(ConfigurationUtils.isFontSupportEnabled())
{
this.add(fontButton);
fontButton.setName("font");
@ -444,11 +445,11 @@ else if (buttonText.equals("sendFile"))
{
SipCommFileChooser scfc = GenericFileDialog.create(
null, "Send file...", SipCommFileChooser.LOAD_FILE_OPERATION,
ConfigurationManager.getSendFileLastDir());
ConfigurationUtils.getSendFileLastDir());
File selectedFile = scfc.getFileFromDialog();
if(selectedFile != null)
{
ConfigurationManager.setSendFileLastDir(
ConfigurationUtils.setSendFileLastDir(
selectedFile.getParent());
chatContainer.getCurrentChat().sendFile(selectedFile);
}

@ -10,7 +10,6 @@
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.main.chat.conference.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
@ -213,7 +212,7 @@ public void addChatRoom(ChatRoomWrapper chatRoomWrapper)
if (chatRoomWrapper.isPersistent())
{
ConfigurationManager.saveChatRoom(
ConfigurationUtils.saveChatRoom(
chatRoomProvider.getProtocolProvider(),
chatRoomWrapper.getChatRoomID(),
chatRoomWrapper.getChatRoomID(),
@ -237,7 +236,7 @@ public void removeChatRoom(ChatRoomWrapper chatRoomWrapper)
if (chatRoomWrapper.isPersistent())
{
ConfigurationManager.saveChatRoom(
ConfigurationUtils.saveChatRoom(
chatRoomProvider.getProtocolProvider(),
chatRoomWrapper.getChatRoomID(),
null, // The new identifier.

@ -19,6 +19,7 @@
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.resources.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
import org.jitsi.service.resources.*;
@ -117,7 +118,7 @@ else if (itemName.equals("joinChatRoom"))
String nickName = null;
nickName =
ConfigurationManager.getChatRoomProperty(
ConfigurationUtils.getChatRoomProperty(
chatRoomWrapper.getParentProvider()
.getProtocolProvider(), chatRoomWrapper
.getChatRoomID(), "userNickName");
@ -138,7 +139,7 @@ else if (itemName.equals("openChatRoom"))
String nickName = null;
nickName =
ConfigurationManager.getChatRoomProperty(
ConfigurationUtils.getChatRoomProperty(
chatRoomWrapper.getParentProvider()
.getProtocolProvider(), chatRoomWrapper
.getChatRoomID(), "userNickName");
@ -166,15 +167,15 @@ else if (itemName.equals("openChatRoom"))
"",
false,
true);
String nickName = null;
nickName =
ConfigurationManager.getChatRoomProperty(
ConfigurationUtils.getChatRoomProperty(
chatRoomWrapper.getParentProvider()
.getProtocolProvider(), chatRoomWrapper
.getChatRoomID(), "userNickName");
if(nickName == null)
nickName = getNickname();
@ -202,13 +203,13 @@ else if(itemName.equals("joinAsChatRoom"))
else if(itemName.equals("nickNameChatRoom"))
{
String nickName = null;
nickName =
ConfigurationManager.getChatRoomProperty(
ConfigurationUtils.getChatRoomProperty(
chatRoomWrapper.getParentProvider()
.getProtocolProvider(), chatRoomWrapper
.getChatRoomID(), "userNickName");
ChatOperationReasonDialog reasonDialog =
new ChatOperationReasonDialog(GuiActivator.getResources()
.getI18NString("service.gui.CHANGE_NICKNAME"), GuiActivator
@ -225,11 +226,10 @@ else if(itemName.equals("nickNameChatRoom"))
{
nickName = reasonDialog.getReason().trim();
}
ConfigurationManager.updateChatRoomProperty(chatRoomWrapper
ConfigurationUtils.updateChatRoomProperty(chatRoomWrapper
.getParentProvider().getProtocolProvider(), chatRoomWrapper
.getChatRoomID(), "userNickName", nickName);
}
}

@ -19,8 +19,8 @@
import net.java.sip.communicator.impl.gui.main.*;
import net.java.sip.communicator.impl.gui.main.chat.*;
import net.java.sip.communicator.impl.gui.main.chat.conference.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
import org.jitsi.util.*;
@ -363,7 +363,7 @@ public void actionPerformed(ActionEvent e)
{
nickName = reasonDialog.getReason().trim();
ConfigurationManager.updateChatRoomProperty(
ConfigurationUtils.updateChatRoomProperty(
getSelectedProvider().getProtocolProvider(),
chatRoomWrapper.getChatRoomID(), "userNickName", nickName);
}
@ -410,7 +410,7 @@ else if(sourceButton.equals(okButton))
{
nickName = reasonDialog.getReason().trim();
ConfigurationManager.updateChatRoomProperty(
ConfigurationUtils.updateChatRoomProperty(
getSelectedProvider().getProtocolProvider(),
chatRoomWrapper.getChatRoomID(), "userNickName",
nickName);
@ -434,7 +434,7 @@ else if(sourceButton.equals(okButton))
if (!selectedRoom.getChatRoom().isJoined())
{
String savedNick =
ConfigurationManager.getChatRoomProperty(
ConfigurationUtils.getChatRoomProperty(
selectedRoom.getParentProvider()
.getProtocolProvider(), selectedRoom
.getChatRoomID(), "userNickName");
@ -461,7 +461,7 @@ else if(sourceButton.equals(okButton))
true);
String savedNick =
ConfigurationManager.getChatRoomProperty(
ConfigurationUtils.getChatRoomProperty(
chatRoomWrapper.getParentProvider()
.getProtocolProvider(), chatRoomWrapper
.getChatRoomID(), "userNickName");
@ -486,12 +486,12 @@ else if(sourceButton.equals(okButton))
{
nickName = reasonDialog.getReason().trim();
ConfigurationManager.updateChatRoomProperty(
ConfigurationUtils.updateChatRoomProperty(
getSelectedProvider().getProtocolProvider(),
chatRoomWrapper.getChatRoomID(),
"userNickName", nickName);
}
GuiActivator.getUIService().getConferenceChatManager()
.joinChatRoom(chatRoomWrapper,nickName,null);
}

@ -20,6 +20,7 @@
import net.java.sip.communicator.impl.gui.main.chat.conference.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
/**
@ -170,7 +171,7 @@ void openChatForSelection()
}
String savedNick =
ConfigurationManager.getChatRoomProperty(chatRoomWrapper
ConfigurationUtils.getChatRoomProperty(chatRoomWrapper
.getParentProvider().getProtocolProvider(), chatRoomWrapper
.getChatRoomID(), "userNickName");
@ -192,7 +193,7 @@ void openChatForSelection()
{
nickName = reasonDialog.getReason().trim();
ConfigurationManager.updateChatRoomProperty(chatRoomWrapper
ConfigurationUtils.updateChatRoomProperty(chatRoomWrapper
.getParentProvider().getProtocolProvider(), chatRoomWrapper
.getChatRoomID(), "userNickName", nickName);

@ -165,7 +165,7 @@ private void init()
// we have an empty choice and one account
if(accountCombo.getItemCount() > 2
|| (accountCombo.getItemCount() == 2
&& !ConfigurationManager
&& !ConfigurationUtils
.isHideAccountSelectionWhenPossibleEnabled()))
{
labelsPanel.add(accountLabel);
@ -213,7 +213,7 @@ public void removeUpdate(DocumentEvent e)
this.getContentPane().add(mainPanel, BorderLayout.CENTER);
if(ConfigurationManager.isHideAccountSelectionWhenPossibleEnabled())
if(ConfigurationUtils.isHideAccountSelectionWhenPossibleEnabled())
this.setPreferredSize(new Dimension(450, 205));
else
this.setPreferredSize(new Dimension(450, 250));
@ -327,7 +327,7 @@ public static JComboBox createGroupCombo(final Dialog parentDialog)
final String newGroupString = GuiActivator.getResources()
.getI18NString("service.gui.CREATE_GROUP");
if (!ConfigurationManager.isCreateGroupDisabled())
if (!ConfigurationUtils.isCreateGroupDisabled())
{
groupCombo.addItem(newGroupString);
}

@ -14,6 +14,7 @@
import net.java.sip.communicator.impl.gui.main.*;
import net.java.sip.communicator.impl.gui.main.contactlist.addgroup.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.skin.*;
import net.java.sip.communicator.util.swing.*;
@ -48,10 +49,10 @@ public CommonRightButtonMenu(MainFrame mainFrame)
{
this.mainFrame = mainFrame;
if (!ConfigurationManager.isAddContactDisabled())
if (!ConfigurationUtils.isAddContactDisabled())
this.add(addContactItem);
if (!ConfigurationManager.isCreateGroupDisabled())
if (!ConfigurationUtils.isCreateGroupDisabled())
this.add(createGroupItem);
this.addContactItem.setMnemonic(GuiActivator.getResources()

@ -10,9 +10,9 @@
import javax.swing.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
/**
* Implements <tt>ListModel</tt> for <tt>MetaContactListService</tt> in order to
@ -383,7 +383,7 @@ public void closeGroup(MetaContactGroup group)
this.closedGroups.add(group);
ConfigurationManager.setContactListGroupCollapsed(
ConfigurationUtils.setContactListGroupCollapsed(
group.getMetaUID(),
true);
}
@ -402,7 +402,7 @@ public void openGroup(MetaContactGroup group)
contentAdded(this.indexOf(group.getMetaContact(0)), this.indexOf(group
.getMetaContact(countContactsAndSubgroups(group) - 1)));
ConfigurationManager.setContactListGroupCollapsed(
ConfigurationUtils.setContactListGroupCollapsed(
group.getMetaUID(),
false);
}
@ -516,7 +516,7 @@ private boolean containsOnlineContacts(MetaContactGroup group)
private void initGroupsStatus(MetaContactGroup group)
{
boolean isClosed = ConfigurationManager
boolean isClosed = ConfigurationUtils
.isContactListGroupCollapsed(group.getMetaUID());
if (isClosed)

@ -842,7 +842,7 @@ private void initButtonsPanel(UIContact uiContact)
OperationSetVideoTelephony.class);
if (videoContact != null
|| (ConfigurationManager
|| (ConfigurationUtils
.isRouteVideoAndDesktopUsingPhoneNumberEnabled()
&& hasPhone
&& GuiActivator.getOpSetRegisteredProviders(
@ -858,7 +858,7 @@ private void initButtonsPanel(UIContact uiContact)
OperationSetDesktopSharingServer.class);
if (desktopContact != null
|| (ConfigurationManager
|| (ConfigurationUtils
.isRouteVideoAndDesktopUsingPhoneNumberEnabled()
&& hasPhone
&& GuiActivator.getOpSetRegisteredProviders(
@ -870,7 +870,7 @@ private void initButtonsPanel(UIContact uiContact)
}
if (uiContact.getDescriptor() instanceof SourceContact
&& !ConfigurationManager.isAddContactDisabled())
&& !ConfigurationUtils.isAddContactDisabled())
{
x += addButton(addContactButton, ++gridX, x, false);
}
@ -1113,7 +1113,7 @@ private void callVideo(TreeNode treeNode)
= contactDescriptor.getContactDetailsForOperationSet(
OperationSetVideoTelephony.class);
if(ConfigurationManager.isRouteVideoAndDesktopUsingPhoneNumberEnabled()
if(ConfigurationUtils.isRouteVideoAndDesktopUsingPhoneNumberEnabled()
&& contactDescriptor.getDescriptor() instanceof MetaContact)
{
videoContacts.addAll(CallManager.getAdditionalNumbers(
@ -1230,7 +1230,7 @@ private void shareDesktop(TreeNode treeNode)
= contactDescriptor.getContactDetailsForOperationSet(
OperationSetDesktopSharingServer.class);
if(ConfigurationManager.isRouteVideoAndDesktopUsingPhoneNumberEnabled()
if(ConfigurationUtils.isRouteVideoAndDesktopUsingPhoneNumberEnabled()
&& contactDescriptor.getDescriptor() instanceof MetaContact)
{
desktopContacts.addAll(CallManager.getAdditionalNumbers(

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

@ -13,6 +13,7 @@
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
/**
@ -140,7 +141,7 @@ public MoveContactToMetaContactThread( Contact srcContact,
@SuppressWarnings("fallthrough") //intentional
public void run()
{
if (!ConfigurationManager.isMoveContactConfirmationRequested())
if (!ConfigurationUtils.isMoveContactConfirmationRequested())
{
// we move the specified contact
GuiActivator.getContactListService()
@ -165,7 +166,7 @@ public void run()
switch (dialog.showDialog())
{
case MessageDialog.OK_DONT_ASK_CODE:
ConfigurationManager.setMoveContactConfirmationRequested(false);
ConfigurationUtils.setMoveContactConfirmationRequested(false);
// do fall through
case MessageDialog.OK_RETURN_CODE:
@ -196,7 +197,7 @@ public MoveMetaContactToMetaContactThread( MetaContact srcContact,
@SuppressWarnings("fallthrough") //intentional
public void run()
{
if (!ConfigurationManager.isMoveContactConfirmationRequested())
if (!ConfigurationUtils.isMoveContactConfirmationRequested())
{
// We move all subcontacts of the source MetaContact to the
// destination MetaContact.
@ -221,7 +222,7 @@ public void run()
switch (dialog.showDialog())
{
case MessageDialog.OK_DONT_ASK_CODE:
ConfigurationManager.setMoveContactConfirmationRequested(false);
ConfigurationUtils.setMoveContactConfirmationRequested(false);
// do fall through
case MessageDialog.OK_RETURN_CODE:
@ -266,7 +267,7 @@ public MoveContactToGroupThread(Contact srcContact,
public void run()
{
if (!ConfigurationManager.isMoveContactConfirmationRequested())
if (!ConfigurationUtils.isMoveContactConfirmationRequested())
{
// we move the specified contact
GuiActivator.getContactListService()
@ -291,7 +292,7 @@ public void run()
switch (dialog.showDialog())
{
case MessageDialog.OK_DONT_ASK_CODE:
ConfigurationManager.setMoveContactConfirmationRequested(false);
ConfigurationUtils.setMoveContactConfirmationRequested(false);
// do fall through
case MessageDialog.OK_RETURN_CODE:
@ -323,7 +324,7 @@ public MoveMetaContactThread( MetaContact srcContact,
@SuppressWarnings("fallthrough")
public void run()
{
if (!ConfigurationManager.isMoveContactConfirmationRequested())
if (!ConfigurationUtils.isMoveContactConfirmationRequested())
{
// we move the specified contact
try
@ -355,7 +356,7 @@ public void run()
switch (dialog.showDialog())
{
case MessageDialog.OK_DONT_ASK_CODE:
ConfigurationManager.setMoveContactConfirmationRequested(false);
ConfigurationUtils.setMoveContactConfirmationRequested(false);
// do fall through
case MessageDialog.OK_RETURN_CODE:

@ -469,7 +469,7 @@ else if(d instanceof MobilePhoneDetail)
}
routingForVideoEnabled =
ConfigurationManager
ConfigurationUtils
.isRouteVideoAndDesktopUsingPhoneNumberEnabled()
&& phones.size() > 0
&& GuiActivator.getOpSetRegisteredProviders(
@ -477,7 +477,7 @@ else if(d instanceof MobilePhoneDetail)
null,
null).size() > 0;
routingForDesktopEnabled =
ConfigurationManager
ConfigurationUtils
.isRouteVideoAndDesktopUsingPhoneNumberEnabled()
&& phones.size() > 0
&& GuiActivator.getOpSetRegisteredProviders(
@ -485,7 +485,6 @@ else if(d instanceof MobilePhoneDetail)
null,
null).size() > 0;
// add all the contacts that support telephony to the call menu
if (metaContact.getContactCount() > 1 || phones.size() > 0)
{
@ -655,12 +654,12 @@ else if(d instanceof MobilePhoneDetail)
addSeparator();
if (!ConfigurationManager.isAddContactDisabled())
if (!ConfigurationUtils.isAddContactDisabled())
add(addContactItem);
addSeparator();
if (!ConfigurationManager.isRemoveContactDisabled())
if (!ConfigurationUtils.isRemoveContactDisabled())
add(removeContactMenu);
add(renameContactItem);
@ -931,11 +930,11 @@ else if (itemName.equals("sendFile"))
SipCommFileChooser scfc = GenericFileDialog.create(
null, "Send file...",
SipCommFileChooser.LOAD_FILE_OPERATION,
ConfigurationManager.getSendFileLastDir());
ConfigurationUtils.getSendFileLastDir());
File selectedFile = scfc.getFileFromDialog();
if(selectedFile != null)
{
ConfigurationManager.setSendFileLastDir(
ConfigurationUtils.setSendFileLastDir(
selectedFile.getParent());
// Obtain the corresponding chat panel.

@ -10,7 +10,6 @@
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.main.contactlist.contactsource.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.gui.event.*;
@ -44,7 +43,7 @@ public class PresenceFilter
*/
public PresenceFilter()
{
isShowOffline = ConfigurationManager.isShowOffline();
isShowOffline = ConfigurationUtils.isShowOffline();
}
/**
@ -117,7 +116,7 @@ public void setShowOffline(boolean isShowOffline)
{
this.isShowOffline = isShowOffline;
ConfigurationManager.setShowOffline(isShowOffline);
ConfigurationUtils.setShowOffline(isShowOffline);
}
/**

@ -19,6 +19,7 @@
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.contactsource.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.skin.*;
import net.java.sip.communicator.util.swing.*;
@ -79,7 +80,7 @@ private void initItems()
add(initCallMenu());
// Only create the menu if the add contact functionality is enabled.
if (!ConfigurationManager.isAddContactDisabled())
if (!ConfigurationUtils.isAddContactDisabled())
{
addContactComponent
= TreeContactList.createAddContactMenu(sourceContact);

@ -1314,7 +1314,7 @@ public void treeCollapsed(TreeExpansionEvent event)
GroupNode groupNode = (GroupNode) collapsedNode;
String id = groupNode.getGroupDescriptor().getId();
if (id != null)
ConfigurationManager
ConfigurationUtils
.setContactListGroupCollapsed(id, true);
}
}
@ -1336,7 +1336,7 @@ public void treeExpanded(TreeExpansionEvent event)
GroupNode groupNode = (GroupNode) collapsedNode;
String id = groupNode.getGroupDescriptor().getId();
if (id != null)
ConfigurationManager
ConfigurationUtils
.setContactListGroupCollapsed(id, false);
}
}

@ -16,8 +16,8 @@
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.service.protocol.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.skin.*;
import net.java.sip.communicator.util.swing.*;
import net.java.sip.communicator.util.swing.event.*;
@ -71,7 +71,7 @@ public UnknownContactPanel(MainFrame window)
this.add(mainPanel, BorderLayout.NORTH);
if (!ConfigurationManager.isAddContactDisabled())
if (!ConfigurationUtils.isAddContactDisabled())
{
initAddContactButton();
}

@ -443,7 +443,7 @@ private void loadTooltip(final ExtendedTooltip tip)
&& protocolContact.getStatusMessage().length() > 0)
statusMessage = protocolContact.getStatusMessage();
if(ConfigurationManager.isHideAccountStatusSelectorsEnabled())
if(ConfigurationUtils.isHideAccountStatusSelectorsEnabled())
break;
ImageIcon protocolStatusIcon

@ -10,9 +10,9 @@
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.main.contactlist.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.util.*;
/**
* The <tt>MetaUIGroup</tt> is the implementation of the UIGroup for the
@ -88,7 +88,7 @@ public UIGroup getParentGroup()
*/
public boolean isGroupCollapsed()
{
return ConfigurationManager
return ConfigurationUtils
.isContactListGroupCollapsed(metaGroup.getMetaUID());
}

@ -84,7 +84,7 @@ public static void registerMenuItems(SIPCommMenu parentMenu)
// if we are in disabled menu mode and we have only one item
// change its name (like global auto answer)
if( ConfigurationManager.isAutoAnswerDisableSubmenu()
if( ConfigurationUtils.isAutoAnswerDisableSubmenu()
&& getAutoAnswerItemCount(parentMenu) == 1)
{
updateItem(getAutoAnswerItem(parentMenu, 0), true);
@ -162,7 +162,7 @@ public void run()
int itemsCount = getAutoAnswerItemCount(parentMenu);
// if menu is disabled for autoanswer and we have added an item
if(ConfigurationManager.isAutoAnswerDisableSubmenu()
if(ConfigurationUtils.isAutoAnswerDisableSubmenu()
&& itemsCount != initialCount)
{
// if initial count was 1, lets change provider name to the
@ -359,7 +359,7 @@ public void run()
// if menu is disabled for auto answer and we have left with one
// item set its name like a global one
if(ConfigurationManager.isAutoAnswerDisableSubmenu()
if(ConfigurationUtils.isAutoAnswerDisableSubmenu()
&& getAutoAnswerItemCount(parentMenu) == 1)
{
updateItem(getAutoAnswerItem(parentMenu, 0), true);
@ -566,7 +566,7 @@ public void actionPerformed(ActionEvent e)
private static String getItemDisplayName(
ProtocolProviderService provider)
{
if(ConfigurationManager.isAutoAnswerDisableSubmenu())
if(ConfigurationUtils.isAutoAnswerDisableSubmenu())
return GuiActivator.getResources()
.getI18NString("service.gui.AUTO_ANSWER")
+ " - " + provider.getAccountID().getDisplayName();
@ -912,7 +912,7 @@ else if(callFwd.isSelected())
answerWithVideoCheckBox.isSelected());
// as settings changed lets update items
if( ConfigurationManager.isAutoAnswerDisableSubmenu()
if( ConfigurationUtils.isAutoAnswerDisableSubmenu()
&& getAutoAnswerItemCount(parentMenu) == 1)
{
updateItem(getAutoAnswerItem(parentMenu, 0), true);

@ -109,16 +109,16 @@ public FileMenu(MainFrame parentWindow)
.getI18nMnemonic("service.gui.NEW_ACCOUNT"));
// add separator only if there are other items enabled
if(!ConfigurationManager.isAddContactDisabled()
|| !ConfigurationManager.isCreateGroupDisabled()
|| !ConfigurationManager.isGoToChatroomDisabled())
if(!ConfigurationUtils.isAddContactDisabled()
|| !ConfigurationUtils.isCreateGroupDisabled()
|| !ConfigurationUtils.isGoToChatroomDisabled())
{
this.addSeparator();
endsWithSeparator = true;
}
}
if (!ConfigurationManager.isAddContactDisabled())
if (!ConfigurationUtils.isAddContactDisabled())
{
addContactItem = new JMenuItem(
resources.getI18NString("service.gui.ADD_CONTACT") + "...");
@ -134,8 +134,8 @@ public FileMenu(MainFrame parentWindow)
// if next item is disabled add separator here
// only if there is something next
if(ConfigurationManager.isCreateGroupDisabled()
&& !ConfigurationManager.isGoToChatroomDisabled())
if(ConfigurationUtils.isCreateGroupDisabled()
&& !ConfigurationUtils.isGoToChatroomDisabled())
{
this.addSeparator();
endsWithSeparator = true;
@ -144,19 +144,19 @@ public FileMenu(MainFrame parentWindow)
endsWithSeparator = false;
}
if (!ConfigurationManager.isCreateGroupDisabled())
if (!ConfigurationUtils.isCreateGroupDisabled())
{
this.add(createGroupItem);
// add separator if there is something next
if(!ConfigurationManager.isGoToChatroomDisabled())
if(!ConfigurationUtils.isGoToChatroomDisabled())
{
this.addSeparator();
endsWithSeparator = true;
}
}
if (!ConfigurationManager.isGoToChatroomDisabled())
if (!ConfigurationUtils.isGoToChatroomDisabled())
{
this.add(myChatRoomsItem);
endsWithSeparator = false;

@ -26,6 +26,7 @@
import net.java.sip.communicator.service.gui.Container;
import net.java.sip.communicator.service.notification.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.Logger;
import net.java.sip.communicator.util.skin.*;
import net.java.sip.communicator.util.swing.*;
@ -205,7 +206,7 @@ else if (itemName.equals("conference"))
}
else if (itemName.equals("showHideOffline"))
{
boolean isShowOffline = ConfigurationManager.isShowOffline();
boolean isShowOffline = ConfigurationUtils.isShowOffline();
TreeContactList.presenceFilter.setShowOffline(!isShowOffline);
@ -346,7 +347,7 @@ private void registerMenuItems()
if(!cfg.getBoolean(AUTO_ANSWER_MENU_DISABLED_PROP, false))
{
if(ConfigurationManager.isAutoAnswerDisableSubmenu())
if(ConfigurationUtils.isAutoAnswerDisableSubmenu())
{
this.addSeparator();
AutoAnswerMenu.registerMenuItems(this);
@ -361,7 +362,7 @@ private void registerMenuItems()
this.addSeparator();
// Show/hide offline contacts menu item.
String offlineTextKey = ConfigurationManager.isShowOffline()
String offlineTextKey = ConfigurationUtils.isShowOffline()
? "service.gui.HIDE_OFFLINE_CONTACTS"
: "service.gui.SHOW_OFFLINE_CONTACTS";

@ -652,7 +652,7 @@ public void serverStoredDetailsChanged(ServerStoredDetailsChangeEvent evt)
*/
public String getUIClassID()
{
if(ConfigurationManager.isTransparentWindowEnabled())
if(ConfigurationUtils.isTransparentWindowEnabled())
return uiClassID;
else
return super.getUIClassID();

@ -22,8 +22,6 @@
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
import org.jitsi.service.configuration.*;
/**
* The <tt>GlobalStatusSelectorBox</tt> is a global status selector box, which
* appears in the status panel, when the user has more than one account. It
@ -124,7 +122,7 @@ public GlobalStatusSelectorBox(MainFrame mainFrame)
offlineStatus = status;
}
if(!ConfigurationManager.isHideAccountStatusSelectorsEnabled())
if(!ConfigurationUtils.isHideAccountStatusSelectorsEnabled())
this.addSeparator();
this.setFont(titleLabel.getFont().deriveFont(Font.PLAIN, 11f));
@ -187,7 +185,7 @@ public void addAccount(ProtocolProviderService protocolProvider)
? new PresenceStatusMenu(protocolProvider)
: new SimpleStatusMenu(protocolProvider);
if(ConfigurationManager.isHideAccountStatusSelectorsEnabled())
if(ConfigurationUtils.isHideAccountStatusSelectorsEnabled())
statusSelectorMenu.setVisible(false);
// If this is the first account in our menu.

@ -1,721 +0,0 @@
/*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.plugin.generalconfig;
import java.io.*;
import java.util.*;
import javax.net.ssl.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.resources.*;
import net.java.sip.communicator.util.Logger;
import org.jitsi.service.configuration.*;
import org.jitsi.service.resources.*;
import org.jitsi.util.*;
public class ConfigurationManager
{
private static final Logger logger
= Logger.getLogger(ConfigurationManager.class);
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 isSendTypingNotifications;
private static boolean isMultiChatWindowEnabled;
private static boolean isLeaveChatRoomOnWindowCloseEnabled;
private static boolean isHistoryLoggingEnabled;
private static boolean isHistoryShown;
private static int chatHistorySize;
private static int windowTransparency;
private static boolean isTransparentWindowEnabled;
/**
* Indicates if phone numbers should be normalized before dialed.
*/
private static boolean isNormalizePhoneNumber;
/**
* Indicates if a string containing alphabetical characters might be
* considered as a phone number.
*/
private static boolean acceptPhoneNumberWithAlphaChars;
private static ConfigurationService configService
= GeneralConfigPluginActivator.getConfigurationService();
/**
*
*/
public static void loadGuiConfigurations()
{
// Load the "auPopupNewMessage" property.
String autoPopupProperty =
"service.gui.AUTO_POPUP_NEW_MESSAGE";
String autoPopup = configService.getString(autoPopupProperty);
if(autoPopup == null)
autoPopup = Resources.getSettingsString(autoPopupProperty);
if(autoPopup != null && autoPopup.equalsIgnoreCase("yes"))
autoPopupNewMessage = true;
// Load the "sendMessageCommand" property.
String messageCommandProperty =
"service.gui.SEND_MESSAGE_COMMAND";
String messageCommand = configService.getString(messageCommandProperty);
if(messageCommand == null)
messageCommand =
Resources.getSettingsString(messageCommandProperty);
if(messageCommand != null && messageCommand.length() > 0)
{
sendMessageCommand = messageCommand;
}
// Load the "sendTypingNotifications" property.
String isSendTypingNotifProperty =
"service.gui.SEND_TYPING_NOTIFICATIONS_ENABLED";
String isSendTypingNotif =
configService.getString(isSendTypingNotifProperty);
if(isSendTypingNotif == null)
isSendTypingNotif =
Resources.getSettingsString(isSendTypingNotifProperty);
if(isSendTypingNotif != null && isSendTypingNotif.length() > 0)
{
isSendTypingNotifications
= new Boolean(isSendTypingNotif).booleanValue();
}
// Load the "isLeaveChatroomOnWindowCloseEnabled" property.
String isLeaveChatRoomOnWindowCloseEnabledStringProperty
= "service.gui.LEAVE_CHATROOM_ON_WINDOW_CLOSE";
String isLeaveChatRoomOnWindowCloseEnabledString
= configService.getString(isLeaveChatRoomOnWindowCloseEnabledStringProperty);
if(isLeaveChatRoomOnWindowCloseEnabledString == null)
isLeaveChatRoomOnWindowCloseEnabledString =
Resources.
getSettingsString(isLeaveChatRoomOnWindowCloseEnabledStringProperty);
if(isLeaveChatRoomOnWindowCloseEnabledString != null
&& isLeaveChatRoomOnWindowCloseEnabledString.length() > 0)
{
isLeaveChatRoomOnWindowCloseEnabled
= new Boolean(isLeaveChatRoomOnWindowCloseEnabledString)
.booleanValue();
}
// Load the "isMultiChatWindowEnabled" property.
String isMultiChatWindowEnabledStringProperty
= "service.gui.IS_MULTI_CHAT_WINDOW_ENABLED";
String isMultiChatWindowEnabledString
= configService.getString(isMultiChatWindowEnabledStringProperty);
if(isMultiChatWindowEnabledString == null)
isMultiChatWindowEnabledString =
Resources.
getSettingsString(isMultiChatWindowEnabledStringProperty);
if(isMultiChatWindowEnabledString != null
&& isMultiChatWindowEnabledString.length() > 0)
{
isMultiChatWindowEnabled
= new Boolean(isMultiChatWindowEnabledString)
.booleanValue();
}
// Load the "isHistoryLoggingEnabled" property.
String isHistoryLoggingEnabledPropertyString =
"impl.msghistory.IS_MESSAGE_HISTORY_ENABLED";
String isHistoryLoggingEnabledString
= configService.getString(
isHistoryLoggingEnabledPropertyString);
if(isHistoryLoggingEnabledString == null)
isHistoryLoggingEnabledString =
Resources.
getSettingsString(isHistoryLoggingEnabledPropertyString);
if(isHistoryLoggingEnabledString != null
&& isHistoryLoggingEnabledString.length() > 0)
{
isHistoryLoggingEnabled
= new Boolean(isHistoryLoggingEnabledString)
.booleanValue();
}
// Load the "isHistoryShown" property.
String isHistoryShownStringProperty =
"service.gui.IS_MESSAGE_HISTORY_SHOWN";
String isHistoryShownString
= configService.getString(isHistoryShownStringProperty);
if(isHistoryShownString == null)
isHistoryShownString =
Resources.getSettingsString(isHistoryShownStringProperty);
if(isHistoryShownString != null
&& isHistoryShownString.length() > 0)
{
isHistoryShown
= new Boolean(isHistoryShownString)
.booleanValue();
}
// Load the "chatHistorySize" property.
String chatHistorySizeStringProperty =
"service.gui.MESSAGE_HISTORY_SIZE";
String chatHistorySizeString
= configService.getString(chatHistorySizeStringProperty);
if(chatHistorySizeString == null)
chatHistorySizeString =
Resources.getSettingsString(chatHistorySizeStringProperty);
if(chatHistorySizeString != null
&& chatHistorySizeString.length() > 0)
{
chatHistorySize
= Integer.parseInt(chatHistorySizeString);
}
// Load the "isTransparentWindowEnabled" property.
String isTransparentWindowEnabledProperty =
"impl.gui.IS_TRANSPARENT_WINDOW_ENABLED";
String isTransparentWindowEnabledString
= configService.getString(isTransparentWindowEnabledProperty);
if(isTransparentWindowEnabledString == null)
isTransparentWindowEnabledString =
Resources.getSettingsString(isTransparentWindowEnabledProperty);
if(isTransparentWindowEnabledString != null
&& isTransparentWindowEnabledString.length() > 0)
{
isTransparentWindowEnabled
= new Boolean(isTransparentWindowEnabledString).booleanValue();
}
// Load the "windowTransparency" property.
String windowTransparencyProperty =
"impl.gui.WINDOW_TRANSPARENCY";
String windowTransparencyString
= configService.getString(windowTransparencyProperty);
if(windowTransparencyString == null)
windowTransparencyString =
Resources.getSettingsString(windowTransparencyProperty);
if(windowTransparencyString != null
&& windowTransparencyString.length() > 0)
{
windowTransparency
= Integer.parseInt(windowTransparencyString);
}
// Load the "NORMALIZE_PHONE_NUMBER" property.
String normalizePhoneNumberProperty =
"impl.gui.NORMALIZE_PHONE_NUMBER";
isNormalizePhoneNumber
= configService.getBoolean(normalizePhoneNumberProperty, true);
// Load the "ACCEPT_PHONE_NUMBER_WITH_ALPHA_CHARS" property.
String acceptPhoneNumberWithAlphaCharsProperty =
"impl.gui.ACCEPT_PHONE_NUMBER_WITH_ALPHA_CHARS";
acceptPhoneNumberWithAlphaChars
= configService.getBoolean(
acceptPhoneNumberWithAlphaCharsProperty,
true);
}
/**
* Return TRUE if "autoPopupNewMessage" property is true, otherwise - return
* FALSE. Indicates to the user interface whether new messages should be
* opened and bring to front.
* @return TRUE if "autoPopupNewMessage" property is true, otherwise - return
* FALSE.
*/
public static boolean isAutoPopupNewMessage()
{
return autoPopupNewMessage;
}
/**
* Return TRUE if "sendTypingNotifications" property is true, otherwise -
* return FALSE. Indicates to the user interface whether typing
* notifications are enabled or disabled.
* @return TRUE if "sendTypingNotifications" property is true, otherwise -
* return FALSE.
*/
public static boolean isSendTypingNotifications()
{
return isSendTypingNotifications;
}
/**
* Returns <code>true</code> if the "isMultiChatWindowEnabled" property is
* true, otherwise - returns <code>false</code>. Indicates to the user
* interface whether the chat window could contain multiple chats or just
* one chat.
* @return <code>true</code> if the "isMultiChatWindowEnabled" property is
* true, otherwise - returns <code>false</code>.
*/
public static boolean isMultiChatWindowEnabled()
{
return isMultiChatWindowEnabled;
}
/**
* Returns <code>true</code> if the "isLeaveChatRoomOnWindowCloseEnabled"
* property is true, otherwise - returns <code>false</code>. Indicates to
* the user interface whether when closing the chat window we would leave
* the chat room.
* @return <code>true</code> if the "isLeaveChatRoomOnWindowCloseEnabled"
* property is true, otherwise - returns <code>false</code>.
*/
public static boolean isLeaveChatRoomOnWindowCloseEnabled()
{
return isLeaveChatRoomOnWindowCloseEnabled;
}
/**
* Returns <code>true</code> if the "isHistoryLoggingEnabled" property is
* true, otherwise - returns <code>false</code>. Indicates to the user
* interface whether the history logging is enabled.
* @return <code>true</code> if the "isHistoryLoggingEnabled" property is
* true, otherwise - returns <code>false</code>.
*/
public static boolean isHistoryLoggingEnabled()
{
return isHistoryLoggingEnabled;
}
/**
* Returns <code>true</code> if the "isHistoryShown" property is
* true, otherwise - returns <code>false</code>. Indicates to the user
* whether the history is shown in the chat window.
* @return <code>true</code> if the "isHistoryShown" property is
* true, otherwise - returns <code>false</code>.
*/
public static boolean isHistoryShown()
{
return isHistoryShown;
}
/**
* Returns the number of messages from chat history that would be shown in
* the chat window.
* @return the number of messages from chat history that would be shown in
* the chat window.
*/
public static int getChatHistorySize()
{
return chatHistorySize;
}
/**
* Return the "sendMessageCommand" property that was saved previously
* through the <tt>ConfigurationService</tt>. Indicates to the user
* interface whether the default send message command is Enter or CTRL-Enter.
* @return "Enter" or "CTRL-Enter" message commands.
*/
public static String getSendMessageCommand()
{
return sendMessageCommand;
}
/**
* Gets the configuration handler which is currently in use.
*
* @return the configuration handler which is currently in use
*/
public static String getPopupHandlerConfig()
{
return (String) configService.getProperty("systray.POPUP_HANDLER");
}
/**
* Saves the popup handler choice made by the user.
*
* @param handler the handler which will be used
*/
public static void setPopupHandlerConfig(String handler)
{
configService.setProperty("systray.POPUP_HANDLER", handler);
}
/**
* Returns <code>true</code> if transparent windows are enabled,
* <code>false</code> otherwise.
*
* @return <code>true</code> if transparent windows are enabled,
* <code>false</code> otherwise.
*/
public static boolean isTransparentWindowEnabled()
{
return isTransparentWindowEnabled;
}
public static void setTransparentWindowEnabled(
boolean isTransparentWindowEnabled)
{
ConfigurationManager.isTransparentWindowEnabled =
isTransparentWindowEnabled;
configService.setProperty(
"impl.gui.IS_TRANSPARENT_WINDOW_ENABLED",
new Boolean(isTransparentWindowEnabled).toString());
}
/**
* Returns <code>true</code> if phone numbers should be normalized,
* <code>false</code> otherwise.
*
* @return <code>true</code> if phone numbers should be normalized,
* <code>false</code> otherwise.
*/
public static boolean isNormalizePhoneNumber()
{
return isNormalizePhoneNumber;
}
/**
* Updates the "NORMALIZE_PHONE_NUMBER" property.
*
* @param isNormalize indicates to the user interface whether all dialed
* phone numbers should be normalized
*/
public static void setNormalizePhoneNumber(boolean isNormalize)
{
ConfigurationManager.isNormalizePhoneNumber = isNormalize;
configService.setProperty("impl.gui.NORMALIZE_PHONE_NUMBER",
Boolean.toString(isNormalize));
}
/**
* Returns <code>true</code> if a string with a alphabetical character migth
* be considered as a phone number. <code>false</code> otherwise.
*
* @return <code>true</code> if a string with a alphabetical character migth
* be considered as a phone number. <code>false</code> otherwise.
*/
public static boolean acceptPhoneNumberWithAlphaChars()
{
return acceptPhoneNumberWithAlphaChars;
}
/**
* Updates the "ACCEPT_PHONE_NUMBER_WITH_CHARS" property.
*
* @param accepPhoneNumberWithAlphaChars indicates to the user interface
* whether a string with alphabetical characters might be accepted as a
* phone number.
*/
public static void setAcceptPhoneNumberWithAlphaChars(
boolean acceptPhoneNumberWithAlphaChars)
{
ConfigurationManager.acceptPhoneNumberWithAlphaChars
= acceptPhoneNumberWithAlphaChars;
configService.setProperty(
"impl.gui.ACCEPT_PHONE_NUMBER_WITH_ALPHA_CHARS",
Boolean.toString(acceptPhoneNumberWithAlphaChars));
}
/**
* Returns the transparency value for all transparent windows.
*
* @return the transparency value for all transparent windows.
*/
public static int getWindowTransparency()
{
return windowTransparency;
}
/**
* Updates the "WINDOW_TRANSPARENCY" property.
*
* @param windowTransparency indicates to the user interface what is the
* window transparency value
**/
public static void setWindowTransparency(int windowTransparency)
{
ConfigurationManager.windowTransparency = windowTransparency;
configService.setProperty(
"impl.gui.WINDOW_TRANSPARENCY",
Integer.toString(windowTransparency));
}
/**
* Updates the "autoPopupNewMessage" property.
*
* @param autoPopupNewMessage indicates to the user interface whether new
* messages should be opened and bring to front.
**/
public static void setAutoPopupNewMessage(boolean autoPopupNewMessage)
{
ConfigurationManager.autoPopupNewMessage = autoPopupNewMessage;
if(autoPopupNewMessage)
configService.setProperty(
"service.gui.AUTO_POPUP_NEW_MESSAGE",
"yes");
else
configService.setProperty(
"service.gui.AUTO_POPUP_NEW_MESSAGE",
"no");
}
/**
* Updates the "sendTypingNotifications" property through the
* <tt>ConfigurationService</tt>.
*
* @param isSendTypingNotif <code>true</code> to indicate that typing
* notifications are enabled, <code>false</code> otherwise.
*/
public static void setSendTypingNotifications(boolean isSendTypingNotif)
{
isSendTypingNotifications = isSendTypingNotif;
configService.setProperty(
"service.gui.SEND_TYPING_NOTIFICATIONS_ENABLED",
Boolean.toString(isSendTypingNotif));
}
/**
* Updates the "sendMessageCommand" property through the
* <tt>ConfigurationService</tt>.
*
* @param newMessageCommand the command used to send a message ( it could be
* ENTER_COMMAND or CTRL_ENTER_COMMAND)
*/
public static void setSendMessageCommand(String newMessageCommand)
{
sendMessageCommand = newMessageCommand;
configService.setProperty(
"service.gui.SEND_MESSAGE_COMMAND",
newMessageCommand);
}
/**
* Updates the "isMultiChatWindowEnabled" property through the
* <tt>ConfigurationService</tt>.
*
* @param isMultiChatWindowEnabled indicates if the chat window could
* contain multiple chats or only one chat.
*/
public static void setMultiChatWindowEnabled(
boolean isMultiChatWindowEnabled)
{
ConfigurationManager.isMultiChatWindowEnabled = isMultiChatWindowEnabled;
configService.setProperty(
"service.gui.IS_MULTI_CHAT_WINDOW_ENABLED",
Boolean.toString(isMultiChatWindowEnabled));
}
/**
* Updates the "isLeaveChatroomOnWindowClose" property through
* the <tt>ConfigurationService</tt>.
*
* @param isLeaveChatroomOnWindowClose indicates whether
* to leave chat room on window close.
*/
public static void setLeaveChatRoomOnWindowClose(
boolean isLeaveChatroomOnWindowClose)
{
ConfigurationManager.isLeaveChatRoomOnWindowCloseEnabled
= isLeaveChatroomOnWindowClose;
configService.setProperty(
"service.gui.LEAVE_CHATROOM_ON_WINDOW_CLOSE",
Boolean.toString(isLeaveChatroomOnWindowClose));
}
/**
* Updates the "isHistoryLoggingEnabled" property through the
* <tt>ConfigurationService</tt>.
*
* @param isHistoryLoggingEnabled indicates if the history logging is
* enabled.
*/
public static void setHistoryLoggingEnabled(
boolean isHistoryLoggingEnabled)
{
ConfigurationManager.isHistoryLoggingEnabled = isHistoryLoggingEnabled;
configService.setProperty(
"impl.msghistory.IS_MESSAGE_HISTORY_ENABLED",
Boolean.toString(isHistoryLoggingEnabled));
}
/**
* Updates the "isHistoryShown" property through the
* <tt>ConfigurationService</tt>.
*
* @param isHistoryShown indicates if the message history is
* shown
*/
public static void setHistoryShown(boolean isHistoryShown)
{
ConfigurationManager.isHistoryShown = isHistoryShown;
configService.setProperty(
"service.gui.IS_MESSAGE_HISTORY_SHOWN",
Boolean.toString(isHistoryShown));
}
/**
* Updates the "chatHistorySize" property through the
* <tt>ConfigurationService</tt>.
*
* @param historySize indicates if the history logging is
* enabled.
*/
public static void setChatHistorySize(int historySize)
{
ConfigurationManager.chatHistorySize = historySize;
configService.setProperty(
"service.gui.MESSAGE_HISTORY_SIZE",
Integer.toString(chatHistorySize));
}
public static Locale getCurrentLanguage()
{
String localeId
= configService.getString(
ResourceManagementService.DEFAULT_LOCALE_CONFIG);
return
(localeId != null)
? ResourceManagementServiceUtils.getLocale(localeId)
: Locale.getDefault();
}
public static void setLanguage(Locale locale)
{
String language = locale.getLanguage();
String country = locale.getCountry();
configService.setProperty(
ResourceManagementService.DEFAULT_LOCALE_CONFIG,
(country.length() > 0) ? (language + '_' + country) : language);
}
public static void setClientPort(int port)
{
configService.setProperty(
ProtocolProviderFactory.PREFERRED_CLEAR_PORT_PROPERTY_NAME,
port);
}
public static void setClientSecurePort(int port)
{
configService.setProperty(
ProtocolProviderFactory.PREFERRED_SECURE_PORT_PROPERTY_NAME,
port);
}
public static int getClientPort()
{
return configService.getInt(
ProtocolProviderFactory.PREFERRED_CLEAR_PORT_PROPERTY_NAME,
5060);
}
public static int getClientSecurePort()
{
return configService.getInt(
ProtocolProviderFactory.PREFERRED_SECURE_PORT_PROPERTY_NAME,
5061);
}
public static String[] getAvailableSslProtocols()
{
SSLSocket temp;
try
{
temp = (SSLSocket) SSLSocketFactory
.getDefault().createSocket();
return temp.getSupportedProtocols();
}
catch (IOException e)
{
logger.error(e);
return new String[]{};
}
}
public static String[] getEnabledSslProtocols()
{
String enabledSslProtocols = configService
.getString("gov.nist.javax.sip.TLS_CLIENT_PROTOCOLS");
if(StringUtils.isNullOrEmpty(enabledSslProtocols, true))
{
SSLSocket temp;
try
{
temp = (SSLSocket) SSLSocketFactory
.getDefault().createSocket();
return temp.getEnabledProtocols();
}
catch (IOException e)
{
logger.error(e);
return getAvailableSslProtocols();
}
}
return enabledSslProtocols.split("(,)|(,\\s)");
}
public static void setEnabledSslProtocols(String[] enabledProtocols)
{
if(enabledProtocols == null || enabledProtocols.length == 0)
configService.removeProperty(
"gov.nist.javax.sip.TLS_CLIENT_PROTOCOLS");
else
{
String protocols = Arrays.toString(enabledProtocols);
configService.setProperty(
"gov.nist.javax.sip.TLS_CLIENT_PROTOCOLS",
protocols.substring(1, protocols.length() - 1));
}
}
}

@ -103,7 +103,7 @@ public void start(Object dependentService)
// If the general configuration form is disabled don't continue.
if (!getConfigurationService().getBoolean(DISABLED_PROP, false))
{
ConfigurationManager.loadGuiConfigurations();
ConfigurationUtils.loadGuiConfigurations();
properties.put( ConfigurationForm.FORM_TYPE,
ConfigurationForm.GENERAL_TYPE);

@ -17,6 +17,7 @@
import net.java.sip.communicator.plugin.generalconfig.autoaway.*;
import net.java.sip.communicator.service.systray.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.Logger;
import net.java.sip.communicator.util.swing.*;
@ -254,13 +255,13 @@ private Component createGroupMessagesCheckbox()
groupMessagesCheckBox.setAlignmentX(JCheckBox.LEFT_ALIGNMENT);
groupMessagesCheckBox.setSelected(
ConfigurationManager.isMultiChatWindowEnabled());
ConfigurationUtils.isMultiChatWindowEnabled());
groupMessagesCheckBox.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
ConfigurationManager.setMultiChatWindowEnabled(
ConfigurationUtils.setMultiChatWindowEnabled(
groupMessagesCheckBox.isSelected());
}
});
@ -281,13 +282,13 @@ private Component createMultichatCheckbox()
leaveChatroomCheckBox.setAlignmentX(JCheckBox.LEFT_ALIGNMENT);
leaveChatroomCheckBox.setSelected(
ConfigurationManager.isLeaveChatRoomOnWindowCloseEnabled());
ConfigurationUtils.isLeaveChatRoomOnWindowCloseEnabled());
leaveChatroomCheckBox.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
ConfigurationManager.setLeaveChatRoomOnWindowClose(
ConfigurationUtils.setLeaveChatRoomOnWindowClose(
leaveChatroomCheckBox.isSelected());
}
});
@ -312,13 +313,13 @@ private Component createHistoryPanel()
logHistoryCheckBox.setText(
Resources.getString("plugin.generalconfig.LOG_HISTORY"));
logHistoryCheckBox.setSelected(
ConfigurationManager.isHistoryLoggingEnabled());
ConfigurationUtils.isHistoryLoggingEnabled());
logHistoryCheckBox.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
ConfigurationManager.setHistoryLoggingEnabled(
ConfigurationUtils.setHistoryLoggingEnabled(
logHistoryCheckBox.isSelected());
}
});
@ -334,13 +335,13 @@ public void actionPerformed(ActionEvent e)
showHistoryCheckBox.setText(
Resources.getString("plugin.generalconfig.SHOW_HISTORY"));
showHistoryCheckBox.setSelected(
ConfigurationManager.isHistoryShown());
ConfigurationUtils.isHistoryShown());
showHistoryCheckBox.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
ConfigurationManager.setHistoryShown(
ConfigurationUtils.setHistoryShown(
showHistoryCheckBox.isSelected());
}
});
@ -352,7 +353,7 @@ public void actionPerformed(ActionEvent e)
showHistoryPanel.add(historySizeSpinner);
historySizeSpinner.setModel(historySizeSpinnerModel);
historySizeSpinner.setValue(
ConfigurationManager.getChatHistorySize());
ConfigurationUtils.getChatHistorySize());
logHistoryCheckBox.addChangeListener(new ChangeListener()
{
@ -379,7 +380,7 @@ public void stateChanged(ChangeEvent e)
{
public void stateChanged(ChangeEvent e)
{
ConfigurationManager.setChatHistorySize(
ConfigurationUtils.setChatHistorySize(
((Integer) historySizeSpinner
.getValue()).intValue());
}
@ -390,13 +391,13 @@ public void stateChanged(ChangeEvent e)
historySizeLabel.setText(
Resources.getString("plugin.generalconfig.HISTORY_SIZE"));
if (!ConfigurationManager.isHistoryLoggingEnabled())
if (!ConfigurationUtils.isHistoryLoggingEnabled())
{
showHistoryCheckBox.setEnabled(false);
historySizeSpinner.setEnabled(false);
}
if (!ConfigurationManager.isHistoryShown())
if (!ConfigurationUtils.isHistoryShown())
{
historySizeSpinner.setEnabled(false);
}
@ -422,19 +423,19 @@ private Component createSendMessagePanel()
ComboBoxModel sendMessageComboBoxModel =
new DefaultComboBoxModel(
new String[] {
ConfigurationManager.ENTER_COMMAND,
ConfigurationManager.CTRL_ENTER_COMMAND });
ConfigurationUtils.ENTER_COMMAND,
ConfigurationUtils.CTRL_ENTER_COMMAND });
final JComboBox sendMessageComboBox = new JComboBox();
sendMessagePanel.add(sendMessageComboBox);
sendMessageComboBox.setModel(sendMessageComboBoxModel);
sendMessageComboBox.setSelectedItem(
ConfigurationManager.getSendMessageCommand());
ConfigurationUtils.getSendMessageCommand());
sendMessageComboBox.addItemListener(new ItemListener()
{
public void itemStateChanged(ItemEvent arg0)
{
ConfigurationManager.setSendMessageCommand(
ConfigurationUtils.setSendMessageCommand(
(String)sendMessageComboBox.getSelectedItem());
}
});
@ -459,13 +460,13 @@ private Component createTypingNitificationsCheckBox()
new Dimension(253, 20));
enableTypingNotifiCheckBox.setSelected(
ConfigurationManager.isSendTypingNotifications());
ConfigurationUtils.isSendTypingNotifications());
enableTypingNotifiCheckBox.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
ConfigurationManager.setSendTypingNotifications(
ConfigurationUtils.setSendTypingNotifications(
enableTypingNotifiCheckBox.isSelected());
}
});
@ -487,13 +488,13 @@ private Component createBringToFrontCheckBox()
bringToFrontCheckBox.setAlignmentX(Component.LEFT_ALIGNMENT);
bringToFrontCheckBox.setSelected(
ConfigurationManager.isAutoPopupNewMessage());
ConfigurationUtils.isAutoPopupNewMessage());
bringToFrontCheckBox.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
ConfigurationManager.setAutoPopupNewMessage(
ConfigurationUtils.setAutoPopupNewMessage(
bringToFrontCheckBox.isSelected());
}
});
@ -566,7 +567,7 @@ public void itemStateChanged(ItemEvent evt)
{
// "Auto" selected. Delete the user's preference and
// select the best available handler.
ConfigurationManager.setPopupHandlerConfig(null);
ConfigurationUtils.setPopupHandlerConfig(null);
GeneralConfigPluginActivator.getSystrayService()
.selectBestPopupMessageHandler();
@ -576,7 +577,7 @@ public void itemStateChanged(ItemEvent evt)
(PopupMessageHandler)
notifConfigComboBox.getSelectedItem();
ConfigurationManager.setPopupHandlerConfig(
ConfigurationUtils.setPopupHandlerConfig(
handler.getClass().getName());
GeneralConfigPluginActivator.getSystrayService()
@ -610,7 +611,7 @@ private Component createLocaleConfigPanel()
locale.getDisplayLanguage(locale));
}
Locale currLocale =
ConfigurationManager.getCurrentLanguage();
ConfigurationUtils.getCurrentLanguage();
localesConfigComboBox.setSelectedItem(currLocale
.getDisplayLanguage(currLocale));
@ -632,7 +633,7 @@ public void actionPerformed(ActionEvent e)
if(locale.getDisplayLanguage(locale)
.equals(language))
{
ConfigurationManager.setLanguage(locale);
ConfigurationUtils.setLanguage(locale);
break;
}
}
@ -681,7 +682,7 @@ private Component createNormalizeNumberCheckBox()
JPanel checkBoxPanel = new TransparentPanel(new BorderLayout());
SIPCommCheckBox formatPhoneNumber = new SIPCommCheckBox("",
ConfigurationManager.isNormalizePhoneNumber());
ConfigurationUtils.isNormalizePhoneNumber());
formatPhoneNumber.setAlignmentY(Component.TOP_ALIGNMENT);
@ -689,7 +690,7 @@ private Component createNormalizeNumberCheckBox()
{
public void actionPerformed(ActionEvent e)
{
ConfigurationManager.setNormalizePhoneNumber(
ConfigurationUtils.setNormalizePhoneNumber(
((JCheckBox)e.getSource()).isSelected());
}
});
@ -725,7 +726,7 @@ private Component createAcceptPhoneNumberWithAlphaCharCheckBox()
// phone numbers.
SIPCommCheckBox acceptPhoneNumberWithAlphaChars
= new SIPCommCheckBox("",
ConfigurationManager.acceptPhoneNumberWithAlphaChars());
ConfigurationUtils.acceptPhoneNumberWithAlphaChars());
acceptPhoneNumberWithAlphaChars.setAlignmentY(Component.TOP_ALIGNMENT);
@ -733,7 +734,7 @@ private Component createAcceptPhoneNumberWithAlphaCharCheckBox()
{
public void actionPerformed(ActionEvent e)
{
ConfigurationManager.setAcceptPhoneNumberWithAlphaChars(
ConfigurationUtils.setAcceptPhoneNumberWithAlphaChars(
((JCheckBox)e.getSource()).isSelected());
}
});

@ -13,6 +13,7 @@
import javax.swing.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
/**
@ -65,7 +66,7 @@ public SIPConfigForm()
final JTextField clientPortField = new JTextField(6);
clientPortField.setText(
String.valueOf(ConfigurationManager.getClientPort()));
String.valueOf(ConfigurationUtils.getClientPort()));
valuePanel.add(clientPortField);
clientPortField.addFocusListener(new FocusListener()
{
@ -82,7 +83,7 @@ public void focusLost(FocusEvent e)
throw new NumberFormatException(
"Not a port number");
ConfigurationManager.setClientPort(port);
ConfigurationUtils.setClientPort(port);
}
catch (NumberFormatException ex)
{
@ -107,7 +108,7 @@ public void focusGained(FocusEvent e)
final JTextField clientSecurePortField = new JTextField(6);
clientSecurePortField.setText(
String.valueOf(ConfigurationManager.getClientSecurePort()));
String.valueOf(ConfigurationUtils.getClientSecurePort()));
valuePanel.add(clientSecurePortField);
clientSecurePortField.addFocusListener(new FocusListener()
{
@ -124,7 +125,7 @@ public void focusLost(FocusEvent e)
throw new NumberFormatException(
"Not a port number");
ConfigurationManager.setClientSecurePort(port);
ConfigurationUtils.setClientSecurePort(port);
}
catch (NumberFormatException ex)
{
@ -148,13 +149,13 @@ public void focusGained(FocusEvent e)
});
String configuredProtocols = Arrays.toString(
ConfigurationManager.getEnabledSslProtocols());
ConfigurationUtils.getEnabledSslProtocols());
pnlSslProtocols = Box.createVerticalBox();
pnlSslProtocols.setBorder(BorderFactory.createTitledBorder(Resources
.getString("plugin.generalconfig.SIP_SSL_PROTOCOLS")));
pnlSslProtocols.setAlignmentX(Component.LEFT_ALIGNMENT);
for(String protocol : ConfigurationManager.getAvailableSslProtocols())
for(String protocol : ConfigurationUtils.getAvailableSslProtocols())
{
JCheckBox chkProtocol = new SIPCommCheckBox(protocol);
chkProtocol.addActionListener(this);
@ -179,7 +180,7 @@ public void actionPerformed(ActionEvent e)
if(((JCheckBox) child).isSelected())
enabledSslProtocols.add(((JCheckBox) child).getText());
}
ConfigurationManager.setEnabledSslProtocols(
ConfigurationUtils.setEnabledSslProtocols(
enabledSslProtocols.toArray(new String[]{}));
}
}

@ -4,19 +4,24 @@
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.impl.gui.utils;
package net.java.sip.communicator.util;
import java.awt.*;
import java.beans.*;
import java.io.*;
import java.util.*;
import java.util.List; /* disambiguation */
import net.java.sip.communicator.impl.gui.*;
import javax.net.ssl.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.resources.*;
import org.jitsi.service.configuration.*;
import org.jitsi.service.neomedia.*;
import org.jitsi.service.neomedia.codec.*;
import org.jitsi.service.resources.*;
import org.jitsi.util.*;
import org.osgi.framework.*;
/**
@ -26,8 +31,24 @@
* @author Yana Stamcheva
* @author Damian Minkov
*/
public class ConfigurationManager
public class ConfigurationUtils
{
/**
* The logger for this class.
*/
private static final Logger logger
= Logger.getLogger(ConfigurationUtils.class);
/**
* The send message command defined by the Enter key.
*/
public static final String ENTER_COMMAND = "Enter";
/**
* The send message command defined by the Ctrl-Enter key.
*/
public static final String CTRL_ENTER_COMMAND = "Ctrl-Enter";
/**
* Indicates whether the message automatic pop-up is enabled.
*/
@ -163,7 +184,7 @@ public class ConfigurationManager
* The configuration service.
*/
private static ConfigurationService configService
= GuiActivator.getConfigurationService();
= UtilActivator.getConfigurationService();
/**
* The parent of the last contact.
@ -272,6 +293,17 @@ public class ConfigurationManager
private static final String SINGLE_WINDOW_INTERFACE_ENABLED
= "net.java.sip.communicator.service.gui.SINGLE_WINDOW_INTERFACE_ENABLED";
/**
* Indicates if phone numbers should be normalized before dialed.
*/
private static boolean isNormalizePhoneNumber;
/**
* Indicates if a string containing alphabetical characters might be
* considered as a phone number.
*/
private static boolean acceptPhoneNumberWithAlphaChars;
/**
* Loads all user interface configurations.
*/
@ -287,7 +319,7 @@ public static void loadGuiConfigurations()
String autoPopup = configService.getString(autoPopupProperty);
if(autoPopup == null)
autoPopup = GuiActivator.getResources().
autoPopup = UtilActivator.getResources().
getSettingsString(autoPopupProperty);
if(autoPopup != null && autoPopup.equalsIgnoreCase("yes"))
@ -300,7 +332,7 @@ public static void loadGuiConfigurations()
if(messageCommand == null)
messageCommand
= GuiActivator.getResources()
= UtilActivator.getResources()
.getSettingsString(messageCommandProperty);
if(messageCommand == null || messageCommand.length() == 0)
@ -351,7 +383,7 @@ public static void loadGuiConfigurations()
if(isSendTypingNotif == null)
isSendTypingNotif =
GuiActivator.getResources().
UtilActivator.getResources().
getSettingsString(isSendTypingNotifProperty);
if(isSendTypingNotif != null && isSendTypingNotif.length() > 0)
@ -381,7 +413,7 @@ public static void loadGuiConfigurations()
if(isMultiChatWindowEnabledString == null)
isMultiChatWindowEnabledString =
GuiActivator.getResources().
UtilActivator.getResources().
getSettingsString(isMultiChatWindowEnabledStringProperty);
if(isMultiChatWindowEnabledString != null
@ -401,7 +433,7 @@ public static void loadGuiConfigurations()
if(isLeaveChatRoomOnWindowCloseEnabledString == null)
isLeaveChatRoomOnWindowCloseEnabledString =
GuiActivator.getResources().getSettingsString(
UtilActivator.getResources().getSettingsString(
isLeaveChatRoomOnWindowCloseEnabledStringProperty);
if(isLeaveChatRoomOnWindowCloseEnabledString != null
@ -433,7 +465,7 @@ public static void loadGuiConfigurations()
if(isHistoryShownString == null)
isHistoryShownString =
GuiActivator.getResources().
UtilActivator.getResources().
getSettingsString(isHistoryShownStringProperty);
if(isHistoryShownString != null
@ -451,7 +483,7 @@ public static void loadGuiConfigurations()
if(chatHistorySizeString == null)
chatHistorySizeString =
GuiActivator.getResources().
UtilActivator.getResources().
getSettingsString(chatHistorySizeStringProperty);
if(chatHistorySizeString != null
@ -468,7 +500,7 @@ public static void loadGuiConfigurations()
if(chatWriteAreaSizeString == null)
chatWriteAreaSizeString =
GuiActivator.getResources().
UtilActivator.getResources().
getSettingsString(chatWriteAreaSizeStringProperty);
if(chatWriteAreaSizeString != null
@ -487,7 +519,7 @@ public static void loadGuiConfigurations()
if(isTransparentWindowEnabledString == null)
isTransparentWindowEnabledString =
GuiActivator.getResources().
UtilActivator.getResources().
getSettingsString(isTransparentWindowEnabledProperty);
if(isTransparentWindowEnabledString != null
@ -506,7 +538,7 @@ public static void loadGuiConfigurations()
if(windowTransparencyString == null)
windowTransparencyString =
GuiActivator.getResources().
UtilActivator.getResources().
getSettingsString(windowTransparencyProperty);
if(windowTransparencyString != null
@ -525,7 +557,7 @@ public static void loadGuiConfigurations()
if(isWindowDecoratedString == null)
isWindowDecoratedString =
GuiActivator.getResources().
UtilActivator.getResources().
getSettingsString(isWindowDecoratedProperty);
if(isWindowDecoratedString != null
@ -598,7 +630,7 @@ public static void loadGuiConfigurations()
// Load the "net.java.sip.communicator.impl.gui.main.account
// .ADVANCED_CONFIG_DISABLED" property.
String advancedConfigDisabledDefaultProp
= GuiActivator.getResources().getSettingsString(
= UtilActivator.getResources().getSettingsString(
"impl.gui.main.account.ADVANCED_CONFIG_DISABLED");
boolean isAdvancedConfigDisabled = false;
@ -616,7 +648,7 @@ public static void loadGuiConfigurations()
// Single interface enabled property.
String singleInterfaceEnabledProp
= GuiActivator.getResources().getSettingsString(
= UtilActivator.getResources().getSettingsString(
SINGLE_WINDOW_INTERFACE_ENABLED);
boolean isEnabled = false;
@ -625,7 +657,7 @@ public static void loadGuiConfigurations()
isEnabled = Boolean.parseBoolean(singleInterfaceEnabledProp);
else
isEnabled = Boolean.parseBoolean(
GuiActivator.getResources().getSettingsString(
UtilActivator.getResources().getSettingsString(
"impl.gui.SINGLE_WINDOW_INTERFACE"));
// Load the advanced account configuration disabled.
@ -669,7 +701,7 @@ public static void loadGuiConfigurations()
String showStatusChangedInChatProperty
= "impl.gui.SHOW_STATUS_CHANGED_IN_CHAT";
String showStatusChangedInChatDefault = GuiActivator.getResources().
String showStatusChangedInChatDefault = UtilActivator.getResources().
getSettingsString(showStatusChangedInChatProperty);
// if there is a default value use it
@ -684,7 +716,7 @@ public static void loadGuiConfigurations()
String routeVideoAndDesktopUsingPhoneNumberProperty
= "impl.gui.ROUTE_VIDEO_AND_DESKTOP_TO_PNONENUMBER";
String routeVideoAndDesktopUsingPhoneNumberDefault =
GuiActivator.getResources()
UtilActivator.getResources()
.getSettingsString(routeVideoAndDesktopUsingPhoneNumberProperty);
if(routeVideoAndDesktopUsingPhoneNumberDefault != null)
@ -697,7 +729,7 @@ public static void loadGuiConfigurations()
String hideAccountMenuProperty
= "impl.gui.HIDE_SELECTION_ON_SINGLE_ACCOUNT";
String hideAccountMenuDefaultValue = GuiActivator.getResources()
String hideAccountMenuDefaultValue = UtilActivator.getResources()
.getSettingsString(hideAccountMenuProperty);
if(hideAccountMenuDefaultValue != null)
@ -710,7 +742,7 @@ public static void loadGuiConfigurations()
String hideAccountStatusSelectorsProperty
= "impl.gui.HIDE_ACCOUNT_STATUS_SELECTORS";
String hideAccountsStatusDefaultValue = GuiActivator.getResources()
String hideAccountsStatusDefaultValue = UtilActivator.getResources()
.getSettingsString(hideAccountStatusSelectorsProperty);
if(hideAccountsStatusDefaultValue != null)
@ -724,7 +756,7 @@ public static void loadGuiConfigurations()
String autoAnswerDisableSubmenuProperty
= "impl.gui.AUTO_ANSWER_DISABLE_SUBMENU";
String autoAnswerDisableSubmenuDefaultValue =
GuiActivator.getResources()
UtilActivator.getResources()
.getSettingsString(autoAnswerDisableSubmenuProperty);
if(autoAnswerDisableSubmenuDefaultValue != null)
@ -738,6 +770,15 @@ public static void loadGuiConfigurations()
isChatRoomConfigDisabled = configService.getBoolean(
CHAT_ROOM_CONFIG_DISABLED_PROP,
isChatRoomConfigDisabled);
isNormalizePhoneNumber
= configService.getBoolean("impl.gui.NORMALIZE_PHONE_NUMBER", true);
// Load the "ACCEPT_PHONE_NUMBER_WITH_ALPHA_CHARS" property.
acceptPhoneNumberWithAlphaChars
= configService.getBoolean(
"impl.gui.ACCEPT_PHONE_NUMBER_WITH_ALPHA_CHARS",
true);
}
/**
@ -751,9 +792,9 @@ public static boolean isFontSupportEnabled()
"net.java.sip.communicator.impl.gui.FONT_SUPPORT_ENABLED";
boolean defaultValue = false;
String defaultSettingStr =
GuiActivator.getResources().getSettingsString(fontDisabledProp);
UtilActivator.getResources().getSettingsString(fontDisabledProp);
if(defaultSettingStr != null)
defaultValue = Boolean.parseBoolean(defaultSettingStr);
@ -774,6 +815,26 @@ public static boolean isAutoPopupNewMessage()
return autoPopupNewMessage;
}
/**
* Updates the "autoPopupNewMessage" property.
*
* @param autoPopup indicates to the user interface whether new
* messages should be opened and bring to front.
**/
public static void setAutoPopupNewMessage(boolean autoPopup)
{
autoPopupNewMessage = autoPopup;
if(autoPopupNewMessage)
configService.setProperty(
"service.gui.AUTO_POPUP_NEW_MESSAGE",
"yes");
else
configService.setProperty(
"service.gui.AUTO_POPUP_NEW_MESSAGE",
"no");
}
/**
* Return TRUE if "showCallPanel" property is true, otherwise - return
* FALSE. Indicates to the user interface whether the panel containing the
@ -835,6 +896,22 @@ public static boolean isSendTypingNotifications()
return isSendTypingNotifications;
}
/**
* Updates the "sendTypingNotifications" property through the
* <tt>ConfigurationService</tt>.
*
* @param isSendTypingNotif <code>true</code> to indicate that typing
* notifications are enabled, <code>false</code> otherwise.
*/
public static void setSendTypingNotifications(boolean isSendTypingNotif)
{
isSendTypingNotifications = isSendTypingNotif;
configService.setProperty(
"service.gui.SEND_TYPING_NOTIFICATIONS_ENABLED",
Boolean.toString(isSendTypingNotif));
}
/**
* Returns TRUE if the "isMoveContactConfirmationRequested" property is true,
* otherwise - returns FALSE. Indicates to the user interface whether the
@ -860,6 +937,22 @@ public static boolean isMultiChatWindowEnabled()
return isMultiChatWindowEnabled;
}
/**
* Updates the "isMultiChatWindowEnabled" property through the
* <tt>ConfigurationService</tt>.
*
* @param isEnabled indicates if the chat window could
* contain multiple chats or only one chat.
*/
public static void setMultiChatWindowEnabled(boolean isEnabled)
{
isMultiChatWindowEnabled = isEnabled;
configService.setProperty(
"service.gui.IS_MULTI_CHAT_WINDOW_ENABLED",
Boolean.toString(isMultiChatWindowEnabled));
}
/**
* Returns <code>true</code> if the "isLeaveChatRoomOnWindowCloseEnabled"
* property is true, otherwise - returns <code>false</code>. Indicates to
@ -873,6 +966,21 @@ public static boolean isLeaveChatRoomOnWindowCloseEnabled()
return isLeaveChatRoomOnWindowCloseEnabled;
}
/**
* Updates the "isLeaveChatroomOnWindowClose" property through
* the <tt>ConfigurationService</tt>.
*
* @param isLeave indicates whether to leave chat room on window close.
*/
public static void setLeaveChatRoomOnWindowClose(boolean isLeave)
{
isLeaveChatRoomOnWindowCloseEnabled = isLeave;
configService.setProperty(
"service.gui.LEAVE_CHATROOM_ON_WINDOW_CLOSE",
Boolean.toString(isLeaveChatRoomOnWindowCloseEnabled));
}
/**
* Returns <code>true</code> if the "isHistoryLoggingEnabled" property is
* true, otherwise - returns <code>false</code>. Indicates to the user
@ -884,7 +992,23 @@ public static boolean isHistoryLoggingEnabled()
{
return isHistoryLoggingEnabled;
}
/**
* Updates the "isHistoryLoggingEnabled" property through the
* <tt>ConfigurationService</tt>.
*
* @param isEnabled indicates if the history logging is
* enabled.
*/
public static void setHistoryLoggingEnabled(boolean isEnabled)
{
isHistoryLoggingEnabled = isEnabled;
configService.setProperty(
"impl.msghistory.IS_MESSAGE_HISTORY_ENABLED",
Boolean.toString(isHistoryLoggingEnabled));
}
/**
* Returns <code>true</code> if the "isHistoryShown" property is
* true, otherwise - returns <code>false</code>. Indicates to the user
@ -896,7 +1020,22 @@ public static boolean isHistoryShown()
{
return isHistoryShown;
}
/**
* Updates the "isHistoryShown" property through the
* <tt>ConfigurationService</tt>.
*
* @param isShown indicates if the message history is shown
*/
public static void setHistoryShown(boolean isShown)
{
isHistoryShown = isShown;
configService.setProperty(
"service.gui.IS_MESSAGE_HISTORY_SHOWN",
Boolean.toString(isHistoryShown));
}
/**
* Returns <code>true</code> if the "isWindowDecorated" property is
* true, otherwise - returns <code>false</code>..
@ -907,7 +1046,7 @@ public static boolean isWindowDecorated()
{
return isWindowDecorated;
}
/**
* Returns <code>true</code> if the "isChatToolbarVisible" property is
* true, otherwise - returns <code>false</code>..
@ -1107,6 +1246,22 @@ public static String getSendMessageCommand()
return sendMessageCommand;
}
/**
* Updates the "sendMessageCommand" property through the
* <tt>ConfigurationService</tt>.
*
* @param newMessageCommand the command used to send a message ( it could be
* ENTER_COMMAND or CTRL_ENTER_COMMAND)
*/
public static void setSendMessageCommand(String newMessageCommand)
{
sendMessageCommand = newMessageCommand;
configService.setProperty(
"service.gui.SEND_MESSAGE_COMMAND",
newMessageCommand);
}
/**
* Return the "lastContactParent" property that was saved previously
* through the <tt>ConfigurationService</tt>. Indicates
@ -1145,7 +1300,7 @@ private static ProtocolProviderService findProviderFromAccountId(
String savedAccountId)
{
ProtocolProviderService protocolProvider = null;
for (ProtocolProviderFactory providerFactory : GuiActivator
for (ProtocolProviderFactory providerFactory : UtilActivator
.getProtocolProviderFactories().values())
{
ServiceReference serRef;
@ -1159,7 +1314,7 @@ private static ProtocolProviderService findProviderFromAccountId(
serRef = providerFactory.getProviderForAccount(accountId);
protocolProvider
= (ProtocolProviderService) GuiActivator.bundleContext
= (ProtocolProviderService) UtilActivator.bundleContext
.getService(serRef);
}
}
@ -1178,6 +1333,22 @@ public static int getChatHistorySize()
return chatHistorySize;
}
/**
* Updates the "chatHistorySize" property through the
* <tt>ConfigurationService</tt>.
*
* @param historySize indicates if the history logging is
* enabled.
*/
public static void setChatHistorySize(int historySize)
{
chatHistorySize = historySize;
configService.setProperty(
"service.gui.MESSAGE_HISTORY_SIZE",
Integer.toString(chatHistorySize));
}
/**
* Returns the preferred height of the chat write area.
*
@ -1229,8 +1400,48 @@ public static String getSendFileLastDir()
*/
public static boolean isNormalizePhoneNumber()
{
return configService.getBoolean(
"impl.gui.NORMALIZE_PHONE_NUMBER", true);
return isNormalizePhoneNumber;
}
/**
* Updates the "NORMALIZE_PHONE_NUMBER" property.
*
* @param isNormalize indicates to the user interface whether all dialed
* phone numbers should be normalized
*/
public static void setNormalizePhoneNumber(boolean isNormalize)
{
isNormalizePhoneNumber = isNormalize;
configService.setProperty("impl.gui.NORMALIZE_PHONE_NUMBER",
Boolean.toString(isNormalize));
}
/**
* Returns <code>true</code> if a string with a alphabetical character migth
* be considered as a phone number. <code>false</code> otherwise.
*
* @return <code>true</code> if a string with a alphabetical character migth
* be considered as a phone number. <code>false</code> otherwise.
*/
public static boolean acceptPhoneNumberWithAlphaChars()
{
return acceptPhoneNumberWithAlphaChars;
}
/**
* Updates the "ACCEPT_PHONE_NUMBER_WITH_CHARS" property.
*
* @param accept indicates to the user interface whether a string with
* alphabetical characters might be accepted as a phone number.
*/
public static void setAcceptPhoneNumberWithAlphaChars(boolean accept)
{
acceptPhoneNumberWithAlphaChars = accept;
configService.setProperty(
"impl.gui.ACCEPT_PHONE_NUMBER_WITH_ALPHA_CHARS",
Boolean.toString(acceptPhoneNumberWithAlphaChars));
}
/**
@ -1301,7 +1512,7 @@ public static boolean isSingleWindowInterfaceEnabled()
* Updates the "singleWindowInterface" property through the
* <tt>ConfigurationService</tt>.
*
* @param singleWindowInterface <code>true</code> to indicate that the
* @param isEnabled <code>true</code> to indicate that the
* single window interface is enabled, <tt>false</tt> - otherwise
*/
public static void setSingleWindowInterfaceEnabled(boolean isEnabled)
@ -1330,7 +1541,7 @@ public static void setWindowTransparency(int transparency)
*/
public static void setShowOffline(boolean isShowOffline)
{
ConfigurationManager.isShowOffline = isShowOffline;
ConfigurationUtils.isShowOffline = isShowOffline;
configService.setProperty(
"net.java.sip.communicator.impl.gui.showOffline",
@ -1346,7 +1557,7 @@ public static void setShowOffline(boolean isShowOffline)
*/
public static void setShowCallPanel(boolean isCallPanelShown)
{
ConfigurationManager.isCallPanelShown = isCallPanelShown;
ConfigurationUtils.isCallPanelShown = isCallPanelShown;
configService.setProperty(
"net.java.sip.communicator.impl.gui.showCallPanel",
@ -1390,6 +1601,16 @@ public static void setQuitWarningShown(boolean isWarningShown)
Boolean.toString(isQuitWarningShown));
}
/**
* Saves the popup handler choice made by the user.
*
* @param handler the handler which will be used
*/
public static void setPopupHandlerConfig(String handler)
{
configService.setProperty("systray.POPUP_HANDLER", handler);
}
/**
* Updates the "lastContactParent" property through the
* <tt>ConfigurationService</tt>.
@ -1472,7 +1693,7 @@ public static void setShowSmileys(boolean isVisible)
* Updates the "isChatSimpleThemeEnabled" property through the
* <tt>ConfigurationService</tt>.
*
* @param isVisible indicates if the chat simple theme is enabled
* @param isEnabled indicates if the chat simple theme is enabled
*/
public static void setChatSimpleThemeEnabled(boolean isEnabled)
{
@ -1627,6 +1848,38 @@ public static void setChatDefaultFontColor(Color fontColor)
defaultFontColor);
}
/**
* Returns the current language configuration.
*
* @return the current locale
*/
public static Locale getCurrentLanguage()
{
String localeId
= configService.getString(
ResourceManagementService.DEFAULT_LOCALE_CONFIG);
return
(localeId != null)
? ResourceManagementServiceUtils.getLocale(localeId)
: Locale.getDefault();
}
/**
* Sets the current language configuration.
*
* @param locale the locale to set
*/
public static void setLanguage(Locale locale)
{
String language = locale.getLanguage();
String country = locale.getCountry();
configService.setProperty(
ResourceManagementService.DEFAULT_LOCALE_CONFIG,
(country.length() > 0) ? (language + '_' + country) : language);
}
/**
* Saves a chat room through the <tt>ConfigurationService</tt>.
*
@ -2112,6 +2365,121 @@ public static String getFactoryImplPackageName(
return className.substring(0, className.lastIndexOf('.'));
}
/**
* Returns the configured client port.
*
* @return the client port
*/
public static int getClientPort()
{
return configService.getInt(
ProtocolProviderFactory.PREFERRED_CLEAR_PORT_PROPERTY_NAME,
5060);
}
/**
* Sets the client port.
*
* @param port the port to set
*/
public static void setClientPort(int port)
{
configService.setProperty(
ProtocolProviderFactory.PREFERRED_CLEAR_PORT_PROPERTY_NAME,
port);
}
/**
* Returns the client secure port.
*
* @return the client secure port
*/
public static int getClientSecurePort()
{
return configService.getInt(
ProtocolProviderFactory.PREFERRED_SECURE_PORT_PROPERTY_NAME,
5061);
}
/**
* Sets the client secure port.
*
* @param port the port to set
*/
public static void setClientSecurePort(int port)
{
configService.setProperty(
ProtocolProviderFactory.PREFERRED_SECURE_PORT_PROPERTY_NAME,
port);
}
/**
* Returns the list of enabled SSL protocols.
*
* @return the list of enabled SSL protocols
*/
public static String[] getEnabledSslProtocols()
{
String enabledSslProtocols = configService
.getString("gov.nist.javax.sip.TLS_CLIENT_PROTOCOLS");
if(StringUtils.isNullOrEmpty(enabledSslProtocols, true))
{
SSLSocket temp;
try
{
temp = (SSLSocket) SSLSocketFactory
.getDefault().createSocket();
return temp.getEnabledProtocols();
}
catch (IOException e)
{
logger.error(e);
return getAvailableSslProtocols();
}
}
return enabledSslProtocols.split("(,)|(,\\s)");
}
/**
* Returns the list of available SSL protocols.
*
* @return the list of available SSL protocols
*/
public static String[] getAvailableSslProtocols()
{
SSLSocket temp;
try
{
temp = (SSLSocket) SSLSocketFactory
.getDefault().createSocket();
return temp.getSupportedProtocols();
}
catch (IOException e)
{
logger.error(e);
return new String[]{};
}
}
/**
* Sets the enables SSL protocols list.
*
* @param enabledProtocols the list of enabled SSL protocols to set
*/
public static void setEnabledSslProtocols(String[] enabledProtocols)
{
if(enabledProtocols == null || enabledProtocols.length == 0)
configService.removeProperty(
"gov.nist.javax.sip.TLS_CLIENT_PROTOCOLS");
else
{
String protocols = Arrays.toString(enabledProtocols);
configService.setProperty(
"gov.nist.javax.sip.TLS_CLIENT_PROTOCOLS",
protocols.substring(1, protocols.length() - 1));
}
}
/**
* Returns <tt>true</tt> if the account associated with
* <tt>protocolProvider</tt> has at least one video format enabled in it's
@ -2132,14 +2500,14 @@ public static boolean hasEnabledVideoFormat(
.get(ProtocolProviderFactory.OVERRIDE_ENCODINGS);
if(Boolean.parseBoolean(overrideEncodings))
{
encodingConfiguration = GuiActivator.getMediaService().
encodingConfiguration = UtilActivator.getMediaService().
createEmptyEncodingConfiguration();
encodingConfiguration.loadProperties(accountProperties,
ProtocolProviderFactory.ENCODING_PROP_PREFIX);
}
else
{
encodingConfiguration = GuiActivator.getMediaService().
encodingConfiguration = UtilActivator.getMediaService().
getCurrentEncodingConfiguration();
}

@ -8,6 +8,7 @@
import java.awt.image.*;
import java.net.*;
import java.util.*;
import javax.imageio.*;
@ -15,6 +16,7 @@
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.keybindings.*;
import net.java.sip.communicator.service.netaddr.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.resources.*;
import org.jitsi.service.configuration.*;
@ -54,7 +56,9 @@ public class UtilActivator
private static FileAccessService fileAccessService;
private static BundleContext bundleContext;
private static MediaService mediaService;
static BundleContext bundleContext;
/**
* Network address manager service will inform us for changes in
@ -258,6 +262,22 @@ public static FileAccessService getFileAccessService()
return fileAccessService;
}
/**
* Returns an instance of the <tt>MediaService</tt> obtained from the
* bundle context.
* @return an instance of the <tt>MediaService</tt> obtained from the
* bundle context
*/
public static MediaService getMediaService()
{
if (mediaService == null)
{
mediaService
= ServiceUtils.getService(bundleContext, MediaService.class);
}
return mediaService;
}
/**
* Returns the {@link MediaConfigurationService} instance registered in the
* <tt>BundleContext</tt> of the <tt>UtilActivator</tt>.
@ -270,4 +290,47 @@ public static MediaConfigurationService getMediaConfiguration()
return ServiceUtils.getService(bundleContext,
MediaConfigurationService.class);
}
/**
* Returns all <tt>ProtocolProviderFactory</tt>s obtained from the bundle
* context.
*
* @return all <tt>ProtocolProviderFactory</tt>s obtained from the bundle
* context
*/
public static Map<Object, ProtocolProviderFactory>
getProtocolProviderFactories()
{
Map<Object, ProtocolProviderFactory> providerFactoriesMap
= new Hashtable<Object, ProtocolProviderFactory>();
ServiceReference[] serRefs = null;
try
{
// get all registered provider factories
serRefs
= bundleContext.getServiceReferences(
ProtocolProviderFactory.class.getName(),
null);
}
catch (InvalidSyntaxException e)
{
logger.error("LoginManager : " + e);
}
if (serRefs != null)
{
for (ServiceReference serRef : serRefs)
{
ProtocolProviderFactory providerFactory
= (ProtocolProviderFactory)
bundleContext.getService(serRef);
providerFactoriesMap.put(
serRef.getProperty(ProtocolProviderFactory.PROTOCOL),
providerFactory);
}
}
return providerFactoriesMap;
}
}

Loading…
Cancel
Save