diff options
Diffstat (limited to 'src/net/java/sip/communicator/plugin/desktoputil')
6 files changed, 831 insertions, 2 deletions
diff --git a/src/net/java/sip/communicator/plugin/desktoputil/AuthenticationWindow.java b/src/net/java/sip/communicator/plugin/desktoputil/AuthenticationWindow.java index 265c44d..a989eec 100644 --- a/src/net/java/sip/communicator/plugin/desktoputil/AuthenticationWindow.java +++ b/src/net/java/sip/communicator/plugin/desktoputil/AuthenticationWindow.java @@ -12,6 +12,7 @@ import java.awt.event.*; import javax.swing.*; import net.java.sip.communicator.service.gui.*; +import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.util.Logger; import org.jitsi.util.*; @@ -757,5 +758,36 @@ public class AuthenticationWindow }); return subscribeLabel; } + + + /** + * Returns the icon corresponding to the given <tt>protocolProvider</tt>. + * + * @param protocolProvider the <tt>ProtocolProviderService</tt>, which icon + * we're looking for + * @return the icon to show on the authentication window + */ + public static ImageIcon getAuthenticationWindowIcon( + ProtocolProviderService protocolProvider) + { + Image image = null; + + if(protocolProvider != null) + { + ProtocolIcon protocolIcon = protocolProvider.getProtocolIcon(); + + if(protocolIcon.isSizeSupported(ProtocolIcon.ICON_SIZE_64x64)) + image = ImageUtils.getBytesInImage( + protocolIcon.getIcon(ProtocolIcon.ICON_SIZE_64x64)); + else if(protocolIcon.isSizeSupported(ProtocolIcon.ICON_SIZE_48x48)) + image = ImageUtils.getBytesInImage( + protocolIcon.getIcon(ProtocolIcon.ICON_SIZE_48x48)); + } + + if (image != null) + return new ImageIcon(image); + + return null; + } } diff --git a/src/net/java/sip/communicator/plugin/desktoputil/DesktopUtilActivator.java b/src/net/java/sip/communicator/plugin/desktoputil/DesktopUtilActivator.java index 23bb10d..2be0ca1 100644 --- a/src/net/java/sip/communicator/plugin/desktoputil/DesktopUtilActivator.java +++ b/src/net/java/sip/communicator/plugin/desktoputil/DesktopUtilActivator.java @@ -10,6 +10,7 @@ import javax.swing.*; import net.java.sip.communicator.service.browserlauncher.*; import net.java.sip.communicator.service.certificate.*; import net.java.sip.communicator.service.credentialsstorage.*; +import net.java.sip.communicator.service.globaldisplaydetails.*; import net.java.sip.communicator.service.gui.*; import net.java.sip.communicator.service.keybindings.*; import net.java.sip.communicator.service.protocol.*; @@ -52,6 +53,8 @@ public class DesktopUtilActivator private static AudioNotifierService audioNotifierService; + private static GlobalDisplayDetailsService globalDisplayDetailsService; + static BundleContext bundleContext; /** @@ -324,4 +327,23 @@ public class DesktopUtilActivator } return audioNotifierService; } + + /** + * Returns the <tt>GlobalDisplayDetailsService</tt> obtained from the bundle + * context. + * + * @return the <tt>GlobalDisplayDetailsService</tt> obtained from the bundle + * context + */ + public static GlobalDisplayDetailsService getGlobalDisplayDetailsService() + { + if (globalDisplayDetailsService == null) + { + globalDisplayDetailsService + = ServiceUtils.getService( + bundleContext, + GlobalDisplayDetailsService.class); + } + return globalDisplayDetailsService; + } }
\ No newline at end of file diff --git a/src/net/java/sip/communicator/plugin/desktoputil/MessageDialog.java b/src/net/java/sip/communicator/plugin/desktoputil/MessageDialog.java new file mode 100644 index 0000000..1b4ec68 --- /dev/null +++ b/src/net/java/sip/communicator/plugin/desktoputil/MessageDialog.java @@ -0,0 +1,343 @@ +/* + * 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.desktoputil; + +import java.awt.*; +import java.awt.event.*; +import java.lang.reflect.*; + +import javax.swing.*; + +import net.java.sip.communicator.util.skin.*; + +/** + * The <tt>MessageDialog</tt> is a <tt>JDialog</tt> that contains a question + * message, two buttons to confirm or cancel the question and a check box that + * allows user to choose to not be questioned any more over this subject. + * <p> + * The message and the name of the "OK" button could be configured. + * + * @author Yana Stamcheva + * @author Adam Netocny + */ +public class MessageDialog + extends SIPCommDialog + implements ActionListener, + Skinnable +{ + private static final long serialVersionUID = 1L; + + private JButton cancelButton = new JButton( + DesktopUtilActivator.getResources().getI18NString("service.gui.CANCEL")); + + protected JButton okButton = new JButton( + DesktopUtilActivator.getResources().getI18NString("service.gui.OK")); + + private JCheckBox doNotAskAgain = new SIPCommCheckBox( + DesktopUtilActivator.getResources() + .getI18NString("service.gui.DO_NOT_ASK_AGAIN")); + + private JLabel iconLabel = new JLabel(new ImageIcon( + DesktopUtilActivator.getImage("service.gui.icons.WARNING_ICON"))); + + private StyledHTMLEditorPane messageArea = new StyledHTMLEditorPane(); + + private TransparentPanel buttonsPanel + = new TransparentPanel(new FlowLayout(FlowLayout.CENTER)); + + private TransparentPanel checkBoxPanel + = new TransparentPanel(new FlowLayout(FlowLayout.LEADING)); + + private TransparentPanel mainPanel + = new TransparentPanel(new BorderLayout(5, 5)); + + private boolean isConfirmationEnabled = true; + + private int returnCode; + + /** + * Indicates that the OK button is pressed. + */ + public static final int OK_RETURN_CODE = 0; + + /** + * Indicates that the Cancel button is pressed. + */ + public static final int CANCEL_RETURN_CODE = 1; + + /** + * Indicates that the OK button is pressed and the Don't ask check box is + * checked. + */ + public static final int OK_DONT_ASK_CODE = 2; + + /** + * The maximum width that we allow message dialogs to have. + */ + private static final int MAX_MSG_PANE_WIDTH = 600; + + /** + * The maximum height that we allow message dialogs to have. + */ + private static final int MAX_MSG_PANE_HEIGHT = 800; + + /** + * Creates an instance of <tt>MessageDialog</tt> by specifying the + * owner window and the message to be displayed. + * @param owner the dialog owner + * @param title the title of the message + * @param message the message to be displayed + * @param okButtonName ok button name + * @param isConfirmationEnabled indicates whether the "Do not ask again" + * button should be enabled or not + */ + public MessageDialog(Frame owner, + String title, + String message, + String okButtonName, + boolean isConfirmationEnabled) + { + super(owner, false); + + this.isConfirmationEnabled = isConfirmationEnabled; + + this.getContentPane().setLayout(new BorderLayout(5, 5)); + + this.messageArea.setOpaque(false); + this.messageArea.setEditable(false); + this.messageArea.setContentType("text/html"); + + this.messageArea.setBorder( + BorderFactory.createEmptyBorder(10, 10, 0, 10)); + this.checkBoxPanel.setBorder( + BorderFactory.createEmptyBorder(0, 10, 10, 10)); + + this.init(); + + this.setTitle(title); + + setMessage(message); + + if(okButtonName != null) + { + this.okButton.setText(okButtonName); + this.okButton.setMnemonic(okButtonName.charAt(0)); + } + } + + /** + * Creates an instance of <tt>MessageDialog</tt> by specifying the + * owner window and the message to be displayed. + * @param owner the dialog owner + * @param title the title of the message + * @param message the message to be displayed + * @param okButtonName ok button name + */ + public MessageDialog( Frame owner, + String title, + String message, + String okButtonName) + { + this(owner, title, message, okButtonName, true); + } + + /** + * Creates an instance of <tt>MessageDialog</tt> by specifying the + * owner window and the message to be displayed. + * @param owner the dialog owner + * @param title the title of the message + * @param message the message to be displayed + * @param isCancelButtonEnabled <code>true</code> to show the Cancel button, + * <code>false</code> - otherwise + */ + public MessageDialog( Frame owner, + String title, + String message, + boolean isCancelButtonEnabled) + { + this(owner, title, message, null, true); + + if(!isCancelButtonEnabled) + { + doNotAskAgain.setText(DesktopUtilActivator.getResources() + .getI18NString("service.gui.DO_NOT_SHOW_AGAIN")); + + buttonsPanel.remove(cancelButton); + } + } + + /** + * Initializes this dialog. + */ + private void init() + { + this.getRootPane().setDefaultButton(okButton); + + if(isConfirmationEnabled) + this.checkBoxPanel.add(doNotAskAgain); + + this.buttonsPanel.add(okButton); + this.buttonsPanel.add(cancelButton); + + this.okButton.addActionListener(this); + this.cancelButton.addActionListener(this); + + this.cancelButton.setMnemonic(cancelButton.getText().charAt(0)); + + this.mainPanel.add(messageArea, BorderLayout.NORTH); + this.mainPanel.add(checkBoxPanel, BorderLayout.CENTER); + + TransparentPanel iconPanel = new TransparentPanel(new BorderLayout()); + iconPanel.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 0)); + iconPanel.add(iconLabel, BorderLayout.NORTH); + + this.getContentPane().add(iconPanel, BorderLayout.WEST); + this.getContentPane().add(mainPanel, BorderLayout.CENTER); + this.getContentPane().add(buttonsPanel, BorderLayout.SOUTH); + } + + public void replaceCheckBoxPanel(Component comp) + { + this.mainPanel.add(comp, BorderLayout.CENTER); + } + + /** + * Sets the message to be displayed. + * @param message The message to be displayed. + */ + public void setMessage(String message) + { + this.messageArea.setText(message); + + setMaxWidth(600); + } + + /** + * try to reevaluate the preferred size of the message pane. + * (this is definitely not a neat way to do it ... but it works). + */ + public void setMaxWidth(int maxWidth) + { + //try to reevaluate the preferred size of the message pane. + //(this is definitely not a neat way to do it ... but it works). + this.messageArea.setSize( + new Dimension(MAX_MSG_PANE_WIDTH, MAX_MSG_PANE_HEIGHT)); + int height = this.messageArea.getPreferredSize().height; + this.messageArea.setPreferredSize(new Dimension(maxWidth, height)); + } + + /** + * Shows the dialog. + * @return The return code that should indicate what was the choice of + * the user. If the user chooses cancel, the return code is the + * CANCEL_RETURN_CODE. + */ + public int showDialog() + { + if (!SwingUtilities.isEventDispatchThread()) + { + final int[] returnCodes = new int[1]; + Exception exception = null; + try + { + SwingUtilities.invokeAndWait(new Runnable() + { + public void run() + { + returnCodes[0] = showDialog(); + } + }); + } + catch (InterruptedException ex) + { + exception = ex; + } + catch (InvocationTargetException ex) + { + exception = ex; + } + if (exception != null) + throw new UndeclaredThrowableException(exception); + return returnCodes[0]; + } + + pack(); + + setModal(true); + setVisible(true); + + return returnCode; + } + + /** + * Handles the <tt>ActionEvent</tt>. Depending on the user choice sets + * the return code to the appropriate value. + * + * @param e the <tt>ActionEvent</tt> that notified us + */ + public void actionPerformed(ActionEvent e) + { + JButton button = (JButton)e.getSource(); + + if(button.equals(okButton)) + { + if (doNotAskAgain.isSelected()) + { + this.returnCode = OK_DONT_ASK_CODE; + } + else + { + this.returnCode = OK_RETURN_CODE; + } + } + else + { + this.returnCode = CANCEL_RETURN_CODE; + } + + this.dispose(); + } + + /** + * Visually clicks the cancel button on close. + * + * @param isEscaped indicates if the window was close by pressing the escape + * button + */ + @Override + protected void close(boolean isEscaped) + { + this.cancelButton.doClick(); + } + + /** + * Reloads icon. + */ + public void loadSkin() + { + iconLabel.setIcon(new ImageIcon( + DesktopUtilActivator.getImage("service.gui.icons.WARNING_ICON"))); + } + + /** + * Changes the icon in the dialog. + * @param image + */ + public void setIcon(Image image) + { + iconLabel.setIcon(new ImageIcon(image)); + } + + /** + * Changes the icon in the dialog. + * @param image + */ + public void setIcon(ImageIcon image) + { + iconLabel.setIcon(image); + } +} diff --git a/src/net/java/sip/communicator/plugin/desktoputil/chat/ChatOperationReasonDialog.java b/src/net/java/sip/communicator/plugin/desktoputil/chat/ChatOperationReasonDialog.java new file mode 100644 index 0000000..ae59707 --- /dev/null +++ b/src/net/java/sip/communicator/plugin/desktoputil/chat/ChatOperationReasonDialog.java @@ -0,0 +1,234 @@ +/* + * 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.desktoputil.chat; + +import java.awt.*; + +import javax.swing.*; +import javax.swing.event.*; + +import net.java.sip.communicator.plugin.desktoputil.DesktopUtilActivator; +import net.java.sip.communicator.plugin.desktoputil.MessageDialog; + +/** + * + * @author Yana Stamcheva + * @author Valentin Martinet + */ +public class ChatOperationReasonDialog extends MessageDialog +{ + private static final long serialVersionUID = 3290030744711759011L; + + private final JTextField reasonField = new JTextField(); + + private final JPanel reasonFieldPanel = new JPanel(new BorderLayout()); + + /** + * Creates an instance of <tt>ChatOperationReasonDialog</tt> using the + * default title and message. + */ + public ChatOperationReasonDialog() + { + this(null, + DesktopUtilActivator.getResources().getI18NString( + "service.gui.REASON"), + DesktopUtilActivator.getResources().getI18NString( + "service.gui.SPECIFY_REASON"), + DesktopUtilActivator.getResources().getI18NString( + "service.gui.OK"), true, false); + + + } + + /** + * Creates an instance of <tt>ChatOperationReasonDialog</tt> using the + * default title and message. + * + * @param disableOKIfReasonIsEmpty if true the OK button will be disabled if + * the reason text is empty. + */ + public ChatOperationReasonDialog(boolean disableOKIfReasonIsEmpty) + { + this(null, + DesktopUtilActivator.getResources().getI18NString( + "service.gui.REASON"), + DesktopUtilActivator.getResources().getI18NString( + "service.gui.SPECIFY_REASON"), + DesktopUtilActivator.getResources().getI18NString( + "service.gui.OK"), true, disableOKIfReasonIsEmpty); + + + } + + /** + * Creates an instance of <tt>ChatOperationReasonDialog</tt> by specifying + * the title and the message shown in the dialog. + * @param title the title of this dialog + * @param message the message shown in this dialog + */ + public ChatOperationReasonDialog(String title, String message) + { + this(null, + title, + message, + DesktopUtilActivator.getResources().getI18NString("service.gui.OK"), + true, + false); + + } + + /** + * Creates an instance of <tt>ChatOperationReasonDialog</tt> by specifying + * the title and the message shown in the dialog. + * @param title the title of this dialog + * @param message the message shown in this dialog + * @param disableOKIfReasonIsEmpty if true the OK button will be disabled if + * the reason text is empty. + * @param showReasonLabel specify if we want the "Reason:" label + */ + public ChatOperationReasonDialog(String title, String message, + boolean showReasonLabel, + boolean disableOKIfReasonIsEmpty) + { + this(null, + title, + message, + DesktopUtilActivator.getResources().getI18NString("service.gui.OK"), + showReasonLabel, + disableOKIfReasonIsEmpty); + } + + /** + * Creates an instance of <tt>ChatOperationReasonDialog</tt> by specifying + * the parent window, the title and the message to show. + * @param chatWindow the parent window + * @param title the title of this dialog + * @param message the message shown in this dialog + * @param okButtonName the custom name of the ok button + * @param showReasonLabel specify if we want the "Reason:" label + */ + public ChatOperationReasonDialog(Frame chatWindow, String title, + String message, String okButtonName, boolean showReasonLabel) + { + this(chatWindow, + title, + message, + okButtonName, + showReasonLabel, + false); + } + + /** + * Creates an instance of <tt>ChatOperationReasonDialog</tt> by specifying + * the parent window, the title and the message to show. + * + * @param chatWindow the parent window + * @param title the title of this dialog + * @param message the message shown in this dialog + * @param okButtonName the custom name of the ok button + * @param showReasonLabel specify if we want the "Reason:" label + * @param disableOKIfReasonIsEmpty if true the OK button will be disabled if + * the reason text is empty. + */ + public ChatOperationReasonDialog(Frame chatWindow, String title, + String message, String okButtonName, boolean showReasonLabel, + boolean disableOKIfReasonIsEmpty) + { + super(chatWindow, title, message, okButtonName, false); + + JPanel reasonPanel = new JPanel(new BorderLayout()); + JLabel reasonLabel + = new JLabel( + showReasonLabel + ? (DesktopUtilActivator.getResources().getI18NString( + "service.gui.REASON") + + ":") + : ""); + + reasonPanel.add(reasonLabel, BorderLayout.WEST); + reasonPanel.add(new JLabel(" "), BorderLayout.EAST); + + reasonFieldPanel.add(reasonField, BorderLayout.NORTH); + reasonFieldPanel.setOpaque(false); + reasonPanel.add(reasonFieldPanel, BorderLayout.CENTER); + reasonPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + reasonPanel.setOpaque(false); + + replaceCheckBoxPanel(reasonPanel); + + if(disableOKIfReasonIsEmpty) + { + updateOKButtonState(); + reasonField.getDocument().addDocumentListener( + new DocumentListener() + { + public void removeUpdate(DocumentEvent ev) + { + updateOKButtonState(); + } + + public void insertUpdate(DocumentEvent ev) + { + updateOKButtonState(); + } + + public void changedUpdate(DocumentEvent ev) + { + updateOKButtonState(); + } + }); + } + this.pack(); + } + + /** + * Adds component to panel which contains the reason text field. + * @param comp the component to be added. + */ + public void addToReasonFieldPannel(Component comp) + { + reasonFieldPanel.add(comp, BorderLayout.CENTER); + } + + /** + * Enables the OK button if reason field is not empty and disables it if the + * reason field is empty. + */ + private void updateOKButtonState() + { + okButton.setEnabled(!reasonField.getText().trim().equals("")); + } + + /** + * Returns the text entered in the reason field. + * @return the text entered in the reason field + */ + public String getReason() + { + return reasonField.getText(); + } + + /** + * Sets a default value for the reason field. + * @param value the text to set as default text for the reason field + */ + public void setReasonFieldText(String value) + { + reasonField.setText(value); + } + + /** + * Sets the message to be displayed. + * @param message The message to be displayed. + */ + public void setMessage(String message) + { + super.setMessage(message); + + setMaxWidth(400); + } +} diff --git a/src/net/java/sip/communicator/plugin/desktoputil/chat/ChatRoomJoinOptionsDialog.java b/src/net/java/sip/communicator/plugin/desktoputil/chat/ChatRoomJoinOptionsDialog.java new file mode 100644 index 0000000..cd7ed11 --- /dev/null +++ b/src/net/java/sip/communicator/plugin/desktoputil/chat/ChatRoomJoinOptionsDialog.java @@ -0,0 +1,196 @@ +/**
+ *
+ */
+package net.java.sip.communicator.plugin.desktoputil.chat;
+
+import java.awt.*;
+import java.awt.event.*;
+
+import javax.swing.*;
+import javax.swing.border.*;
+
+import net.java.sip.communicator.plugin.desktoputil.*;
+import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.util.*;
+
+/**
+ * @author Ico
+ *
+ */
+/**
+ * Dialog with fields for nickname and subject.
+ */
+public class ChatRoomJoinOptionsDialog extends ChatOperationReasonDialog
+{
+ /**
+ * Serial id.
+ */
+ private static final long serialVersionUID = -916498752420264164L;
+
+ /**
+ * Text field for the subject.
+ */
+ private SIPCommTextField subject = new SIPCommTextField(DesktopUtilActivator
+ .getResources().getI18NString("service.gui.SUBJECT"));
+
+ /**
+ * Label that hides and shows the subject fields panel on click.
+ */
+ private JLabel cmdExpandSubjectFields;
+
+ /**
+ * Panel that holds the subject fields.
+ */
+ private JPanel subjectFieldsPannel = new JPanel(new BorderLayout());
+
+ /**
+ * Adds the subject fields to dialog. Sets action listeners.
+ *
+ * @param title the title of the dialog
+ * @param message the message shown in this dialog
+ * @param disableOKIfReasonIsEmpty if true the OK button will be
+ * disabled if the reason text is empty.
+ * @param showReasonLabel specify if we want the "Reason:" label
+ * @param dontDisplaySubjectFields if true the sibject fields will be
+ * hidden.
+ */
+ public ChatRoomJoinOptionsDialog(String title, String message,
+ boolean showReasonLabel,
+ boolean disableOKIfReasonIsEmpty,
+ boolean dontDisplaySubjectFields)
+ {
+ super(title,
+ message,
+ showReasonLabel,
+ disableOKIfReasonIsEmpty);
+
+ if(dontDisplaySubjectFields)
+ return;
+
+ JPanel subjectPanel = new JPanel(new BorderLayout());
+ subjectPanel.setOpaque(false);
+ subjectPanel.setBorder(
+ BorderFactory.createEmptyBorder(10, 0, 0, 0));
+
+ subjectFieldsPannel.setBorder(
+ BorderFactory.createEmptyBorder(10, 30, 0, 0));
+ subjectFieldsPannel.setOpaque(false);
+ subjectFieldsPannel.add(subject, BorderLayout.CENTER);
+ subjectFieldsPannel.setVisible(false);
+ subject.setFont(getFont().deriveFont(12f));
+
+ cmdExpandSubjectFields = new JLabel();
+ cmdExpandSubjectFields.setBorder(new EmptyBorder(0, 5, 0, 0));
+ cmdExpandSubjectFields.setIcon(DesktopUtilActivator.getResources()
+ .getImage("service.gui.icons.RIGHT_ARROW_ICON"));
+ cmdExpandSubjectFields.setText(DesktopUtilActivator
+ .getResources().getI18NString("service.gui.SET_SUBJECT"));
+ cmdExpandSubjectFields.addMouseListener(new MouseAdapter()
+ {
+ @Override
+ public void mouseClicked(MouseEvent e)
+ {
+ cmdExpandSubjectFields.setIcon(
+ UtilActivator.getResources().getImage(
+ subjectFieldsPannel.isVisible()
+ ? "service.gui.icons.RIGHT_ARROW_ICON"
+ : "service.gui.icons.DOWN_ARROW_ICON"));
+
+ subjectFieldsPannel.setVisible(
+ !subjectFieldsPannel.isVisible());
+
+ pack();
+ }
+ });
+ subjectPanel.add(cmdExpandSubjectFields,BorderLayout.NORTH);
+ subjectPanel.add(subjectFieldsPannel,BorderLayout.CENTER);
+ addToReasonFieldPannel(subjectPanel);
+ this.pack();
+ }
+
+ /**
+ * Returns the text entered in the subject field.
+ *
+ * @return the text from the subject field.
+ */
+ public String getSubject()
+ {
+ return subject.getText();
+ }
+
+ /**
+ * Opens a dialog with a fields for the nickname and the subject of the room
+ * and returns them.
+ *
+ * @param pps the protocol provider associated with the chat room.
+ * @param chatRoomId the id of the chat room.
+ * @return array with the nickname and subject values.
+ */
+ public static String[] getJoinOptions(ProtocolProviderService pps,
+ String chatRoomId)
+ {
+ return getJoinOptions(false, pps, chatRoomId);
+ }
+
+ /**
+ * Opens a dialog with a fields for the nickname and the subject of the room
+ * and returns them.
+ *
+ * @param dontDisplaySubjectFields if true the subject fields will be hidden
+ * @return array with the nickname and subject values.
+ */
+ public static String[] getJoinOptions(boolean dontDisplaySubjectFields,
+ ProtocolProviderService pps, String chatRoomId)
+ {
+ String nickName = null;
+ ChatRoomJoinOptionsDialog reasonDialog =
+ new ChatRoomJoinOptionsDialog(DesktopUtilActivator.getResources()
+ .getI18NString("service.gui.CHANGE_NICKNAME"),
+ DesktopUtilActivator.getResources().getI18NString(
+ "service.gui.CHANGE_NICKNAME_LABEL"), false, true,
+ dontDisplaySubjectFields);
+ reasonDialog.setIcon(new ImageIcon(DesktopUtilActivator.getImage(
+ "service.gui.icons.CHANGE_NICKNAME_16x16")));
+
+ final OperationSetServerStoredAccountInfo accountInfoOpSet
+ = pps.getOperationSet(
+ OperationSetServerStoredAccountInfo.class);
+
+ String displayName = "";
+ if (accountInfoOpSet != null)
+ {
+ displayName = AccountInfoUtils.getDisplayName(accountInfoOpSet);
+ }
+
+ if(displayName == null || displayName.length() == 0)
+ {
+ displayName = DesktopUtilActivator.getGlobalDisplayDetailsService()
+ .getGlobalDisplayName();
+ if(displayName == null || displayName.length() == 0)
+ {
+ displayName = pps.getAccountID().getUserID();
+ if(displayName != null)
+ {
+ int atIndex = displayName.lastIndexOf("@");
+ if (atIndex > 0)
+ displayName = displayName.substring(0, atIndex);
+ }
+ }
+ }
+ reasonDialog.setReasonFieldText(displayName);
+
+ int result = reasonDialog.showDialog();
+
+ if (result == MessageDialog.OK_RETURN_CODE)
+ {
+ nickName = reasonDialog.getReason().trim();
+ ConfigurationUtils.updateChatRoomProperty(
+ pps,
+ chatRoomId, "userNickName", nickName);
+
+ }
+ String[] joinOptions = {nickName, reasonDialog.getSubject()};
+ return joinOptions;
+ }
+
+}
diff --git a/src/net/java/sip/communicator/plugin/desktoputil/desktoputil.manifest.mf b/src/net/java/sip/communicator/plugin/desktoputil/desktoputil.manifest.mf index 4b91013..91f2af6 100644 --- a/src/net/java/sip/communicator/plugin/desktoputil/desktoputil.manifest.mf +++ b/src/net/java/sip/communicator/plugin/desktoputil/desktoputil.manifest.mf @@ -59,7 +59,8 @@ Import-Package: com.sun.awt, org.xml.sax, sun.awt.shell, sun.net.dns, - sun.net.util + sun.net.util, + net.java.sip.communicator.service.globaldisplaydetails Export-Package: net.java.sip.communicator.plugin.desktoputil, net.java.sip.communicator.plugin.desktoputil.border, net.java.sip.communicator.plugin.desktoputil.event, @@ -67,4 +68,5 @@ Export-Package: net.java.sip.communicator.plugin.desktoputil, net.java.sip.communicator.plugin.desktoputil.presence, net.java.sip.communicator.plugin.desktoputil.presence.avatar, net.java.sip.communicator.plugin.desktoputil.transparent, - net.java.sip.communicator.plugin.desktoputil.wizard + net.java.sip.communicator.plugin.desktoputil.wizard, + net.java.sip.communicator.plugin.desktoputil.chat |