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.
This commit is contained in:
Peter Šurda 2016-03-01 09:21:10 +08:00
parent 375ff7128d
commit cb2576fc37
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -60,6 +60,21 @@ class MessageView(QtGui.QTextBrowser):
if reply == QtGui.QMessageBox.Yes: if reply == QtGui.QMessageBox.Yes:
QtGui.QDesktopServices.openUrl(link) 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): def lazyRender(self):
if self.rendering: if self.rendering:
return return