diff options
Diffstat (limited to 'src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigurationPanel.java')
-rw-r--r-- | src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigurationPanel.java | 178 |
1 files changed, 123 insertions, 55 deletions
diff --git a/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigurationPanel.java b/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigurationPanel.java index f5e482a..03fc308 100644 --- a/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigurationPanel.java +++ b/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigurationPanel.java @@ -98,6 +98,13 @@ public class GeneralConfigurationPanel = "net.java.sip.communicator.plugin.generalconfig.localeconfig.DISABLED"; + /** + * Indicates if the systray config panel should be disabled, i.e. not + * visible to the user. + */ + private static final String SYSTRAY_CONFIG_DISABLED_PROP = + "net.java.sip.communicator.plugin.generalconfig.systrayconfig.DISABLED"; + /** * Indicates if the Call configuration panel should be disabled, i.e. * not visible to the user. @@ -169,6 +176,13 @@ public class GeneralConfigurationPanel } if(!GeneralConfigPluginActivator.getConfigurationService() + .getBoolean(SYSTRAY_CONFIG_DISABLED_PROP, false)) + { + mainPanel.add(createSystrayeConfigPanel()); + mainPanel.add(Box.createVerticalStrut(10)); + } + + if(!GeneralConfigPluginActivator.getConfigurationService() .getBoolean(CALL_CONFIG_DISABLED_PROP, false)) { mainPanel.add(createCallConfigPanel()); @@ -237,6 +251,30 @@ public class GeneralConfigurationPanel } /** + * Initializes the minimize instead of hide checkbox. + */ + public Component createMinimzeInsteadOfHideCheckBox() + { + JCheckBox chk = new SIPCommCheckBox(); + + chk.setText( + Resources.getString("plugin.generalconfig.MINIMIZE_NOT_HIDE")); + chk.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + boolean value = ((JCheckBox) e.getSource()).isSelected(); + ConfigurationUtils.setIsMinimizeInsteadOfHide(value); + UtilActivator.getUIService().setMainWindowCanHide( + !UtilActivator.getSystrayService().checkInitialized()); + } + }); + + chk.setSelected(ConfigurationUtils.isMinimizeInsteadOfHide()); + return chk; + } + + /** * Creates the message configuration panel. * @return the created panel */ @@ -832,6 +870,72 @@ public class GeneralConfigurationPanel return localeConfigPanel; } + private static class Item + { + public String key; + public String value; + + public Item(String key, String value) + { + this.key = key; + this.value = value; + } + + @Override + public String toString() + { + return GeneralConfigPluginActivator.getResources() + .getI18NString(value); + } + } + + /** + * Initializes the systray configuration panel. + * @return the created component + */ + private Component createSystrayeConfigPanel() + { + JPanel panel = GeneralConfigPluginActivator. + createConfigSectionComponent( + Resources.getString("service.systray.MODE")); + + final JComboBox<Item> systrayModes = new JComboBox<>(); + SystrayService ss = GeneralConfigPluginActivator.getSystrayService(); + for (Map.Entry<String, String> mode : ss.getSystrayModes().entrySet()) + { + Item i = new Item(mode.getKey(), mode.getValue()); + systrayModes.addItem(i); + if (mode.getKey().equals(ss.getActiveSystrayMode())) + { + systrayModes.setSelectedItem(i); + } + } + + systrayModes.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + GeneralConfigPluginActivator.getConfigurationService() + .setProperty(SystrayService.PNMAE_TRAY_MODE, + ((Item) systrayModes.getSelectedItem()).key); + } + }); + + panel.add(systrayModes); + String label = "<html><body style='width:350px'>* " + + Resources.getString("service.systray.CLI_NOTE", new String[]{ + Resources.getSettingsString("service.gui.APPLICATION_NAME") + }) + "</body></html>"; + JLabel warnLabel = new JLabel(label); + warnLabel.setToolTipText(label); + warnLabel.setForeground(Color.GRAY); + warnLabel.setFont(warnLabel.getFont().deriveFont(8)); + warnLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 8, 0)); + panel.add(warnLabel); + return panel; + } + /** * Creates the call configuration panel. * @@ -856,13 +960,11 @@ public class GeneralConfigurationPanel */ private Component createNormalizeNumberCheckBox() { - JPanel checkBoxPanel = new TransparentPanel(new BorderLayout()); - - SIPCommCheckBox formatPhoneNumber = new SIPCommCheckBox("", + SIPCommCheckBox formatPhoneNumber = new SIPCommCheckBox( + GeneralConfigPluginActivator.getResources().getI18NString( + "plugin.generalconfig.REMOVE_SPECIAL_PHONE_SYMBOLS"), ConfigurationUtils.isNormalizePhoneNumber()); - formatPhoneNumber.setAlignmentY(Component.TOP_ALIGNMENT); - formatPhoneNumber.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -872,22 +974,7 @@ public class GeneralConfigurationPanel } }); - StyledHTMLEditorPane checkBoxTextLabel = new StyledHTMLEditorPane(); - - checkBoxTextLabel.setContentType("text/html"); - checkBoxTextLabel.appendToEnd( - "<html>" + GeneralConfigPluginActivator.getResources().getI18NString( - "plugin.generalconfig.REMOVE_SPECIAL_PHONE_SYMBOLS") + "</html>"); - - checkBoxTextLabel.setBorder( - BorderFactory.createEmptyBorder(3, 0, 0, 0)); - checkBoxTextLabel.setOpaque(false); - checkBoxTextLabel.setEditable(false); - - checkBoxPanel.add(formatPhoneNumber, BorderLayout.WEST); - checkBoxPanel.add(checkBoxTextLabel, BorderLayout.CENTER); - - return checkBoxPanel; + return formatPhoneNumber; } /** @@ -897,17 +984,17 @@ public class GeneralConfigurationPanel */ private Component createAcceptPhoneNumberWithAlphaCharCheckBox() { - JPanel checkBoxPanel = new TransparentPanel(new BorderLayout()); + JPanel checkBoxPanel = new TransparentPanel(); + checkBoxPanel.setLayout(new BoxLayout(checkBoxPanel, BoxLayout.Y_AXIS)); // Checkbox to accept string with alphabetical characters as potential // phone numbers. - SIPCommCheckBox acceptPhoneNumberWithAlphaChars - = new SIPCommCheckBox("", + SIPCommCheckBox alphaCharNumbers = new SIPCommCheckBox( + GeneralConfigPluginActivator.getResources().getI18NString( + "plugin.generalconfig.ACCEPT_PHONE_NUMBER_WITH_ALPHA_CHARS"), ConfigurationUtils.acceptPhoneNumberWithAlphaChars()); - acceptPhoneNumberWithAlphaChars.setAlignmentY(Component.TOP_ALIGNMENT); - - acceptPhoneNumberWithAlphaChars.addActionListener(new ActionListener() + alphaCharNumbers.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -916,21 +1003,6 @@ public class GeneralConfigurationPanel } }); - StyledHTMLEditorPane acceptPhoneNumberWithAlphaCharsTextLabel - = new StyledHTMLEditorPane(); - - acceptPhoneNumberWithAlphaCharsTextLabel.setContentType("text/html"); - acceptPhoneNumberWithAlphaCharsTextLabel.appendToEnd( - "<html>" - + GeneralConfigPluginActivator.getResources().getI18NString( - "plugin.generalconfig.ACCEPT_PHONE_NUMBER_WITH_ALPHA_CHARS") - + "</html>"); - - acceptPhoneNumberWithAlphaCharsTextLabel.setBorder( - BorderFactory.createEmptyBorder(3, 0, 0, 0)); - acceptPhoneNumberWithAlphaCharsTextLabel.setOpaque(false); - acceptPhoneNumberWithAlphaCharsTextLabel.setEditable(false); - // The example of changing letters to numbers in a phone number. String label = "* " + Resources.getString( "plugin.generalconfig.ACCEPT_PHONE_NUMBER_WITH_ALPHA_CHARS_EXAMPLE"); @@ -942,14 +1014,8 @@ public class GeneralConfigurationPanel exampleLabel.setHorizontalAlignment(JLabel.LEFT); // Adds the components to the current panel. - checkBoxPanel.add(acceptPhoneNumberWithAlphaChars, BorderLayout.WEST); - checkBoxPanel.add( - acceptPhoneNumberWithAlphaCharsTextLabel, - BorderLayout.CENTER); - checkBoxPanel.add( - exampleLabel, - BorderLayout.SOUTH); - + checkBoxPanel.add(alphaCharNumbers); + checkBoxPanel.add(exampleLabel); return checkBoxPanel; } @@ -959,15 +1025,17 @@ public class GeneralConfigurationPanel */ public Component createStartupConfigPanel() { - if (!OSUtils.IS_WINDOWS) - return null; - JPanel updateConfigPanel = GeneralConfigPluginActivator. createConfigSectionComponent( Resources.getString("plugin.generalconfig.STARTUP_CONFIG")); - updateConfigPanel.add(createAutoStartCheckBox()); - updateConfigPanel.add(createUpdateCheckBox()); + updateConfigPanel.add(createMinimzeInsteadOfHideCheckBox()); + if (OSUtils.IS_WINDOWS) + { + updateConfigPanel.add(createAutoStartCheckBox()); + updateConfigPanel.add(createUpdateCheckBox()); + } + return updateConfigPanel; } |