From afdfdc05ce7976e966e61f9e338469e280795d48 Mon Sep 17 00:00:00 2001 From: Dimitur Kirov Date: Mon, 8 May 2006 22:06:42 +0000 Subject: [PATCH] add completion for single message dialog --- src/dialogs.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/dialogs.py b/src/dialogs.py index 6ad9754e5..e33c0c43a 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -1252,6 +1252,29 @@ class SingleMessageWindow: self.subject = '' self.subject_entry.set_text(self.subject) + self.completion_dict = {} + if to == '': + liststore = gtkgui_helpers.get_completion_liststore(self.to_entry) + # add all contacts to the model + for jid in gajim.contacts.get_jid_list(account): + contact = gajim.contacts.get_contact_with_highest_priority( + account, jid) + self.completion_dict[jid] = contact + name = contact.name + if self.completion_dict.has_key(name): + contact1 = self.completion_dict[name] + del self.completion_dict[name] + self.completion_dict['%s (%s)' % (name, contact1.jid)] = \ + contact1 + self.completion_dict['%s (%s)' % (name, jid)] = contact + else: + self.completion_dict[name] = contact + for jid in self.completion_dict.keys(): + contact = self.completion_dict[jid] + img = gajim.interface.roster.jabber_state_images['16'][ + contact.show] + liststore.append((img.get_pixbuf(), jid)) + self.xml.signal_autoconnect(self) if gajim.config.get('saveposition'): @@ -1357,6 +1380,8 @@ class SingleMessageWindow: _('Please make sure you are connected with "%s".' % self.account)) return to_whom_jid = self.to_entry.get_text().decode('utf-8') + if self.completion_dict.has_key(to_whom_jid): + to_whom_jid = self.completion_dict[to_whom_jid].jid subject = self.subject_entry.get_text().decode('utf-8') begin, end = self.message_tv_buffer.get_bounds() message = self.message_tv_buffer.get_text(begin, end).decode('utf-8')