we can now copy (not move) a contact to another group

This commit is contained in:
Yann Leboulanger 2005-11-01 22:52:04 +00:00
parent c9c319a141
commit d1ebec6ad4
1 changed files with 13 additions and 11 deletions

View File

@ -2290,8 +2290,10 @@ _('If "%s" accepts this request you will know his status.') %jid)
# We upgrade only the first user because user2.groups is a pointer to # We upgrade only the first user because user2.groups is a pointer to
# user1.groups # user1.groups
u = gajim.contacts[account][data][0] u = gajim.contacts[account][data][0]
if context.action != gtk.gdk.ACTION_COPY:
u.groups.remove(grp_source) u.groups.remove(grp_source)
if model.iter_n_children(iter_group_source) == 1: #this was the only child if model.iter_n_children(iter_group_source) == 1:
# this was the only child
model.remove(iter_group_source) model.remove(iter_group_source)
# delete the group if it is empty (need to look for offline users too) # delete the group if it is empty (need to look for offline users too)
for jid in gajim.contacts[account]: for jid in gajim.contacts[account]:
@ -2303,7 +2305,7 @@ _('If "%s" accepts this request you will know his status.') %jid)
u.groups.append(grp_dest) u.groups.append(grp_dest)
self.add_contact_to_roster(data, account) self.add_contact_to_roster(data, account)
gajim.connections[account].update_contact(u.jid, u.name, u.groups) gajim.connections[account].update_contact(u.jid, u.name, u.groups)
if context.action == gtk.gdk.ACTION_MOVE: if context.action in (gtk.gdk.ACTION_MOVE, gtk.gdk.ACTION_COPY):
context.finish(True, True, etime) context.finish(True, True, etime)
return return
@ -2466,7 +2468,7 @@ _('If "%s" accepts this request you will know his status.') %jid)
#signals #signals
TARGETS = [('MY_TREE_MODEL_ROW', gtk.TARGET_SAME_WIDGET, 0)] TARGETS = [('MY_TREE_MODEL_ROW', gtk.TARGET_SAME_WIDGET, 0)]
self.tree.enable_model_drag_source( gtk.gdk.BUTTON1_MASK, TARGETS, self.tree.enable_model_drag_source( gtk.gdk.BUTTON1_MASK, TARGETS,
gtk.gdk.ACTION_DEFAULT| gtk.gdk.ACTION_MOVE) gtk.gdk.ACTION_DEFAULT | gtk.gdk.ACTION_MOVE | gtk.gdk.ACTION_COPY)
self.tree.enable_model_drag_dest(TARGETS, gtk.gdk.ACTION_DEFAULT) self.tree.enable_model_drag_dest(TARGETS, gtk.gdk.ACTION_DEFAULT)
self.tree.connect('drag_data_get', self.drag_data_get_data) self.tree.connect('drag_data_get', self.drag_data_get_data)
self.tree.connect('drag_data_received', self.drag_data_received_data) self.tree.connect('drag_data_received', self.drag_data_received_data)