[webkit-qt] Extending Qt's QML WebView feature set

Jan Kundrát jkt at flaska.net
Thu Nov 1 11:36:46 PDT 2012

I'm using the WebView QML component in the Harmattan version of my IMAP
e-mail client called Trojita [1]. The WebView component is used for
rendering of actual e-mails, so I need quite an amount of control over
how the webkit underneath operates.

In Qt 4.7 (which ships on Harmattan), I had to basically maintain a fork
of the QDeclarativeWebView class, see [2] for how it looks like. The
changes I needed were:

1) Make the QWebSettings property available to the QML code, and publish
the userStyleSheet property through that. This was needed to make the
WebView render things in white on black background [3], a theme which is
used throughout my application.

2) Make it possible to provide a custom QNetworkAccessManager for each
WebView instance. This is very important for various reasons I outlined
in [4] -- in short, each e-mail being displayed must not access the
network without an explicit user's acknowledgement for privacy reasons.
It can also only ever have access to a single IMAP message at a time. In
order to support a use case where multiple messages are open at once,
one therefore has to use two distinct QNAM instances, one for each
WebView, which makes QDeclarativeNetworkAccessManagerFactory not
suitable for this job (apart from any possible threading issues). My
patch makes it possible to use a QNAM subclass provided by the user's
C++ code.

The patches will have to be cleaned up (they're against a 4.7 release of
Qt, for one thing, and use Trojita-specific naming to prevent any
clashes as well). I am not familiar with Qt5/WebKit release plans and I
also don't like wasting time preparing patches which nobody would
accept, which is why I'd like to ask here -- would you guys accept
patches adding this functionality? And what's the probability of them
being included in Qt 5.0?

With kind regards,

[1] http://trojita.flaska.net/
[4] http://thread.gmane.org/gmane.comp.lib.qt.user/1807
Trojita, a fast e-mail client -- http://trojita.flaska.net/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 259 bytes
Desc: OpenPGP digital signature
URL: <http://lists.webkit.org/pipermail/webkit-qt/attachments/20121101/2a965928/attachment.sig>

More information about the webkit-qt mailing list