[jitsi-dev] Re: [jitsi~svn:10606] Add configuration to remove support for contact groups from the Jitsi UI.


#1

Hey Tom,

it is a good addition, but I think there is still work to be done here
after I tested it.
I have some empty spaces in the contact list and also moving with the
keyboard in the list at some point there is no selected contact(see
the screenshot attached).
Also with right click there is still "Move to group" menu.
And also File -> Create Group, and when adding contact you can choose a group.
My opinion is if the user is not seeing the groups we must not show
them at all in any part of the application.
You have removed some star imports, please stick to the code convention.
(-import net.java.sip.communicator.service.protocol.ServerStoredDetails.*:wink:

Thanks
damencho

···

On Fri, Mar 15, 2013 at 1:42 PM, <tomdenham@java.net> wrote:

Project: jitsi
Repository: svn
Revision: 10606
Author: tomdenham
Date: 2013-03-15 11:42:02 UTC
Link:

Log Message:
------------
Add configuration to remove support for contact groups from the Jitsi UI.

To enable, set
net.java.sip.communicator.impl.gui.main.contactlist.FLATTEN_GROUP_ENABLED

Default is that no behaviour is changed.

Revisions:
----------
10606

Modified Paths:
---------------
trunk/src/net/java/sip/communicator/impl/contactlist/MclStorageManager.java
trunk/src/net/java/sip/communicator/impl/gui/main/contactlist/MetaContactRightButtonMenu.java
trunk/src/net/java/sip/communicator/impl/gui/main/contactlist/GroupNode.java
trunk/src/net/java/sip/communicator/util/ConfigurationUtils.java
trunk/src/net/java/sip/communicator/impl/contactlist/MetaContactImpl.java
trunk/src/net/java/sip/communicator/impl/gui/main/contactlist/TreeContactList.java

Diffs:
------
Index: trunk/src/net/java/sip/communicator/impl/contactlist/MetaContactImpl.java

--- trunk/src/net/java/sip/communicator/impl/contactlist/MetaContactImpl.java (revision 10605)
+++ trunk/src/net/java/sip/communicator/impl/contactlist/MetaContactImpl.java (revision 10606)
@@ -941,7 +941,7 @@

         List<String> values = details.get(name);

- if(values == null)
+ if (values == null)
         {
             values = new ArrayList<String>();
             details.put(name, values);
@@ -963,7 +963,7 @@
             return;

         List<String> values = details.get(name);
- if(values == null)
+ if (values == null)
             return;

         values.remove(value);
Index: trunk/src/net/java/sip/communicator/impl/contactlist/MclStorageManager.java

--- trunk/src/net/java/sip/communicator/impl/contactlist/MclStorageManager.java (revision 10605)
+++ trunk/src/net/java/sip/communicator/impl/contactlist/MclStorageManager.java (revision 10606)
@@ -31,12 +31,12 @@
  * the following:
  * <p>
  * 1) The MetaContactListService is started. <br>
- * 2) If no file exists for the meta contact list, create one. 3) We receive an
- * OSGI event telling us that a new ProtocolProviderService is registered or we
- * simply retrieve one that was already in the bundle 4) We look through the
- * contact list file and load groups and contacts belonging to this new
- * provider. Unresolved proto groups and contacts will be created for every one
- * of them.
+ * 2) If no file exists for the meta contact list, create one. <br>
+ * 3) We receive an OSGI event telling us that a new ProtocolProviderService is
+ * registered or we simply retrieve one that was already in the bundle <br>
+ * 4) We look through the contact list file and load groups and contacts
+ * belonging to this new provider. Unresolved proto groups and contacts will be
+ * created for every one of them.
  * <p>
  *
  * @author Emil Ivov
Index: trunk/src/net/java/sip/communicator/impl/gui/main/contactlist/TreeContactList.java

--- trunk/src/net/java/sip/communicator/impl/gui/main/contactlist/TreeContactList.java (revision 10605)
+++ trunk/src/net/java/sip/communicator/impl/gui/main/contactlist/TreeContactList.java (revision 10606)
@@ -466,8 +466,15 @@
         }

         GroupNode groupNode = null;
- if (group == null)
+ if (group == null ||
+ (ConfigurationUtils.isFlattenGroupEnabled() &&
+ group instanceof MetaUIGroup))
+ {
+ // When contact groups are flattened, force all contacts that are
+ // in a MetaUI group into the root so they don't appear to be
+ // under a contact group.
             groupNode = treeModel.getRoot();
+ }
         else if (group instanceof UIGroupImpl)
         {
             UIGroupImpl contactImpl = (UIGroupImpl) group;
@@ -675,8 +682,14 @@
             return;
         }

- if (!(group instanceof UIGroupImpl))
+ if ((!(group instanceof UIGroupImpl)) ||
+ (ConfigurationUtils.isCreateGroupDisabled() &&
+ group instanceof MetaUIGroup))
+ {
+ // When contact groups are disabled, don't add the MetaUIGroups to
+ // the UI.
             return;
+ }

         UIGroupImpl groupImpl = (UIGroupImpl) group;

@@ -1631,7 +1644,7 @@
     /**
      * Adds the given contact source to the list of available contact sources.
      *
- * @param contactSource the <tt>ContactSourceService</tt>
+ * @param contactSource the <tt>ContactSourceService</tt>
      */
     public void addContactSource(ContactSourceService contactSource)
     {
@@ -1998,7 +2011,7 @@
         }
         if (preferredProvider != null)
             dialog.setSelectedAccount(preferredProvider);
-
+
         String contactAddress = contactDetail.getDetail();
         dialog.setContactAddress(contactAddress);
         if(displayName != null && !displayName.equalsIgnoreCase(contactAddress))
Index: trunk/src/net/java/sip/communicator/impl/gui/main/contactlist/GroupNode.java

--- trunk/src/net/java/sip/communicator/impl/gui/main/contactlist/GroupNode.java (revision 10605)
+++ trunk/src/net/java/sip/communicator/impl/gui/main/contactlist/GroupNode.java (revision 10606)
@@ -40,7 +40,7 @@
     /**
      * The corresponding <tt>UIGroup</tt>.
      */
- private final UIGroupImpl group;
+ private final UIGroup group;

     /**
      * The <tt>ContactListNode</tt> <tt>Comparator</tt> used to sort the list of
Index: trunk/src/net/java/sip/communicator/impl/gui/main/contactlist/MetaContactRightButtonMenu.java

--- trunk/src/net/java/sip/communicator/impl/gui/main/contactlist/MetaContactRightButtonMenu.java (revision 10605)
+++ trunk/src/net/java/sip/communicator/impl/gui/main/contactlist/MetaContactRightButtonMenu.java (revision 10606)
@@ -29,8 +29,14 @@
import net.java.sip.communicator.service.gui.Container;
import net.java.sip.communicator.service.gui.event.*;
import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.service.protocol.OperationSetExtendedAuthorizations.*;
-import net.java.sip.communicator.service.protocol.ServerStoredDetails.*;
+import net.java.sip.communicator.service.protocol.OperationSetExtendedAuthorizations.SubscriptionStatus;
+import net.java.sip.communicator.service.protocol.ServerStoredDetails.FaxDetail;
+import net.java.sip.communicator.service.protocol.ServerStoredDetails.GenericDetail;
+import net.java.sip.communicator.service.protocol.ServerStoredDetails.MobilePhoneDetail;
+import net.java.sip.communicator.service.protocol.ServerStoredDetails.PagerDetail;
+import net.java.sip.communicator.service.protocol.ServerStoredDetails.PhoneNumberDetail;
+import net.java.sip.communicator.service.protocol.ServerStoredDetails.VideoDetail;
+import net.java.sip.communicator.service.protocol.ServerStoredDetails.WorkPhoneDetail;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.account.*;
import net.java.sip.communicator.util.skin.*;
@@ -663,8 +669,10 @@

         addSeparator();

- if (!ConfigurationUtils.isContactMoveDisabled())
+ if (!ConfigurationUtils.isContactMoveDisabled() &&
+ !ConfigurationUtils.isCreateGroupDisabled())
         {
+
             add(moveToMenu);
             add(moveSubcontactMenu);

Index: trunk/src/net/java/sip/communicator/util/ConfigurationUtils.java

--- trunk/src/net/java/sip/communicator/util/ConfigurationUtils.java (revision 10605)
+++ trunk/src/net/java/sip/communicator/util/ConfigurationUtils.java (revision 10606)
@@ -172,6 +172,11 @@
     private static boolean isCreateGroupDisabled;

     /**
+ * Indicates if the create group functionality is disabled.
+ */
+ private static boolean isFlattenGroupEnabled;
+
+ /**
      * Indicates if the remove contact functionality is disabled.
      */
     private static boolean isRemoveContactDisabled;
@@ -351,7 +356,7 @@
             new ConfigurationChangeListener());

         // Load the "auPopupNewMessage" property.
- String autoPopupProperty =
+ String autoPopupProperty =
             "service.gui.AUTO_POPUP_NEW_MESSAGE";

         String autoPopup = configService.getString(autoPopupProperty);
@@ -388,7 +393,7 @@
         // Load the "showOffline" property.
         String showOffline = configService.getString(
             "net.java.sip.communicator.impl.gui.showOffline");
-
+
         if(showOffline != null && showOffline.length() > 0)
         {
             isShowOffline = Boolean.parseBoolean(showOffline);
@@ -411,13 +416,13 @@
         }

         // Load the "sendTypingNotifications" property.
- String isSendTypingNotifProperty =
+ String isSendTypingNotifProperty =
             "service.gui.SEND_TYPING_NOTIFICATIONS_ENABLED";
- String isSendTypingNotif =
+ String isSendTypingNotif =
             configService.getString(isSendTypingNotifProperty);

         if(isSendTypingNotif == null)
- isSendTypingNotif =
+ isSendTypingNotif =
                 UtilActivator.getResources().
                     getSettingsString(isSendTypingNotifProperty);

@@ -447,7 +452,7 @@
             = configService.getString(isMultiChatWindowEnabledStringProperty);

         if(isMultiChatWindowEnabledString == null)
- isMultiChatWindowEnabledString =
+ isMultiChatWindowEnabledString =
                 UtilActivator.getResources().
                     getSettingsString(isMultiChatWindowEnabledStringProperty);

@@ -490,14 +495,14 @@
             );

         // Load the "isHistoryShown" property.
- String isHistoryShownStringProperty =
+ String isHistoryShownStringProperty =
             "service.gui.IS_MESSAGE_HISTORY_SHOWN";

         String isHistoryShownString
             = configService.getString(isHistoryShownStringProperty);

         if(isHistoryShownString == null)
- isHistoryShownString =
+ isHistoryShownString =
                 UtilActivator.getResources().
                     getSettingsString(isHistoryShownStringProperty);

@@ -515,7 +520,7 @@
             = configService.getString(chatHistorySizeStringProperty);

         if(chatHistorySizeString == null)
- chatHistorySizeString =
+ chatHistorySizeString =
                 UtilActivator.getResources().
                     getSettingsString(chatHistorySizeStringProperty);

@@ -532,7 +537,7 @@
             = configService.getString(chatWriteAreaSizeStringProperty);

         if(chatWriteAreaSizeString == null)
- chatWriteAreaSizeString =
+ chatWriteAreaSizeString =
                 UtilActivator.getResources().
                     getSettingsString(chatWriteAreaSizeStringProperty);

@@ -551,7 +556,7 @@
             = configService.getString(isTransparentWindowEnabledProperty);

         if(isTransparentWindowEnabledString == null)
- isTransparentWindowEnabledString =
+ isTransparentWindowEnabledString =
                 UtilActivator.getResources().
                     getSettingsString(isTransparentWindowEnabledProperty);

@@ -570,7 +575,7 @@
             = configService.getString(windowTransparencyProperty);

         if(windowTransparencyString == null)
- windowTransparencyString =
+ windowTransparencyString =
                 UtilActivator.getResources().
                     getSettingsString(windowTransparencyProperty);

@@ -589,7 +594,7 @@
             = configService.getString(isWindowDecoratedProperty);

         if(isWindowDecoratedString == null)
- isWindowDecoratedString =
+ isWindowDecoratedString =
                 UtilActivator.getResources().
                     getSettingsString(isWindowDecoratedProperty);

@@ -646,6 +651,13 @@
                 "CREATE_GROUP_DISABLED",
                 false);

+ // Load the "FLATTEN_GROUP_ENABLED" property.
+ isFlattenGroupEnabled
+ = configService.getBoolean(
+ "net.java.sip.communicator.impl.gui.main.contactlist." +
+ "FLATTEN_GROUP_ENABLED",
+ false);
+
         // Load the "GO_TO_CHATROOM_DISABLED" property.
         isGoToChatroomDisabled
             = configService.getBoolean(
@@ -887,9 +899,9 @@

     /**
      * Updates the "autoPopupNewMessage" property.
- *
+ *
      * @param autoPopup indicates to the user interface whether new
- * messages should be opened and bring to front.
+ * messages should be opened and bring to front.
      **/
     public static void setAutoPopupNewMessage(boolean autoPopup)
     {
@@ -969,7 +981,7 @@
     /**
      * Updates the "sendTypingNotifications" property through the
      * <tt>ConfigurationService</tt>.
- *
+ *
      * @param isSendTypingNotif <code>true</code> to indicate that typing
      * notifications are enabled, <code>false</code> otherwise.
      */
@@ -1010,7 +1022,7 @@
     /**
      * Updates the "isMultiChatWindowEnabled" property through the
      * <tt>ConfigurationService</tt>.
- *
+ *
      * @param isEnabled indicates if the chat window could
      * contain multiple chats or only one chat.
      */
@@ -1039,7 +1051,7 @@
     /**
      * Updates the "isLeaveChatroomOnWindowClose" property through
      * the <tt>ConfigurationService</tt>.
- *
+ *
      * @param isLeave indicates whether to leave chat room on window close.
      */
     public static void setLeaveChatRoomOnWindowClose(boolean isLeave)
@@ -1066,7 +1078,7 @@
     /**
      * Updates the "isHistoryLoggingEnabled" property through the
      * <tt>ConfigurationService</tt>.
- *
+ *
      * @param isEnabled indicates if the history logging is
      * enabled.
      */
@@ -1094,7 +1106,7 @@
     /**
      * Updates the "isHistoryShown" property through the
      * <tt>ConfigurationService</tt>.
- *
+ *
      * @param isShown indicates if the message history is shown
      */
     public static void setHistoryShown(boolean isShown)
@@ -1127,7 +1139,7 @@
     {
         return isChatToolbarVisible;
     }
-
+
     /**
      * Returns <code>true</code> if the "isChatStylebarVisible" property is
      * true, otherwise - returns <code>false</code>..
@@ -1184,6 +1196,17 @@
     }

     /**
+ * Returns <code>true</code> if the "FLATTEN_GROUP_ENABLED" property is
+ * true, otherwise - returns <code>false</code>..
+ * @return <code>true</code> if the "FLATTEN_GROUP_ENABLED" property is
+ * true, otherwise - returns <code>false</code>.
+ */
+ public static boolean isFlattenGroupEnabled()
+ {
+ return isFlattenGroupEnabled;
+ }
+
+ /**
      * Returns <code>true</code> if the "GO_TO_CHATROOM_DISABLED" property is
      * true, otherwise - returns <code>false</code>..
      * @return <code>true</code> if the "GO_TO_CHATROOM_DISABLED" property is
@@ -1345,7 +1368,7 @@

     /**
      * Sets the advanced account config disabled property.
- *
+ *
      * @param disabled the new value to set
      */
     public static void setAdvancedAccountConfigDisabled(boolean disabled)
@@ -1372,7 +1395,7 @@
     /**
      * Updates the "sendMessageCommand" property through the
      * <tt>ConfigurationService</tt>.
- *
+ *
      * @param newMessageCommand the command used to send a message ( it could be
      * ENTER_COMMAND or CTRL_ENTER_COMMAND)
      */
@@ -1387,8 +1410,8 @@

     /**
      * Return the "lastContactParent" property that was saved previously
- * through the <tt>ConfigurationService</tt>. Indicates
- * the last selected group on adding new contact
+ * through the <tt>ConfigurationService</tt>. Indicates
+ * the last selected group on adding new contact
      * @return group name of the last selected group when adding contact.
      */
     public static String getLastContactParent()
@@ -1459,7 +1482,7 @@
     /**
      * Updates the "chatHistorySize" property through the
      * <tt>ConfigurationService</tt>.
- *
+ *
      * @param historySize indicates if the history logging is
      * enabled.
      */
@@ -1474,7 +1497,7 @@

     /**
      * Returns the preferred height of the chat write area.
- *
+ *
      * @return the preferred height of the chat write area.
      */
     public static int getChatWriteAreaSize()
@@ -1485,7 +1508,7 @@
     /**
      * Returns <code>true</code> if transparent windows are enabled,
      * <code>false</code> otherwise.
- *
+ *
      * @return <code>true</code> if transparent windows are enabled,
      * <code>false</code> otherwise.
      */
@@ -1496,7 +1519,7 @@

     /**
      * Returns the transparency value for all transparent windows.
- *
+ *
      * @return the transparency value for all transparent windows.
      */
     public static int getWindowTransparency()
@@ -1506,7 +1529,7 @@

     /**
      * Returns the last opened directory of the send file file chooser.
- *
+ *
      * @return the last opened directory of the send file file chooser
      */
     public static String getSendFileLastDir()
@@ -1517,7 +1540,7 @@
     /**
      * Returns <code>true</code> if phone numbers should be normalized,
      * <code>false</code> otherwise.
- *
+ *
      * @return <code>true</code> if phone numbers should be normalized,
      * <code>false</code> otherwise.
      */
@@ -1672,7 +1695,7 @@

     /**
      * Sets the transparency value for all transparent windows.
- *
+ *
      * @param transparency the transparency value for all transparent windows.
      */
     public static void setWindowTransparency(int transparency)
@@ -1683,7 +1706,7 @@
     /**
      * Updates the "showOffline" property through the
      * <tt>ConfigurationService</tt>.
- *
+ *
      * @param isShowOffline <code>true</code> to indicate that the
      * offline users should be shown, <code>false</code> otherwise.
      */
@@ -1699,7 +1722,7 @@
     /**
      * Updates the "showCallPanel" property through the
      * <tt>ConfigurationService</tt>.
- *
+ *
      * @param isCallPanelShown <code>true</code> to indicate that the
      * call panel should be shown, <code>false</code> otherwise.
      */
@@ -1735,7 +1758,7 @@
     /**
      * Updates the "showAppQuitWarning" property through the
      * <tt>ConfigurationService</tt>.
- *
+ *
      * @param isWarningShown indicates if the message warning the user that the
      * application would not be closed if she clicks the X button would be
      * shown again.
@@ -1762,7 +1785,7 @@
      /**
      * Updates the "lastContactParent" property through the
      * <tt>ConfigurationService</tt>.
- *
+ *
      * @param groupName the group name of the selected group when adding
      * last contact
      */
@@ -1778,7 +1801,7 @@
     /**
      * Updates the "isMoveContactQuestionEnabled" property through the
      * <tt>ConfigurationService</tt>.
- *
+ *
      * @param isRequested indicates if a confirmation would be requested
      * from user during the move contact process.
      */
@@ -1794,7 +1817,7 @@
     /**
      * Updates the "isTransparentWindowEnabled" property through the
      * <tt>ConfigurationService</tt>.
- *
+ *
      * @param isTransparent indicates if the transparency is enabled in the
      * application.
      */
@@ -1806,17 +1829,17 @@
                 "impl.gui.IS_TRANSPARENT_WINDOW_ENABLED",
                 Boolean.toString(isTransparentWindowEnabled));
     }
-
+
     /**
      * Updates the "isChatToolbarVisible" property through the
      * <tt>ConfigurationService</tt>.
- *
+ *
      * @param isVisible indicates if the chat toolbar is visible.
      */
     public static void setChatToolbarVisible(boolean isVisible)
     {
         isChatToolbarVisible = isVisible;
-
+
         configService.setProperty(
                 "net.java.sip.communicator.impl.gui.chat.ChatWindow.showToolbar",
                 Boolean.toString(isChatToolbarVisible));
@@ -1825,7 +1848,7 @@
     /**
      * Updates the "isShowSmileys" property through the
      * <tt>ConfigurationService</tt>.
- *
+ *
      * @param isVisible indicates if the smileys are visible
      */
     public static void setShowSmileys(boolean isVisible)
@@ -1840,7 +1863,7 @@
     /**
      * Updates the "isChatSimpleThemeEnabled" property through the
      * <tt>ConfigurationService</tt>.
- *
+ *
      * @param isEnabled indicates if the chat simple theme is enabled
      */
     public static void setChatSimpleThemeEnabled(boolean isEnabled)
@@ -1855,13 +1878,13 @@
     /**
      * Updates the "isChatStylebarVisible" property through the
      * <tt>ConfigurationService</tt>.
- *
+ *
      * @param isVisible indicates if the chat stylebar is visible.
      */
     public static void setChatStylebarVisible(boolean isVisible)
     {
         isChatStylebarVisible = isVisible;
-
+
         configService.setProperty(
                 "net.java.sip.communicator.impl.gui.chat.ChatWindow.showStylebar",
                 Boolean.toString(isChatStylebarVisible));
@@ -1870,7 +1893,7 @@
     /**
      * Updates the "net.java.sip.communicator.impl.gui.CHAT_WRITE_AREA_SIZE"
      * property through the <tt>ConfigurationService</tt>.
- *
+ *
      * @param size the new size to set
      */
     public static void setChatWriteAreaSize(int size)
@@ -1885,7 +1908,7 @@
     /**
      * Updates the "SEND_FILE_LAST_DIR"
      * property through the <tt>ConfigurationService</tt>.
- *
+ *
      * @param lastDir last download directory
      */
     public static void setSendFileLastDir(String lastDir)
@@ -2030,7 +2053,7 @@

     /**
      * Saves a chat room through the <tt>ConfigurationService</tt>.
- *
+ *
      * @param protocolProvider the protocol provider to which the chat room
      * belongs
      * @param oldChatRoomId the old identifier of the chat room
@@ -2101,7 +2124,7 @@
     /**
      * Updates the status of the chat room through the
      * <tt>ConfigurationService</tt>.
- *
+ *
      * @param protocolProvider the protocol provider to which the chat room
      * belongs
      * @param chatRoomId the identifier of the chat room to update
@@ -2197,11 +2220,11 @@
             }
         }
     }
-
+
     /**
      * Returns the chat room property, saved through the
      * <tt>ConfigurationService</tt>.
- *
+ *
      * @param protocolProvider the protocol provider, to which the chat room
      * belongs
      * @param chatRoomId the identifier of the chat room
@@ -2402,7 +2425,7 @@
     private static class ConfigurationChangeListener
             implements PropertyChangeListener
     {
- public void propertyChange(PropertyChangeEvent evt)
+ public void propertyChange(PropertyChangeEvent evt)
         {
             // All properties we're interested in here are Strings.
             if (!(evt.getNewValue() instanceof String))