fix HTML display such as URL, email address and image

This commit is contained in:
Kashiko Koibumi 2024-05-16 10:26:11 +09:00
parent 6a090e802e
commit ec91d9f20c
No known key found for this signature in database
GPG Key ID: 8F06E069E37C40C4
5 changed files with 163 additions and 85 deletions

View File

@ -1428,7 +1428,7 @@ class MyForm(settingsmixin.SMainWindow):
# addressbook # addressbook
def addressbookKeyPressEvent(self, event): def addressbookKeyPressEvent(self, event):
"""Handle keypress event in addressbook widget""" """Handle keypress event in addressbook widget"""
if event.key() == QtCore.Qt.Key_Delete: if event.key() == QtCore.Qt.Key.Key_Delete:
self.on_action_AddressBookDelete() self.on_action_AddressBookDelete()
else: else:
return QtWidgets.QTableWidget.keyPressEvent( return QtWidgets.QTableWidget.keyPressEvent(
@ -1445,7 +1445,7 @@ class MyForm(settingsmixin.SMainWindow):
def handleKeyPress(self, event, focus=None): def handleKeyPress(self, event, focus=None):
"""This method handles keypress events for all widgets on MyForm""" """This method handles keypress events for all widgets on MyForm"""
messagelist = self.getCurrentMessagelist() messagelist = self.getCurrentMessagelist()
if event.key() == QtCore.Qt.Key_Delete: if event.key() == QtCore.Qt.Key.Key_Delete:
if isinstance(focus, (MessageView, QtWidgets.QTableWidget)): if isinstance(focus, (MessageView, QtWidgets.QTableWidget)):
folder = self.getCurrentFolder() folder = self.getCurrentFolder()
if folder == "sent": if folder == "sent":
@ -1453,24 +1453,24 @@ class MyForm(settingsmixin.SMainWindow):
else: else:
self.on_action_InboxTrash() self.on_action_InboxTrash()
event.ignore() event.ignore()
elif QtWidgets.QApplication.queryKeyboardModifiers() == QtCore.Qt.NoModifier: elif QtWidgets.QApplication.queryKeyboardModifiers() == QtCore.Qt.KeyboardModifier.NoModifier:
if event.key() == QtCore.Qt.Key_N: if event.key() == QtCore.Qt.Key.Key_N:
currentRow = messagelist.currentRow() currentRow = messagelist.currentRow()
if currentRow < messagelist.rowCount() - 1: if currentRow < messagelist.rowCount() - 1:
messagelist.selectRow(currentRow + 1) messagelist.selectRow(currentRow + 1)
event.ignore() event.ignore()
elif event.key() == QtCore.Qt.Key_P: elif event.key() == QtCore.Qt.Key.Key_P:
currentRow = messagelist.currentRow() currentRow = messagelist.currentRow()
if currentRow > 0: if currentRow > 0:
messagelist.selectRow(currentRow - 1) messagelist.selectRow(currentRow - 1)
event.ignore() event.ignore()
elif event.key() == QtCore.Qt.Key_R: elif event.key() == QtCore.Qt.Key.Key_R:
if messagelist == self.ui.tableWidgetInboxChans: if messagelist == self.ui.tableWidgetInboxChans:
self.on_action_InboxReplyChan() self.on_action_InboxReplyChan()
else: else:
self.on_action_InboxReply() self.on_action_InboxReply()
event.ignore() event.ignore()
elif event.key() == QtCore.Qt.Key_C: elif event.key() == QtCore.Qt.Key.Key_C:
currentAddress = self.getCurrentAccount() currentAddress = self.getCurrentAccount()
if currentAddress: if currentAddress:
self.setSendFromComboBox(currentAddress) self.setSendFromComboBox(currentAddress)
@ -1482,7 +1482,7 @@ class MyForm(settingsmixin.SMainWindow):
) )
self.ui.lineEditTo.setFocus() self.ui.lineEditTo.setFocus()
event.ignore() event.ignore()
elif event.key() == QtCore.Qt.Key_F: elif event.key() == QtCore.Qt.Key.Key_F:
try: try:
self.getCurrentSearchLine(retObj=True).setFocus() self.getCurrentSearchLine(retObj=True).setFocus()
except AttributeError: except AttributeError:
@ -2861,7 +2861,7 @@ class MyForm(settingsmixin.SMainWindow):
content = ' '.join(lines) # To keep the whitespace between lines content = ' '.join(lines) # To keep the whitespace between lines
content = shared.fixPotentiallyInvalidUTF8Data(content) content = shared.fixPotentiallyInvalidUTF8Data(content)
content = content content = content
textEdit.setHtml(QtCore.QString(content)) textEdit.setHtml(content)
def on_action_InboxMarkUnread(self): def on_action_InboxMarkUnread(self):
tableWidget = self.getCurrentMessagelist() tableWidget = self.getCurrentMessagelist()
@ -2928,7 +2928,7 @@ class MyForm(settingsmixin.SMainWindow):
self.ui.comboBoxSendFrom, self.ui.comboBoxSendFromBroadcast self.ui.comboBoxSendFrom, self.ui.comboBoxSendFromBroadcast
): ):
for i in range(box.count()): for i in range(box.count()):
if str(box.itemData(i).toPyObject()) == address: if box.itemData(i) == address:
box.setCurrentIndex(i) box.setCurrentIndex(i)
break break
else: else:
@ -4071,7 +4071,7 @@ class MyForm(settingsmixin.SMainWindow):
messageTextedit.setCurrentFont(QtGui.QFont()) messageTextedit.setCurrentFont(QtGui.QFont())
messageTextedit.setTextColor(QtGui.QColor()) messageTextedit.setTextColor(QtGui.QColor())
messageTextedit.setPlainText(message) messageTextedit.setContent(message)
def tableWidgetAddressBookItemChanged(self, item): def tableWidgetAddressBookItemChanged(self, item):
if item.type == AccountMixin.CHAN: if item.type == AccountMixin.CHAN:

View File

@ -9,9 +9,11 @@
from PyQt6 import QtCore, QtGui, QtWidgets from PyQt6 import QtCore, QtGui, QtWidgets
from bmconfigparser import config from bmconfigparser import config
from .foldertree import AddressBookCompleter from .foldertree import AddressBookCompleter
from .blacklist import Blacklist from .messageview import MessageView
from .messagecompose import MessageCompose
import bitmessageqt.settingsmixin as settingsmixin import bitmessageqt.settingsmixin as settingsmixin
from .networkstatus import NetworkStatus from .networkstatus import NetworkStatus
from .blacklist import Blacklist
class Ui_MainWindow(object): class Ui_MainWindow(object):
def setupUi(self, MainWindow): def setupUi(self, MainWindow):
@ -105,7 +107,7 @@ class Ui_MainWindow(object):
self.tableWidgetInbox.verticalHeader().setVisible(False) self.tableWidgetInbox.verticalHeader().setVisible(False)
self.tableWidgetInbox.verticalHeader().setDefaultSectionSize(26) self.tableWidgetInbox.verticalHeader().setDefaultSectionSize(26)
self.verticalLayout_7.addWidget(self.tableWidgetInbox) self.verticalLayout_7.addWidget(self.tableWidgetInbox)
self.textEditInboxMessage = QtWidgets.QTextEdit(parent=self.inbox) self.textEditInboxMessage = MessageView(parent=self.inbox)
self.textEditInboxMessage.setBaseSize(QtCore.QSize(0, 500)) self.textEditInboxMessage.setBaseSize(QtCore.QSize(0, 500))
self.textEditInboxMessage.setReadOnly(True) self.textEditInboxMessage.setReadOnly(True)
self.textEditInboxMessage.setObjectName("textEditInboxMessage") self.textEditInboxMessage.setObjectName("textEditInboxMessage")
@ -200,34 +202,42 @@ class Ui_MainWindow(object):
self.verticalLayout_5.addWidget(self.textEditMessage) self.verticalLayout_5.addWidget(self.textEditMessage)
self.gridLayout_8.addLayout(self.verticalLayout_5, 0, 0, 1, 1) self.gridLayout_8.addLayout(self.verticalLayout_5, 0, 0, 1, 1)
self.tabWidgetSend.addTab(self.sendDirect, "") self.tabWidgetSend.addTab(self.sendDirect, "")
self.tab_2 = QtWidgets.QWidget() self.sendBroadcast = QtWidgets.QWidget()
self.tab_2.setObjectName("tab_2") self.sendBroadcast.setObjectName("sendBroadcast")
self.gridLayout_9 = QtWidgets.QGridLayout(self.tab_2) self.gridLayout_9 = QtWidgets.QGridLayout(self.sendBroadcast)
self.gridLayout_9.setObjectName("gridLayout_9") self.gridLayout_9.setObjectName("gridLayout_9")
self.verticalLayout_6 = QtWidgets.QVBoxLayout() self.verticalSplitter_6 = settingsmixin.SSplitter()
self.verticalLayout_6.setObjectName("verticalLayout_6") self.verticalSplitter_6.setObjectName("verticalSplitter_6")
self.verticalSplitter_6.setOrientation(QtCore.Qt.Orientation.Vertical)
self.gridLayout_5 = QtWidgets.QGridLayout() self.gridLayout_5 = QtWidgets.QGridLayout()
self.gridLayout_5.setObjectName("gridLayout_5") self.gridLayout_5.setObjectName("gridLayout_5")
self.label_8 = QtWidgets.QLabel(parent=self.tab_2) self.label_8 = QtWidgets.QLabel(self.sendBroadcast)
self.label_8.setObjectName("label_8") self.label_8.setObjectName("label_8")
self.gridLayout_5.addWidget(self.label_8, 0, 0, 1, 1) self.gridLayout_5.addWidget(self.label_8, 0, 0, 1, 1)
self.lineEditSubjectBroadcast = QtWidgets.QLineEdit(parent=self.tab_2) self.lineEditSubjectBroadcast = QtWidgets.QLineEdit(self.sendBroadcast)
self.lineEditSubjectBroadcast.setText("") self.lineEditSubjectBroadcast.setText("")
self.lineEditSubjectBroadcast.setObjectName("lineEditSubjectBroadcast") self.lineEditSubjectBroadcast.setObjectName("lineEditSubjectBroadcast")
self.gridLayout_5.addWidget(self.lineEditSubjectBroadcast, 1, 1, 1, 1) self.gridLayout_5.addWidget(self.lineEditSubjectBroadcast, 1, 1, 1, 1)
self.label_7 = QtWidgets.QLabel(parent=self.tab_2) self.label_7 = QtWidgets.QLabel(self.sendBroadcast)
self.label_7.setObjectName("label_7") self.label_7.setObjectName("label_7")
self.gridLayout_5.addWidget(self.label_7, 1, 0, 1, 1) self.gridLayout_5.addWidget(self.label_7, 1, 0, 1, 1)
self.comboBoxSendFromBroadcast = QtWidgets.QComboBox(parent=self.tab_2) self.comboBoxSendFromBroadcast = QtWidgets.QComboBox(self.sendBroadcast)
self.comboBoxSendFromBroadcast.setMinimumSize(QtCore.QSize(300, 0)) self.comboBoxSendFromBroadcast.setMinimumSize(QtCore.QSize(300, 0))
self.comboBoxSendFromBroadcast.setObjectName("comboBoxSendFromBroadcast") self.comboBoxSendFromBroadcast.setObjectName("comboBoxSendFromBroadcast")
self.gridLayout_5.addWidget(self.comboBoxSendFromBroadcast, 0, 1, 1, 1) self.gridLayout_5.addWidget(self.comboBoxSendFromBroadcast, 0, 1, 1, 1)
self.verticalLayout_6.addLayout(self.gridLayout_5) self.gridLayout_5_Widget = QtWidgets.QWidget()
self.textEditMessageBroadcast = QtWidgets.QTextEdit(parent=self.tab_2) self.gridLayout_5_Widget.setLayout(self.gridLayout_5)
self.verticalSplitter_6.addWidget(self.gridLayout_5_Widget)
self.textEditMessageBroadcast = MessageCompose(self.sendBroadcast)
self.textEditMessageBroadcast.setObjectName("textEditMessageBroadcast") self.textEditMessageBroadcast.setObjectName("textEditMessageBroadcast")
self.verticalLayout_6.addWidget(self.textEditMessageBroadcast) self.verticalSplitter_6.addWidget(self.textEditMessageBroadcast)
self.gridLayout_9.addLayout(self.verticalLayout_6, 0, 0, 1, 1) self.verticalSplitter_6.setStretchFactor(0, 0)
self.tabWidgetSend.addTab(self.tab_2, "") self.verticalSplitter_6.setStretchFactor(1, 1)
self.verticalSplitter_6.setCollapsible(0, False)
self.verticalSplitter_6.setCollapsible(1, False)
self.verticalSplitter_6.handle(1).setEnabled(False)
self.gridLayout_9.addWidget(self.verticalSplitter_6, 0, 0, 1, 1)
self.tabWidgetSend.addTab(self.sendBroadcast, "")
self.verticalLayout.addWidget(self.tabWidgetSend) self.verticalLayout.addWidget(self.tabWidgetSend)
self.horizontalLayout_5 = QtWidgets.QHBoxLayout() self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
self.horizontalLayout_5.setObjectName("horizontalLayout_5") self.horizontalLayout_5.setObjectName("horizontalLayout_5")
@ -351,7 +361,7 @@ class Ui_MainWindow(object):
self.tableWidgetInboxSubscriptions.verticalHeader().setVisible(False) self.tableWidgetInboxSubscriptions.verticalHeader().setVisible(False)
self.tableWidgetInboxSubscriptions.verticalHeader().setDefaultSectionSize(26) self.tableWidgetInboxSubscriptions.verticalHeader().setDefaultSectionSize(26)
self.verticalLayout_4.addWidget(self.tableWidgetInboxSubscriptions) self.verticalLayout_4.addWidget(self.tableWidgetInboxSubscriptions)
self.textEditInboxMessageSubscriptions = QtWidgets.QTextEdit(parent=self.subscriptions) self.textEditInboxMessageSubscriptions = MessageView(parent=self.subscriptions)
self.textEditInboxMessageSubscriptions.setBaseSize(QtCore.QSize(0, 500)) self.textEditInboxMessageSubscriptions.setBaseSize(QtCore.QSize(0, 500))
self.textEditInboxMessageSubscriptions.setReadOnly(True) self.textEditInboxMessageSubscriptions.setReadOnly(True)
self.textEditInboxMessageSubscriptions.setObjectName("textEditInboxMessageSubscriptions") self.textEditInboxMessageSubscriptions.setObjectName("textEditInboxMessageSubscriptions")
@ -428,7 +438,7 @@ class Ui_MainWindow(object):
self.tableWidgetInboxChans.verticalHeader().setVisible(False) self.tableWidgetInboxChans.verticalHeader().setVisible(False)
self.tableWidgetInboxChans.verticalHeader().setDefaultSectionSize(26) self.tableWidgetInboxChans.verticalHeader().setDefaultSectionSize(26)
self.verticalLayout_8.addWidget(self.tableWidgetInboxChans) self.verticalLayout_8.addWidget(self.tableWidgetInboxChans)
self.textEditInboxMessageChans = QtWidgets.QTextEdit(parent=self.chans) self.textEditInboxMessageChans = MessageView(parent=self.chans)
self.textEditInboxMessageChans.setBaseSize(QtCore.QSize(0, 500)) self.textEditInboxMessageChans.setBaseSize(QtCore.QSize(0, 500))
self.textEditInboxMessageChans.setReadOnly(True) self.textEditInboxMessageChans.setReadOnly(True)
self.textEditInboxMessageChans.setObjectName("textEditInboxMessageChans") self.textEditInboxMessageChans.setObjectName("textEditInboxMessageChans")
@ -600,7 +610,7 @@ class Ui_MainWindow(object):
"p, li { white-space: pre-wrap; }\n" "p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'Droid Sans\'; font-size:9pt; font-weight:400; font-style:normal;\">\n" "</style></head><body style=\" font-family:\'Droid Sans\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:\'MS Shell Dlg 2\';\"><br /></p></body></html>")) "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:\'MS Shell Dlg 2\';\"><br /></p></body></html>"))
self.tabWidgetSend.setTabText(self.tabWidgetSend.indexOf(self.tab_2), _translate("MainWindow", "Send Message to your Subscribers")) self.tabWidgetSend.setTabText(self.tabWidgetSend.indexOf(self.sendBroadcast), _translate("MainWindow", "Send Message to your Subscribers"))
self.pushButtonTTL.setText(_translate("MainWindow", "TTL:")) self.pushButtonTTL.setText(_translate("MainWindow", "TTL:"))
self.pushButtonClear.setText(_translate("MainWindow", "Clear")) self.pushButtonClear.setText(_translate("MainWindow", "Clear"))
self.pushButtonSend.setText(_translate("MainWindow", "Send")) self.pushButtonSend.setText(_translate("MainWindow", "Send"))

View File

@ -1,19 +1,30 @@
--- bitmessageui.py.orig 2024-05-13 08:32:22.376971328 +0900 --- bitmessageui.py.orig 2024-05-16 08:36:50.513403227 +0900
+++ bitmessageui.py 2024-05-14 15:56:24.921713575 +0900 +++ bitmessageui.py 2024-05-16 11:17:05.028916782 +0900
@@ -7,7 +7,11 @@ @@ -7,7 +7,13 @@
from PyQt6 import QtCore, QtGui, QtWidgets from PyQt6 import QtCore, QtGui, QtWidgets
- -
+from bmconfigparser import config +from bmconfigparser import config
+from .foldertree import AddressBookCompleter +from .foldertree import AddressBookCompleter
+from .blacklist import Blacklist +from .messageview import MessageView
+from .messagecompose import MessageCompose
+import bitmessageqt.settingsmixin as settingsmixin +import bitmessageqt.settingsmixin as settingsmixin
+from .networkstatus import NetworkStatus +from .networkstatus import NetworkStatus
+from .blacklist import Blacklist
class Ui_MainWindow(object): class Ui_MainWindow(object):
def setupUi(self, MainWindow): def setupUi(self, MainWindow):
@@ -140,6 +144,11 @@ @@ -101,7 +107,7 @@
self.tableWidgetInbox.verticalHeader().setVisible(False)
self.tableWidgetInbox.verticalHeader().setDefaultSectionSize(26)
self.verticalLayout_7.addWidget(self.tableWidgetInbox)
- self.textEditInboxMessage = QtWidgets.QTextEdit(parent=self.inbox)
+ self.textEditInboxMessage = MessageView(parent=self.inbox)
self.textEditInboxMessage.setBaseSize(QtCore.QSize(0, 500))
self.textEditInboxMessage.setReadOnly(True)
self.textEditInboxMessage.setObjectName("textEditInboxMessage")
@@ -140,6 +146,11 @@
self.tableWidgetAddressBook.horizontalHeader().setStretchLastSection(True) self.tableWidgetAddressBook.horizontalHeader().setStretchLastSection(True)
self.tableWidgetAddressBook.verticalHeader().setVisible(False) self.tableWidgetAddressBook.verticalHeader().setVisible(False)
self.verticalLayout_2.addWidget(self.tableWidgetAddressBook) self.verticalLayout_2.addWidget(self.tableWidgetAddressBook)
@ -25,7 +36,7 @@
self.pushButtonAddAddressBook = QtWidgets.QPushButton(parent=self.send) self.pushButtonAddAddressBook = QtWidgets.QPushButton(parent=self.send)
self.pushButtonAddAddressBook.setMaximumSize(QtCore.QSize(200, 16777215)) self.pushButtonAddAddressBook.setMaximumSize(QtCore.QSize(200, 16777215))
self.pushButtonAddAddressBook.setObjectName("pushButtonAddAddressBook") self.pushButtonAddAddressBook.setObjectName("pushButtonAddAddressBook")
@@ -156,40 +165,41 @@ @@ -156,68 +167,77 @@
self.verticalLayout.setObjectName("verticalLayout") self.verticalLayout.setObjectName("verticalLayout")
self.tabWidgetSend = QtWidgets.QTabWidget(parent=self.send) self.tabWidgetSend = QtWidgets.QTabWidget(parent=self.send)
self.tabWidgetSend.setObjectName("tabWidgetSend") self.tabWidgetSend.setObjectName("tabWidgetSend")
@ -74,11 +85,61 @@
self.verticalLayout_5.addWidget(self.textEditMessage) self.verticalLayout_5.addWidget(self.textEditMessage)
self.gridLayout_8.addLayout(self.verticalLayout_5, 0, 0, 1, 1) self.gridLayout_8.addLayout(self.verticalLayout_5, 0, 0, 1, 1)
- self.tabWidgetSend.addTab(self.tab, "") - self.tabWidgetSend.addTab(self.tab, "")
- self.tab_2 = QtWidgets.QWidget()
- self.tab_2.setObjectName("tab_2")
- self.gridLayout_9 = QtWidgets.QGridLayout(self.tab_2)
+ self.tabWidgetSend.addTab(self.sendDirect, "") + self.tabWidgetSend.addTab(self.sendDirect, "")
self.tab_2 = QtWidgets.QWidget() + self.sendBroadcast = QtWidgets.QWidget()
self.tab_2.setObjectName("tab_2") + self.sendBroadcast.setObjectName("sendBroadcast")
self.gridLayout_9 = QtWidgets.QGridLayout(self.tab_2) + self.gridLayout_9 = QtWidgets.QGridLayout(self.sendBroadcast)
@@ -263,6 +273,9 @@ self.gridLayout_9.setObjectName("gridLayout_9")
- self.verticalLayout_6 = QtWidgets.QVBoxLayout()
- self.verticalLayout_6.setObjectName("verticalLayout_6")
+ self.verticalSplitter_6 = settingsmixin.SSplitter()
+ self.verticalSplitter_6.setObjectName("verticalSplitter_6")
+ self.verticalSplitter_6.setOrientation(QtCore.Qt.Orientation.Vertical)
self.gridLayout_5 = QtWidgets.QGridLayout()
self.gridLayout_5.setObjectName("gridLayout_5")
- self.label_8 = QtWidgets.QLabel(parent=self.tab_2)
+ self.label_8 = QtWidgets.QLabel(self.sendBroadcast)
self.label_8.setObjectName("label_8")
self.gridLayout_5.addWidget(self.label_8, 0, 0, 1, 1)
- self.lineEditSubjectBroadcast = QtWidgets.QLineEdit(parent=self.tab_2)
+ self.lineEditSubjectBroadcast = QtWidgets.QLineEdit(self.sendBroadcast)
self.lineEditSubjectBroadcast.setText("")
self.lineEditSubjectBroadcast.setObjectName("lineEditSubjectBroadcast")
self.gridLayout_5.addWidget(self.lineEditSubjectBroadcast, 1, 1, 1, 1)
- self.label_7 = QtWidgets.QLabel(parent=self.tab_2)
+ self.label_7 = QtWidgets.QLabel(self.sendBroadcast)
self.label_7.setObjectName("label_7")
self.gridLayout_5.addWidget(self.label_7, 1, 0, 1, 1)
- self.comboBoxSendFromBroadcast = QtWidgets.QComboBox(parent=self.tab_2)
+ self.comboBoxSendFromBroadcast = QtWidgets.QComboBox(self.sendBroadcast)
self.comboBoxSendFromBroadcast.setMinimumSize(QtCore.QSize(300, 0))
self.comboBoxSendFromBroadcast.setObjectName("comboBoxSendFromBroadcast")
self.gridLayout_5.addWidget(self.comboBoxSendFromBroadcast, 0, 1, 1, 1)
- self.verticalLayout_6.addLayout(self.gridLayout_5)
- self.textEditMessageBroadcast = QtWidgets.QTextEdit(parent=self.tab_2)
+ self.gridLayout_5_Widget = QtWidgets.QWidget()
+ self.gridLayout_5_Widget.setLayout(self.gridLayout_5)
+ self.verticalSplitter_6.addWidget(self.gridLayout_5_Widget)
+ self.textEditMessageBroadcast = MessageCompose(self.sendBroadcast)
self.textEditMessageBroadcast.setObjectName("textEditMessageBroadcast")
- self.verticalLayout_6.addWidget(self.textEditMessageBroadcast)
- self.gridLayout_9.addLayout(self.verticalLayout_6, 0, 0, 1, 1)
- self.tabWidgetSend.addTab(self.tab_2, "")
+ self.verticalSplitter_6.addWidget(self.textEditMessageBroadcast)
+ self.verticalSplitter_6.setStretchFactor(0, 0)
+ self.verticalSplitter_6.setStretchFactor(1, 1)
+ self.verticalSplitter_6.setCollapsible(0, False)
+ self.verticalSplitter_6.setCollapsible(1, False)
+ self.verticalSplitter_6.handle(1).setEnabled(False)
+ self.gridLayout_9.addWidget(self.verticalSplitter_6, 0, 0, 1, 1)
+ self.tabWidgetSend.addTab(self.sendBroadcast, "")
self.verticalLayout.addWidget(self.tabWidgetSend)
self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
self.horizontalLayout_5.setObjectName("horizontalLayout_5")
@@ -263,6 +283,9 @@
self.labelHumanFriendlyTTLDescription.setMaximumSize(QtCore.QSize(45, 16777215)) self.labelHumanFriendlyTTLDescription.setMaximumSize(QtCore.QSize(45, 16777215))
self.labelHumanFriendlyTTLDescription.setObjectName("labelHumanFriendlyTTLDescription") self.labelHumanFriendlyTTLDescription.setObjectName("labelHumanFriendlyTTLDescription")
self.horizontalLayout_5.addWidget(self.labelHumanFriendlyTTLDescription) self.horizontalLayout_5.addWidget(self.labelHumanFriendlyTTLDescription)
@ -88,7 +149,16 @@
self.pushButtonSend = QtWidgets.QPushButton(parent=self.send) self.pushButtonSend = QtWidgets.QPushButton(parent=self.send)
self.pushButtonSend.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.pushButtonSend.setMaximumSize(QtCore.QSize(16777215, 16777215))
self.pushButtonSend.setObjectName("pushButtonSend") self.pushButtonSend.setObjectName("pushButtonSend")
@@ -348,15 +361,15 @@ @@ -338,7 +361,7 @@
self.tableWidgetInboxSubscriptions.verticalHeader().setVisible(False)
self.tableWidgetInboxSubscriptions.verticalHeader().setDefaultSectionSize(26)
self.verticalLayout_4.addWidget(self.tableWidgetInboxSubscriptions)
- self.textEditInboxMessageSubscriptions = QtWidgets.QTextEdit(parent=self.subscriptions)
+ self.textEditInboxMessageSubscriptions = MessageView(parent=self.subscriptions)
self.textEditInboxMessageSubscriptions.setBaseSize(QtCore.QSize(0, 500))
self.textEditInboxMessageSubscriptions.setReadOnly(True)
self.textEditInboxMessageSubscriptions.setObjectName("textEditInboxMessageSubscriptions")
@@ -348,15 +371,15 @@
icon6 = QtGui.QIcon() icon6 = QtGui.QIcon()
icon6.addPixmap(QtGui.QPixmap(":/newPrefix/images/subscriptions.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off) icon6.addPixmap(QtGui.QPixmap(":/newPrefix/images/subscriptions.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
self.tabWidget.addTab(self.subscriptions, icon6, "") self.tabWidget.addTab(self.subscriptions, icon6, "")
@ -108,7 +178,7 @@
self.treeWidgetChans.setMaximumSize(QtCore.QSize(200, 16777215)) self.treeWidgetChans.setMaximumSize(QtCore.QSize(200, 16777215))
self.treeWidgetChans.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.treeWidgetChans.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
self.treeWidgetChans.setLineWidth(1) self.treeWidgetChans.setLineWidth(1)
@@ -368,7 +381,7 @@ @@ -368,7 +391,7 @@
icon7.addPixmap(QtGui.QPixmap(":/newPrefix/images/can-icon-16px.png"), QtGui.QIcon.Mode.Selected, QtGui.QIcon.State.Off) icon7.addPixmap(QtGui.QPixmap(":/newPrefix/images/can-icon-16px.png"), QtGui.QIcon.Mode.Selected, QtGui.QIcon.State.Off)
self.treeWidgetChans.headerItem().setIcon(0, icon7) self.treeWidgetChans.headerItem().setIcon(0, icon7)
self.verticalLayout_17.addWidget(self.treeWidgetChans) self.verticalLayout_17.addWidget(self.treeWidgetChans)
@ -117,7 +187,7 @@
self.pushButtonAddChan.setMaximumSize(QtCore.QSize(200, 16777215)) self.pushButtonAddChan.setMaximumSize(QtCore.QSize(200, 16777215))
self.pushButtonAddChan.setObjectName("pushButtonAddChan") self.pushButtonAddChan.setObjectName("pushButtonAddChan")
self.verticalLayout_17.addWidget(self.pushButtonAddChan) self.verticalLayout_17.addWidget(self.pushButtonAddChan)
@@ -377,10 +390,10 @@ @@ -377,10 +400,10 @@
self.verticalLayout_8.setObjectName("verticalLayout_8") self.verticalLayout_8.setObjectName("verticalLayout_8")
self.horizontalLayout_6 = QtWidgets.QHBoxLayout() self.horizontalLayout_6 = QtWidgets.QHBoxLayout()
self.horizontalLayout_6.setObjectName("horizontalLayout_6") self.horizontalLayout_6.setObjectName("horizontalLayout_6")
@ -130,7 +200,7 @@
self.inboxSearchOptionChans.setObjectName("inboxSearchOptionChans") self.inboxSearchOptionChans.setObjectName("inboxSearchOptionChans")
self.inboxSearchOptionChans.addItem("") self.inboxSearchOptionChans.addItem("")
self.inboxSearchOptionChans.addItem("") self.inboxSearchOptionChans.addItem("")
@@ -389,7 +402,7 @@ @@ -389,7 +412,7 @@
self.inboxSearchOptionChans.addItem("") self.inboxSearchOptionChans.addItem("")
self.horizontalLayout_6.addWidget(self.inboxSearchOptionChans) self.horizontalLayout_6.addWidget(self.inboxSearchOptionChans)
self.verticalLayout_8.addLayout(self.horizontalLayout_6) self.verticalLayout_8.addLayout(self.horizontalLayout_6)
@ -139,16 +209,16 @@
self.tableWidgetInboxChans.setEditTriggers(QtWidgets.QAbstractItemView.EditTrigger.NoEditTriggers) self.tableWidgetInboxChans.setEditTriggers(QtWidgets.QAbstractItemView.EditTrigger.NoEditTriggers)
self.tableWidgetInboxChans.setAlternatingRowColors(True) self.tableWidgetInboxChans.setAlternatingRowColors(True)
self.tableWidgetInboxChans.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection) self.tableWidgetInboxChans.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection)
@@ -415,7 +428,7 @@ @@ -415,7 +438,7 @@
self.tableWidgetInboxChans.verticalHeader().setVisible(False) self.tableWidgetInboxChans.verticalHeader().setVisible(False)
self.tableWidgetInboxChans.verticalHeader().setDefaultSectionSize(26) self.tableWidgetInboxChans.verticalHeader().setDefaultSectionSize(26)
self.verticalLayout_8.addWidget(self.tableWidgetInboxChans) self.verticalLayout_8.addWidget(self.tableWidgetInboxChans)
- self.textEditInboxMessageChans = QtWidgets.QTextEdit(parent=self.tab_3) - self.textEditInboxMessageChans = QtWidgets.QTextEdit(parent=self.tab_3)
+ self.textEditInboxMessageChans = QtWidgets.QTextEdit(parent=self.chans) + self.textEditInboxMessageChans = MessageView(parent=self.chans)
self.textEditInboxMessageChans.setBaseSize(QtCore.QSize(0, 500)) self.textEditInboxMessageChans.setBaseSize(QtCore.QSize(0, 500))
self.textEditInboxMessageChans.setReadOnly(True) self.textEditInboxMessageChans.setReadOnly(True)
self.textEditInboxMessageChans.setObjectName("textEditInboxMessageChans") self.textEditInboxMessageChans.setObjectName("textEditInboxMessageChans")
@@ -424,113 +437,20 @@ @@ -424,113 +447,20 @@
self.gridLayout_4.addLayout(self.horizontalLayout_7, 0, 0, 1, 1) self.gridLayout_4.addLayout(self.horizontalLayout_7, 0, 0, 1, 1)
icon8 = QtGui.QIcon() icon8 = QtGui.QIcon()
icon8.addPixmap(QtGui.QPixmap(":/newPrefix/images/can-icon-16px.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off) icon8.addPixmap(QtGui.QPixmap(":/newPrefix/images/can-icon-16px.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
@ -273,7 +343,7 @@
self.menubar = QtWidgets.QMenuBar(parent=MainWindow) self.menubar = QtWidgets.QMenuBar(parent=MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 885, 27)) self.menubar.setGeometry(QtCore.QRect(0, 0, 885, 27))
self.menubar.setObjectName("menubar") self.menubar.setObjectName("menubar")
@@ -550,6 +470,8 @@ @@ -550,6 +480,8 @@
self.actionManageKeys = QtGui.QAction(parent=MainWindow) self.actionManageKeys = QtGui.QAction(parent=MainWindow)
self.actionManageKeys.setCheckable(False) self.actionManageKeys.setCheckable(False)
self.actionManageKeys.setEnabled(True) self.actionManageKeys.setEnabled(True)
@ -282,7 +352,7 @@
icon = QtGui.QIcon.fromTheme("dialog-password") icon = QtGui.QIcon.fromTheme("dialog-password")
self.actionManageKeys.setIcon(icon) self.actionManageKeys.setIcon(icon)
self.actionManageKeys.setObjectName("actionManageKeys") self.actionManageKeys.setObjectName("actionManageKeys")
@@ -561,6 +483,10 @@ @@ -561,6 +493,10 @@
icon = QtGui.QIcon.fromTheme("help-contents") icon = QtGui.QIcon.fromTheme("help-contents")
self.actionHelp.setIcon(icon) self.actionHelp.setIcon(icon)
self.actionHelp.setObjectName("actionHelp") self.actionHelp.setObjectName("actionHelp")
@ -293,7 +363,7 @@
self.actionAbout = QtGui.QAction(parent=MainWindow) self.actionAbout = QtGui.QAction(parent=MainWindow)
icon = QtGui.QIcon.fromTheme("help-about") icon = QtGui.QIcon.fromTheme("help-about")
self.actionAbout.setIcon(icon) self.actionAbout.setIcon(icon)
@@ -584,17 +510,23 @@ @@ -584,17 +520,23 @@
self.menuFile.addAction(self.actionManageKeys) self.menuFile.addAction(self.actionManageKeys)
self.menuFile.addAction(self.actionDeleteAllTrashedMessages) self.menuFile.addAction(self.actionDeleteAllTrashedMessages)
self.menuFile.addAction(self.actionRegenerateDeterministicAddresses) self.menuFile.addAction(self.actionRegenerateDeterministicAddresses)
@ -319,7 +389,7 @@
QtCore.QMetaObject.connectSlotsByName(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
MainWindow.setTabOrder(self.tableWidgetInbox, self.textEditInboxMessage) MainWindow.setTabOrder(self.tableWidgetInbox, self.textEditInboxMessage)
MainWindow.setTabOrder(self.textEditInboxMessage, self.comboBoxSendFrom) MainWindow.setTabOrder(self.textEditInboxMessage, self.comboBoxSendFrom)
@@ -603,12 +535,26 @@ @@ -603,12 +545,26 @@
MainWindow.setTabOrder(self.lineEditSubject, self.textEditMessage) MainWindow.setTabOrder(self.lineEditSubject, self.textEditMessage)
MainWindow.setTabOrder(self.textEditMessage, self.pushButtonSend) MainWindow.setTabOrder(self.textEditMessage, self.pushButtonSend)
MainWindow.setTabOrder(self.pushButtonSend, self.pushButtonAddSubscription) MainWindow.setTabOrder(self.pushButtonSend, self.pushButtonAddSubscription)
@ -352,7 +422,7 @@
def retranslateUi(self, MainWindow): def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate _translate = QtCore.QCoreApplication.translate
@@ -646,7 +592,7 @@ @@ -646,7 +602,7 @@
"p, li { white-space: pre-wrap; }\n" "p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'Droid Sans\'; font-size:9pt; font-weight:400; font-style:normal;\">\n" "</style></head><body style=\" font-family:\'Droid Sans\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:\'MS Shell Dlg 2\';\"><br /></p></body></html>")) "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:\'MS Shell Dlg 2\';\"><br /></p></body></html>"))
@ -361,16 +431,19 @@
self.label_8.setText(_translate("MainWindow", "From:")) self.label_8.setText(_translate("MainWindow", "From:"))
self.label_7.setText(_translate("MainWindow", "Subject:")) self.label_7.setText(_translate("MainWindow", "Subject:"))
self.textEditMessageBroadcast.setHtml(_translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" self.textEditMessageBroadcast.setHtml(_translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
@@ -656,7 +602,7 @@ @@ -654,9 +610,9 @@
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'Droid Sans\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:\'MS Shell Dlg 2\';\"><br /></p></body></html>")) "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:\'MS Shell Dlg 2\';\"><br /></p></body></html>"))
self.tabWidgetSend.setTabText(self.tabWidgetSend.indexOf(self.tab_2), _translate("MainWindow", "Send Message to your Subscribers")) - self.tabWidgetSend.setTabText(self.tabWidgetSend.indexOf(self.tab_2), _translate("MainWindow", "Send Message to your Subscribers"))
+ self.tabWidgetSend.setTabText(self.tabWidgetSend.indexOf(self.sendBroadcast), _translate("MainWindow", "Send Message to your Subscribers"))
self.pushButtonTTL.setText(_translate("MainWindow", "TTL:")) self.pushButtonTTL.setText(_translate("MainWindow", "TTL:"))
- self.labelHumanFriendlyTTLDescription.setText(_translate("MainWindow", "X days")) - self.labelHumanFriendlyTTLDescription.setText(_translate("MainWindow", "X days"))
+ self.pushButtonClear.setText(_translate("MainWindow", "Clear")) + self.pushButtonClear.setText(_translate("MainWindow", "Clear"))
self.pushButtonSend.setText(_translate("MainWindow", "Send")) self.pushButtonSend.setText(_translate("MainWindow", "Send"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.send), _translate("MainWindow", "Send")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.send), _translate("MainWindow", "Send"))
self.treeWidgetSubscriptions.headerItem().setText(0, _translate("MainWindow", "Subscriptions")) self.treeWidgetSubscriptions.headerItem().setText(0, _translate("MainWindow", "Subscriptions"))
@@ -694,28 +640,8 @@ @@ -694,28 +650,8 @@
item.setText(_translate("MainWindow", "Subject")) item.setText(_translate("MainWindow", "Subject"))
item = self.tableWidgetInboxChans.horizontalHeaderItem(3) item = self.tableWidgetInboxChans.horizontalHeaderItem(3)
item.setText(_translate("MainWindow", "Received")) item.setText(_translate("MainWindow", "Received"))
@ -401,7 +474,7 @@
self.tabWidget.setTabText(self.tabWidget.indexOf(self.networkstatus), _translate("MainWindow", "Network Status")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.networkstatus), _translate("MainWindow", "Network Status"))
self.menuFile.setTitle(_translate("MainWindow", "File")) self.menuFile.setTitle(_translate("MainWindow", "File"))
self.menuSettings.setTitle(_translate("MainWindow", "Settings")) self.menuSettings.setTitle(_translate("MainWindow", "Settings"))
@@ -726,8 +652,10 @@ @@ -726,8 +662,10 @@
self.actionExit.setShortcut(_translate("MainWindow", "Ctrl+Q")) self.actionExit.setShortcut(_translate("MainWindow", "Ctrl+Q"))
self.actionHelp.setText(_translate("MainWindow", "Help")) self.actionHelp.setText(_translate("MainWindow", "Help"))
self.actionHelp.setShortcut(_translate("MainWindow", "F1")) self.actionHelp.setShortcut(_translate("MainWindow", "F1"))

View File

@ -38,7 +38,7 @@ class MessageView(QtWidgets.QTextBrowser):
def mousePressEvent(self, event): def mousePressEvent(self, event):
"""Mouse press button event handler""" """Mouse press button event handler"""
if event.button() == QtCore.Qt.LeftButton and self.html and self.html.has_html and self.cursorForPosition( if event.button() == QtCore.Qt.MouseButton.LeftButton and self.html and self.html.has_html and self.cursorForPosition(
event.pos()).block().blockNumber() == 0: event.pos()).block().blockNumber() == 0:
if self.mode == MessageView.MODE_PLAIN: if self.mode == MessageView.MODE_PLAIN:
self.showHTML() self.showHTML()
@ -52,11 +52,11 @@ class MessageView(QtWidgets.QTextBrowser):
# super will actually automatically take care of zooming # super will actually automatically take care of zooming
super(MessageView, self).wheelEvent(event) super(MessageView, self).wheelEvent(event)
if ( if (
QtGui.QApplication.queryKeyboardModifiers() & QtCore.Qt.ControlModifier QtWidgets.QApplication.queryKeyboardModifiers() & QtCore.Qt.KeyboardModifier.ControlModifier
) == QtCore.Qt.ControlModifier and event.orientation() == QtCore.Qt.Vertical: ) == QtCore.Qt.KeyboardModifier.ControlModifier and event.orientation() == QtCore.Qt.Vertical:
zoom = self.currentFont().pointSize() * 100 / self.defaultFontPointSize zoom = self.currentFont().pointSize() * 100 / self.defaultFontPointSize
QtGui.QApplication.activeWindow().statusBar().showMessage(_translate( QtWidgets.QApplication.activeWindow().statusBar().showMessage(_translate(
"MainWindow", "Zoom level %1%").arg(str(zoom))) "MainWindow", "Zoom level {0}%").format(str(zoom)))
def setWrappingWidth(self, width=None): def setWrappingWidth(self, width=None):
"""Set word-wrapping width""" """Set word-wrapping width"""
@ -68,14 +68,15 @@ class MessageView(QtWidgets.QTextBrowser):
def confirmURL(self, link): def confirmURL(self, link):
"""Show a dialog requesting URL opening confirmation""" """Show a dialog requesting URL opening confirmation"""
if link.scheme() == "mailto": if link.scheme() == "mailto":
window = QtGui.QApplication.activeWindow() window = QtWidgets.QApplication.activeWindow()
window.ui.lineEditTo.setText(link.path()) window.ui.lineEditTo.setText(link.path())
if link.hasQueryItem("subject"): query = QtCore.QUrlQuery(link)
if query.hasQueryItem("subject"):
window.ui.lineEditSubject.setText( window.ui.lineEditSubject.setText(
link.queryItemValue("subject")) query.queryItemValue("subject"))
if link.hasQueryItem("body"): if query.hasQueryItem("body"):
window.ui.textEditMessage.setText( window.ui.textEditMessage.setText(
link.queryItemValue("body")) query.queryItemValue("body"))
window.setSendFromComboBox() window.setSendFromComboBox()
window.ui.tabWidgetSend.setCurrentIndex(0) window.ui.tabWidgetSend.setCurrentIndex(0)
window.ui.tabWidget.setCurrentIndex( window.ui.tabWidget.setCurrentIndex(
@ -83,18 +84,18 @@ class MessageView(QtWidgets.QTextBrowser):
) )
window.ui.textEditMessage.setFocus() window.ui.textEditMessage.setFocus()
return return
reply = QtGui.QMessageBox.warning( reply = QtWidgets.QMessageBox.warning(
self, self,
QtGui.QApplication.translate( QtWidgets.QApplication.translate(
"MessageView", "MessageView",
"Follow external link"), "Follow external link"),
QtGui.QApplication.translate( QtWidgets.QApplication.translate(
"MessageView", "MessageView",
"The link \"%1\" will open in a browser. It may be a security risk, it could de-anonymise you" "The link \"{0}\" will open in a browser. It may be a security risk, it could de-anonymise you"
" or download malicious data. Are you sure?").arg(unicode(link.toString())), " or download malicious data. Are you sure?").format(link.toString()),
QtGui.QMessageBox.Yes, QtWidgets.QMessageBox.StandardButton.Yes,
QtGui.QMessageBox.No) QtWidgets.QMessageBox.StandardButton.No)
if reply == QtGui.QMessageBox.Yes: if reply == QtWidgets.QMessageBox.StandardButton.Yes:
QtGui.QDesktopServices.openUrl(link) QtGui.QDesktopServices.openUrl(link)
def loadResource(self, restype, name): def loadResource(self, restype, name):
@ -123,8 +124,8 @@ class MessageView(QtWidgets.QTextBrowser):
pos = self.out.find(">", self.outpos) pos = self.out.find(">", self.outpos)
if pos > self.outpos: if pos > self.outpos:
self.outpos = pos + 1 self.outpos = pos + 1
cursor.movePosition(QtGui.QTextCursor.End, QtGui.QTextCursor.MoveAnchor) cursor.movePosition(QtGui.QTextCursor.MoveOperation.End, QtGui.QTextCursor.MoveMode.MoveAnchor)
cursor.insertHtml(QtCore.QString(self.out[startpos:self.outpos])) cursor.insertHtml(str(self.out[startpos:self.outpos]))
self.verticalScrollBar().setValue(position) self.verticalScrollBar().setValue(position)
self.rendering = False self.rendering = False
@ -133,9 +134,8 @@ class MessageView(QtWidgets.QTextBrowser):
self.mode = MessageView.MODE_PLAIN self.mode = MessageView.MODE_PLAIN
out = self.html.raw out = self.html.raw
if self.html.has_html: if self.html.has_html:
out = "<div align=\"center\" style=\"text-decoration: underline;\"><b>" + unicode( out = "<div align=\"center\" style=\"text-decoration: underline;\"><b>" + QtWidgets.QApplication.translate(
QtGui.QApplication.translate( "MessageView", "HTML detected, click here to display") + "</b></div><br/>" + out
"MessageView", "HTML detected, click here to display")) + "</b></div><br/>" + out
self.out = out self.out = out
self.outpos = 0 self.outpos = 0
self.setHtml("") self.setHtml("")
@ -145,8 +145,7 @@ class MessageView(QtWidgets.QTextBrowser):
"""Render message as HTML""" """Render message as HTML"""
self.mode = MessageView.MODE_HTML self.mode = MessageView.MODE_HTML
out = self.html.sanitised out = self.html.sanitised
out = "<div align=\"center\" style=\"text-decoration: underline;\"><b>" + unicode( out = "<div align=\"center\" style=\"text-decoration: underline;\"><b>" + QtWidgets.QApplication.translate("MessageView", "Click here to disable HTML") + "</b></div><br/>" + out
QtGui.QApplication.translate("MessageView", "Click here to disable HTML")) + "</b></div><br/>" + out
self.out = out self.out = out
self.outpos = 0 self.outpos = 0
self.setHtml("") self.setHtml("")

View File

@ -122,10 +122,6 @@ class SafeHTMLParser(HTMLParser):
self.sanitised += "&" + name + ";" self.sanitised += "&" + name + ";"
def feed(self, data): def feed(self, data):
try:
data = unicode(data, 'utf-8')
except UnicodeDecodeError:
data = unicode(data, 'utf-8', errors='replace')
HTMLParser.feed(self, data) HTMLParser.feed(self, data)
tmp = SafeHTMLParser.replace_pre(data) tmp = SafeHTMLParser.replace_pre(data)
tmp = self.uriregex1.sub(r'<a href="\1">\1</a>', tmp) tmp = self.uriregex1.sub(r'<a href="\1">\1</a>', tmp)