Adds drag and drop for contacts to the root group Contacts.

fix-message-formatting
Damian Minkov 12 years ago
parent 66ed785131
commit 3dc1f75297

@ -1282,7 +1282,13 @@ public void moveMetaContact(MetaContact metaContact,
}
else
{
opSetPresence.moveContactToGroup(protoContact, protoGroup);
if(newMetaGroup.equals(getRoot()))
opSetPresence.moveContactToGroup(
protoContact,
opSetPresence.getServerStoredContactListRoot());
else
opSetPresence.moveContactToGroup(
protoContact, protoGroup);
}
}
}

@ -108,7 +108,10 @@ protected Transferable createTransferable(JComponent component)
@Override
public boolean canImport(JComponent comp, DataFlavor flavor[])
{
Object selectedObject = ((UIContact)((ContactNode)transferredObject)
if(!(transferredObject instanceof ContactNode))
return false;
Object selectedObject = (((ContactNode)transferredObject)
.getContactDescriptor()).getDescriptor();
if (selectedObject instanceof MetaContact)
{
@ -307,10 +310,14 @@ else if (dest instanceof GroupNode)
= ((GroupNode) dest).getGroupDescriptor();
// We support darg&drop for MetaContacts only for now.
if (!(destGroup instanceof MetaUIGroup))
if (!(destGroup instanceof MetaUIGroup)
&& !destGroup.equals(list.getRootUIGroup()))
{
return false;
}
if (!transferredContact
if (destGroup instanceof MetaUIGroup
&& !transferredContact
.getParentGroup().equals(destGroup)
&& !(ConfigurationUtils.isContactMoveDisabled()
&& ConfigurationUtils.isCreateGroupDisabled()))
@ -319,6 +326,13 @@ else if (dest instanceof GroupNode)
(MetaContact) transferredContact.getDescriptor(),
(MetaContactGroup) destGroup.getDescriptor());
}
else if(destGroup.equals(list.getRootUIGroup()))
{
MetaContactListManager.moveMetaContactToGroup(
(MetaContact) transferredContact.getDescriptor(),
GuiActivator.getContactListService().getRoot());
}
return true;
}
}

@ -24,6 +24,5 @@
public abstract class AbstractContactGroupJabberImpl
implements ContactGroup
{
public abstract void addContact(ContactJabberImpl contact);
}

@ -167,7 +167,7 @@ public ContactGroup getParentContactGroup()
* Adds the specified contact to the end of this group.
* @param contact the new contact to add to this group
*/
void addContact(ContactJabberImpl contact)
public void addContact(ContactJabberImpl contact)
{
buddies.put(contact.getAddress().toLowerCase(), contact);
}

@ -396,13 +396,13 @@ public void moveContactToGroup(Contact contactToMove,
throw new IllegalArgumentException(
"The specified contact is not an jabber contact." +
contactToMove);
if( !(newParent instanceof ContactGroupJabberImpl) )
if( !(newParent instanceof AbstractContactGroupJabberImpl) )
throw new IllegalArgumentException(
"The specified group is not an jabber contact group."
+ newParent);
ssContactList.moveContact((ContactJabberImpl)contactToMove,
(ContactGroupJabberImpl)newParent);
(AbstractContactGroupJabberImpl)newParent);
}
/**

@ -82,7 +82,7 @@ void removeContact(ContactJabberImpl contact)
* Adds the specified contact to the end of this group.
* @param contact the new contact to add to this group
*/
void addContact(ContactJabberImpl contact)
public void addContact(ContactJabberImpl contact)
{
contacts.put(contact.getAddress(), contact);
}

@ -464,7 +464,7 @@ public void addContact(ContactGroup parent, String id)
{
String[] parentNames = null;
if(parent != null)
if(parent != null && parent != getRootGroup())
parentNames = new String[]{parent.getGroupName()};
// modify our reply timeout because some XMPP may send "result" IQ
@ -749,7 +749,7 @@ public void renameGroup(ContactGroupJabberImpl groupToRename, String newName)
* @param newParent the group where we'd like the parent placed.
*/
public void moveContact(ContactJabberImpl contact,
ContactGroupJabberImpl newParent)
AbstractContactGroupJabberImpl newParent)
throws OperationFailedException
{
// when the contact is not persistent, coming
@ -1032,8 +1032,6 @@ private void initRoster()
}
}
}
}
/**

Loading…
Cancel
Save