mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 01:52:31 +02:00
Add a copy to clipboard button for the duplicates message when copying to another library. Fixes #1278305 [The Popup for duplicate records when using "copy to library xyz" does not have a "copy to clipboard" option that would be most useful](https://bugs.launchpad.net/calibre/+bug/1278305)
This commit is contained in:
parent
e6c62225cb
commit
f7414c034f
1 changed files with 8 additions and 1 deletions
|
|
@ -12,7 +12,7 @@
|
|||
from collections import defaultdict
|
||||
|
||||
from PyQt4.Qt import (
|
||||
QToolButton, QDialog, QGridLayout, QIcon, QLabel, QDialogButtonBox,
|
||||
QToolButton, QDialog, QGridLayout, QIcon, QLabel, QDialogButtonBox, QApplication,
|
||||
QFormLayout, QCheckBox, QWidget, QScrollArea, QVBoxLayout, Qt, QListWidgetItem, QListWidget)
|
||||
|
||||
from calibre.gui2.actions import InterfaceAction
|
||||
|
|
@ -284,9 +284,16 @@ def __init__(self, parent, duplicates, loc):
|
|||
b.clicked.connect(self.select_all)
|
||||
self.n = b = bb.addButton(_('Select &none'), bb.ActionRole)
|
||||
b.clicked.connect(self.select_none)
|
||||
self.ctc = b = bb.addButton(_('&Copy to clipboard'), bb.ActionRole)
|
||||
b.clicked.connect(self.copy_to_clipboard)
|
||||
l.addWidget(bb)
|
||||
self.resize(600, 400)
|
||||
|
||||
def copy_to_clipboard(self):
|
||||
items = [('✓' if item.checkState() == Qt.Checked else '✗') + ' ' + unicode(item.text())
|
||||
for item in self.items]
|
||||
QApplication.clipboard().setText('\n'.join(items))
|
||||
|
||||
def select_all(self):
|
||||
for i in self.items:
|
||||
i.setCheckState(Qt.Checked)
|
||||
|
|
|
|||
Loading…
Reference in a new issue