When in merged account mode, if we drag and drop contacts from one account to another, show drop menu,

allow to change group, inform user why creation of metacontact is not possible. Fixes #1383.
This commit is contained in:
Jean-Marie Traissard 2006-05-14 15:12:17 +00:00
parent fe335b6c0d
commit 1dfd15631b
1 changed files with 19 additions and 11 deletions

View File

@ -3116,10 +3116,12 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
if type_source != 'contact': # source is not a contact if type_source != 'contact': # source is not a contact
return return
source_account = model[iter_source][C_ACCOUNT].decode('utf-8') source_account = model[iter_source][C_ACCOUNT].decode('utf-8')
disable_meta = False
if account != source_account: # dropped in another account if account != source_account: # dropped in another account
if self.regroup and type_dest == 'group': if self.regroup:
# on a group in merge mode is ok # in merge mode it is ok to change group, but disable meta
account = source_account account = source_account
disable_meta = True
else: else:
return return
it = iter_source it = iter_source
@ -3188,15 +3190,21 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
item.connect('activate', self.on_drop_in_group, account, c_source, item.connect('activate', self.on_drop_in_group, account, c_source,
grp_dest, context, etime, grp_source) grp_dest, context, etime, grp_source)
menu.append(item) menu.append(item)
c_dest = gajim.contacts.get_contact_with_highest_priority(account, if not disable_meta:
jid_dest) # source and dest account are the same, enable metacontacts
item = gtk.MenuItem(_('Make %s and %s metacontacts') % (c_source.name, c_dest = gajim.contacts.get_contact_with_highest_priority(account,
c_dest.name)) jid_dest)
is_big_brother = False item = gtk.MenuItem(_('Make %s and %s metacontacts') % (c_source.name,
if model.iter_has_child(iter_source): c_dest.name))
is_big_brother = True is_big_brother = False
item.connect('activate', self.on_drop_in_contact, account, c_source, if model.iter_has_child(iter_source):
c_dest, is_big_brother, context, etime) is_big_brother = True
item.connect('activate', self.on_drop_in_contact, account, c_source,
c_dest, is_big_brother, context, etime)
else: #source and dest account are not the same, disable meta
item = gtk.MenuItem(_('Can\'t create a metacontact with contacts from two different accounts'))
item.set_sensitive(False)
menu.append(item) menu.append(item)
menu.attach_to_widget(self.tree, None) menu.attach_to_widget(self.tree, None)