From ca19bcd9792fe9c2fcf67f06f58ab557b7213260 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 13 Aug 2011 12:41:42 -0600 Subject: [PATCH] Add an option to not preserve the date when copying books between libraries (found in Preferences->Adding books) --- src/calibre/gui2/__init__.py | 1 + src/calibre/gui2/actions/copy_to_library.py | 3 +++ src/calibre/gui2/preferences/adding.py | 1 + src/calibre/gui2/preferences/adding.ui | 17 ++++++++++++----- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index 12e60464f7..dedec91a1c 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -97,6 +97,7 @@ gprefs.defaults['book_display_fields'] = [ ('last_modified', False), ('size', False), ] gprefs.defaults['default_author_link'] = 'http://en.wikipedia.org/w/index.php?search={author}' +gprefs.defaults['preserve_date_on_ctl'] = True # }}} diff --git a/src/calibre/gui2/actions/copy_to_library.py b/src/calibre/gui2/actions/copy_to_library.py index 846eb54b9c..14c61c91e6 100644 --- a/src/calibre/gui2/actions/copy_to_library.py +++ b/src/calibre/gui2/actions/copy_to_library.py @@ -15,6 +15,7 @@ from calibre.gui2.actions import InterfaceAction from calibre.gui2 import error_dialog, Dispatcher, warning_dialog, gprefs from calibre.gui2.dialogs.progress import ProgressDialog from calibre.utils.config import prefs, tweaks +from calibre.utils.date import now class Worker(Thread): # {{{ @@ -55,6 +56,8 @@ class Worker(Thread): # {{{ for i, x in enumerate(self.ids): mi = self.db.get_metadata(x, index_is_id=True, get_cover=True, cover_as_data=True) + if not gprefs['preserve_date_on_ctl']: + mi.timestamp = now() self.progress(i, mi.title) fmts = self.db.formats(x, index_is_id=True) if not fmts: fmts = [] diff --git a/src/calibre/gui2/preferences/adding.py b/src/calibre/gui2/preferences/adding.py index b4c4ce846a..3965cd2afd 100644 --- a/src/calibre/gui2/preferences/adding.py +++ b/src/calibre/gui2/preferences/adding.py @@ -24,6 +24,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): r('read_file_metadata', prefs) r('swap_author_names', prefs) r('add_formats_to_existing', prefs) + r('preserve_date_on_ctl', gprefs) choices = [ (_('Ignore duplicate incoming formats'), 'ignore'), (_('Overwrite existing duplicate formats'), 'overwrite'), diff --git a/src/calibre/gui2/preferences/adding.ui b/src/calibre/gui2/preferences/adding.ui index e1d00f975d..4a0d01be73 100644 --- a/src/calibre/gui2/preferences/adding.ui +++ b/src/calibre/gui2/preferences/adding.ui @@ -58,7 +58,7 @@ - + Automerge: If books with similar titles and authors found, merge the incoming formats automatically into @@ -72,7 +72,7 @@ Title match ignores leading indefinite articles ("the", "a", - + Automerge: If books with similar titles and authors found, merge the incoming formats automatically into @@ -88,7 +88,7 @@ Author matching is exact. - + &Tags to apply when adding a book: @@ -98,14 +98,14 @@ Author matching is exact. - + A comma-separated list of tags that will be applied to books added to the library - + &Configure metadata from file name @@ -127,6 +127,13 @@ Author matching is exact. + + + + When &copying books from one library to another, preserve the date + + +