mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-28 13:35:31 +01:00
Enhancement #1912074: make the saved search editor multiline.
This commit is contained in:
parent
d33e6ebad4
commit
9c0fabff25
1 changed files with 6 additions and 5 deletions
|
|
@ -4,7 +4,8 @@
|
|||
|
||||
|
||||
from PyQt5.Qt import (
|
||||
QFormLayout, QIcon, QLabel, QLineEdit, QListWidget, Qt, QVBoxLayout, QDialog, QDialogButtonBox
|
||||
QFormLayout, QIcon, QLabel, QLineEdit, QListWidget, Qt, QVBoxLayout, QDialog,
|
||||
QDialogButtonBox, QPlainTextEdit
|
||||
)
|
||||
|
||||
from calibre import prepare_string_for_xml
|
||||
|
|
@ -51,12 +52,12 @@ def setup_ui(self):
|
|||
l.addRow(_('&Name:'), n)
|
||||
n.setPlaceholderText(_('The Saved search name'))
|
||||
|
||||
self.search = s = QLineEdit(self)
|
||||
self.search = s = QPlainTextEdit(self)
|
||||
s.setMinimumWidth(400)
|
||||
l.addRow(_('&Search:'), s)
|
||||
s.setPlaceholderText(_('The search expression'))
|
||||
if self.initial_search:
|
||||
s.setText(self.initial_search)
|
||||
s.setPlainText(self.initial_search)
|
||||
n.setFocus(Qt.FocusReason.OtherFocusReason)
|
||||
l.addRow(self.bb)
|
||||
|
||||
|
|
@ -68,7 +69,7 @@ def accept(self):
|
|||
_('No search name'),
|
||||
_('You must specify a name for the Saved search'),
|
||||
show=True)
|
||||
expression = self.search.text().strip()
|
||||
expression = self.search.toPlainText().strip()
|
||||
if not expression:
|
||||
return error_dialog(
|
||||
self,
|
||||
|
|
@ -182,7 +183,7 @@ def edit_search(self):
|
|||
validate=self.validate_edit)
|
||||
d.setWindowTitle(_('Edit saved search'))
|
||||
d.sname.setText(n)
|
||||
d.search.setText(self.searches[n])
|
||||
d.search.setPlainText(self.searches[n])
|
||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
||||
return
|
||||
name, expression = d.accepted_data
|
||||
|
|
|
|||
Loading…
Reference in a new issue