diff --git a/gui/qt/qrtextedit.py b/gui/qt/qrtextedit.py index 4a90514f9..fd63ad075 100644 --- a/gui/qt/qrtextedit.py +++ b/gui/qt/qrtextedit.py @@ -8,10 +8,25 @@ from util import ButtonsTextEdit class ShowQRTextEdit(ButtonsTextEdit): - def __init__(self, text=None): + def __init__(self, text=None, paranoid=False): ButtonsTextEdit.__init__(self, text) self.setReadOnly(1) self.addButton(":icons/qrcode.png", self.qr_show, _("Show as QR code")) + + if paranoid: + # Paranoid flag forces the user to write down what's in the box, + # like Mycelium does. This is useful since many users just copy + # and paste their code, then when disaster strikes they don't have + # it written down anywhere. + self.setAcceptDrops(False) # No dragging and dropping + # Use custom context menu to remove copy/paste from menu + self.setContextMenuPolicy(Qt.ActionsContextMenu) + self.qaction = QAction(_("Show as QR code"), self) + self.qaction.triggered.connect(self.qr_show) + self.addAction(self.qaction) + # No text selection allowed. + self.setTextInteractionFlags(Qt.NoTextInteraction) + run_hook('show_text_edit', self) def qr_show(self): @@ -22,12 +37,6 @@ class ShowQRTextEdit(ButtonsTextEdit): s = unicode(self.toPlainText()) QRDialog(s).exec_() - def contextMenuEvent(self, e): - m = self.createStandardContextMenu() - m.addAction(_("Show as QR code"), self.qr_show) - m.exec_(e.globalPos()) - - class ScanQRTextEdit(ButtonsTextEdit): def __init__(self, text=""): diff --git a/gui/qt/seed_dialog.py b/gui/qt/seed_dialog.py index b9d5a5375..41fd68519 100644 --- a/gui/qt/seed_dialog.py +++ b/gui/qt/seed_dialog.py @@ -75,7 +75,7 @@ def enter_seed_box(msg, window, sid=None, text=None): seed_e = ScanQRTextEdit() seed_e.setTabChangesFocus(True) else: - seed_e = ShowQRTextEdit(text=text) + seed_e = ShowQRTextEdit(text=text, paranoid=True) seed_e.setMaximumHeight(130) vbox.addWidget(label) grid = QGridLayout()