diff --git a/resources/images/images.properties b/resources/images/images.properties
index a7ea9efa1..845549752 100644
--- a/resources/images/images.properties
+++ b/resources/images/images.properties
@@ -5,7 +5,6 @@ service.gui.SIP_COMMUNICATOR_LOGO_32x32=resources/images/logo/sc_logo_32x32.png
service.gui.SIP_COMMUNICATOR_LOGO_45x45=resources/images/logo/sc_logo_45x45.png
service.gui.SIP_COMMUNICATOR_LOGO_64x64=resources/images/logo/sc_logo_64x64.png
service.gui.SIP_COMMUNICATOR_LOGO_128x128=resources/images/logo/sc_logo_128x128.png
-service.gui.AUTH_WINDOW_BACKGROUND=resources/images/impl/gui/common/passWindowBackground.png
service.gui.MENU_BACKGROUND=resources/images/impl/gui/common/menuBackground.png
service.gui.WINDOW_TITLE_BAR=resources/images/impl/gui/common/windowTitleBarBackground.png
service.gui.WINDOW_TITLE_BAR_BG=resources/images/impl/gui/common/windowTitleBar.png
diff --git a/resources/images/impl/gui/common/passWindowBackground.png b/resources/images/impl/gui/common/passWindowBackground.png
deleted file mode 100644
index 54aa6bf14..000000000
Binary files a/resources/images/impl/gui/common/passWindowBackground.png and /dev/null differ
diff --git a/resources/images/impl/gui/common/src/passworsWindowBackground.svg b/resources/images/impl/gui/common/src/passworsWindowBackground.svg
deleted file mode 100644
index b972393d6..000000000
--- a/resources/images/impl/gui/common/src/passworsWindowBackground.svg
+++ /dev/null
@@ -1,3019 +0,0 @@
-
-
-
diff --git a/resources/languages/resources.properties b/resources/languages/resources.properties
index b632cb892..601863d19 100644
--- a/resources/languages/resources.properties
+++ b/resources/languages/resources.properties
@@ -129,7 +129,6 @@ service.gui.CHAT_ROOM_REQUIRES_PASSWORD=The {0} chat room has requested a passwo
service.gui.CHAT_ROOMS=Chat rooms
service.gui.CHAT_ROOM=Chat room
service.gui.CHAT_ROOM_SUBJECT_CHANGED={0} has changed the subject to {1}
-service.gui.CHAT_ROOM_REMEMBER_PASSWORD=Remember password
service.gui.CHOOSE_CONTACT=Choose contact
service.gui.CHOOSE_ACCOUNT=Please select one of the listed accounts.
service.gui.CITY=City
diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatManager.java b/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatManager.java
index b5b0fa15e..8440a0133 100644
--- a/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatManager.java
+++ b/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatManager.java
@@ -13,7 +13,7 @@
import net.java.sip.communicator.impl.gui.main.chat.*;
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.plugin.desktoputil.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
@@ -1626,11 +1626,40 @@ protected void done()
if(AUTHENTICATION_FAILED.equals(returnCode))
{
chatRoomWrapper.removePassword();
- ChatRoomAuthenticationWindow authWindow
- = new ChatRoomAuthenticationWindow(chatRoomWrapper,
- nickName);
+
+ AuthenticationWindowService authWindowsService
+ = ServiceUtils.getService(
+ GuiActivator.bundleContext,
+ AuthenticationWindowService.class);
+
+ AuthenticationWindowService.AuthenticationWindow authWindow =
+ authWindowsService.create(
+ null, null, null, false,
+ chatRoomWrapper.isPersistent(),
+ ImageLoader.getAuthenticationWindowIcon(
+ chatRoomWrapper.getParentProvider()
+ .getProtocolProvider()),
+ GuiActivator.getResources().getI18NString(
+ "service.gui.AUTHENTICATION_WINDOW_TITLE",
+ new String[]{chatRoomWrapper.getParentProvider()
+ .getName()}),
+ GuiActivator.getResources().getI18NString(
+ "service.gui.CHAT_ROOM_REQUIRES_PASSWORD",
+ new String[]{
+ chatRoomWrapper.getChatRoomName()}),
+ "", null, null, null);
authWindow.setVisible(true);
+
+ if (!authWindow.isCanceled())
+ {
+ GuiActivator.getUIService().getConferenceChatManager()
+ .joinChatRoom(
+ chatRoomWrapper,
+ nickName,
+ new String(authWindow.getPassword()).getBytes(),
+ authWindow.isRememberPassword());
+ }
}
else if(REGISTRATION_REQUIRED.equals(returnCode))
{
@@ -1670,7 +1699,7 @@ else if(SUBSCRIPTION_ALREADY_EXISTS.equals(returnCode))
GuiActivator.getResources().getI18NString(
"service.gui.ERROR"), errorMessage).showDialog();
}
-
+
if (SUCCESS.equals(returnCode) && rememberPassword)
{
chatRoomWrapper.savePassword(new String(password));
diff --git a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/joinforms/ChatRoomAuthenticationWindow.java b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/joinforms/ChatRoomAuthenticationWindow.java
deleted file mode 100644
index f400b5be1..000000000
--- a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/joinforms/ChatRoomAuthenticationWindow.java
+++ /dev/null
@@ -1,304 +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.impl.gui.main.chatroomslist.joinforms;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import javax.swing.*;
-
-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.plugin.desktoputil.*;
-import net.java.sip.communicator.util.skin.*;
-
-/**
- * The ChatRoomAuthenticationWindow is the the authentication window
- * for chat rooms that require password.
- *
- * @author Yana Stamcheva
- * @author Adam Netocny
- */
-public class ChatRoomAuthenticationWindow
- extends SIPCommFrame
- implements ActionListener,
- Skinnable
-{
- private JTextArea infoTextArea = new JTextArea();
-
- private JLabel passwdLabel = new JLabel(
- GuiActivator.getResources().getI18NString("service.gui.PASSWORD"));
-
- private JCheckBox rememberPassword;
-
- private JPasswordField passwdField = new JPasswordField(15);
-
- private JButton loginButton = new JButton(
- GuiActivator.getResources().getI18NString("service.gui.OK"));
-
- private JButton cancelButton = new JButton(
- GuiActivator.getResources().getI18NString("service.gui.CANCEL"));
-
- private JPanel labelsPanel =
- new TransparentPanel(new GridLayout(0, 1, 8, 8));
-
- private JPanel textFieldsPanel =
- new TransparentPanel(new GridLayout(0, 1, 8, 8));
-
-
- private JPanel bottomPanel =
- new TransparentPanel(new GridLayout(0, 1, 8, 8));
-
-
- private JPanel mainPanel = new TransparentPanel(new BorderLayout(10, 10));
-
- private JPanel buttonsPanel =
- new TransparentPanel(new FlowLayout(FlowLayout.CENTER));
-
- private LoginWindowBackground backgroundPanel;
-
- private ChatRoomWrapper chatRoom;
-
- private String nickname;
-
- /**
- * Creates an instance of the LoginWindow.
- * @param chatRoom the chat room for which we're authenticating
- */
- public ChatRoomAuthenticationWindow(ChatRoomWrapper chatRoom, String nickname)
- {
- this.chatRoom = chatRoom;
-
- this.nickname = nickname;
-
- ImageIcon logoImage
- = new ImageIcon(chatRoom.getParentProvider().getImage());
-
- backgroundPanel = new LoginWindowBackground(logoImage);
-
- this.backgroundPanel.setPreferredSize(new Dimension(420, 230));
-
- this.backgroundPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
-
- this.backgroundPanel.setBorder(
- BorderFactory.createEmptyBorder(20, 5, 5, 5));
-
- this.getContentPane().setLayout(new BorderLayout());
-
- this.init();
-
- this.getContentPane().add(backgroundPanel, BorderLayout.CENTER);
-
- this.setResizable(false);
-
- this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
-
- this.setTitle(GuiActivator.getResources().getI18NString(
- "service.gui.AUTHENTICATION_WINDOW_TITLE",
- new String[]{chatRoom.getParentProvider().getName()}));
-
- this.enableKeyActions();
- }
-
- /**
- * Constructs the AuthenticationWindow.
- */
- private void init()
- {
-
-
- this.infoTextArea.setOpaque(false);
- this.infoTextArea.setLineWrap(true);
- this.infoTextArea.setWrapStyleWord(true);
- this.infoTextArea.setFont(infoTextArea.getFont().deriveFont(Font.BOLD));
- this.infoTextArea.setEditable(false);
- this.infoTextArea.setText(
- GuiActivator.getResources().getI18NString(
- "service.gui.CHAT_ROOM_REQUIRES_PASSWORD",
- new String[]{chatRoom.getChatRoomName()}));
-
- this.passwdLabel.setFont(passwdLabel.getFont().deriveFont(Font.BOLD));
-
-
- this.labelsPanel.add(passwdLabel);
-
-
- this.textFieldsPanel.add(passwdField);
- this.rememberPassword = new JCheckBox(GuiActivator.getResources()
- .getI18NString("service.gui.CHAT_ROOM_REMEMBER_PASSWORD"),
- chatRoom.isPersistent());
- this.bottomPanel.add(rememberPassword);
- this.buttonsPanel.add(loginButton);
- this.buttonsPanel.add(cancelButton);
- this.bottomPanel.add(buttonsPanel);
- this.mainPanel.add(infoTextArea, BorderLayout.NORTH);
- this.mainPanel.add(labelsPanel, BorderLayout.WEST);
- this.mainPanel.add(textFieldsPanel, BorderLayout.CENTER);
- this.mainPanel.add(bottomPanel, BorderLayout.SOUTH);
-
-
- this.backgroundPanel.add(mainPanel, BorderLayout.CENTER);
-
- this.loginButton.setName("ok");
- this.cancelButton.setName("cancel");
-
- this.loginButton.setMnemonic(
- GuiActivator.getResources().getI18nMnemonic("service.gui.OK"));
- this.cancelButton.setMnemonic(
- GuiActivator.getResources().getI18nMnemonic("service.gui.CANCEL"));
-
- this.loginButton.addActionListener(this);
- this.cancelButton.addActionListener(this);
-
- this.getRootPane().setDefaultButton(loginButton);
-
- this.setTransparent(true);
- }
-
- /**
- * Sets transparent background to all components in the login window,
- * because of the nonwhite background.
- * @param transparent true to set a transparent background,
- * false otherwise.
- */
- private void setTransparent(boolean transparent) {
- this.mainPanel.setOpaque(!transparent);
- this.labelsPanel.setOpaque(!transparent);
- this.textFieldsPanel.setOpaque(!transparent);
- this.bottomPanel.setOpaque(!transparent);
-
- }
-
- /**
- * Handles the ActionEvent triggered when one of the buttons is
- * clicked. When "Login" button is choosen installs a new account from
- * the user input and logs in.
- *
- * @param evt the action event that has just occurred.
- */
- public void actionPerformed(ActionEvent evt)
- {
- JButton button = (JButton) evt.getSource();
- String buttonName = button.getName();
-
- if (buttonName.equals("ok"))
- {
- GuiActivator.getUIService().getConferenceChatManager()
- .joinChatRoom(chatRoom, nickname,
- new String(passwdField.getPassword()).getBytes(),
- rememberPassword.isSelected());
-
- }
-
- this.dispose();
- }
-
- /**
- * The LoginWindowBackground is a JPanel that overrides
- * the paintComponent method to provide a custom background
- * image for this window.
- */
- private static class LoginWindowBackground extends JPanel
- {
- private ImageIcon bgImage;
-
- public LoginWindowBackground(ImageIcon bgImage)
- {
- this.bgImage = bgImage;
- }
-
- /**
- * Sets background image.
- * @param bgImage Background image.
- */
- public void setBgImage(ImageIcon bgImage)
- {
- this.bgImage = bgImage;
- }
-
- @Override
- protected void paintComponent(Graphics g)
- {
- super.paintComponent(g);
-
- g = g.create();
- try
- {
- AntialiasingManager.activateAntialiasing(g);
-
- Graphics2D g2 = (Graphics2D) g;
-
- if (bgImage != null)
- g2.drawImage(bgImage.getImage(), 30, 30, null);
-
- g2.drawImage(ImageLoader
- .getImage(ImageLoader.AUTH_WINDOW_BACKGROUND), 0, 0, this
- .getWidth(), this.getHeight(), null);
- }
- finally
- {
- g.dispose();
- }
- }
- }
-
- /**
- * Enables the actions when a key is pressed, for now
- * closes the window when esc is pressed.
- */
- private void enableKeyActions() {
-
- UIAction act = new UIAction() {
- public void actionPerformed(ActionEvent e) {
- ChatRoomAuthenticationWindow.this.setVisible(false);
- }
- };
-
- getRootPane().getActionMap().put("close", act);
-
- InputMap imap = this.getRootPane().getInputMap(
- JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
- imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "close");
- }
-
- @Override
- protected void close(boolean isEscaped)
- {
- this.cancelButton.doClick();
- }
-
- /**
- * Shows this modal dialog.
- *
- * @param isVisible specifies whether we should be showing or hiding the
- * window.
- */
- @Override
- public void setVisible(boolean isVisible)
- {
- this.pack();
-
- super.setVisible(isVisible);
-
- if(isVisible)
- {
- this.passwdField.requestFocus();
- }
- }
-
- /**
- * Reloads logo image.
- */
- public void loadSkin()
- {
- ImageIcon logoImage
- = new ImageIcon(chatRoom.getParentProvider().getImage());
-
- backgroundPanel.setBgImage(logoImage);
- }
-}
diff --git a/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java b/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java
index a65f133b9..cbb4780a4 100644
--- a/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java
+++ b/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java
@@ -1222,12 +1222,6 @@ public class ImageLoader
public static final ImageID TOOLBAR_DRAG_ICON = new ImageID(
"service.gui.icons.TOOLBAR_DRAG_ICON");
- /**
- * The background image of the AuthenticationWindow.
- */
- public static final ImageID AUTH_WINDOW_BACKGROUND = new ImageID(
- "service.gui.AUTH_WINDOW_BACKGROUND");
-
/**
* The icon used to indicate a search.
*/
diff --git a/src/net/java/sip/communicator/plugin/desktoputil/AuthenticationWindow.java b/src/net/java/sip/communicator/plugin/desktoputil/AuthenticationWindow.java
index fa457373d..265c44d43 100644
--- a/src/net/java/sip/communicator/plugin/desktoputil/AuthenticationWindow.java
+++ b/src/net/java/sip/communicator/plugin/desktoputil/AuthenticationWindow.java
@@ -222,7 +222,7 @@ private void init( String userName,
else
this.uinValue = new JTextField();
- this.init();
+ this.init(isUserNameEditable);
this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
@@ -400,8 +400,9 @@ private void initIcon(ImageIcon icon)
/**
* Constructs the LoginWindow.
+ * @param isUserNameEditable indicates if the user name is editable
*/
- private void init()
+ private void init(boolean isUserNameEditable)
{
String title;
@@ -420,8 +421,18 @@ private void init()
new String[]{server});
String uinText;
+ boolean showUsernameInDialog = true;
if(usernameLabelText != null)
+ {
+ // if username is not editable and username label text is empty
+ // we do not want to display it
+ if(usernameLabelText.length() == 0
+ && !isUserNameEditable)
+ {
+ showUsernameInDialog = false;
+ }
uinText = usernameLabelText;
+ }
else
uinText = DesktopUtilActivator.getResources().getI18NString(
"service.gui.IDENTIFIER");
@@ -453,13 +464,17 @@ private void init()
TransparentPanel labelsPanel
= new TransparentPanel(new GridLayout(0, 1, 8, 8));
- labelsPanel.add(uinLabel);
+ if(showUsernameInDialog)
+ labelsPanel.add(uinLabel);
+
labelsPanel.add(passwdLabel);
TransparentPanel textFieldsPanel
= new TransparentPanel(new GridLayout(0, 1, 8, 8));
- textFieldsPanel.add(uinValue);
+ if(showUsernameInDialog)
+ textFieldsPanel.add(uinValue);
+
textFieldsPanel.add(passwdField);
JPanel southFieldsPanel = new TransparentPanel(new GridLayout(1, 2));