[webkit-qt] Global settings in WebKit2 port

José Dapena Paz jdapena at igalia.com
Fri Jan 18 02:54:18 PST 2013


Hi,

In my recent work for Qt/WebKit2, I found a need for exposing some
global settings and events:
* Spellchecking variables are global (not specific to a context nor a
view). There's only one spellchecker, and properties like "beign
enabled", "check languages A and B" are global then.
* Web notifications are not associated to any web view (at least at API
level). They are associated to a WKPageRef, but we don't have access to
the associated UI client. So my idea is notifying the user also through
a global object.

In Qt/WebKit1 this kind of variables are exposed in object QWebSettings
with static methods for global settings.

In Qt/WebKit2 we have QWebPreferences, associated to each QQuickWebView.
So it is not exactly valid for this case.

My proposal is adding an object accessible through QML for global
settings. The proposal has already an implementation in spellchecking
bug [1]

Basically:
* I have a QWebGlobal object, which allows to access the global
spellchecker (and would also add properties for any other settings
needed).
* This QWebGlobal object is exposed as a global variable "webkit" in QML
JS.

I'd love some feedback. To start with, here we go with a set of
questions:
* C++ object QWebGlobal naming... Anything better? QWebSettings?
* QML global object named as "webkit". Ok?
* How would we prefer to expose spellchecking vars? Just
webkit.textChecker.property = whatever? Or better something like
webkit.textCheckerProperty = whatever and avoid exposing the textchecker
object at all in QML?
* About notifications [2]: I need a way to tell user a new notification
has been requested. My current take is adding a signal to QWebGlobal
"showNotification" that passes a QWebNotification object to user. It
would allow to How would you see this?
* What about the other global settings existing in Qt/WebKit1?

[1] https://bugs.webkit.org/show_bug.cgi?id=105034
[2] https://bugs.webkit.org/show_bug.cgi?id=96171




More information about the webkit-qt mailing list