better reply in single message

This commit is contained in:
Yann Leboulanger 2005-11-17 23:04:56 +00:00
parent 4330b72485
commit 7a50fa4c7d
1 changed files with 9 additions and 4 deletions

View File

@ -970,9 +970,6 @@ class SingleMessageWindow:
if self.action == 'send': if self.action == 'send':
if self.message: # we come from a reply? if self.message: # we come from a reply?
self.message_textview.grab_focus() self.message_textview.grab_focus()
# add > at the begining of each line
self.message = '>' + self.message
self.message = self.message.replace('\n', '\n>')
else: # we write a new message else: # we write a new message
self.subject_entry.grab_focus() self.subject_entry.grab_focus()
elif self.action == 'receive': elif self.action == 'receive':
@ -988,6 +985,8 @@ class SingleMessageWindow:
self.subject = '' self.subject = ''
self.subject_entry.set_text(self.subject) self.subject_entry.set_text(self.subject)
self.message_tv_buffer.set_text(self.message) self.message_tv_buffer.set_text(self.message)
if self.action == 'send' and self.message:
gobject.idle_add(self.set_cursor_to_end)
begin_iter = self.message_tv_buffer.get_start_iter() begin_iter = self.message_tv_buffer.get_start_iter()
self.message_tv_buffer.place_cursor(begin_iter) self.message_tv_buffer.place_cursor(begin_iter)
@ -1003,6 +1002,10 @@ class SingleMessageWindow:
gajim.config.get('single_msg-height')) gajim.config.get('single_msg-height'))
self.window.show_all() self.window.show_all()
def set_cursor_to_end(self):
end_iter = self.message_tv_buffer.get_end_iter()
self.message_tv_buffer.place_cursor(end_iter)
def save_pos(self): def save_pos(self):
if gajim.config.get('saveposition'): if gajim.config.get('saveposition'):
# save the window size and position # save the window size and position
@ -1083,7 +1086,9 @@ class SingleMessageWindow:
def on_reply_button_clicked(self, widget): def on_reply_button_clicked(self, widget):
# we create a new blank window to send and we preset RE: and to jid # we create a new blank window to send and we preset RE: and to jid
self.subject = _('RE: %s') % self.subject self.subject = _('RE: %s') % self.subject
self.message = _('\n\n\n== Original Message ==\n%s') % self.message self.message = _('%s wrote:\n' % self.from_whom) + self.message
# add > at the begining of each line
self.message = self.message.replace('\n', '\n> ') + '\n\n'
self.window.destroy() self.window.destroy()
SingleMessageWindow(self.account, to = self.from_whom, SingleMessageWindow(self.account, to = self.from_whom,
action = 'send', from_whom = self.from_whom, subject = self.subject, action = 'send', from_whom = self.from_whom, subject = self.subject,