Author: dkirov Date: 2006-05-09 00:06:42 +0200 (Tue, 09 May 2006) New Revision: 6302
Modified: trunk/src/dialogs.py Log: add completion for single message dialog
Modified: trunk/src/dialogs.py =================================================================== --- trunk/src/dialogs.py 2006-05-08 22:00:02 UTC (rev 6301) +++ trunk/src/dialogs.py 2006-05-08 22:06:42 UTC (rev 6302) @@ -1252,6 +1252,29 @@ 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 @@ _('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')