we now can't remove / rename accounts with unread events

This commit is contained in:
Yann Leboulanger 2006-03-30 17:23:06 +00:00
parent 62951fb718
commit 883bff804c
1 changed files with 18 additions and 5 deletions

View File

@ -1111,10 +1111,18 @@ class AccountModificationWindow:
config = {} config = {}
name = self.xml.get_widget('name_entry').get_text().decode('utf-8') name = self.xml.get_widget('name_entry').get_text().decode('utf-8')
if gajim.connections.has_key(self.account): if gajim.connections.has_key(self.account):
if name != self.account and \ if name != self.account:
gajim.connections[self.account].connected != 0: if gajim.connections[self.account].connected != 0:
dialogs.ErrorDialog(_('You are currently connected to the server'), dialogs.ErrorDialog(
_('To change the account name, you must be disconnected.')).get_response() _('You are currently connected to the server'),
_('To change the account name, you must be disconnected.')).\
get_response()
return
if len(gajim.awaiting_events[self.account]):
dialogs.ErrorDialog(_('Unread events'),
_('To change the account name, you must read all pending '
'events.')).\
get_response()
return return
if (name == ''): if (name == ''):
dialogs.ErrorDialog(_('Invalid account name'), dialogs.ErrorDialog(_('Invalid account name'),
@ -1643,6 +1651,11 @@ class AccountsWindow:
if not iter: if not iter:
return return
account = model.get_value(iter, 0).decode('utf-8') account = model.get_value(iter, 0).decode('utf-8')
if len(gajim.awaiting_events[account]):
dialogs.ErrorDialog(_('Unread events'),
_('Read all pending events before removing this account.')).\
get_response()
return
if gajim.interface.instances[account].has_key('remove_account'): if gajim.interface.instances[account].has_key('remove_account'):
gajim.interface.instances[account]['remove_account'].window.present() gajim.interface.instances[account]['remove_account'].window.present()
else: else: