Fix #1896559 [feature request: edit book name of TOC blank](https://bugs.launchpad.net/calibre/+bug/1896559)

This commit is contained in:
Kovid Goyal 2020-09-23 10:11:00 +05:30
parent 754ebf854b
commit e9351ae870
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -163,6 +163,7 @@ class ItemEdit(QWidget):
f.la2 = la = QLabel('<b>'+_('&Name of the ToC entry:')) f.la2 = la = QLabel('<b>'+_('&Name of the ToC entry:'))
l.addWidget(la) l.addWidget(la)
self.name = QLineEdit(self) self.name = QLineEdit(self)
self.name.setPlaceholderText(_('(Untitled)'))
la.setBuddy(self.name) la.setBuddy(self.name)
l.addWidget(self.name) l.addWidget(self.name)
@ -252,7 +253,7 @@ class ItemEdit(QWidget):
self.current_item, self.current_where = item, where self.current_item, self.current_where = item, where
self.current_name = None self.current_name = None
self.current_frag = None self.current_frag = None
self.name.setText(_('(Untitled)')) self.name.setText('')
dest_index, frag = 0, None dest_index, frag = 0, None
if item is not None: if item is not None:
if where is None: if where is None:
@ -298,4 +299,4 @@ class ItemEdit(QWidget):
@property @property
def result(self): def result(self):
return (self.current_item, self.current_where, self.current_name, return (self.current_item, self.current_where, self.current_name,
self.current_frag, unicode_type(self.name.text())) self.current_frag, self.name.text().strip() or _('(Untitled)'))