diff options
author | Damian Minkov <damencho@jitsi.org> | 2013-12-04 16:33:39 +0200 |
---|---|---|
committer | Damian Minkov <damencho@jitsi.org> | 2013-12-04 16:33:39 +0200 |
commit | 1c173976e3c81bf32734a0cf380409b6a19a4232 (patch) | |
tree | 41088bfb7852b8d816f84344d1bd30ea6a7006ea /src/net/java/sip | |
parent | c83f720007e5baa8770d5912c0e281d263adfb6b (diff) | |
download | jitsi-1c173976e3c81bf32734a0cf380409b6a19a4232.zip jitsi-1c173976e3c81bf32734a0cf380409b6a19a4232.tar.gz jitsi-1c173976e3c81bf32734a0cf380409b6a19a4232.tar.bz2 |
Adds extended away global status.
Diffstat (limited to 'src/net/java/sip')
8 files changed, 123 insertions, 10 deletions
diff --git a/src/net/java/sip/communicator/impl/globaldisplaydetails/GlobalStatusServiceImpl.java b/src/net/java/sip/communicator/impl/globaldisplaydetails/GlobalStatusServiceImpl.java index dd01d0c..eb2596d 100644 --- a/src/net/java/sip/communicator/impl/globaldisplaydetails/GlobalStatusServiceImpl.java +++ b/src/net/java/sip/communicator/impl/globaldisplaydetails/GlobalStatusServiceImpl.java @@ -101,10 +101,14 @@ public class GlobalStatusServiceImpl { return GlobalStatusEnum.OFFLINE; } - else if(status < PresenceStatus.AWAY_THRESHOLD) + else if(status < PresenceStatus.EXTENDED_AWAY_THRESHOLD) { return GlobalStatusEnum.DO_NOT_DISTURB; } + else if(status < PresenceStatus.AWAY_THRESHOLD) + { + return GlobalStatusEnum.EXTENDED_AWAY; + } else if(status < PresenceStatus.AVAILABLE_THRESHOLD) { return GlobalStatusEnum.AWAY; @@ -177,13 +181,21 @@ public class GlobalStatusServiceImpl PresenceStatus.AWAY_THRESHOLD, PresenceStatus.AVAILABLE_THRESHOLD); } + else if (lastStatus.equals( + GlobalStatusEnum.EXTENDED_AWAY_STATUS)) + { + status = getPresenceStatus( + protocolProvider, + PresenceStatus.EXTENDED_AWAY_THRESHOLD, + PresenceStatus.AWAY_THRESHOLD); + } else if (lastStatus .equals(GlobalStatusEnum.DO_NOT_DISTURB_STATUS)) { status = getPresenceStatus( protocolProvider, PresenceStatus.ONLINE_THRESHOLD, - PresenceStatus.AWAY_THRESHOLD); + PresenceStatus.EXTENDED_AWAY_THRESHOLD); } else if (lastStatus .equals(GlobalStatusEnum.FREE_FOR_CHAT_STATUS)) @@ -448,7 +460,7 @@ public class GlobalStatusServiceImpl publishStatus( protocolProvider, PresenceStatus.ONLINE_THRESHOLD, - PresenceStatus.AWAY_THRESHOLD); + PresenceStatus.EXTENDED_AWAY_THRESHOLD); } else if (itemName.equals(GlobalStatusEnum.AWAY_STATUS)) { @@ -466,6 +478,22 @@ public class GlobalStatusServiceImpl PresenceStatus.AWAY_THRESHOLD, PresenceStatus.AVAILABLE_THRESHOLD); } + else if (itemName.equals(GlobalStatusEnum.EXTENDED_AWAY_STATUS)) + { + if(!protocolProvider.isRegistered()) + { + saveStatusInformation(protocolProvider, itemName); + + GlobalDisplayDetailsActivator.getUIService() + .getLoginManager().login(protocolProvider); + } + else + // a status in the away interval + publishStatus( + protocolProvider, + PresenceStatus.EXTENDED_AWAY_THRESHOLD, + PresenceStatus.AWAY_THRESHOLD); + } } } diff --git a/src/net/java/sip/communicator/impl/gui/main/presence/GlobalStatusSelectorBox.java b/src/net/java/sip/communicator/impl/gui/main/presence/GlobalStatusSelectorBox.java index c80a3aa..fec417c 100644 --- a/src/net/java/sip/communicator/impl/gui/main/presence/GlobalStatusSelectorBox.java +++ b/src/net/java/sip/communicator/impl/gui/main/presence/GlobalStatusSelectorBox.java @@ -413,6 +413,10 @@ public class GlobalStatusSelectorBox { imgType = SystrayService.SC_IMG_AWAY_TYPE; } + else if (globalStatus.equals(GlobalStatusEnum.EXTENDED_AWAY)) + { + imgType = SystrayService.SC_IMG_EXTENDED_AWAY_TYPE; + } else if (globalStatus.equals(GlobalStatusEnum.ONLINE)) { imgType = SystrayService.SC_IMG_TYPE; diff --git a/src/net/java/sip/communicator/impl/osdependent/jdic/StatusSubMenu.java b/src/net/java/sip/communicator/impl/osdependent/jdic/StatusSubMenu.java index e70a498..fd4faf1 100644 --- a/src/net/java/sip/communicator/impl/osdependent/jdic/StatusSubMenu.java +++ b/src/net/java/sip/communicator/impl/osdependent/jdic/StatusSubMenu.java @@ -408,10 +408,14 @@ public class StatusSubMenu { nameToSelect = GlobalStatusEnum.OFFLINE_STATUS; } - else if(status < PresenceStatus.AWAY_THRESHOLD) + else if(status < PresenceStatus.EXTENDED_AWAY_THRESHOLD) { nameToSelect = GlobalStatusEnum.DO_NOT_DISTURB_STATUS; } + else if(status < PresenceStatus.AWAY_THRESHOLD) + { + nameToSelect = GlobalStatusEnum.EXTENDED_AWAY_STATUS; + } else if(status < PresenceStatus.AVAILABLE_THRESHOLD) { nameToSelect = GlobalStatusEnum.AWAY_STATUS; diff --git a/src/net/java/sip/communicator/impl/osdependent/jdic/SystrayServiceJdicImpl.java b/src/net/java/sip/communicator/impl/osdependent/jdic/SystrayServiceJdicImpl.java index 60d87fe..0e0d7b6 100644 --- a/src/net/java/sip/communicator/impl/osdependent/jdic/SystrayServiceJdicImpl.java +++ b/src/net/java/sip/communicator/impl/osdependent/jdic/SystrayServiceJdicImpl.java @@ -82,6 +82,8 @@ public class SystrayServiceJdicImpl private ImageIcon logoIconAway; + private ImageIcon logoIconExtendedAway; + private ImageIcon logoIconFFC; private ImageIcon logoIconDND; @@ -101,6 +103,8 @@ public class SystrayServiceJdicImpl private URL dockIconAway; + private URL dockIconExtendedAway; + private URL dockIconFFC; private URL dockIconDND; @@ -193,6 +197,8 @@ public class SystrayServiceJdicImpl "service.systray.TRAY_ICON_WINDOWS_OFFLINE"); logoIconAway = Resources.getImage( "service.systray.TRAY_ICON_WINDOWS_AWAY"); + logoIconExtendedAway = Resources.getImage( + "service.systray.TRAY_ICON_WINDOWS_EXTENDED_AWAY"); logoIconFFC = Resources.getImage( "service.systray.TRAY_ICON_WINDOWS_FFC"); logoIconDND = Resources.getImage( @@ -220,6 +226,8 @@ public class SystrayServiceJdicImpl logoIconOffline = Resources.getImage( "service.systray.TRAY_ICON_OFFLINE"); logoIconAway = Resources.getImage("service.systray.TRAY_ICON_AWAY"); + logoIconExtendedAway = Resources.getImage( + "service.systray.TRAY_ICON_EXTENDED_AWAY"); logoIconFFC = Resources.getImage("service.systray.TRAY_ICON_FFC"); logoIconDND = Resources.getImage("service.systray.TRAY_ICON_DND"); envelopeIcon = Resources.getImage("service.systray.MESSAGE_ICON"); @@ -248,6 +256,8 @@ public class SystrayServiceJdicImpl "service.systray.DOCK_ICON_OFFLINE"); dockIconAway = Resources.getImageURL( "service.systray.DOCK_ICON_AWAY"); + dockIconExtendedAway = Resources.getImageURL( + "service.systray.DOCK_ICON_EXTENDED_AWAY"); dockIconFFC = Resources.getImageURL("service.systray.DOCK_ICON_FFC"); dockIconDND = @@ -377,6 +387,10 @@ public class SystrayServiceJdicImpl if (!isMac) systrayIconToSet = logoIconAway; break; + case SystrayService.SC_IMG_EXTENDED_AWAY_TYPE: + if (!isMac) + systrayIconToSet = logoIconExtendedAway; + break; case SystrayService.SC_IMG_FFC_TYPE: if (!isMac) systrayIconToSet = logoIconFFC; @@ -414,6 +428,9 @@ public class SystrayServiceJdicImpl case SystrayService.SC_IMG_AWAY_TYPE: dockIconURLToSet = dockIconAway; break; + case SystrayService.SC_IMG_EXTENDED_AWAY_TYPE: + dockIconURLToSet = dockIconExtendedAway; + break; case SystrayService.SC_IMG_FFC_TYPE: dockIconURLToSet = dockIconFFC; break; diff --git a/src/net/java/sip/communicator/service/protocol/PresenceStatus.java b/src/net/java/sip/communicator/service/protocol/PresenceStatus.java index 40fc2da..76a27c3 100644 --- a/src/net/java/sip/communicator/service/protocol/PresenceStatus.java +++ b/src/net/java/sip/communicator/service/protocol/PresenceStatus.java @@ -39,7 +39,13 @@ public class PresenceStatus * An integer above which all values of the status coefficient indicate both * connectivity and availability but the person is away from the computer. */ - public static final int AWAY_THRESHOLD = 31; + public static final int EXTENDED_AWAY_THRESHOLD = 32; + + /** + * An integer above which all values of the status coefficient indicate both + * connectivity and availability but the person is away from the computer. + */ + public static final int AWAY_THRESHOLD = 36; /** * An integer above which all values of the status coefficient indicate both diff --git a/src/net/java/sip/communicator/service/protocol/globalstatus/GlobalStatusEnum.java b/src/net/java/sip/communicator/service/protocol/globalstatus/GlobalStatusEnum.java index 630c1e3..ad285c1 100644 --- a/src/net/java/sip/communicator/service/protocol/globalstatus/GlobalStatusEnum.java +++ b/src/net/java/sip/communicator/service/protocol/globalstatus/GlobalStatusEnum.java @@ -8,6 +8,7 @@ package net.java.sip.communicator.service.protocol.globalstatus; import java.util.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.util.*; /** * The global statuses available to the system. @@ -32,6 +33,11 @@ public class GlobalStatusEnum public static final String AWAY_STATUS = "Away"; /** + * Indicates that the user is extended away. + */ + public static final String EXTENDED_AWAY_STATUS = "Extended Away"; + + /** * Indicates that the user is connected and eager to communicate. */ public static final String FREE_FOR_CHAT_STATUS = "Free For Chat"; @@ -76,6 +82,17 @@ public class GlobalStatusEnum "service.gui.AWAY_STATUS"); /** + * The Away status. Indicates that the user has connectivity but might + * not be able to immediately act upon initiation of communication. + */ + public static final GlobalStatusEnum EXTENDED_AWAY + = new GlobalStatusEnum( + 35, + EXTENDED_AWAY_STATUS, + loadIcon("service.gui.statusicons.USER_EXTENDED_AWAY_ICON"), + "service.gui.EXTENDED_AWAY_STATUS"); + + /** * The DND status. Indicates that the user has connectivity but prefers * not to be contacted. */ @@ -107,6 +124,10 @@ public class GlobalStatusEnum globalStatusSet.add(ONLINE); globalStatusSet.add(FREE_FOR_CHAT); globalStatusSet.add(AWAY); + + if(!ConfigurationUtils.isHideExtendedAwayStatus()) + globalStatusSet.add(EXTENDED_AWAY); + globalStatusSet.add(DO_NOT_DISTURB); globalStatusSet.add(OFFLINE); } diff --git a/src/net/java/sip/communicator/service/systray/SystrayService.java b/src/net/java/sip/communicator/service/systray/SystrayService.java index 9138e39..c38ea78 100644 --- a/src/net/java/sip/communicator/service/systray/SystrayService.java +++ b/src/net/java/sip/communicator/service/systray/SystrayService.java @@ -37,31 +37,36 @@ public interface SystrayService public static final int NONE_MESSAGE_TYPE = -1; /** - * Image type corresponding to the sip-communicator icon + * Image type corresponding to the jitsi icon */ public static final int SC_IMG_TYPE = 0; /** - * Image type corresponding to the sip-communicator offline icon + * Image type corresponding to the jitsi offline icon */ public static final int SC_IMG_OFFLINE_TYPE = 2; /** - * Image type corresponding to the sip-communicator away icon + * Image type corresponding to the jitsi away icon */ public static final int SC_IMG_AWAY_TYPE = 3; /** - * Image type corresponding to the sip-communicator free for chat icon + * Image type corresponding to the jitsi free for chat icon */ public static final int SC_IMG_FFC_TYPE = 4; /** - * Image type corresponding to the sip-communicator do not disturb icon + * Image type corresponding to the jitsi do not disturb icon */ public static final int SC_IMG_DND_TYPE = 5; /** + * Image type corresponding to the jitsi away icon + */ + public static final int SC_IMG_EXTENDED_AWAY_TYPE = 6; + + /** * Image type corresponding to the envelope icon */ public static final int ENVELOPE_IMG_TYPE = 1; diff --git a/src/net/java/sip/communicator/util/ConfigurationUtils.java b/src/net/java/sip/communicator/util/ConfigurationUtils.java index 0f951a4..8000bf3 100644 --- a/src/net/java/sip/communicator/util/ConfigurationUtils.java +++ b/src/net/java/sip/communicator/util/ConfigurationUtils.java @@ -292,6 +292,11 @@ public class ConfigurationUtils private static boolean hideAccountStatusSelectors = false; /** + * Hide extended away status. + */ + private static boolean hideExtendedAwayStatus = false; + + /** * Whether to disable creation of auto answer submenu. */ private static boolean autoAnswerDisableSubmenu = false; @@ -890,6 +895,20 @@ public class ConfigurationUtils isHideAddressInCallHistoryTooltipEnabled = configService.getBoolean( HIDE_ADDR_IN_CALL_HISTORY_TOOLTIP_PROPERTY, isHideAddressInCallHistoryTooltipEnabled); + + String hideExtendedAwayStatusProperty + = "net.java.sip.communicator.service.protocol" + + ".globalstatus.HIDE_EXTENDED_AWAY_STATUS"; + String hideExtendedAwayStatusDefaultValue = UtilActivator.getResources() + .getSettingsString(hideExtendedAwayStatusProperty); + + if(hideExtendedAwayStatusDefaultValue != null) + hideExtendedAwayStatus = Boolean.parseBoolean( + hideExtendedAwayStatusDefaultValue); + + hideExtendedAwayStatus = configService.getBoolean( + hideExtendedAwayStatusProperty, + hideExtendedAwayStatus); } /** @@ -1739,6 +1758,15 @@ public class ConfigurationUtils } /** + * Whether to hide extended away status from global menu. + * @return whether to hide extended away status. + */ + public static boolean isHideExtendedAwayStatus() + { + return hideExtendedAwayStatus; + } + + /** * Whether creation of separate submenu for auto answer is disabled. * @return whether creation of separate submenu for auto answer * is disabled. |