Fix context menu when paranoid=False

This commit is contained in:
Fredrick Brennan 2015-10-18 16:00:28 +08:00
parent 63a53c5aad
commit 88ca99c624
1 changed files with 8 additions and 0 deletions

View File

@ -12,6 +12,7 @@ class ShowQRTextEdit(ButtonsTextEdit):
ButtonsTextEdit.__init__(self, text)
self.setReadOnly(1)
self.addButton(":icons/qrcode.png", self.qr_show, _("Show as QR code"))
self.paranoid = paranoid
if paranoid:
# Paranoid flag forces the user to write down what's in the box,
@ -37,6 +38,13 @@ class ShowQRTextEdit(ButtonsTextEdit):
s = unicode(self.toPlainText())
QRDialog(s).exec_()
def contextMenuEvent(self, e):
if self.paranoid: return
m = self.createStandardContextMenu()
m.addAction(_("Show as QR code"), self.qr_show)
m.exec_(e.globalPos())
class ScanQRTextEdit(ButtonsTextEdit):
def __init__(self, text=""):