From 74d6513287302f475e9f65c3d235028aff0d64c9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 15 Nov 2019 11:07:31 +0530 Subject: [PATCH] Default title should start with #1 --- src/calibre/gui2/viewer/bookmarks.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/viewer/bookmarks.py b/src/calibre/gui2/viewer/bookmarks.py index 4a1fcbc84f..875b7e90b7 100644 --- a/src/calibre/gui2/viewer/bookmarks.py +++ b/src/calibre/gui2/viewer/bookmarks.py @@ -266,8 +266,17 @@ class BookmarkManager(QWidget): import_current_bookmarks(imported) def create_new_bookmark(self, pos_data): + base_default_title = _('Bookmark') + all_titles = {bm['title'] for bm in self.get_bookmarks()} + c = 0 + while True: + c += 1 + default_title = '{} #{}'.format(base_default_title, c) + if default_title not in all_titles: + break + title, ok = QInputDialog.getText(self, _('Add bookmark'), - _('Enter title for bookmark:'), text=_('Bookmark')) + _('Enter title for bookmark:'), text=default_title) title = unicode_type(title).strip() if not ok or not title: return