From 97049952ccac95efdc72c099e2882be8083ef4cf Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 20 Nov 2013 10:05:19 +0530 Subject: [PATCH] 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) --- src/calibre/gui2/preferences/emailp.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/preferences/emailp.py b/src/calibre/gui2/preferences/emailp.py index 7f348030c0..e94cfe4656 100644 --- a/src/calibre/gui2/preferences/emailp.py +++ b/src/calibre/gui2/preferences/emailp.py @@ -17,7 +17,7 @@ from calibre.utils.config import ConfigProxy from calibre.gui2 import NONE from calibre.utils.smtp import config as smtp_prefs -class EmailAccounts(QAbstractTableModel): # {{{ +class EmailAccounts(QAbstractTableModel): # {{{ def __init__(self, accounts, subjects, aliases={}): QAbstractTableModel.__init__(self) @@ -191,6 +191,10 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): # No defaults to restore to 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) if not self.send_email_widget.set_email_settings(to_set): raise AbortCommit('abort')