KParts Browser Plugin
One of the biggest advantages of Konqueror is that it smoothly integrates with the KDE desktop. Any file type can be opened within Konqueror as it loads KParts modules to handle non-HTML files. For example, to display PDF files within the browser, the embeddable part from Okular is used. Unfortunately, this technology is KDE-only, at least no other browser supports KParts.
On the other side, most browsers support a plugin technology originally coming from the good ol’ Netscape 2.0. Most prominently, it is used for the Flash plugin from Adobe and the PDF plugin as part of the of Acrobat Reader.
So, why not combine both technologies to use KDE parts in “normal” browsers?
With quite little effort, based on some examples by Qt/Nokia, I was able to hack a proof of concept: A small plugin which can be used with browsers such as Mozilla Firefox, Opera, Arora, or Chromium.
So far, the plugin supports PDF and PostScript files (via Okular), OpenDocument text, presentation, and spreadsheet (via KOffice) and MP3/OggVorbis files (via DragonPlayer). More file types can be added with only a few lines of code, given that there is a KDE part installed which can handle this file.
Interested? Visit the project’s homepage and try it out yourself!







Certainly an interesting project, also for “native KDE” browsers, such as rekonq. The hardest part – if possible at all – is integration of the part’s toolbars and menus.
… and “Knusprigkeitsgrad von Frühstücksflocken” really made me laugh, I hope it is not real
Christoph
May 22, 2010 at 17:53
As far as I know does the Netscape plugin API do not include changing/setting menus or similar. One is restricted to rectangular area assigned by the browser. Maybe some really bad hacks are possible with JavaScript, but I doubt it …
Thomas Fischer
May 22, 2010 at 20:15
I have a plugin which loads okular into firefox using kparts here: http://github.com/jeremysanders/okularplugin
It is fairly basic, but the keyboard focus generally works.
Have you tried calling QApplication::setActiveWindow(this) in your window when it is created? I have to call this on mouse enter events to stop the keyboard focus stopping working.
Jeremy Sanders
June 4, 2010 at 10:53
Hello Jeremy, thanks for the tip. Keyboard focus/input is now working. I released a new version using this code (20100604a). Supporting GUI elements such as toolbars may be my next step …
Thomas Fischer
June 4, 2010 at 12:09
Just have to say you’re my hero for the work done on KBibTex
Also, wouldn’t it be possible to use KParts for a Firefox Plugin, similar to the Firefox-Mac-PDF plugin? I’d imagine that should be doable..?
eothred
August 5, 2010 at 6:14
Sorry, didn’t read well enough. You already implemented that! I’ll try it out
eothred
August 5, 2010 at 6:16
Hmm, to me it seems there is a bug if I click on a pdf link which is open in a new window? At least Firefox seems to crash? All in all I’m hugely impressed though!
Yngve I. Levinsen
August 10, 2010 at 18:16
Can you please provide me with an example (link)?
Thomas Fischer
August 12, 2010 at 21:07
http://arxiv.org/abs/1008.0131 Try to click on the PDF link there. At least for me it crashes.
Yngve I. Levinsen
August 16, 2010 at 10:48
Tested with Firefox, Opera, and Arora. No problem. Try to compile with all debugging enabled and send me the command line output of your browser via email (should contain mostly KPartPlugin debug messages).
Thomas Fischer
August 17, 2010 at 11:27
(firefox:7079): Gdk-WARNING **: gdkproperty-x11.c:325 invalid X atom: 6400
QWidget: Cannot create a QWidget when no GUI is being used
KCrash: Application ‘/home/yngve’ crashing…
KCrash: Attempting to start /usr/lib/kde4/libexec/drkonqi from kdeinit
sock_file=/home/yngve/.kdemod4/socket-yngve-mbp/kdeinit4__0
[warn] epoll_wait: Bad file descriptor
…
Yngve
August 17, 2010 at 11:53
Can you reproduce the crash with another browser, e.g. Opera or Arora? Are you using the KWallet plugin for Firefox? Any other Qt/KDE-related plugins installed in Firefox? Have you ensured that you are using the most recent version of my plugin and no other/older versions are installed anywhere else on your filesystem?
Thomas Fischer
August 17, 2010 at 12:40
Interesting, it works well in both Opera and Arora, but Firefox crashes. I use Arch Linux (well, Chakra but at the moment it is in principle just a preconfigured Arch Linux variant), and had the firefox 3.6.8-1 installed from the extras repository, and I also tried the firefox-kde-opensuse 3.6.3-1 from kdemod-extragear. That one crashed with the same QWidget error message. Yes I am using the Kwallet integration, other than that I also have plasma notification integration thingy. Cannot remember/see more KDE-related plugins.
Yngve
August 17, 2010 at 16:41
Ah, and I installed the version you released on the 23. of July, which to me looks like the latest?
Yngve
August 17, 2010 at 16:42
The KWallet plugin is most likely the reason for your problems. Try to disable it, and you will most certainly notice that Firefox will no longer crash. I had problems with this plugin as well, but as I never really used, I uninstalled it to avoid crashes. Maybe I should contact its author to iron out the problem …
Thomas Fischer
August 18, 2010 at 9:09
Yes.
Thomas Fischer
August 18, 2010 at 9:09
Any chance to get the search working? CTR+F is disabled in browser and plugin
ich
November 11, 2010 at 11:43
Hello Ich,
I have tried to find a solution here, but no success yet. The way how Netscape plugins work it is not easy (if possible at all) to implement such shortcut handling.
If someone else knows a Netscape plugin that supports keyboard shortcuts and that has its source code available, I can have a look there and try to implement it in a similar way in the KParts plugin.
Thomas Fischer
November 19, 2010 at 13:29
Hi!
As there is some activity on the kde-on-windows ml (http://mail.kde.org/pipermail/kde-windows/2010-December/005385.html)
do you think it’s possibile to release this plugin for windows too?
ZeD
December 21, 2010 at 13:10
It would be interesting to have this plugin for Windows, too, but I have no experience with KDE on Windows. Maybe ask on of the KDE-on-Windows guys if they know if it would be possible …
Thomas Fischer
February 20, 2011 at 17:43
hello! First I’ve to say: GREAT PROJECT! I love the integration of Okular in a browser (but i use the fork ‘OkularPlugin-Git’, like Jeremy Sanders)
Is it possible to watch DivX-videos with this plugin or does it support vlc (I know it’s not a kde-program, but…)
best regards…
Philipp
June 7, 2011 at 23:47