diff --git a/src/calibre/gui2/dialogs/metadata_bulk.py b/src/calibre/gui2/dialogs/metadata_bulk.py
index 5ea8f00148..da6e92c26a 100644
--- a/src/calibre/gui2/dialogs/metadata_bulk.py
+++ b/src/calibre/gui2/dialogs/metadata_bulk.py
@@ -15,15 +15,16 @@ from calibre.ebooks.metadata import string_to_authors, authors_to_string
from calibre.ebooks.metadata.book.base import composite_formatter
from calibre.ebooks.metadata.meta import get_metadata
from calibre.gui2.custom_column_widgets import populate_metadata_page
-from calibre.gui2 import error_dialog, ResizableDialog
+from calibre.gui2 import error_dialog, ResizableDialog, UNDEFINED_QDATE
from calibre.gui2.progress_indicator import ProgressIndicator
from calibre.utils.config import dynamic
from calibre.utils.titlecase import titlecase
from calibre.utils.icu import sort_key, capitalize
-from calibre.utils.config import prefs
+from calibre.utils.config import prefs, tweaks
from calibre.utils.magick.draw import identify_data
+from calibre.utils.date import qt_to_dt
-def get_cover_data(path):
+def get_cover_data(path): # {{{
old = prefs['read_file_metadata']
if not old:
prefs['read_file_metadata'] = True
@@ -46,7 +47,7 @@ def get_cover_data(path):
prefs['read_file_metadata'] = old
return cdata, area
-
+# }}}
class MyBlockingBusy(QDialog): # {{{
@@ -132,7 +133,8 @@ class MyBlockingBusy(QDialog): # {{{
remove_all, remove, add, au, aus, do_aus, rating, pub, do_series, \
do_autonumber, do_remove_format, remove_format, do_swap_ta, \
do_remove_conv, do_auto_author, series, do_series_restart, \
- series_start_value, do_title_case, cover_action, clear_series = self.args
+ series_start_value, do_title_case, cover_action, clear_series, \
+ pubdate = self.args
# first loop: do author and title. These will commit at the end of each
@@ -209,6 +211,9 @@ class MyBlockingBusy(QDialog): # {{{
if clear_series:
self.db.set_series(id, '', notify=False, commit=False)
+ if pubdate is not None:
+ self.db.set_pubdate(id, pubdate, notify=False, commit=False)
+
if do_series:
if do_series_restart:
if self.series_start_value is None:
@@ -288,6 +293,12 @@ class MetadataBulkDialog(ResizableDialog, Ui_MetadataBulkDialog):
self.series.editTextChanged.connect(self.series_changed)
self.tag_editor_button.clicked.connect(self.tag_editor)
self.autonumber_series.stateChanged[int].connect(self.auto_number_changed)
+ self.pubdate.setMinimumDate(UNDEFINED_QDATE)
+ pubdate_format = tweaks['gui_pubdate_display_format']
+ if pubdate_format is not None:
+ self.pubdate.setDisplayFormat(pubdate_format)
+ self.pubdate.setSpecialValueText(_('Undefined'))
+ self.clear_pubdate_button.clicked.connect(self.clear_pubdate)
if len(self.db.custom_field_keys(include_composites=False)) == 0:
self.central_widget.removeTab(1)
@@ -304,6 +315,9 @@ class MetadataBulkDialog(ResizableDialog, Ui_MetadataBulkDialog):
self.central_widget.setCurrentIndex(tab)
self.exec_()
+ def clear_pubdate(self, *args):
+ self.pubdate.setDate(UNDEFINED_QDATE)
+
def button_clicked(self, which):
if which == self.button_box.button(QDialogButtonBox.Apply):
self.do_again = True
@@ -783,6 +797,10 @@ class MetadataBulkDialog(ResizableDialog, Ui_MetadataBulkDialog):
do_remove_conv = self.remove_conversion_settings.isChecked()
do_auto_author = self.auto_author_sort.isChecked()
do_title_case = self.change_title_to_title_case.isChecked()
+ pubdate = None
+ if self.apply_pubdate.isChecked():
+ pubdate = qt_to_dt(self.pubdate.date())
+
cover_action = None
if self.cover_remove.isChecked():
cover_action = 'remove'
@@ -794,7 +812,8 @@ class MetadataBulkDialog(ResizableDialog, Ui_MetadataBulkDialog):
args = (remove_all, remove, add, au, aus, do_aus, rating, pub, do_series,
do_autonumber, do_remove_format, remove_format, do_swap_ta,
do_remove_conv, do_auto_author, series, do_series_restart,
- series_start_value, do_title_case, cover_action, clear_series)
+ series_start_value, do_title_case, cover_action, clear_series,
+ pubdate)
bb = MyBlockingBusy(_('Applying changes to %d books.\nPhase {0} {1}%%.')
%len(self.ids), args, self.db, self.ids,
diff --git a/src/calibre/gui2/dialogs/metadata_bulk.ui b/src/calibre/gui2/dialogs/metadata_bulk.ui
index 9240cd1af8..b14c31c9d1 100644
--- a/src/calibre/gui2/dialogs/metadata_bulk.ui
+++ b/src/calibre/gui2/dialogs/metadata_bulk.ui
@@ -75,13 +75,31 @@
- -
-
-
- A&utomatically set author sort
+
-
+
+
+ true
+ -
+
+
-
+
+
+ A&utomatically set author sort
+
+
+
+ -
+
+
+ &Swap title and author
+
+
+
+
+
-
@@ -95,7 +113,7 @@
- -
+
-
Specify how the author(s) of this book should be sorted. For example Charles Dickens should be sorted as Dickens, Charles.
@@ -115,7 +133,7 @@
- -
+
-
Rating of this book. 0-5 stars
@@ -156,7 +174,7 @@
- -
+
-
true
@@ -202,6 +220,9 @@
&Remove tags:
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
remove_tags
@@ -220,7 +241,7 @@
Check this box to remove all tags from the books.
- Remove all
+ Remove &all
@@ -241,52 +262,44 @@
-
-
-
-
-
-
- List of known series. You can add new series.
-
-
- List of known series. You can add new series.
-
-
- true
-
-
- QComboBox::InsertAlphabetically
-
-
- QComboBox::AdjustToContents
-
-
-
- -
-
-
- If checked, the series will be cleared
-
-
- Clear series
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 20
- 0
-
-
-
-
-
+
+
+
+ 0
+ 0
+
+
+
+ List of known series. You can add new series.
+
+
+ List of known series. You can add new series.
+
+
+ true
+
+
+ QComboBox::InsertAlphabetically
+
+
+ QComboBox::AdjustToMinimumContentsLengthWithIcon
+
+
+ 40
+
+
- -
+
-
+
+
+ If checked, the series will be cleared
+
+
+ &Clear series
+
+
+
+ -
-
@@ -297,7 +310,7 @@ you selected them. So if you selected Book A and then Book B,
Book A will have series number 1 and Book B series number 2.
- Automatically number books in this series
+ &Automatically number books in this series
@@ -312,7 +325,7 @@ for that series. Checking this box will tell calibre to start numbering
from the value in the box
- Force numbers to start with
+ &Force numbers to start with:
@@ -332,85 +345,94 @@ from the value in the box
+
+
+ -
+
+
+ &Published:
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+ pubdate
+
+
+
+ -
+
-
-
+
+
+ MMM yyyy
+
+
+
+ -
+
+
+ Clear published date
+
+
+ ...
+
+
+
+ :/images/trash.png:/images/trash.png
+
+
+
+
+
+ -
+
+
+ &Apply date
+
+
+
+ -
+
+
-
+
+
+ Force the title to be in title case. If both this and swap authors are checked,
+title and author are swapped before the title case is set
+
+
+ Change title to title &case
+
+
+
+ -
+
Qt::Horizontal
- 20
- 10
+ 40
+ 20
-
-
- -
-
-
- Remove &format:
-
-
- remove_format
-
-
-
- -
-
-
- -
-
-
- true
-
-
-
- -
-
-
- &Swap title and author
-
-
-
- -
-
-
- Force the title to be in title case. If both this and swap authors are checked,
-title and author are swapped before the title case is set
-
-
- Change title to title case
-
-
-
- -
-
-
- Remove stored conversion settings for the selected books.
+
-
+
+
+ Remove stored conversion settings for the selected books.
Future conversion of these books will use the default settings.
-
-
- Remove &stored conversion settings for the selected books
-
-
+
+
+ Remove &stored conversion settings for the selected books
+
+
+
+
-
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
- -
Change &cover
@@ -440,6 +462,55 @@ Future conversion of these books will use the default settings.
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Fixed
+
+
+
+ 20
+ 15
+
+
+
+
+ -
+
+
+ Remove &format:
+
+
+ remove_format
+
+
+
+ -
+
+
+
+ 120
+ 16777215
+
+
+
+
@@ -800,8 +871,8 @@ not multiple and the destination field is multiple
0
0
- 197
- 60
+ 826
+ 313
@@ -902,14 +973,9 @@ not multiple and the destination field is multiple
remove_tags
remove_all_tags
series
- clear_series
autonumber_series
series_numbering_restarts
series_start_number
- remove_format
- remove_conversion_settings
- swap_title_and_author
- change_title_to_title_case
button_box
search_field
search_mode
diff --git a/src/calibre/gui2/dialogs/metadata_single.py b/src/calibre/gui2/dialogs/metadata_single.py
index ede605343b..e4efdf0470 100644
--- a/src/calibre/gui2/dialogs/metadata_single.py
+++ b/src/calibre/gui2/dialogs/metadata_single.py
@@ -16,7 +16,7 @@ from PyQt4.Qt import SIGNAL, QObject, Qt, QTimer, QDate, \
from calibre.gui2 import error_dialog, file_icon_provider, dynamic, \
choose_files, choose_images, ResizableDialog, \
- warning_dialog, question_dialog
+ warning_dialog, question_dialog, UNDEFINED_QDATE
from calibre.gui2.dialogs.metadata_single_ui import Ui_MetadataSingleDialog
from calibre.gui2.dialogs.fetch_metadata import FetchMetadata
from calibre.gui2.dialogs.tag_editor import TagEditor
@@ -491,11 +491,15 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
self.formats.setAcceptDrops(True)
self.cover_changed = False
self.cpixmap = None
- self.pubdate.setMinimumDate(QDate(100,1,1))
+ self.pubdate.setMinimumDate(UNDEFINED_QDATE)
pubdate_format = tweaks['gui_pubdate_display_format']
if pubdate_format is not None:
self.pubdate.setDisplayFormat(pubdate_format)
- self.date.setMinimumDate(QDate(100,1,1))
+ self.date.setMinimumDate(UNDEFINED_QDATE)
+ self.pubdate.setSpecialValueText(_('Undefined'))
+ self.date.setSpecialValueText(_('Undefined'))
+ self.clear_pubdate_button.clicked.connect(self.clear_pubdate)
+
self.connect(self.cover, SIGNAL('cover_changed(PyQt_PyObject)'), self.cover_dropped)
QObject.connect(self.cover_button, SIGNAL("clicked(bool)"), \
@@ -615,6 +619,9 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
self.show()
+ def clear_pubdate(self, *args):
+ self.pubdate.setDate(UNDEFINED_QDATE)
+
def create_custom_column_editors(self):
w = self.central_widget.widget(1)
layout = w.layout()
diff --git a/src/calibre/gui2/dialogs/metadata_single.ui b/src/calibre/gui2/dialogs/metadata_single.ui
index 6d31342dcf..60c221be1a 100644
--- a/src/calibre/gui2/dialogs/metadata_single.ui
+++ b/src/calibre/gui2/dialogs/metadata_single.ui
@@ -100,6 +100,112 @@
+ -
+
+
-
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+ Automatically create the title sort entry based on the current title entry.
+Using this button to create title sort will change title sort from red to green.
+
+
+ ...
+
+
+
+ :/images/auto_author_sort.png:/images/auto_author_sort.png
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+ Swap the author and title
+
+
+ ...
+
+
+
+ :/images/swap.png:/images/swap.png
+
+
+
+ 16
+ 16
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+ Automatically create the author sort entry based on the current author entry.
+Using this button to create author sort will change author sort from red to green.
+
+
+ ...
+
+
+
+ :/images/auto_author_sort.png:/images/auto_author_sort.png
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
-
@@ -226,6 +332,31 @@ If the box is colored green, then text matches the individual author's sort stri
+ -
+
+
-
+
+
+ Tags categorize the book. This is particularly useful while searching. <br><br>They can be any words or phrases, separated by commas.
+
+
+
+
+
+ -
+
+
+ Open Tag Editor
+
+
+ Open Tag Editor
+
+
+
+ :/images/chapters.png:/images/chapters.png
+
+
+
-
@@ -265,6 +396,20 @@ If the box is colored green, then text matches the individual author's sort stri
+ -
+
+
+ Remove unused series (Series that have no books)
+
+
+ ...
+
+
+
+ :/images/trash.png:/images/trash.png
+
+
+
-
@@ -330,7 +475,7 @@ If the box is colored green, then text matches the individual author's sort stri
- -
+
-
MMM yyyy
@@ -340,144 +485,10 @@ If the box is colored green, then text matches the individual author's sort stri
- -
-
-
-
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
- -
-
-
- Automatically create the title sort entry based on the current title entry.
-Using this button to create title sort will change title sort from red to green.
-
-
- ...
-
-
-
- :/images/auto_author_sort.png:/images/auto_author_sort.png
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
- -
-
-
- Swap the author and title
-
-
- ...
-
-
-
- :/images/swap.png:/images/swap.png
-
-
-
- 16
- 16
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
- -
-
-
- Automatically create the author sort entry based on the current author entry.
-Using this button to create author sort will change author sort from red to green.
-
-
- ...
-
-
-
- :/images/auto_author_sort.png:/images/auto_author_sort.png
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
-
-
- -
-
-
-
-
-
- Tags categorize the book. This is particularly useful while searching. <br><br>They can be any words or phrases, separated by commas.
-
-
-
-
-
- -
-
+
-
+
- Open Tag Editor
-
-
- Open Tag Editor
-
-
-
- :/images/chapters.png:/images/chapters.png
-
-
-
- -
-
-
- Remove unused series (Series that have no books)
-
-
- ...
+ Clear published date