mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
In the main book list when editing a blank published date, use a default value of Jan 2000 so that changing the date it easier
This commit is contained in:
parent
060836c133
commit
f5086f5c9c
@ -9,7 +9,7 @@ import sys
|
|||||||
|
|
||||||
from PyQt4.Qt import (Qt, QApplication, QStyle, QIcon, QDoubleSpinBox,
|
from PyQt4.Qt import (Qt, QApplication, QStyle, QIcon, QDoubleSpinBox,
|
||||||
QVariant, QSpinBox, QStyledItemDelegate, QComboBox, QTextDocument,
|
QVariant, QSpinBox, QStyledItemDelegate, QComboBox, QTextDocument,
|
||||||
QAbstractTextDocumentLayout, QFont, QFontInfo)
|
QAbstractTextDocumentLayout, QFont, QFontInfo, QDate)
|
||||||
|
|
||||||
from calibre.gui2 import UNDEFINED_QDATETIME, error_dialog, rating_font
|
from calibre.gui2 import UNDEFINED_QDATETIME, error_dialog, rating_font
|
||||||
from calibre.constants import iswindows
|
from calibre.constants import iswindows
|
||||||
@ -83,6 +83,7 @@ class DateDelegate(QStyledItemDelegate): # {{{
|
|||||||
qde.setSpecialValueText(_('Undefined'))
|
qde.setSpecialValueText(_('Undefined'))
|
||||||
qde.setCalendarPopup(True)
|
qde.setCalendarPopup(True)
|
||||||
return qde
|
return qde
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
class PubDateDelegate(QStyledItemDelegate): # {{{
|
class PubDateDelegate(QStyledItemDelegate): # {{{
|
||||||
@ -104,6 +105,12 @@ class PubDateDelegate(QStyledItemDelegate): # {{{
|
|||||||
qde.setCalendarPopup(True)
|
qde.setCalendarPopup(True)
|
||||||
return qde
|
return qde
|
||||||
|
|
||||||
|
def setEditorData(self, editor, index):
|
||||||
|
val = index.data(Qt.EditRole).toDate()
|
||||||
|
if val == UNDEFINED_QDATETIME.date():
|
||||||
|
val = QDate(2000, 1, 1)
|
||||||
|
editor.setDate(val)
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
class TextDelegate(QStyledItemDelegate): # {{{
|
class TextDelegate(QStyledItemDelegate): # {{{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user