mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
E-book viewer: Show an error when creating a bookmark if the bookmark position is not found. See #2029521 (Epub files with non-functional bookmarks)
This commit is contained in:
parent
05464cc4f9
commit
3df98e0995
@ -10,7 +10,7 @@ from qt.core import (
|
|||||||
QPushButton, Qt, QWidget, pyqtSignal,
|
QPushButton, Qt, QWidget, pyqtSignal,
|
||||||
)
|
)
|
||||||
|
|
||||||
from calibre.gui2 import choose_files, choose_save_file
|
from calibre.gui2 import choose_files, choose_save_file, error_dialog
|
||||||
from calibre.gui2.dialogs.confirm_delete import confirm
|
from calibre.gui2.dialogs.confirm_delete import confirm
|
||||||
from calibre.gui2.gestures import GestureManager
|
from calibre.gui2.gestures import GestureManager
|
||||||
from calibre.gui2.viewer.shortcuts import get_shortcut_for
|
from calibre.gui2.viewer.shortcuts import get_shortcut_for
|
||||||
@ -367,6 +367,9 @@ class BookmarkManager(QWidget):
|
|||||||
return
|
return
|
||||||
title = self.uniqify_bookmark_title(title)
|
title = self.uniqify_bookmark_title(title)
|
||||||
cfi = (pos_data.get('selection_bounds') or {}).get('start') or pos_data['cfi']
|
cfi = (pos_data.get('selection_bounds') or {}).get('start') or pos_data['cfi']
|
||||||
|
if not cfi:
|
||||||
|
error_dialog(self, _('Failed to bookmark'), _('Could not calculate position in book'), show=True)
|
||||||
|
return
|
||||||
bm = {
|
bm = {
|
||||||
'title': title,
|
'title': title,
|
||||||
'pos_type': 'epubcfi',
|
'pos_type': 'epubcfi',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user