Change status message interface added

cusax-fix
Yana Stamcheva 18 years ago
parent c3044ea4be
commit 8d68be927f

@ -66,6 +66,8 @@ banFailed=Ban failed
banFailedGeneralError=Failed to ban {0}. A general server error occured.
banFailedNotAllowed=Failed to ban {0}. The owner and the administratior of the room could not be banned.
banFailedNotEnoughPermissions=Failed to ban {0}. You don't have enough privileges to do that.
brbMessage=I'm gone right now, but I'll be back.
busyMessage=Sorry, I'm busy right now.
call=Call
callVia=Call via:
callList=Call list
@ -199,15 +201,18 @@ networkFailure=Network failure
next=&Next
new=&New
newAccount=&New account
newMessage=New message...
newName=New name:
newStatusMessage=New status message
no=No
noAccountFound=In order to use the SIP-Communicator you need at least one registered account. The following pages will guide you through the process of creating an account.
noAvailableRooms=The list of rooms for this server is currently not available.
noMessage=No message
noMultiChatAccountAvailable=No accounts, supporting multi user chat found. Check sip-communicator.org for more information on which protocols support multi user chat.
nonEmptyChatWindowClose=You're trying to close a chat with a non-sent message. Are you sure you want to close this chat?
nonExistingUserId=The {0} server does not recognize specified user id.
notifications=Notifications
ok=&OK
ok=&Ok
offline=Offline
olderCalls=Older calls
online=Online
@ -263,6 +268,7 @@ sendFile=S&end file
selectContactSupportingInfo=There is no info for this contact.
sendMessage=&Send a message
sendVia=Send via
setStatusMessage=Set status message
settings=&Settings
showCallPanel=Show call panel
showChannelsList=Show channels list
@ -273,6 +279,7 @@ soundOnOff=Turn sound on/off
statusChangedChatMessage=has become {0}
statusChangeGeneralError=Failed to change status for account: User name: {0}, Server name: {1}, due to a general error.
statusChangeNetworkFailure=Failed to change status for account: User name: {0}, Server name: {1}, due to a network problem.
statusMessageInfo=In the field below you can specify the new message you would like to use.
subject=Subject
summary=Summary
today=Today

@ -18,6 +18,7 @@
import net.java.sip.communicator.impl.gui.i18n.*;
import net.java.sip.communicator.impl.gui.main.*;
import net.java.sip.communicator.impl.gui.main.login.*;
import net.java.sip.communicator.impl.gui.main.presence.message.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
@ -113,6 +114,11 @@ else if ((onlineStatus != null
.getBytesInImage(status.getStatusIcon())),
new ItemActionListener());
}
this.addSeparator();
this.add(new StatusMessageMenu(protocolProvider));
this.setSelectedStatus(offlineStatus);
}
@ -127,7 +133,6 @@ public void actionPerformed(ActionEvent e)
{
if (e.getSource() instanceof JMenuItem)
{
JMenuItem menuItem = (JMenuItem) e.getSource();
LoginManager loginManager = mainFrame.getLoginManager();

@ -27,23 +27,27 @@ public abstract class StatusSelectorBox
extends SIPCommMenu
{
/**
* Starts the connecting animation.
*
* @param images
* @param images the animated image to play
*/
public void startConnecting(BufferedImage[] images){}
/**
*
* Updates the current status.
*/
public void updateStatus(){}
/**
* Returns the account index (In case of more than one account for one and
* the same protocol).
*
* @return
* @return the account index
*/
public int getAccountIndex(){return -1;}
/**
* Sets the account index.
*
* @param index
*/

@ -7,9 +7,13 @@
package net.java.sip.communicator.impl.systray;
import java.awt.image.*;
import java.io.*;
import java.util.*;
import javax.imageio.*;
import javax.swing.*;
import net.java.sip.communicator.util.*;
/**
* The Messages class manages the access to the internationalization
@ -31,43 +35,82 @@ public class Resources
/**
* Returns an internationalized string corresponding to the given key.
*
* @param key The key of the string.
* @return An internationalized string corresponding to the given key.
*/
public static String getString(String key)
public static String getString(String key)
{
try
try
{
return RESOURCE_BUNDLE.getString(key);
String resourceString = RESOURCE_BUNDLE.getString(key);
int mnemonicIndex = resourceString.indexOf('&');
if(mnemonicIndex > -1)
{
String firstPart = resourceString.substring(0, mnemonicIndex);
String secondPart = resourceString.substring(mnemonicIndex + 1);
resourceString = firstPart.concat(secondPart);
}
} catch (MissingResourceException e)
return resourceString;
}
catch (MissingResourceException e)
{
return '!' + key + '!';
}
}
}
/**
* Returns an internationalized string corresponding to the given key.
*
* @param key The key of the string.
* @return An internationalized string corresponding to the given key.
*/
public static char getMnemonic(String key)
{
try
{
String resourceString = RESOURCE_BUNDLE.getString(key);
int mnemonicIndex = resourceString.indexOf('&');
if(mnemonicIndex > -1)
return resourceString.charAt(mnemonicIndex + 1);
}
catch (MissingResourceException e)
{
return 0;
}
return 0;
}
/**
* Loads an image from a given image identifier.
* @param key The key of the image.
*
* @param imageID The identifier of the image.
* @return The image for the given identifier.
*/
public static byte[] getImage(String key)
public static ImageIcon getImage(String imageID)
{
byte[] image = new byte[100000];
String path=Resources.getString(key);
try
{
Resources.class.getClassLoader()
.getResourceAsStream(path).read(image);
} catch (IOException e)
BufferedImage image = null;
String path = Resources.getString(imageID);
try
{
log.error("Failed to load image:" + key, e);
image =
ImageIO.read(Resources.class.getClassLoader()
.getResourceAsStream(path));
}
catch (IOException e)
{
log.error("Failed to load image:" + path, e);
}
return image;
}
return new ImageIcon(image);
}
}

@ -13,6 +13,7 @@
import javax.swing.*;
import net.java.sip.communicator.impl.systray.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
@ -47,6 +48,8 @@ public class StatusSelector
private Logger logger = Logger.getLogger(
StatusSelector.class.getName());
private StatusMessageMenu statusMessageMenu;
/**
* Creates an instance of StatusSelector
*
@ -58,34 +61,38 @@ public StatusSelector( SystrayServiceJdicImpl jdicSystray,
ProtocolProviderService provider,
OperationSetPresence presence)
{
this.parentSystray = jdicSystray;
this.provider = provider;
this.presence = presence;
this.statusMessageMenu = new StatusMessageMenu(provider);
/* the parent item */
this.setText(provider.getAccountID().getUserID());
this.setIcon(new ImageIcon(
presence.getPresenceStatus().getStatusIcon()));
/* the submenu itself */
Iterator statusIterator = this.presence.getSupportedStatusSet();
while(statusIterator.hasNext())
{
PresenceStatus status = (PresenceStatus) statusIterator.next();
ImageIcon icon = new ImageIcon(status.getStatusIcon());
JMenuItem item = new JMenuItem(status.getStatusName(),icon);
item.addActionListener(this);
this.add(item);
}
this.addSeparator();
this.add(statusMessageMenu);
}
/**
* Change the status of the protocol according to
* the menu item selected
@ -93,7 +100,6 @@ public StatusSelector( SystrayServiceJdicImpl jdicSystray,
*/
public void actionPerformed(ActionEvent evt)
{
JMenuItem menuItem = (JMenuItem) evt.getSource();
Iterator statusSet = presence.getSupportedStatusSet();
@ -110,14 +116,14 @@ public void actionPerformed(ActionEvent evt)
&& !presence.getPresenceStatus().equals(status))
{
if (status.isOnline())
{
{
new PublishPresenceStatusThread(status).start();
}
else
else
{
new ProviderUnRegistration(this.provider).start();
}
}
}
else if (this.provider.getRegistrationState()
!= RegistrationState.REGISTERED
&& this.provider.getRegistrationState()
@ -175,28 +181,28 @@ public void run()
try {
presence.publishPresenceStatus(status, "");
}
catch (IllegalArgumentException e1)
catch (IllegalArgumentException e1)
{
logger.error("Error - changing status", e1);
}
catch (IllegalStateException e1)
catch (IllegalStateException e1)
{
logger.error("Error - changing status", e1);
}
catch (OperationFailedException e1)
catch (OperationFailedException e1)
{
if (e1.getErrorCode()
== OperationFailedException.GENERAL_ERROR)
if (e1.getErrorCode()
== OperationFailedException.GENERAL_ERROR)
{
logger.error(
"General error occured while "
+ "publishing presence status.",
e1);
}
else if (e1.getErrorCode()
else if (e1.getErrorCode()
== OperationFailedException
.NETWORK_FAILURE)
{

@ -52,11 +52,10 @@ public StatusSubMenu(SystrayServiceJdicImpl tray)
{
parentSystray = tray;
this.setText(Resources.getString("setStatus"));
this.setIcon(
new ImageIcon(Resources.getImage("statusMenuIcon")));
this.setIcon(Resources.getImage("statusMenuIcon"));
/* makes the menu look better */
this.setPreferredSize(new java.awt.Dimension(28, 24));

@ -123,30 +123,22 @@ private void initSystray()
// background.
if (osName.startsWith("Windows"))
{
logoIcon = new ImageIcon(
Resources.getImage("trayIconWindows"));
envelopeIcon = new ImageIcon(
Resources.getImage("messageIconWindows"));
logoIcon = Resources.getImage("trayIconWindows");
envelopeIcon = Resources.getImage("messageIconWindows");
}
// If we're running under MacOSX, we use a special black and
// white icons without background.
else if (osName.startsWith("Mac OS X"))
{
logoIcon = new ImageIcon(
Resources.getImage("trayIconMacOSX"));
logoIconWhite = new ImageIcon(
Resources.getImage("trayIconMacOSXWhite"));
envelopeIcon = new ImageIcon(
Resources.getImage("messageIconMacOSX"));
envelopeIconWhite = new ImageIcon(
Resources.getImage("messageIconMacOSXWhite"));
logoIcon = Resources.getImage("trayIconMacOSX");
logoIconWhite = Resources.getImage("trayIconMacOSXWhite");
envelopeIcon = Resources.getImage("messageIconMacOSX");
envelopeIconWhite = Resources.getImage("messageIconMacOSXWhite");
}
else
{
logoIcon = new ImageIcon(
Resources.getImage("trayIcon"));
envelopeIcon = new ImageIcon(
Resources.getImage("messageIcon"));
logoIcon = Resources.getImage("trayIcon");
envelopeIcon = Resources.getImage("messageIcon");
}
currentIcon = logoIcon;

@ -39,15 +39,15 @@ public class TrayMenu
private JMenuItem settingsItem = new JMenuItem(
Resources.getString("settings"),
new ImageIcon(Resources.getImage("settingsMenuIcon")));
Resources.getImage("settingsMenuIcon"));
private JMenuItem closeItem = new JMenuItem(
Resources.getString("close"),
new ImageIcon(Resources.getImage("closeMenuIcon")));
Resources.getImage("closeMenuIcon"));
private JMenuItem addContactMenuItem = new JMenuItem(
Resources.getString("addContact"),
new ImageIcon(Resources.getImage("addContactIcon")));
Resources.getImage("addContactIcon"));
private StatusSubMenu statusMenu;

@ -17,6 +17,7 @@ messageIcon=net/java/sip/communicator/impl/systray/resources/envelope.png
messageIconWindows=net/java/sip/communicator/impl/systray/resources/envelopeWindows.png
messageIconMacOSX=net/java/sip/communicator/impl/systray/resources/envelopeMacOSX.png
messageIconMacOSXWhite=net/java/sip/communicator/impl/systray/resources/envelopeMacOSXWhite.png
newStatusMessageIcon=resources/images/impl/gui/common/renameDialogIcon.png
settings=Settings...
addContact=Add contact...
setStatus=Set Status
@ -26,3 +27,12 @@ offlineStatus=Offline
messageReceived=Message received from
failedToLoadAddContactDialog=Failed to load the "Add contact" wizard dialog.
systrayToolTip=SIP Communicator
setStatusMessage=Set status message
newStatusMessage=New status message
statusMessageInfo=In the field below you can specify the new message you would like to use.
noMessage=No message
newMessage=New message...
busyMessage=Sorry, I'm busy right now.
brbMessage=I'm gone right now, but I'll be back.
ok=&Ok
cancel=&Cancel

Loading…
Cancel
Save