KParts browser plugin – bringing KDE components to all browsers
Thomas Fischer studied computer science in Darmstadt and got his PhD from the University of Kaiserslautern, Germany. He works as a lecturer and researcher at the University of Skövde, Sweden.
Thomas is active in several communities where he reports bugs, submits patches, and advocates open source software. Being a programmer himself, he has programmed on a bibliography software for KDE, KBibTeX, since his time as a PhD student.
KDE includes a flexible framework known as ‘KParts’ to integrate components from one program into another program. One example is Konqueror, which can show PDF files inside its browser interface using Okular's PDF viewer component. However, as this component technology heavily relies on KDE libraries, it is only accessible to KDE programs.
Whereas Konqueror is the the default browser for KDE, many users prefer other browsers such as Firefox, Opera, or Chrome. Being non-KDE programs, these browsers cannot use the KParts components directly, but they support the original Netscape plugin system instead. The Netscape plugin system is used, for instance, to integrate Flash into a browser.
The KParts browser plugin combines both worlds: it implements the Netscape plugin system to integrate into any browser that supports this interface, but relies on KDE's component system to display content to the user. This way, the KParts browser plugin can be used to show PDF files in Firefox using Okular's component (replacing Adobe Reader here) or OpenDocument text files using KWord's component.
During registration, the KParts plugin scans the KDE subsystem for available KPart components and notifies the browser what mime types it supports. On a typical KDE desktop system with a rich set of applications installed, this can easily include 300 mimetypes.
This plugin is an example how KDE software can interact with non-KDE programs. It may be an inspiration for the GNOME community to build something similar, for instance, adding a Netscape plugin interface to Evince.