Thomas Fischer's Weblog

Life, Linux, LaTeX

KParts Browser Plugin

with 21 comments

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!


Written by Thomas Fischer

May 22, 2010 at 17:09

Posted in KDE, Linux

21 Responses

Subscribe to comments with RSS.

  1. 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 🙂


    May 22, 2010 at 17:53

  2. 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

  3. I have a plugin which loads okular into firefox using kparts here:

    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

  4. 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

  5. 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..?


    August 5, 2010 at 6:14

  6. Sorry, didn’t read well enough. You already implemented that! I’ll try it out 🙂


    August 5, 2010 at 6:16

  7. 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

  8. Can you please provide me with an example (link)?

    Thomas Fischer

    August 12, 2010 at 21:07

  9. Try to click on the PDF link there. At least for me it crashes.

    Yngve I. Levinsen

    August 16, 2010 at 10:48

  10. 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

  11. (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
    [warn] epoll_wait: Bad file descriptor


    August 17, 2010 at 11:53

  12. 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

  13. 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.


    August 17, 2010 at 16:41

  14. Ah, and I installed the version you released on the 23. of July, which to me looks like the latest?


    August 17, 2010 at 16:42

  15. 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

  16. Yes.

    Thomas Fischer

    August 18, 2010 at 9:09

  17. Any chance to get the search working? CTR+F is disabled in browser and plugin


    November 11, 2010 at 11:43

  18. 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

  19. Hi!
    As there is some activity on the kde-on-windows ml (
    do you think it’s possibile to release this plugin for windows too?


    December 21, 2010 at 13:10

  20. 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

  21. 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…


    June 7, 2011 at 23:47

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: