diff --git a/src/calibre/gui2/convert/structure_detection.ui b/src/calibre/gui2/convert/structure_detection.ui
index 67fd0a31b2..e4414473f5 100644
--- a/src/calibre/gui2/convert/structure_detection.ui
+++ b/src/calibre/gui2/convert/structure_detection.ui
@@ -28,11 +28,7 @@
-
-
-
- 30
-
-
+
-
diff --git a/src/calibre/gui2/custom_column_widgets.py b/src/calibre/gui2/custom_column_widgets.py
index 58c2f15452..2a9c81e8ee 100644
--- a/src/calibre/gui2/custom_column_widgets.py
+++ b/src/calibre/gui2/custom_column_widgets.py
@@ -132,11 +132,9 @@ class DateEdit(QDateEdit):
def focusInEvent(self, x):
self.setSpecialValueText('')
- QDateEdit.focusInEvent(self, x)
def focusOutEvent(self, x):
self.setSpecialValueText(_('Undefined'))
- QDateEdit.focusOutEvent(self, x)
class DateTime(Base):
@@ -144,10 +142,7 @@ class DateTime(Base):
self.widgets = [QLabel('&'+self.col_metadata['name']+':', parent),
DateEdit(parent)]
w = self.widgets[1]
- format = self.col_metadata['display'].get('date_format','')
- if not format:
- format = 'dd MMM yyyy'
- w.setDisplayFormat(format)
+ w.setDisplayFormat('dd MMM yyyy')
w.setCalendarPopup(True)
w.setMinimumDate(UNDEFINED_QDATE)
w.setSpecialValueText(_('Undefined'))
@@ -161,7 +156,7 @@ class DateTime(Base):
def getter(self):
val = self.widgets[1].date()
- if val <= UNDEFINED_QDATE:
+ if val == UNDEFINED_QDATE:
val = None
else:
val = qt_to_dt(val)
diff --git a/src/calibre/gui2/library/delegates.py b/src/calibre/gui2/library/delegates.py
index 40f7a2e4e0..529055ecd2 100644
--- a/src/calibre/gui2/library/delegates.py
+++ b/src/calibre/gui2/library/delegates.py
@@ -96,7 +96,7 @@ class DateDelegate(QStyledItemDelegate): # {{{
def displayText(self, val, locale):
d = val.toDate()
- if d <= UNDEFINED_QDATE:
+ if d == UNDEFINED_QDATE:
return ''
return format_date(d.toPyDate(), 'dd MMM yyyy')
@@ -116,7 +116,7 @@ class PubDateDelegate(QStyledItemDelegate): # {{{
def displayText(self, val, locale):
d = val.toDate()
- if d <= UNDEFINED_QDATE:
+ if d == UNDEFINED_QDATE:
return ''
format = tweaks['gui_pubdate_display_format']
if format is None:
@@ -194,7 +194,7 @@ class CcDateDelegate(QStyledItemDelegate): # {{{
def displayText(self, val, locale):
d = val.toDate()
- if d <= UNDEFINED_QDATE:
+ if d == UNDEFINED_QDATE:
return ''
return format_date(d.toPyDate(), self.format)
@@ -217,7 +217,7 @@ class CcDateDelegate(QStyledItemDelegate): # {{{
def setModelData(self, editor, model, index):
val = editor.date()
- if val <= UNDEFINED_QDATE:
+ if val == UNDEFINED_QDATE:
val = None
model.setData(index, QVariant(val), Qt.EditRole)
diff --git a/src/calibre/gui2/library/models.py b/src/calibre/gui2/library/models.py
index 89008735fe..9f1a72b021 100644
--- a/src/calibre/gui2/library/models.py
+++ b/src/calibre/gui2/library/models.py
@@ -1216,9 +1216,7 @@ class DeviceBooksModel(BooksModel): # {{{
return done
def set_editable(self, editable):
- # Cannot edit if metadata is sent on connect. Reason: changes will
- # revert to what is in the library on next connect.
- self.editable = editable and prefs['manage_device_metadata']!='on_connect'
+ self.editable = editable
def set_search_restriction(self, s):
pass
diff --git a/src/calibre/library/caches.py b/src/calibre/library/caches.py
index af950a36fc..d46ae23d90 100644
--- a/src/calibre/library/caches.py
+++ b/src/calibre/library/caches.py
@@ -209,13 +209,13 @@ class ResultCache(SearchQueryParser):
if query == 'false':
for item in self._data:
if item is None: continue
- if item[loc] is None or item[loc] <= UNDEFINED_DATE:
+ if item[loc] is None or item[loc] == UNDEFINED_DATE:
matches.add(item[0])
return matches
if query == 'true':
for item in self._data:
if item is None: continue
- if item[loc] is not None and item[loc] > UNDEFINED_DATE:
+ if item[loc] is not None and item[loc] != UNDEFINED_DATE:
matches.add(item[0])
return matches
diff --git a/src/calibre/utils/date.py b/src/calibre/utils/date.py
index b25940d23d..c5fba13f57 100644
--- a/src/calibre/utils/date.py
+++ b/src/calibre/utils/date.py
@@ -44,7 +44,7 @@ parse_date_day_first = compute_locale_info_for_parse_date()
utc_tz = _utc_tz = tzutc()
local_tz = _local_tz = SafeLocalTimeZone()
-UNDEFINED_DATE = datetime(1000,1,1, tzinfo=utc_tz)
+UNDEFINED_DATE = datetime(101,1,1, tzinfo=utc_tz)
def parse_date(date_string, assume_utc=False, as_utc=True, default=None):
'''