diff options
author | Danny van Heumen <danny@dannyvanheumen.nl> | 2014-12-21 23:42:15 +0100 |
---|---|---|
committer | Danny van Heumen <danny@dannyvanheumen.nl> | 2015-01-12 22:47:09 +0100 |
commit | bb0fd0660e136d1a621b9b5ecb7ed4d5fe7896e5 (patch) | |
tree | 54a71db2d435f03ff015bfee6cbaf00487c00e49 /src/net/java/sip/communicator/plugin/ircaccregwizz | |
parent | 8df3ca4793d1575e67999fde5c342b80a794da4c (diff) | |
download | jitsi-bb0fd0660e136d1a621b9b5ecb7ed4d5fe7896e5.zip jitsi-bb0fd0660e136d1a621b9b5ecb7ed4d5fe7896e5.tar.gz jitsi-bb0fd0660e136d1a621b9b5ecb7ed4d5fe7896e5.tar.bz2 |
Extended IRC account dialog to include options for contact and chat room presence.
Diffstat (limited to 'src/net/java/sip/communicator/plugin/ircaccregwizz')
4 files changed, 113 insertions, 7 deletions
diff --git a/src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java index 9243d29..02b8bfd 100644 --- a/src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java +++ b/src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java @@ -22,6 +22,7 @@ import net.java.sip.communicator.service.protocol.*; * and the password of the account. * * @author Lionel Ferreira & Michael Tarantino + * @author Danny van Heumen */ public class FirstWizardPage extends TransparentPanel @@ -120,6 +121,12 @@ public class FirstWizardPage private JCheckBox useSecureConnection = new SIPCommCheckBox( Resources.getString("plugin.ircaccregwizz.USE_SECURE_CONNECTION")); + private JCheckBox enableContactPresenceTask = new SIPCommCheckBox( + Resources.getString("plugin.ircaccregwizz.ENABLE_CONTACT_PRESENCE")); + + private JCheckBox enableChatRoomPresenceTask = new SIPCommCheckBox( + Resources.getString("plugin.ircaccregwizz.ENABLE_CHAT_ROOM_PRESENCE")); + private JPanel mainPanel = new TransparentPanel(); private Object nextPageIdentifier = WizardPage.SUMMARY_PAGE_IDENTIFIER; @@ -193,6 +200,8 @@ public class FirstWizardPage this.defaultPort.setSelected(true); this.passwordNotRequired.setSelected(true); this.useSecureConnection.setSelected(true); + this.enableContactPresenceTask.setSelected(true); + this.enableChatRoomPresenceTask.setSelected(true); this.portField .setText(this.useSecureConnection.isSelected() ? DEFAULT_SECURE_PORT : DEFAULT_PLAINTEXT_PORT); @@ -251,8 +260,13 @@ public class FirstWizardPage serverPanel.setBorder(BorderFactory.createTitledBorder( Resources.getString("plugin.ircaccregwizz.IRC_SERVER"))); - optionsPanel.add(rememberPassBox, BorderLayout.CENTER); - optionsPanel.add(autoNickChange, BorderLayout.SOUTH); + optionsPanel.add(rememberPassBox, BorderLayout.NORTH); + optionsPanel.add(autoNickChange, BorderLayout.CENTER); + JPanel partition = new TransparentPanel(); + optionsPanel.add(partition); + partition.setLayout(new BorderLayout()); + partition.add(enableContactPresenceTask, BorderLayout.WEST); + partition.add(enableChatRoomPresenceTask, BorderLayout.EAST); optionsPanel.setBorder(BorderFactory.createTitledBorder( Resources.getString("service.gui.OPTIONS"))); @@ -345,6 +359,11 @@ public class FirstWizardPage registration.setAutoChangeNick(autoNickChange.isSelected()); registration.setRequiredPassword(!passwordNotRequired.isSelected()); registration.setSecureConnection(useSecureConnection.isSelected()); + registration + .setContactPresenceTaskEnabled(this.enableContactPresenceTask + .isSelected()); + registration.setChatRoomPresenceTaskEnabled(enableChatRoomPresenceTask + .isSelected()); isCommitted = true; } @@ -448,6 +467,14 @@ public class FirstWizardPage accountID.getAccountPropertyBoolean( ProtocolProviderFactory.DEFAULT_ENCRYPTION, true); + boolean contactPresenceTaskEnabled = + accountID.getAccountPropertyBoolean( + IrcAccountRegistrationWizard.CONTACT_PRESENCE_TASK, true); + + boolean chatRoomPresenceTaskEnabled = + accountID.getAccountPropertyBoolean( + IrcAccountRegistrationWizard.CHAT_ROOM_PRESENCE_TASK, true); + this.userIDField.setEnabled(false); this.userIDField.setText(accountID.getUserID()); this.serverField.setText(server); @@ -486,6 +513,9 @@ public class FirstWizardPage } this.useSecureConnection.setSelected(useSecureConnection); + this.enableContactPresenceTask.setSelected(contactPresenceTaskEnabled); + this.enableChatRoomPresenceTask + .setSelected(chatRoomPresenceTaskEnabled); } /** diff --git a/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccRegWizzActivator.java b/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccRegWizzActivator.java index a597f04..50bf657 100644 --- a/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccRegWizzActivator.java +++ b/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccRegWizzActivator.java @@ -109,9 +109,7 @@ public class IrcAccRegWizzActivator { ServiceReference<?>[] serRefs = null; - String osgiFilter = "(" - + ProtocolProviderFactory.PROTOCOL - + "=" + "IRC" + ")"; + String osgiFilter = "(" + ProtocolProviderFactory.PROTOCOL + "=IRC)"; try { diff --git a/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistration.java b/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistration.java index 62f907a..ef2a5e0 100644 --- a/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistration.java +++ b/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistration.java @@ -11,6 +11,7 @@ package net.java.sip.communicator.plugin.ircaccregwizz; * through the <tt>IrcAccountRegistrationWizard</tt>. * * @author Lionel Ferreira & Michael Tarantino + * @author Danny van Heumen */ public class IrcAccountRegistration { @@ -24,6 +25,16 @@ public class IrcAccountRegistration private boolean secureConnection; /** + * Option for activating contact presence task. + */ + private boolean contactPresenceTaskEnabled; + + /** + * Option for activating chat room members presence task. + */ + private boolean chatroomPresenceTaskEnabled; + + /** * Returns the User ID of the IRC registration account. * * @return the User ID of the IRC registration account. @@ -191,4 +202,44 @@ public class IrcAccountRegistration { this.secureConnection = secureConnection; } + + /** + * Get contact presence task enabled. + * + * @return returns <tt>true</tt> if task should be enabled + */ + public boolean isContactPresenceTaskEnabled() + { + return this.contactPresenceTaskEnabled; + } + + /** + * Set contact presence task. + * + * @param value value + */ + public void setContactPresenceTaskEnabled(final boolean value) + { + this.contactPresenceTaskEnabled = value; + } + + /** + * Get chat room presence task. + * + * @return returns <tt>true</tt> if task should be enabled + */ + public boolean isChatRoomPresenceTaskEnabled() + { + return this.chatroomPresenceTaskEnabled; + } + + /** + * Set chat room presence task. + * + * @param value value + */ + public void setChatRoomPresenceTaskEnabled(final boolean value) + { + this.chatroomPresenceTaskEnabled = value; + } } diff --git a/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java index 22fb2de..ed76959 100644 --- a/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java +++ b/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java @@ -17,8 +17,8 @@ import org.osgi.framework.*; /** * The <tt>IrcAccountRegistrationWizard</tt> is an implementation of the - * <tt>AccountRegistrationWizard</tt> for the IRC protocol. It allows - * the user to create and configure a new IRC account. + * <tt>AccountRegistrationWizard</tt> for the IRC protocol. It allows the user + * to create and configure a new IRC account. * * @author Lionel Ferreira & Michael Tarantino * @author Danny van Heumen @@ -30,6 +30,23 @@ public class IrcAccountRegistrationWizard private static final int WIZARD_DIALOG_WIDTH = 600; + /** + * Repeated contact presence task configuration key from + * ProtocolProviderFactoryIrcImpl here to avoid having to import irc + * protocol package directly. See + * ProtocolProviderFactoryIrcImpl.CONTACT_PRESENCE_TASK. + */ + public static final String CONTACT_PRESENCE_TASK = "CONTACT_PRESENCE_TASK"; + + /** + * Repeated chat room presence task configuration key from + * ProtocolProviderFactoryIrcImpl here to avoid having to import irc + * protocol package directly. See + * ProtocolProviderFactoryIrcImpl.CHAT_ROOM_PRESENCE_TASK. + */ + public static final String CHAT_ROOM_PRESENCE_TASK = + "CHAT_ROOM_PRESENCE_TASK"; + private final Logger logger = Logger.getLogger(IrcAccountRegistrationWizard.class); @@ -154,11 +171,16 @@ public class IrcAccountRegistrationWizard port = ":" + port; } + // FIXME i18n summaryTable.put("Password", pass); summaryTable.put("Nickname", registration.getUserID()); summaryTable.put("Server IRC", registration.getServer() + port); summaryTable.put("Secure connection", registration.isSecureConnection() ? "yes" : "no"); + summaryTable.put("Contact presence", + "" + registration.isContactPresenceTaskEnabled()); + summaryTable.put("Chat room presence", + "" + registration.isChatRoomPresenceTaskEnabled()); return summaryTable.entrySet().iterator(); } @@ -251,6 +273,11 @@ public class IrcAccountRegistrationWizard accountProperties.put(ProtocolProviderFactory.DEFAULT_ENCRYPTION, new Boolean(registration.isSecureConnection()).toString()); + accountProperties.put(CONTACT_PRESENCE_TASK, + Boolean.toString(registration.isContactPresenceTaskEnabled())); + accountProperties.put(CHAT_ROOM_PRESENCE_TASK, + Boolean.toString(registration.isChatRoomPresenceTaskEnabled())); + if (isModification()) { providerFactory.modifyAccount(this.protocolProvider, |