Shows newly created groups when using 'Hide offline contacts' filter.

cusax-fix
Damian Minkov 15 years ago
parent f8639bd321
commit c6db18cb92

@ -146,7 +146,8 @@ private boolean isMatching(MetaContact metaContact)
*/
private boolean isMatching(MetaContactGroup metaGroup)
{
return (isShowOffline || metaGroup.countOnlineChildContacts() > 0)
return (isShowOffline || metaGroup.countOnlineChildContacts() > 0
|| MetaContactListSource.isNewGroup(metaGroup))
? true
: false;
}

@ -46,6 +46,13 @@ public class MetaContactListSource
public static final String UI_GROUP_DATA_KEY
= MetaUIGroup.class.getName() + ".uiGroupDescriptor";
/**
* The data key of the MetaGroupDescriptor object used to store whether
* the group is newly created by user.
*/
private static final String GROUP_IS_NEW_KEY
= MetaUIGroup.class.getName() + ".groupIsNew";
/**
* The initial result count below which we insert all filter results
* directly to the contact list without firing events.
@ -84,6 +91,17 @@ public static UIGroup getUIGroup(MetaContactGroup metaGroup)
return (UIGroup) metaGroup.getData(UI_GROUP_DATA_KEY);
}
/**
* Returns whether <tt>MetaContactGroup</tt> is newly created.
* @param metaGroup the <tt>MetaContactGroup</tt>, which we will check.
* @return whether the <tt>MetaContactGroup</tt> is newly created.
*/
public static boolean isNewGroup(MetaContactGroup metaGroup)
{
Object data = metaGroup.getData(GROUP_IS_NEW_KEY);
return data == null ? false : (Boolean)data;
}
/**
* Creates a <tt>UIContact</tt> for the given <tt>metaContact</tt>.
* @param metaContact the <tt>MetaContact</tt> for which we would like to
@ -508,6 +526,12 @@ public void metaContactGroupAdded(MetaContactGroupEvent evt)
uiGroup = MetaContactListSource.createUIGroup(metaGroup);
}
// mark group as newly created
if(metaGroup.countChildContacts() == 0)
{
metaGroup.setData(GROUP_IS_NEW_KEY, Boolean.TRUE);
}
ContactListFilter currentFilter
= GuiActivator.getContactList().getCurrentFilter();

Loading…
Cancel
Save