From ec7d85d6437cd2125fd4709314cf81a4dbe35a68 Mon Sep 17 00:00:00 2001 From: Damian Minkov Date: Tue, 26 Jun 2012 07:32:52 +0000 Subject: [PATCH] Fixes wrong menu item states, missing some configuration evaluation. --- .../MetaContactRightButtonMenu.java | 34 ++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/MetaContactRightButtonMenu.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/MetaContactRightButtonMenu.java index 635571831..0b87d5887 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/MetaContactRightButtonMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/MetaContactRightButtonMenu.java @@ -375,6 +375,8 @@ private void init() CallManager.getTelephonyProviders(); boolean hasPhones = false; boolean separator = false; + boolean routingForVideoEnabled = false; + boolean routingForDesktopEnabled = false; while (contacts.hasNext()) { @@ -460,6 +462,24 @@ else if(d instanceof MobilePhoneDetail) } } + routingForVideoEnabled = + ConfigurationManager + .isRouteVideoAndDesktopUsingPhoneNumberEnabled() + && phones.size() > 0 + && GuiActivator.getOpSetRegisteredProviders( + OperationSetVideoTelephony.class, + null, + null).size() > 0; + routingForDesktopEnabled = + ConfigurationManager + .isRouteVideoAndDesktopUsingPhoneNumberEnabled() + && phones.size() > 0 + && GuiActivator.getOpSetRegisteredProviders( + OperationSetDesktopSharingServer.class, + null, + null).size() > 0; + + // add all the contacts that support telephony to the call menu if (metaContact.getContactCount() > 1 || phones.size() > 0) { @@ -479,7 +499,8 @@ else if(d instanceof MobilePhoneDetail) if (protocolProvider.getOperationSet( OperationSetVideoTelephony.class) != null && hasContactCapabilities(contact, - OperationSetVideoTelephony.class)) + OperationSetVideoTelephony.class) + || routingForVideoEnabled) { videoCallMenu.add( createMenuItem( contactAddress, @@ -491,7 +512,8 @@ else if(d instanceof MobilePhoneDetail) if (protocolProvider.getOperationSet( OperationSetDesktopSharingServer.class) != null && hasContactCapabilities(contact, - OperationSetDesktopSharingServer.class)) + OperationSetDesktopSharingServer.class) + || routingForDesktopEnabled) { multiContactFullShareMenu.add( createMenuItem( contactAddress, @@ -694,11 +716,15 @@ else if (authRequestItemCount == 1 this.callItem.setEnabled(false); if (metaContact.getDefaultContact( - OperationSetVideoTelephony.class) == null) + OperationSetVideoTelephony.class) == null + && !routingForVideoEnabled) + { this.videoCallItem.setEnabled(false); + } if (metaContact.getDefaultContact( - OperationSetDesktopSharingServer.class) == null) + OperationSetDesktopSharingServer.class) == null + && !routingForDesktopEnabled) { fullShareMenuItem.setEnabled(false); regionShareMenuItem.setEnabled(false);