From 5572db6fde03ce6b13709fa20beccf078fd4a539 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 11 Oct 2013 18:03:55 +0530 Subject: [PATCH] Option to mark newly added books An option to mark newly added books with a temporary mark. Optionis in Preferences->Adding books. Fixes #1238609 [[Enhancement] Set books as "Marked" when adding](https://bugs.launchpad.net/calibre/+bug/1238609) --- src/calibre/db/view.py | 4 +++- src/calibre/gui2/preferences/adding.py | 1 + src/calibre/gui2/preferences/adding.ui | 7 +++++++ src/calibre/utils/config_base.py | 2 ++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/calibre/db/view.py b/src/calibre/db/view.py index 76690f440b..1a3d195e66 100644 --- a/src/calibre/db/view.py +++ b/src/calibre/db/view.py @@ -13,7 +13,7 @@ from itertools import izip, imap from future_builtins import map from calibre.ebooks.metadata import title_sort -from calibre.utils.config_base import tweaks +from calibre.utils.config_base import tweaks, prefs from calibre.db.write import uniq def sanitize_sort_field_name(field_metadata, field): @@ -426,4 +426,6 @@ class View(object): ids = tuple(ids) self._map = ids + self._map self._map_filtered = ids + self._map_filtered + if prefs['mark_new_books']: + self.toggle_marked_ids(ids) diff --git a/src/calibre/gui2/preferences/adding.py b/src/calibre/gui2/preferences/adding.py index 266b0ca9cc..f41e830083 100644 --- a/src/calibre/gui2/preferences/adding.py +++ b/src/calibre/gui2/preferences/adding.py @@ -35,6 +35,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): (_('Create new record for each duplicate format'), 'new record')] r('automerge', gprefs, choices=choices) r('new_book_tags', prefs, setting=CommaSeparatedList) + r('mark_new_books', prefs) r('auto_add_path', gprefs, restart_required=True) r('auto_add_check_for_duplicates', gprefs) r('auto_add_auto_convert', gprefs) diff --git a/src/calibre/gui2/preferences/adding.ui b/src/calibre/gui2/preferences/adding.ui index 8b9b9c0cd1..383f1b9b04 100644 --- a/src/calibre/gui2/preferences/adding.ui +++ b/src/calibre/gui2/preferences/adding.ui @@ -151,6 +151,13 @@ Author matching is exact. + + + + &Mark newly added books + + + diff --git a/src/calibre/utils/config_base.py b/src/calibre/utils/config_base.py index 779fd84b54..3f5e4048b6 100644 --- a/src/calibre/utils/config_base.py +++ b/src/calibre/utils/config_base.py @@ -400,6 +400,8 @@ def _prefs(): help=_('Add new formats to existing book records')) c.add_opt('installation_uuid', default=None, help='Installation UUID') c.add_opt('new_book_tags', default=[], help=_('Tags to apply to books added to the library')) + c.add_opt('mark_new_books', default=False, help=_( + 'Mark newly added books. The mark is a temporary mark that is automatically removed when calibre is restarted.')) # these are here instead of the gui preferences because calibredb and # calibre server can execute searches