From cb2576fc3790be6fddba6d1ea318f9525dba642c Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Tue, 1 Mar 2016 09:21:10 +0800 Subject: [PATCH] Empty resource loader for messageview MessageView does not currently load external resources (QTextBrowser by default interprets all external resources as local file names and tries to load them like that. This can, in the future, be implemented. For example, if SOCKS (Tor) is used, the resource could be loaded through the SOCKS too. This commit is a skeleton for it that does not actually do anything and can be filled with an implementation that does the loading. --- src/bitmessageqt/messageview.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/bitmessageqt/messageview.py b/src/bitmessageqt/messageview.py index 66aac2cb..9dd40a54 100644 --- a/src/bitmessageqt/messageview.py +++ b/src/bitmessageqt/messageview.py @@ -60,6 +60,21 @@ class MessageView(QtGui.QTextBrowser): if reply == QtGui.QMessageBox.Yes: QtGui.QDesktopServices.openUrl(link) + def loadResource (restype, name): + if restype == QtGui.QTextDocument.ImageResource and name.scheme() == "bmmsg": + pass +# QImage correctImage; +# lookup the correct QImage from a cache +# return QVariant::fromValue(correctImage); +# elif restype == QtGui.QTextDocument.HtmlResource: +# elif restype == QtGui.QTextDocument.ImageResource: +# elif restype == QtGui.QTextDocument.StyleSheetResource: +# elif restype == QtGui.QTextDocument.UserResource: + else: + pass +# by default, this will interpret it as a local file +# QtGui.QTextBrowser.loadResource(restype, name) + def lazyRender(self): if self.rendering: return