Add field to edit Date to the Edit Meta Information dialog

This commit is contained in:
Kovid Goyal 2009-09-27 23:22:38 -06:00
parent 97eff53503
commit a1a30a50ea
2 changed files with 41 additions and 8 deletions

View File

@ -280,6 +280,8 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
self.cpixmap = None self.cpixmap = None
self.cover.setAcceptDrops(True) self.cover.setAcceptDrops(True)
self.pubdate.setMinimumDate(QDate(100,1,1)) self.pubdate.setMinimumDate(QDate(100,1,1))
self.date.setMinimumDate(QDate(100,1,1))
self.connect(self.cover, SIGNAL('cover_changed(PyQt_PyObject)'), self.cover_dropped) self.connect(self.cover, SIGNAL('cover_changed(PyQt_PyObject)'), self.cover_dropped)
QObject.connect(self.cover_button, SIGNAL("clicked(bool)"), \ QObject.connect(self.cover_button, SIGNAL("clicked(bool)"), \
self.select_cover) self.select_cover)
@ -325,6 +327,9 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
pubdate = db.pubdate(self.id, index_is_id=True) pubdate = db.pubdate(self.id, index_is_id=True)
self.pubdate.setDate(QDate(pubdate.year, pubdate.month, self.pubdate.setDate(QDate(pubdate.year, pubdate.month,
pubdate.day)) pubdate.day))
timestamp = db.timestamp(self.id, index_is_id=True)
self.date.setDate(QDate(timestamp.year, timestamp.month,
timestamp.day))
exts = self.db.formats(row) exts = self.db.formats(row)
if exts: if exts:
@ -567,6 +572,8 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
self.db.set_comment(self.id, qstring_to_unicode(self.comments.toPlainText()), notify=False) self.db.set_comment(self.id, qstring_to_unicode(self.comments.toPlainText()), notify=False)
d = self.pubdate.date() d = self.pubdate.date()
self.db.set_pubdate(self.id, datetime(d.year(), d.month(), d.day())) self.db.set_pubdate(self.id, datetime(d.year(), d.month(), d.day()))
d = self.date.date()
self.db.set_timestamp(self.id, datetime(d.year(), d.month(), d.day()))
if self.cover_changed and self.cover_data is not None: if self.cover_changed and self.cover_data is not None:
self.db.set_cover(self.id, self.cover_data) self.db.set_cover(self.id, self.cover_data)

View File

@ -44,7 +44,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>879</width> <width>879</width>
<height>711</height> <height>710</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_5"> <layout class="QVBoxLayout" name="verticalLayout_5">
@ -177,7 +177,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="3" column="1" colspan="2">
<widget class="QSpinBox" name="rating"> <widget class="QSpinBox" name="rating">
<property name="toolTip"> <property name="toolTip">
<string>Rating of this book. 0-5 stars</string> <string>Rating of this book. 0-5 stars</string>
@ -325,7 +325,7 @@
<item row="8" column="1" colspan="2"> <item row="8" column="1" colspan="2">
<widget class="QLineEdit" name="isbn"/> <widget class="QLineEdit" name="isbn"/>
</item> </item>
<item row="9" column="0"> <item row="10" column="0">
<widget class="QLabel" name="label_10"> <widget class="QLabel" name="label_10">
<property name="text"> <property name="text">
<string>Publishe&amp;d:</string> <string>Publishe&amp;d:</string>
@ -338,14 +338,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1"> <item row="4" column="1" colspan="2">
<widget class="EnComboBox" name="publisher"> <widget class="EnComboBox" name="publisher">
<property name="editable"> <property name="editable">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="1"> <item row="7" column="1" colspan="2">
<widget class="QDoubleSpinBox" name="series_index"> <widget class="QDoubleSpinBox" name="series_index">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -358,7 +358,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="1"> <item row="10" column="1" colspan="2">
<widget class="QDateEdit" name="pubdate"> <widget class="QDateEdit" name="pubdate">
<property name="displayFormat"> <property name="displayFormat">
<string>MMM yyyy</string> <string>MMM yyyy</string>
@ -375,6 +375,29 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="1" colspan="2">
<widget class="QDateEdit" name="date">
<property name="displayFormat">
<string>MMM yyyy</string>
</property>
<property name="calendarPopup">
<bool>true</bool>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>&amp;Date:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>date</cstring>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -695,18 +718,21 @@
<tabstop>remove_series_button</tabstop> <tabstop>remove_series_button</tabstop>
<tabstop>series_index</tabstop> <tabstop>series_index</tabstop>
<tabstop>isbn</tabstop> <tabstop>isbn</tabstop>
<tabstop>date</tabstop>
<tabstop>pubdate</tabstop> <tabstop>pubdate</tabstop>
<tabstop>comments</tabstop> <tabstop>comments</tabstop>
<tabstop>fetch_metadata_button</tabstop> <tabstop>fetch_metadata_button</tabstop>
<tabstop>formats</tabstop>
<tabstop>add_format_button</tabstop> <tabstop>add_format_button</tabstop>
<tabstop>remove_format_button</tabstop> <tabstop>remove_format_button</tabstop>
<tabstop>cover_path</tabstop> <tabstop>cover_path</tabstop>
<tabstop>cover_button</tabstop> <tabstop>cover_button</tabstop>
<tabstop>reset_cover</tabstop> <tabstop>reset_cover</tabstop>
<tabstop>fetch_cover_button</tabstop> <tabstop>fetch_cover_button</tabstop>
<tabstop>scrollArea</tabstop> <tabstop>button_set_cover</tabstop>
<tabstop>formats</tabstop>
<tabstop>button_set_metadata</tabstop>
<tabstop>button_box</tabstop> <tabstop>button_box</tabstop>
<tabstop>scrollArea</tabstop>
</tabstops> </tabstops>
<resources> <resources>
<include location="../../../../resources/images.qrc"/> <include location="../../../../resources/images.qrc"/>