mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04: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
@ -12,7 +12,7 @@ from contextlib import closing
|
||||
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 @@ class DuplicatesQuestion(QDialog): # {{{
|
||||
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…
x
Reference in New Issue
Block a user