Apply changes being edited when clicking apply in the email preferences list. Fixes #1252758 [Alias not created with Add email](https://bugs.launchpad.net/calibre/+bug/1252758)

This commit is contained in:
Kovid Goyal 2013-11-20 10:05:19 +05:30
parent e22587dbc2
commit 97049952cc

View File

@ -17,7 +17,7 @@ from calibre.utils.config import ConfigProxy
from calibre.gui2 import NONE from calibre.gui2 import NONE
from calibre.utils.smtp import config as smtp_prefs from calibre.utils.smtp import config as smtp_prefs
class EmailAccounts(QAbstractTableModel): # {{{ class EmailAccounts(QAbstractTableModel): # {{{
def __init__(self, accounts, subjects, aliases={}): def __init__(self, accounts, subjects, aliases={}):
QAbstractTableModel.__init__(self) QAbstractTableModel.__init__(self)
@ -191,6 +191,10 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
# No defaults to restore to # No defaults to restore to
def commit(self): def commit(self):
if self.email_view.state() == self.email_view.EditingState:
# Ensure that the cell being edited is committed by switching focus
# to some other widget, which automatically closes the open editor
self.send_email_widget.setFocus(Qt.OtherFocusReason)
to_set = bool(self._email_accounts.accounts) to_set = bool(self._email_accounts.accounts)
if not self.send_email_widget.set_email_settings(to_set): if not self.send_email_widget.set_email_settings(to_set):
raise AbortCommit('abort') raise AbortCommit('abort')