mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Edit book: When copying files do it in order so that the files are pasted in the same order when pasting into another editor instance. Fixes #2037198 [Calibre Editor: "Paste # files from other editor instance" > Files Pasted Out of Order](https://bugs.launchpad.net/calibre/+bug/2037198)
This commit is contained in:
parent
4af337c571
commit
34b3ee1138
@ -876,6 +876,16 @@ class FileList(QTreeWidget, OpenWithHandler):
|
||||
ans.discard('')
|
||||
return ans
|
||||
|
||||
@property
|
||||
def selected_names_in_order(self):
|
||||
root = self.invisibleRootItem()
|
||||
for category_item in (root.child(i) for i in range(root.childCount())):
|
||||
for child in (category_item.child(i) for i in range(category_item.childCount())):
|
||||
if child.isSelected():
|
||||
name = child.data(0, NAME_ROLE)
|
||||
if name:
|
||||
yield name
|
||||
|
||||
def move_selected_text_items(self, amt: int) -> bool:
|
||||
parent = self.categories['text']
|
||||
children = tuple(parent.child(i) for i in range(parent.childCount()))
|
||||
@ -906,7 +916,7 @@ class FileList(QTreeWidget, OpenWithHandler):
|
||||
return changed
|
||||
|
||||
def copy_selected_files(self):
|
||||
self.initiate_file_copy.emit(self.selected_names)
|
||||
self.initiate_file_copy.emit(tuple(self.selected_names_in_order))
|
||||
|
||||
def paste_from_other_instance(self):
|
||||
self.initiate_file_paste.emit()
|
||||
|
Loading…
x
Reference in New Issue
Block a user