mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Advanced search builder: Allow using days/weeks/months/years when building a date based search with number of days ago. Fixes #1431695 [[GUI Improvement] Date Search Selection](https://bugs.launchpad.net/calibre/+bug/1431695)
This commit is contained in:
parent
977d76db87
commit
c625f7771c
@ -50,6 +50,7 @@ class SearchDialog(QDialog, Ui_Dialog):
|
||||
self.date_month.currentIndexChanged.connect(lambda : self.sel_date.setChecked(True))
|
||||
self.date_day.valueChanged.connect(lambda : self.sel_date.setChecked(True))
|
||||
self.date_daysago.valueChanged.connect(lambda : self.sel_daysago.setChecked(True))
|
||||
self.date_ago_type.addItems([_('days'), _('weeks'), _('months'), _('years')])
|
||||
self.date_human.currentIndexChanged.connect(lambda : self.sel_human.setChecked(True))
|
||||
init_dateop(self.dateop_date)
|
||||
self.sel_date.setChecked(True)
|
||||
@ -143,7 +144,9 @@ class SearchDialog(QDialog, Ui_Dialog):
|
||||
ans += '-%s' % d
|
||||
return ans
|
||||
if self.sel_daysago.isChecked():
|
||||
return '%s%sdaysago' % (prefix, self.date_daysago.value())
|
||||
val = self.date_daysago.value()
|
||||
val *= {0:1, 1:7, 2:30, 3:365}[self.date_ago_type.currentIndex()]
|
||||
return '%s%sdaysago' % (prefix, val)
|
||||
return '%s%s' % (prefix, unicode(self.date_human.itemData(self.date_human.currentIndex()) or ''))
|
||||
|
||||
def adv_search_string(self):
|
||||
|
@ -52,7 +52,7 @@
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>&What kind of match to use:</string>
|
||||
<string>What &kind of match to use:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>matchkind</cstring>
|
||||
@ -109,7 +109,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>&All these words:</string>
|
||||
<string>A&ll these words:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>all</cstring>
|
||||
@ -126,7 +126,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>This exact &phrase:</string>
|
||||
<string>&This exact phrase:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>all</cstring>
|
||||
@ -143,7 +143,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>&One or more of these words:</string>
|
||||
<string>O&ne or more of these words:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>all</cstring>
|
||||
@ -402,7 +402,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>&month</string>
|
||||
<string>mo&nth</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>date_month</cstring>
|
||||
@ -460,10 +460,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="date_ago_type"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="text">
|
||||
<string>days ago</string>
|
||||
<string> ago</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user