mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Merge branch 'master' of https://github.com/cbhaley/calibre
Fixes #1909380 [Tag Browser: Drag & drop doesn't give VL prompt](https://bugs.launchpad.net/calibre/+bug/1909380)
This commit is contained in:
commit
51a21c3887
@ -18,7 +18,7 @@ from PyQt5.Qt import (
|
||||
from calibre.constants import config_dir
|
||||
from calibre.db.categories import Tag
|
||||
from calibre.ebooks.metadata import rating_to_stars
|
||||
from calibre.gui2 import config, error_dialog, file_icon_provider, gprefs
|
||||
from calibre.gui2 import config, error_dialog, file_icon_provider, gprefs, question_dialog
|
||||
from calibre.gui2.dialogs.confirm_delete import confirm
|
||||
from calibre.library.field_metadata import category_icon_map
|
||||
from calibre.utils.config import prefs, tweaks
|
||||
@ -298,6 +298,15 @@ class TagTreeItem(object): # {{{
|
||||
FL_Interval = namedtuple('FL_Interval', ('first_chr', 'last_chr', 'length'))
|
||||
|
||||
|
||||
def rename_only_in_vl_question(parent):
|
||||
return question_dialog(parent,
|
||||
_('Rename in Virtual library'), '<p>' +
|
||||
_('Do you want this rename to apply only to books '
|
||||
'in the current Virtual library?') + '</p>',
|
||||
yes_text=_('Yes, apply only in VL'),
|
||||
no_text=_('No, apply in entire library'))
|
||||
|
||||
|
||||
class TagsModel(QAbstractItemModel): # {{{
|
||||
|
||||
search_item_renamed = pyqtSignal()
|
||||
@ -878,8 +887,10 @@ class TagsModel(QAbstractItemModel): # {{{
|
||||
new_name = dest_item.tag.original_name + '.' + src_simple_name
|
||||
else:
|
||||
new_name = src_simple_name
|
||||
# In d&d renames always use the vl. This might be controversial.
|
||||
src_item.use_vl = True
|
||||
if self.get_in_vl():
|
||||
src_item.use_vl = rename_only_in_vl_question(self.gui_parent)
|
||||
else:
|
||||
src_item.use_vl = False
|
||||
self.rename_item(src_item, key, new_name)
|
||||
return True
|
||||
# Should be working with a user category
|
||||
|
@ -20,7 +20,7 @@ from calibre.constants import config_dir
|
||||
from calibre.ebooks.metadata import rating_to_stars
|
||||
from calibre.gui2.complete2 import EditWithComplete
|
||||
from calibre.gui2.tag_browser.model import (TagTreeItem, TAG_SEARCH_STATES,
|
||||
TagsModel, DRAG_IMAGE_ROLE, COUNT_ROLE)
|
||||
TagsModel, DRAG_IMAGE_ROLE, COUNT_ROLE, rename_only_in_vl_question)
|
||||
from calibre.gui2.widgets import EnLineEdit
|
||||
from calibre.gui2 import (config, gprefs, choose_files, pixmap_to_data,
|
||||
rating_font, empty_index, question_dialog)
|
||||
@ -133,12 +133,7 @@ class TagDelegate(QStyledItemDelegate): # {{{
|
||||
if not item.ignore_vl:
|
||||
if item.use_vl is None:
|
||||
if self.tags_view.model().get_in_vl():
|
||||
item.use_vl = question_dialog(self.tags_view,
|
||||
_('Rename in Virtual library'), '<p>' +
|
||||
_('Do you want this rename to apply only to books '
|
||||
'in the current Virtual library?') + '</p>',
|
||||
yes_text=_('Yes, apply only in VL'),
|
||||
no_text=_('No, apply in entire library'))
|
||||
item.use_vl = rename_only_in_vl_question(self.tags_view)
|
||||
else:
|
||||
item.use_vl = False
|
||||
elif not item.use_vl and self.tags_view.model().get_in_vl():
|
||||
|
Loading…
x
Reference in New Issue
Block a user