mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1895586 [[Enhancement] Show a warning before deleting a bookmark in the Bookmarks panel](https://bugs.launchpad.net/calibre/+bug/1895586)
This commit is contained in:
parent
50557eb1ae
commit
78cd807494
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
|
|
||||||
from PyQt5.Qt import (
|
from PyQt5.Qt import (
|
||||||
QAction, QComboBox, QGridLayout, QHBoxLayout, QIcon, QInputDialog,
|
QAction, QComboBox, QGridLayout, QHBoxLayout, QIcon, QInputDialog,
|
||||||
QItemSelectionModel, QLabel, QListWidget, QListWidgetItem, QPushButton, Qt,
|
QItemSelectionModel, QLabel, QListWidget, QListWidgetItem, QPushButton, Qt,
|
||||||
@ -13,6 +12,7 @@ from PyQt5.Qt import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
from calibre.gui2 import choose_files, choose_save_file
|
from calibre.gui2 import choose_files, choose_save_file
|
||||||
|
from calibre.gui2.dialogs.confirm_delete import confirm
|
||||||
from calibre.gui2.viewer.shortcuts import get_shortcut_for
|
from calibre.gui2.viewer.shortcuts import get_shortcut_for
|
||||||
from calibre.gui2.viewer.web_view import vprefs
|
from calibre.gui2.viewer.web_view import vprefs
|
||||||
from calibre.utils.date import EPOCH, utcnow
|
from calibre.utils.date import EPOCH, utcnow
|
||||||
@ -237,13 +237,17 @@ class BookmarkManager(QWidget):
|
|||||||
item = self.bookmarks_list.currentItem()
|
item = self.bookmarks_list.currentItem()
|
||||||
if item is not None:
|
if item is not None:
|
||||||
bm = item.data(Qt.UserRole)
|
bm = item.data(Qt.UserRole)
|
||||||
bm['removed'] = True
|
if confirm(
|
||||||
bm['timestamp'] = utcnow().isoformat()
|
_('Are you sure you want to delete the bookmark: {0}?').format(bm['title']),
|
||||||
self.bookmarks_list.blockSignals(True)
|
'delete-bookmark-from-viewer', parent=self, config_set=vprefs
|
||||||
item.setData(Qt.UserRole, bm)
|
):
|
||||||
self.bookmarks_list.blockSignals(False)
|
bm['removed'] = True
|
||||||
item.setHidden(True)
|
bm['timestamp'] = utcnow().isoformat()
|
||||||
self.edited.emit(self.get_bookmarks())
|
self.bookmarks_list.blockSignals(True)
|
||||||
|
item.setData(Qt.UserRole, bm)
|
||||||
|
self.bookmarks_list.blockSignals(False)
|
||||||
|
item.setHidden(True)
|
||||||
|
self.edited.emit(self.get_bookmarks())
|
||||||
|
|
||||||
def edit_bookmark(self):
|
def edit_bookmark(self):
|
||||||
item = self.bookmarks_list.currentItem()
|
item = self.bookmarks_list.currentItem()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user