Need help for a konqueror plugin - Refresh content & javascript intereception

Mathieu Ducharme ducharme.mathieu at gmail.com
Sat May 5 06:06:24 BST 2007


Hi.

I am currently working on a khtml plugin called "Konqueror Userscript[1]",
which aims to provide GreaseMonkey / Userscripts compatibility to Konqueror
in KDE4.
I uploaded a proof-of-concept version today in svn so you can try by
checking out playground/utils/khtml_userscript (You will need to manually
add user.js files in your .kde(4)/share/apps/konqueror/userscripts
folder...)

I ran into a brickwall with two issues, however, so I hope someone on this
list can help me. Just a pointer to the proper documentation would be a
(very welcome) start.

1. I don't know if this is a kde4 issue or something with my code but after
inserting the new javascript code in the page, the content does not get
updated automatically.
I have a simple test scripts which change all links in red. If I click on
the "enter" key in konq, the script will be successfully injected to the
page but the links won't appear in red until I hit a key or move the mouse
inside the view.

I tried calling m_part->view()->repaint() and m_part->view()->update() but
it doesn't do anything. Am I missing something?


2. Is it possible to "intercept" javascript functions inside my plugins. For
example, GreaseMonkey provides a GM_registerMenuCommand() function that
allows userscripts (javascript) to add items to the menu. Basically I would
like to call C++ code (from the plugin) from javascript. This might be
impossible, this might be trivial, I would just like some pointer to know
where to start.

I tried looking at the existing plugins but I couldn't find any that
implements this kind of feature... This would also be needed I guess if
someone would ever want to implement a firebug debugging console for konq...


[1] More information: http://namshub-kde.blogspot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20070505/e863778e/attachment.htm>


More information about the kfm-devel mailing list