diff --git a/src/common/gajim.py b/src/common/gajim.py index 19a354309..4943cafbe 100644 --- a/src/common/gajim.py +++ b/src/common/gajim.py @@ -59,7 +59,8 @@ awaiting_events = {} # list of messages/FT reveived but not printed # if type in ('chat', 'normal'): data = (message, subject, kind, time, # encrypted) # kind can be (incoming, error) - # if type in file-request, file-request-error, file-send-error, file-error: + # if type in file-request, file-request-error, file-send-error, file-error, + # file-completed, file-stopped: # data = file_props nicks = {} # list of our nick names in each account allow_notifications = {} # do we allow notifications for each account ? diff --git a/src/dialogs.py b/src/dialogs.py index 07c45ad84..39d409590 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -912,18 +912,11 @@ class PopupNotificationWindow: chats_window.set_active_tab(self.jid) chats_window.window.present() elif self.msg_type in ('normal', 'file-request', 'file-request-error', - 'file-send-error', 'file-error'): + 'file-send-error', 'file-error', 'file-stopped', 'file-completed'): # Get the first single message event ev = gajim.get_first_event(self.account, self.jid, self.msg_type) self.plugin.roster.open_event(self.account, self.jid, ev) - elif self.msg_type == 'file-completed': # file transfer is complete - self.plugin.windows['file_transfers'].show_completed(self.jid, - self.file_props) - - elif self.msg_type == 'file-stopped': # file transfer ended unexpectedly - self.plugin.windows['file_transfers'].show_stopped(self.jid, - self.file_props) else: # 'chat' self.plugin.roster.new_chat(contact, self.account) chats_window = self.plugin.windows[self.account]['chats'][self.jid] diff --git a/src/gajim.py b/src/gajim.py index d66d57972..bed3feefa 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -885,21 +885,26 @@ class Interface: file_props.has_key('paused') and file_props['paused']: return jid = unicode(file_props['sender']) - if gajim.config.get('notify_on_file_complete'): - if (gajim.connections[account].connected in (2, 3) - and gajim.config.get('autopopup')) or \ - gajim.config.get('autopopupaway'): - if file_props['error'] == 0: - ft.show_completed(jid, file_props) - elif file_props['error'] == -1: - ft.show_stopped(jid, file_props) - return + + if gajim.popup_window(account): if file_props['error'] == 0: - msg_type = 'file-completed' - event_type = _('File Transfer Completed') + ft.show_completed(jid, file_props) elif file_props['error'] == -1: - msg_type = 'file-stopped' - event_type = _('File Transfer Stopped') + ft.show_stopped(jid, file_props) + return + + if file_props['error'] == 0: + msg_type = 'file-completed' + event_type = _('File Transfer Completed') + elif file_props['error'] == -1: + msg_type = 'file-stopped' + event_type = _('File Transfer Stopped') + + self.add_event(account, jid, msg_typ, file_props) + + if gajim.config.get('notify_on_file_complete') and \ + gajim.config.get('autopopupaway') or \ + gajim.connections[account].connected in (2, 3): instance = dialogs.PopupNotificationWindow(self, event_type, jid, account, msg_type, file_props) self.roster.popup_notification_windows.append(instance) diff --git a/src/roster_window.py b/src/roster_window.py index ddbabad21..31a980ead 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -1823,9 +1823,12 @@ _('If "%s" accepts this request you will know his status.') %jid) elif typ in ('file-request-error', 'file-send-error'): ft.show_send_error(data) return True - elif typ == 'file-error': + elif typ in ('file-error', 'file-stopped'): ft.show_stopped(jid, data) return True + elif typ == 'file-completed': + ft.show_completed(jid, data) + return True return False def on_roster_treeview_row_activated(self, widget, path, col = 0): diff --git a/src/systray.py b/src/systray.py index 41a646b02..e715a38cb 100644 --- a/src/systray.py +++ b/src/systray.py @@ -285,7 +285,7 @@ class Systray: self.plugin.roster.new_chat(c, account) w = wins['chats'][jid] elif typ in ('normal', 'file-request', 'file-request-error', - 'file-send-error', 'file-error'): + 'file-send-error', 'file-error', 'file-stopped', 'file-completed'): # Get the first single message event ev = gajim.get_first_event(account, jid, typ) # Open the window