mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add set/unset operators for date searches in the advanced search dialog
This commit is contained in:
parent
575c46310a
commit
7c59955b54
@ -31,6 +31,8 @@ def init_dateop(cb):
|
|||||||
('>', _('after')),
|
('>', _('after')),
|
||||||
('<=', _('before or equal to')),
|
('<=', _('before or equal to')),
|
||||||
('>=', _('after or equal to')),
|
('>=', _('after or equal to')),
|
||||||
|
('s', _('set')),
|
||||||
|
('u', _('unset')),
|
||||||
]:
|
]:
|
||||||
cb.addItem(desc, op)
|
cb.addItem(desc, op)
|
||||||
|
|
||||||
@ -383,6 +385,8 @@ class SearchDialog(QDialog):
|
|||||||
def date_search_string(self):
|
def date_search_string(self):
|
||||||
field = str(self.date_field.itemData(self.date_field.currentIndex()) or '')
|
field = str(self.date_field.itemData(self.date_field.currentIndex()) or '')
|
||||||
op = current_dateop(self.dateop_date)
|
op = current_dateop(self.dateop_date)
|
||||||
|
if op in 'su':
|
||||||
|
return f'{field}:{"true" if op == "s" else "false"}'
|
||||||
prefix = f'{field}:{op}'
|
prefix = f'{field}:{op}'
|
||||||
if self.sel_date.isChecked():
|
if self.sel_date.isChecked():
|
||||||
ans = f'{prefix}{self.date_year.value()}'
|
ans = f'{prefix}{self.date_year.value()}'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user