From 90cd15901f03e6a513a29efb9990bc16264f7e81 Mon Sep 17 00:00:00 2001 From: Yana Stamcheva Date: Wed, 11 Apr 2007 14:11:08 +0000 Subject: [PATCH] systray removed from plugin package --- .../plugin/systray/SystrayActivator.java | 71 ----- .../systray/jdic/ProviderRegistration.java | 87 ------ .../systray/jdic/ProviderUnRegistration.java | 81 ------ .../plugin/systray/jdic/Resources.java | 73 ----- .../plugin/systray/jdic/StatusSelector.java | 203 -------------- .../systray/jdic/StatusSimpleSelector.java | 128 --------- .../plugin/systray/jdic/StatusSubMenu.java | 96 ------- .../plugin/systray/jdic/Systray.java | 265 ------------------ .../plugin/systray/jdic/TrayMenu.java | 162 ----------- .../plugin/systray/jdic/resources.properties | 14 - .../systray/resources/addContactIcon.png | Bin 836 -> 0 bytes .../systray/resources/configureIcon.png | Bin 1036 -> 0 bytes .../plugin/systray/resources/quit.png | Bin 641 -> 0 bytes .../plugin/systray/resources/sipLogo.png | Bin 650 -> 0 bytes .../systray/resources/sipLogoOffline.png | Bin 416 -> 0 bytes .../plugin/systray/resources/statusIcon.png | Bin 625 -> 0 bytes .../plugin/systray/resources/systrayIcon.png | Bin 1135 -> 0 bytes .../plugin/systray/systray.manifest.mf | 31 -- 18 files changed, 1211 deletions(-) delete mode 100644 src/net/java/sip/communicator/plugin/systray/SystrayActivator.java delete mode 100644 src/net/java/sip/communicator/plugin/systray/jdic/ProviderRegistration.java delete mode 100644 src/net/java/sip/communicator/plugin/systray/jdic/ProviderUnRegistration.java delete mode 100755 src/net/java/sip/communicator/plugin/systray/jdic/Resources.java delete mode 100755 src/net/java/sip/communicator/plugin/systray/jdic/StatusSelector.java delete mode 100755 src/net/java/sip/communicator/plugin/systray/jdic/StatusSimpleSelector.java delete mode 100755 src/net/java/sip/communicator/plugin/systray/jdic/StatusSubMenu.java delete mode 100644 src/net/java/sip/communicator/plugin/systray/jdic/Systray.java delete mode 100644 src/net/java/sip/communicator/plugin/systray/jdic/TrayMenu.java delete mode 100755 src/net/java/sip/communicator/plugin/systray/jdic/resources.properties delete mode 100755 src/net/java/sip/communicator/plugin/systray/resources/addContactIcon.png delete mode 100755 src/net/java/sip/communicator/plugin/systray/resources/configureIcon.png delete mode 100755 src/net/java/sip/communicator/plugin/systray/resources/quit.png delete mode 100755 src/net/java/sip/communicator/plugin/systray/resources/sipLogo.png delete mode 100755 src/net/java/sip/communicator/plugin/systray/resources/sipLogoOffline.png delete mode 100644 src/net/java/sip/communicator/plugin/systray/resources/statusIcon.png delete mode 100755 src/net/java/sip/communicator/plugin/systray/resources/systrayIcon.png delete mode 100644 src/net/java/sip/communicator/plugin/systray/systray.manifest.mf diff --git a/src/net/java/sip/communicator/plugin/systray/SystrayActivator.java b/src/net/java/sip/communicator/plugin/systray/SystrayActivator.java deleted file mode 100644 index 5b3b833fa..000000000 --- a/src/net/java/sip/communicator/plugin/systray/SystrayActivator.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * SIP Communicator, 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.systray; - -import net.java.sip.communicator.plugin.systray.jdic.*; -import net.java.sip.communicator.service.gui.UIService; -import net.java.sip.communicator.util.Logger; - -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceReference; - -//test -import net.java.sip.communicator.service.protocol.*; -import net.java.sip.communicator.service.protocol.event.*; -import org.osgi.framework.*; - -/** - * Registers the Systray in the UI Service. - * - * @author Nicolas Chamouard - */ -public class SystrayActivator - implements BundleActivator -{ - - /** - * A currently valid bundle context. - */ - public static BundleContext bundleContext; - - private static Logger logger = Logger.getLogger( - SystrayActivator.class.getName()); - - /** - * Called when this bundle is started. - * - * @param bc The execution context of the bundle being started. - * @throws Exception If - */ - public void start(BundleContext bc) throws Exception - { - bundleContext = bc; - - ServiceReference uiServiceRef = bundleContext - .getServiceReference(UIService.class.getName()); - - UIService uiService - = (UIService) bundleContext.getService(uiServiceRef); - - Systray systray = new Systray(uiService); - bc.addServiceListener(systray); - } - - /** - * Called when this bundle is stopped so the Framework can perform the - * bundle-specific activities necessary to stop the bundle. - * - * @param bc The execution context of the bundle being stopped. - * @throws Exception If this method throws an exception, the bundle is - * still marked as stopped, and the Framework will remove the bundle's - * listeners, unregister all services registered by the bundle, and - * release all services used by the bundle. - */ - public void stop(BundleContext bc) throws Exception { - } -} diff --git a/src/net/java/sip/communicator/plugin/systray/jdic/ProviderRegistration.java b/src/net/java/sip/communicator/plugin/systray/jdic/ProviderRegistration.java deleted file mode 100644 index b4402a751..000000000 --- a/src/net/java/sip/communicator/plugin/systray/jdic/ProviderRegistration.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * SIP Communicator, 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.systray.jdic; - -import net.java.sip.communicator.service.protocol.*; -import net.java.sip.communicator.util.*; - -/** - * The ProviderRegistration is used by the systray plugin - * to make the registration to a protocol provider. This operation - * is implemented within a thread, so that sip-communicator can - * continue its execution during this operation. - * - * @author Nicolas Chamouard - */ - -public class ProviderRegistration - extends Thread -{ - /** - * The protocol provider to whom we want to register - */ - ProtocolProviderService protocolProvider; - /* temporary */ - SecurityAuthority secAuth; - - /** - * The logger for this class. - */ - private Logger logger = Logger.getLogger(ProviderRegistration.class.getName()); - - /** - * Creates an instance of ProviderRegistration. - * @param protocolProvider the provider we want to register - * @param secAuth temporary, will be changed - */ - ProviderRegistration(ProtocolProviderService protocolProvider, - SecurityAuthority secAuth) - { - this.protocolProvider = protocolProvider; - this.secAuth = secAuth; - } - - /** - * Start the thread which will register to the provider - */ - public void run() - { - try { - protocolProvider.register(secAuth); - } - catch (OperationFailedException ex) - { - int errorCode = ex.getErrorCode(); - if (errorCode == OperationFailedException.GENERAL_ERROR) - { - logger.error("Provider could not be registered" - + " due to the following general error: ", ex); - } - else if (errorCode == OperationFailedException.INTERNAL_ERROR) - { - logger.error("Provider could not be registered" - + " due to the following internal error: ", ex); - } - else if (errorCode == OperationFailedException.NETWORK_FAILURE) - { - logger.error("Provider could not be registered" - + " due to a network failure: " + ex); - } - else if (errorCode == OperationFailedException - .INVALID_ACCOUNT_PROPERTIES) - { - logger.error("Provider could not be registered" - + " due to an invalid account property: ", ex); - } - else - { - logger.error("Provider could not be registered.", ex); - } - } - } - } \ No newline at end of file diff --git a/src/net/java/sip/communicator/plugin/systray/jdic/ProviderUnRegistration.java b/src/net/java/sip/communicator/plugin/systray/jdic/ProviderUnRegistration.java deleted file mode 100644 index f9247d307..000000000 --- a/src/net/java/sip/communicator/plugin/systray/jdic/ProviderUnRegistration.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * SIP Communicator, 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.systray.jdic; - -import net.java.sip.communicator.service.protocol.*; -import net.java.sip.communicator.util.*; - -/** - * The ProviderUnRegistration is used by the systray plugin - * to make the unregistration to a protocol provider. This operation - * is implemented within a thread, so that sip-communicator can - * continue its execution smoothly. - * - * @author Nicolas Chamouard - */ -public class ProviderUnRegistration - extends Thread -{ - /** - * The protocol provider to whom we want to unregister - */ - ProtocolProviderService protocolProvider; - /** - * The logger for this class. - */ - private Logger logger = Logger.getLogger(ProviderUnRegistration.class.getName()); - - /** - * Creates an instance of ProviderUnRegistration. - * @param protocolProvider the provider we want to unregister - */ - ProviderUnRegistration(ProtocolProviderService protocolProvider) - { - this.protocolProvider = protocolProvider; - } - - /** - * Start the thread which will unregister to the provider - */ - public void run() - { - try - { - protocolProvider.unregister(); - } - catch (OperationFailedException ex) - { - int errorCode = ex.getErrorCode(); - if (errorCode == OperationFailedException.GENERAL_ERROR) - { - logger.error("Provider could not be unregistered" - + " due to the following general error: ", ex); - } - else if (errorCode == OperationFailedException.INTERNAL_ERROR) - { - logger.error("Provider could not be unregistered" - + " due to the following internal error: ", ex); - } - else if (errorCode == OperationFailedException.NETWORK_FAILURE) - { - logger.error("Provider could not be unregistered" - + " due to a network failure: " + ex); - } - else if (errorCode == OperationFailedException - .INVALID_ACCOUNT_PROPERTIES) - { - logger.error("Provider could not be unregistered" - + " due to an invalid account property: ", ex); - } - else - { - logger.error("Provider could not be unregistered.", ex); - } - } - } - } \ No newline at end of file diff --git a/src/net/java/sip/communicator/plugin/systray/jdic/Resources.java b/src/net/java/sip/communicator/plugin/systray/jdic/Resources.java deleted file mode 100755 index 517946e16..000000000 --- a/src/net/java/sip/communicator/plugin/systray/jdic/Resources.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * SIP Communicator, 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.systray.jdic; - -import java.io.*; -import java.util.*; - -import net.java.sip.communicator.util.*; -/** - * The Messages class manages the access to the internationalization - * properties files. - * - * @author Nicolas Chamouard - */ -public class Resources -{ - - private static Logger log = Logger.getLogger(Resources.class); - - private static final String BUNDLE_NAME - = "net.java.sip.communicator.plugin.systray.jdic.resources"; - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - - - /** - * 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) - { - try - { - return RESOURCE_BUNDLE.getString(key); - - } catch (MissingResourceException e) - { - return '!' + key + '!'; - } - } - - /** - * Loads an image from a given image identifier. - * @param key The key of the image. - * @return The image for the given identifier. - */ - public static byte[] getImage(String key) - { - byte[] image = new byte[100000]; - - String path=Resources.getString(key); - - try - { - Resources.class.getClassLoader() - .getResourceAsStream(path).read(image); - - } catch (IOException e) - { - log.error("Failed to load image:" + key, e); - } - - return image; - } - -} diff --git a/src/net/java/sip/communicator/plugin/systray/jdic/StatusSelector.java b/src/net/java/sip/communicator/plugin/systray/jdic/StatusSelector.java deleted file mode 100755 index 37af95804..000000000 --- a/src/net/java/sip/communicator/plugin/systray/jdic/StatusSelector.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * SIP Communicator, 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.systray.jdic; - - -import java.awt.event.*; -import java.util.*; - -import javax.swing.*; - -import net.java.sip.communicator.service.protocol.*; -import net.java.sip.communicator.util.*; - - -/** - * The StatusSelector is a submenu which allows to select a status for - * a protocol provider which supports the OperationSetPresence. - * - * @author Nicolas Chamouard - * - */ -public class StatusSelector - extends JMenu - implements ActionListener -{ - /** - * A reference of Systray - */ - private Systray parentSystray; - /** - * The protocol provider - */ - private ProtocolProviderService provider; - /** - * The presence status - */ - private OperationSetPresence presence; - - /** - * The logger for this class. - */ - private Logger logger = Logger.getLogger( - StatusSelector.class.getName()); - - /** - * Creates an instance of StatusSelector - * - * @param tray a reference of the parent Systray - * @param pro the protocol provider - * @param pre the presence status - */ - public StatusSelector(Systray tray, - ProtocolProviderService pro, OperationSetPresence pre) - { - - this.parentSystray = tray; - this.provider = pro; - this.presence = pre; - - /* 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); - } - - } - - /** - * Change the status of the protocol according to - * the menu item selected - * @param evt the event containing the menu item name - */ - public void actionPerformed(ActionEvent evt) - { - - JMenuItem menuItem = (JMenuItem) evt.getSource(); - - Iterator statusSet = presence.getSupportedStatusSet(); - - while (statusSet.hasNext()) - { - - PresenceStatus status = ((PresenceStatus) statusSet.next()); - - if (status.getStatusName().equals(menuItem.getText())) - { - - if (this.provider.getRegistrationState() - == RegistrationState.REGISTERED - && !presence.getPresenceStatus().equals(status)) - { - if (status.isOnline()) - { - - new PublishPresenceStatusThread(status).start(); - } - else - { - new ProviderUnRegistration(this.provider).start(); - } - } - else if (this.provider.getRegistrationState() - != RegistrationState.REGISTERED - && this.provider.getRegistrationState() - != RegistrationState.REGISTERING - && this.provider.getRegistrationState() - != RegistrationState.AUTHENTICATING - && status.isOnline()) - { - new ProviderRegistration(this.provider,parentSystray).start(); - } - else - { - if(!status.isOnline() - && !(this.provider.getRegistrationState() - == RegistrationState.UNREGISTERING)) - { - new ProviderUnRegistration(this.provider).start(); - } - } - - break; - } - } - } - - /** - * This class allow to use a thread to change the presence status. - */ - private class PublishPresenceStatusThread extends Thread - { - PresenceStatus status; - - public PublishPresenceStatusThread(PresenceStatus status) - { - this.status = status; - } - - public void run() - { - try { - presence.publishPresenceStatus(status, ""); - } - catch (IllegalArgumentException e1) - { - - logger.error("Error - changing status", e1); - } - catch (IllegalStateException e1) - { - - logger.error("Error - changing status", e1); - } - catch (OperationFailedException e1) - { - - if (e1.getErrorCode() - == OperationFailedException.GENERAL_ERROR) - { - - } - else if (e1.getErrorCode() - == OperationFailedException - .NETWORK_FAILURE) - { - - } - else if (e1.getErrorCode() - == OperationFailedException - .PROVIDER_NOT_REGISTERED) - { - - } - logger.error("Error - changing status", e1); - } - } - } - -} diff --git a/src/net/java/sip/communicator/plugin/systray/jdic/StatusSimpleSelector.java b/src/net/java/sip/communicator/plugin/systray/jdic/StatusSimpleSelector.java deleted file mode 100755 index c4c30b725..000000000 --- a/src/net/java/sip/communicator/plugin/systray/jdic/StatusSimpleSelector.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * SIP Communicator, 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.systray.jdic; - - -import java.awt.event.*; - -import javax.swing.*; - -import net.java.sip.communicator.service.protocol.*; -import net.java.sip.communicator.util.*; - - -/** - * The StatusSimpleSelector is a submenu which allow - * to select a status for a protocol provider which does not - * support the OperationSetPresence - * - * @author Nicolas Chamouard - * - */ -public class StatusSimpleSelector - extends JMenu - implements ActionListener -{ - /** - * A reference of Systray - */ - private Systray parentSystray; - /** - * The protocol provider - */ - private ProtocolProviderService provider; - - /** - * The logger for this class. - */ - private Logger logger = Logger.getLogger( - StatusSimpleSelector.class.getName()); - - /** - * The menu item for the online status - */ - private JMenuItem onlineItem = new JMenuItem( - Resources.getString("onlineStatus"), - new ImageIcon(Resources.getImage("sipLogo"))); - /** - * The menu item for the offline status - */ - private JMenuItem offlineItem = new JMenuItem( - Resources.getString("offlineStatus"), - new ImageIcon(Resources.getImage("sipLogoOffline"))); - - /** - * Creates an instance of StatusSimpleSelector - * - * @param tray a reference of the parent Systray - * @param pro the protocol provider - */ - public StatusSimpleSelector(Systray tray,ProtocolProviderService pro) - { - - this.provider = pro; - this.parentSystray = tray; - - /* the parent item */ - - ImageIcon icon; - - if(provider.isRegistered()) - { - icon = new ImageIcon(Resources.getImage("sipLogo")); - } - else - { - icon = new ImageIcon(Resources.getImage("sipLogoOffline")); - } - - this.setText(provider.getAccountID().getUserID()); - this.setIcon(icon); - - /* the menu itself */ - - this.onlineItem.addActionListener(this); - this.offlineItem.addActionListener(this); - - this.onlineItem.setName("online"); - this.offlineItem.setName("offline"); - - this.add(onlineItem); - this.add(offlineItem); - } - - /** - * Change the status of the protocol according to - * the menu item selected - * @param evt the event containing the menu item name - */ - public void actionPerformed(ActionEvent evt) - { - - JMenuItem menuItem = (JMenuItem) evt.getSource(); - String itemName = menuItem.getName(); - - if(itemName.equals("online")) - { - if(!this.provider.isRegistered()) - { - new ProviderRegistration(this.provider,parentSystray).start(); - } - } - else - { - if( !this.provider.getRegistrationState() - .equals(RegistrationState.UNREGISTERED) - && !this.provider.getRegistrationState() - .equals(RegistrationState.UNREGISTERING)) - { - new ProviderUnRegistration(this.provider).start(); - } - } - } -} diff --git a/src/net/java/sip/communicator/plugin/systray/jdic/StatusSubMenu.java b/src/net/java/sip/communicator/plugin/systray/jdic/StatusSubMenu.java deleted file mode 100755 index de598d454..000000000 --- a/src/net/java/sip/communicator/plugin/systray/jdic/StatusSubMenu.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * SIP Communicator, 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.systray.jdic; - - -import java.awt.*; -import java.util.*; - -import javax.swing.*; - -import net.java.sip.communicator.service.protocol.*; - -/** - * The StatusSubMenu provides a menu which allow - * to select the status for each of the protocol providers - * registered when the menu appears - * - * @author Nicolas Chamouard - * - */ - -public class StatusSubMenu -extends JMenu -//implements ActionListener -{ - - /** - * A reference of Systray - */ - private Systray parentSystray; - - /** - * Creates an instance of StatusSubMenu. - * @param tray a reference of the parent Systray - */ - public StatusSubMenu(Systray tray) - { - - parentSystray = tray; - - this.setText(Resources.getString("setStatus")); - this.setIcon( - new ImageIcon(Resources.getImage("statusMenuIcon"))); - - /* makes the menu look better */ - this.setPreferredSize(new Dimension(28, 24)); - - update(); - - } - - /** - * Updates the Menu by retrieving provider informations - */ - public void update() - { - - this.removeAll(); - - Iterator it=parentSystray.getProtocolProviders(); - - while(it.hasNext()){ - ProtocolProviderService provider = - (ProtocolProviderService) it.next(); - - Map supportedOperationSets - = provider.getSupportedOperationSets(); - - OperationSetPresence presence = (OperationSetPresence) - supportedOperationSets.get(OperationSetPresence.class.getName()); - - if (presence == null) - { - StatusSimpleSelector s = - new StatusSimpleSelector(parentSystray,provider); - - this.add(s); - } - else - { - StatusSelector s = - new StatusSelector(parentSystray,provider,presence); - - this.add(s); - } - } - } - - - -} \ No newline at end of file diff --git a/src/net/java/sip/communicator/plugin/systray/jdic/Systray.java b/src/net/java/sip/communicator/plugin/systray/jdic/Systray.java deleted file mode 100644 index 579aa9b0f..000000000 --- a/src/net/java/sip/communicator/plugin/systray/jdic/Systray.java +++ /dev/null @@ -1,265 +0,0 @@ -/* - * SIP Communicator, 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.systray.jdic; - -import java.util.*; -import java.awt.event.*; -import javax.swing.*; - -import net.java.sip.communicator.util.*; -import net.java.sip.communicator.service.gui.*; -import net.java.sip.communicator.plugin.systray.*; -import net.java.sip.communicator.service.protocol.*; -import net.java.sip.communicator.service.protocol.event.*; - -import org.jdesktop.jdic.tray.*; -import org.osgi.framework.*; - -/** - * - * The Systray provides a Icon and the associated TrayMenu - * in the system tray using the Jdic library. - * - * - * @author Nicolas Chamouard - * - */ - -public class Systray - implements ServiceListener, - MessageListener, - SecurityAuthority -{ - - /** - * A reference of the UIservice - */ - private UIService uiService; - - /** - * The icon in the system tray - */ - private TrayIcon trayIcon; - - /** - * The menu that spring with a right click - */ - private TrayMenu menu; - - /** - * this table contains an up-to-date list of all providers - */ - private Hashtable protocolProviderTable = new Hashtable(); - - /** - * The logger for this class. - */ - private static Logger logger = - Logger.getLogger(Systray.class.getName()); - - /** - * Creates an instance of Systray. - * @param service a reference of the current UIservice - */ - public Systray(UIService service) - { - this.uiService = service; - - uiService.setExitOnMainWindowClose(false); - - BundleContext bc = SystrayActivator.bundleContext; - - /* we fill the protocolProviderTable with all - * running protocol providers at the start of - * the bundle - */ - - bc.addServiceListener(this); - ServiceReference[] protocolProviderRefs = null; - try - { - protocolProviderRefs = bc.getServiceReferences( - ProtocolProviderService.class.getName(),null); - } - catch (InvalidSyntaxException ex) - { - // this shouldn't happen since we're providing no parameter string - // but let's log just in case. - logger.error("Error while retrieving service refs", ex); - return; - } - - // in case we found any - if (protocolProviderRefs != null) - { - - for (int i = 0; i < protocolProviderRefs.length; i++) - { - ProtocolProviderService provider = (ProtocolProviderService) bc - .getService(protocolProviderRefs[i]); - - this.protocolProviderTable.put( - provider.getAccountID(), - provider); - handleProviderAdded(provider); - - } - } - - /* the system tray icon itself */ - - SystemTray tray = SystemTray.getDefaultSystemTray(); - - ImageIcon logoIcon = new ImageIcon(Resources.getImage("trayIcon")); - menu = new TrayMenu(uiService,this); - - trayIcon = new TrayIcon( - logoIcon, "SIP Communicator", menu); - trayIcon.setIconAutoSize(true); - - trayIcon.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - - if(uiService.isVisible()) - { - uiService.setVisible(false); - } - else - { - uiService.setVisible(true); - } - } - }); - - tray.addTrayIcon(trayIcon); - } - - - /** - * Returns a set of all protocol providers. - * - * @return a set of all protocol providers. - */ - public Iterator getProtocolProviders() - { - return this.protocolProviderTable.values().iterator(); - } - - /** - * Currently unused - * @param evt ignored - */ - public void messageDelivered(MessageDeliveredEvent evt) - { - } - - /** - * Currently unused - * @param evt ignored - */ - public void messageDeliveryFailed(MessageDeliveryFailedEvent evt) - { - } - - /** - * Display in a balloon the newly received message - * @param evt the event containing the message - */ - public void messageReceived(MessageReceivedEvent evt) - { - - ApplicationWindow window = uiService.getChatWindow(evt.getSourceContact()); - - if(window.isWindowVisible()) - { - - String contactName = evt.getSourceContact().getDisplayName(); - String message = evt.getSourceMessage().getContent(); - this.trayIcon.displayMessage(contactName,message,TrayIcon.INFO_MESSAGE_TYPE); - } - } - - /** - * When a service ist registered or unregistered, we update - * the provider tables and add/remove listeners (if it supports - * BasicInstantMessenging implementation) - * - * @param event ServiceEvent - */ - public void serviceChanged(ServiceEvent event) - { - - ProtocolProviderService provider = (ProtocolProviderService) - SystrayActivator.bundleContext.getService(event.getServiceReference()); - - if (event.getType() == ServiceEvent.REGISTERED){ - protocolProviderTable.put(provider.getAccountID(),provider); - handleProviderAdded(provider); - - } - if (event.getType() == ServiceEvent.UNREGISTERING){ - protocolProviderTable.remove(provider.getAccountID()); - handleProviderRemoved(provider); - } - - } - - /** - * Checks if the provider has an implementation - * of OperationSetBasicInstantMessaging and - * if so add a listerner to it - * - * @param provider ProtocolProviderService - */ - private void handleProviderAdded(ProtocolProviderService provider) - { - OperationSetBasicInstantMessaging opSetIm - = (OperationSetBasicInstantMessaging) provider - .getSupportedOperationSets().get( - OperationSetBasicInstantMessaging.class.getName()); - - if(opSetIm != null) - opSetIm.addMessageListener(this); - - } - - /** - * Checks if the provider has an implementation - * of OperationSetBasicInstantMessaging and - * if so remove its listerner - * - * @param provider ProtocolProviderService - */ - private void handleProviderRemoved(ProtocolProviderService provider) - { - OperationSetBasicInstantMessaging opSetIm - = (OperationSetBasicInstantMessaging) provider - .getSupportedOperationSets().get( - OperationSetBasicInstantMessaging.class.getName()); - - if(opSetIm != null) - opSetIm.removeMessageListener(this); - - } - - /** - * Used to login to the protocol providers - * @param realm the realm that the credentials are needed for - * @param defaultValues the values to propose the user by default - * @return The Credentials associated with the speciefied realm - */ - public UserCredentials obtainCredentials(String realm, UserCredentials defaultValues) - { - - return null; - } - - -} diff --git a/src/net/java/sip/communicator/plugin/systray/jdic/TrayMenu.java b/src/net/java/sip/communicator/plugin/systray/jdic/TrayMenu.java deleted file mode 100644 index df48d7b23..000000000 --- a/src/net/java/sip/communicator/plugin/systray/jdic/TrayMenu.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * SIP Communicator, 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.systray.jdic; - -import java.awt.event.*; - -import javax.swing.*; -import javax.swing.event.*; - -import net.java.sip.communicator.plugin.systray.*; -import net.java.sip.communicator.service.gui.*; -import net.java.sip.communicator.util.*; - -import org.osgi.framework.*; - -/** - * The Traymenu is the menu that appears when the user right-click - * on the systray icon - * - * @author Nicolas Chamouard - */ -public class TrayMenu - extends JPopupMenu - implements ActionListener, - PopupMenuListener -{ - /** - * The logger for this class. - */ - private Logger logger = Logger.getLogger(TrayMenu.class.getName()); - - /** - * A reference of the Uiservice - */ - private UIService uiService; - /** - * A reference of Systray - */ - private Systray parentSystray; - - private JMenuItem settingsItem = new JMenuItem( - Resources.getString("settings"), - new ImageIcon(Resources.getImage("settingsMenuIcon"))); - - private JMenuItem closeItem = new JMenuItem( - Resources.getString("close"), - new ImageIcon(Resources.getImage("closeMenuIcon"))); - - private JMenuItem addContactMenuItem = new JMenuItem( - Resources.getString("addContact"), - new ImageIcon(Resources.getImage("addContactIcon"))); - - private StatusSubMenu setStatusMenu; - - /** - * The configuration window called by the menu item "settings" - */ - private ConfigurationWindow configDialog; - - - /** - * Creates an instance of TrayMenu. - * @param service a reference of the current UIservice - * @param tray a reference of the parent Systray - */ - public TrayMenu(UIService service, Systray tray) - { - uiService = service; - parentSystray = tray; - - setStatusMenu = new StatusSubMenu(tray); - - this.add(settingsItem); - this.add(addContactMenuItem); - this.addSeparator(); - this.add(setStatusMenu); - this.addSeparator(); - this.add(closeItem); - - this.settingsItem.setName("settings"); - this.closeItem.setName("close"); - this.addContactMenuItem.setName("addContact"); - - this.settingsItem.addActionListener(this); - this.closeItem.addActionListener(this); - this.addContactMenuItem.addActionListener(this); - - this.addPopupMenuListener(this); - - } - - /** - * Handles the ActionEvent when one of the menu items is selected. - * @param evt the event containing the menu item name - */ - public void actionPerformed(ActionEvent evt) - { - - JMenuItem menuItem = (JMenuItem) evt.getSource(); - String itemName = menuItem.getName(); - - if(itemName.equals("settings")) - { - configDialog = uiService.getConfigurationWindow(); - configDialog.showWindow(); - } - else if(itemName.equals("close")) - { - try - { - SystrayActivator.bundleContext.getBundle(0).stop(); - } catch (BundleException ex) - { - logger.error("Failed to gently shutdown Felix", ex); - System.exit(0); - } - - } - else if(itemName.equals("addContact")) - { - ApplicationWindow dialog = uiService.getApplicationWindow( - ApplicationWindow.ADD_CONTACT_WINDOW); - - if(dialog != null) - dialog.showWindow(); - else - uiService.getPopupDialog().showMessagePopupDialog( - Resources.getString("failedToLoadAddContactDialog")); - } - } - - /** - * Currently unused - * @param evt ignored - */ - public void popupMenuCanceled(PopupMenuEvent evt) - { - } - - /** - * Currently unused - * @param evt ignored - */ - public void popupMenuWillBecomeInvisible(PopupMenuEvent evt) - { - } - - /** - * Fill the menu with items when it is displayed - * @param evt ignored - */ - public void popupMenuWillBecomeVisible(PopupMenuEvent evt) - { - setStatusMenu.update(); - } - -} \ No newline at end of file diff --git a/src/net/java/sip/communicator/plugin/systray/jdic/resources.properties b/src/net/java/sip/communicator/plugin/systray/jdic/resources.properties deleted file mode 100755 index 583289b97..000000000 --- a/src/net/java/sip/communicator/plugin/systray/jdic/resources.properties +++ /dev/null @@ -1,14 +0,0 @@ -trayIcon=net/java/sip/communicator/plugin/systray/resources/systrayIcon.png -addContactIcon=net/java/sip/communicator/plugin/systray/resources/addContactIcon.png -statusMenuIcon=net/java/sip/communicator/plugin/systray/resources/statusIcon.png -settingsMenuIcon=net/java/sip/communicator/plugin/systray/resources/configureIcon.png -closeMenuIcon=net/java/sip/communicator/plugin/systray/resources/quit.png -sipLogo=net/java/sip/communicator/plugin/systray/resources/sipLogo.png -sipLogoOffline=net/java/sip/communicator/plugin/systray/resources/sipLogoOffline.png -settings=Settings... -addContact=Add contact... -setStatus=Set Status -close=Close -onlineStatus=Online -offlineStatus=Offline -failedToLoadAddContactDialog=Failed to load the "Add contact" wizard dialog. \ No newline at end of file diff --git a/src/net/java/sip/communicator/plugin/systray/resources/addContactIcon.png b/src/net/java/sip/communicator/plugin/systray/resources/addContactIcon.png deleted file mode 100755 index 947ecd76bd6d083f2d26b84ba6abba22381c111b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 836 zcmV-K1H1f*P)pzA zPyt@u&&g4Mh0^xfmGO-ly*BjP5Z@-Jx5eZ44xc;y_UinhfWR3XCE0Brq zuDo0@{h1|yUA4>v{$xcwz2u9NkLhPW`{=FnBLUG+&MKk3g6w-eO8E3yD72~O1_%K` z4*S@ge(CJHtM`p^AZ?L3g1raJ(mjF6u2A6EoSD79YCZ-Kubryj-RY|{gH+}LQf*FZ zY&-8tD)tuhZUf_tF<%v&c+|so9RPm2CjR~EXZ5hPosNC^XFTyB2ml1yHVE1oG(?HZ zat5SC-2yxJ4=0v(7h61HCKsm7o0je63rF1X_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*fr9G4^RW`rmroc2>Sbg;nAW3N@!E@YYO>W^r&DicKS`Zi9o<1X(BV)yy|Reg z)1K1fckkXtIdb&ag>H{_Xs#$NeEVsPX40tw{vmz?LZz^!W%t-U00000 LNkvXXu0mjfcc>a= diff --git a/src/net/java/sip/communicator/plugin/systray/resources/systrayIcon.png b/src/net/java/sip/communicator/plugin/systray/resources/systrayIcon.png deleted file mode 100755 index 6f2ee2f52375d6680a1ec479f7c5cadb906b283a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1135 zcmV-#1d#iQP)JOMOIm0*T)Y5A zAV7Rk3`BkLFYwg_6BC|%@>yRnCTe100*^i!!-I&aBoIXGMUX=6(mUO@Zuh?D?3wXF zVq#iov$V|1WF|Ae&-^Bn{6_oa(rv{Sw7TbEnC6D-^sT@E{+_!}wNiP0V7s}3%uhcb z(64)}W@p$D$ZkKlvb4ypkx5>OW|*q9Y`ETN6w0p_n4HS8kdrtn!?~#9rrXL8XMy2JAHLpBrCi1ig|;5F+-1(c@I9x} z3K2_k?uQl@t2qiQ0?Y13)3mJx6A_Iw2b;hM0`T#n-#GiZV&+eq{&tI=js$_hcb*-T zzR$z^W8C?5hyzxb(`gTK^IRP1MQ`uHPIhu`_ZP%%$%WZ8iH^R;K&2Gdu3TYhDT`|+ zG1^XX@j-#89Adnb<`;RKu00k3LuV#9$btS-io3ZaZ;2AkA-6HGQq1EiLD!Br0aFk(brc|dg)bE~*Z&uLJib?m z;`xf~s)SSnV6|K#8jD~A1$ED(DR-M*W0Ja8LkNup=`ddHrfhZL`-+^~#?XTYC}FP~ zZ$r>-icnfyK&$DrR({86F>qBY@mQG??GNd4s@$4eoCRUm!Ej}bu%2ga+S&XJo^(j zXdT>1A$f$Bl*81H7ZITZQV1%Q8m_2g7y==5(()mGewi=54`J8f=E0SvWma+}bSuU# z`#$G`-|}7V44>ZWrXt#K%M}bE5Qg}#*JPc%8Q`1Jdz5ycerl0j1J2IOKsbfvE9P