mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Enhancement #1912074: make the saved search editor multiline.
This commit is contained in:
parent
d33e6ebad4
commit
9c0fabff25
@ -4,7 +4,8 @@
|
|||||||
|
|
||||||
|
|
||||||
from PyQt5.Qt import (
|
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
|
from calibre import prepare_string_for_xml
|
||||||
@ -51,12 +52,12 @@ class AddSavedSearch(Dialog):
|
|||||||
l.addRow(_('&Name:'), n)
|
l.addRow(_('&Name:'), n)
|
||||||
n.setPlaceholderText(_('The Saved search name'))
|
n.setPlaceholderText(_('The Saved search name'))
|
||||||
|
|
||||||
self.search = s = QLineEdit(self)
|
self.search = s = QPlainTextEdit(self)
|
||||||
s.setMinimumWidth(400)
|
s.setMinimumWidth(400)
|
||||||
l.addRow(_('&Search:'), s)
|
l.addRow(_('&Search:'), s)
|
||||||
s.setPlaceholderText(_('The search expression'))
|
s.setPlaceholderText(_('The search expression'))
|
||||||
if self.initial_search:
|
if self.initial_search:
|
||||||
s.setText(self.initial_search)
|
s.setPlainText(self.initial_search)
|
||||||
n.setFocus(Qt.FocusReason.OtherFocusReason)
|
n.setFocus(Qt.FocusReason.OtherFocusReason)
|
||||||
l.addRow(self.bb)
|
l.addRow(self.bb)
|
||||||
|
|
||||||
@ -68,7 +69,7 @@ class AddSavedSearch(Dialog):
|
|||||||
_('No search name'),
|
_('No search name'),
|
||||||
_('You must specify a name for the Saved search'),
|
_('You must specify a name for the Saved search'),
|
||||||
show=True)
|
show=True)
|
||||||
expression = self.search.text().strip()
|
expression = self.search.toPlainText().strip()
|
||||||
if not expression:
|
if not expression:
|
||||||
return error_dialog(
|
return error_dialog(
|
||||||
self,
|
self,
|
||||||
@ -182,7 +183,7 @@ class SavedSearchEditor(Dialog):
|
|||||||
validate=self.validate_edit)
|
validate=self.validate_edit)
|
||||||
d.setWindowTitle(_('Edit saved search'))
|
d.setWindowTitle(_('Edit saved search'))
|
||||||
d.sname.setText(n)
|
d.sname.setText(n)
|
||||||
d.search.setText(self.searches[n])
|
d.search.setPlainText(self.searches[n])
|
||||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
if d.exec_() != QDialog.DialogCode.Accepted:
|
||||||
return
|
return
|
||||||
name, expression = d.accepted_data
|
name, expression = d.accepted_data
|
||||||
|
Loading…
x
Reference in New Issue
Block a user