[KDE Dot News]
 faq
 flatforty
 contribute
 subscribe
 configure
 search
 rdf

 main


  Writing Plugins for KDE Applications
Developer Posted by Navindra Umanee on Thursday 25/Jan/2001, @05:30
from the first-in-a-new-series dept.
In the first of what we hope to be an exciting series, Richard Moore has published a tutorial on how to write KPart plugins for KDE 2. In this tutorial, Richard gives us a glimpse into the power of KParts by demonstrating how simple it is to extend Konqueror with a plugin. In particular, he implements a plugin for HTML Validation, but the same mechanism could have just as easily been used to write a plugin for convenient Babelfish translation of the current webpage, or indeed something much more fancy. In general, once you understand what's here you should be able to write plugins for pretty much any application or component in KDE. The full tutorial can be found on the KDE Developer Site. This story was amended and republished at 04:00 PM. Update: 01/26 04:35 PM by N: Kurt Granroth has made available various modifications to the htmlvalidator example and, best of all, has implemented a nifty BabelFish plugin. See his article for details, download the plugins here. Update: 01/28 07:55 PM by I: As yet more proof of the power and simplicity of KParts-based plugins, Carsten Pfeiffer has created another plugin, which allows easy configuration (from a light drop-down menu) of Java, JavaScript, cookies and image loading. Thanks, Rich, Kurt and Carsten.


<  |  >

 

  Related Links
 ·   Articles on Developer
 ·   Also by Navindra Umanee
 ·   Contact author

Thread Threshold:

The Fine Print: The following comments are owned by whomever posted them.
( Reply )

Over 40 comments listed. Printing out index only.
Re: Writing Plugins for KDE Applications
by Shawn Gordon on Thursday 25/Jan/2001, @13:17
Way to go Richard, this is very cool.
[ Reply To This | View ]
Re: Writing Plugins for KDE Applications
by Richard Moore on Thursday 25/Jan/2001, @13:38
I aim to please ;-)
[ Reply To This | View ]
Re: Writing Plugins for KDE Applications
by KDE User on Thursday 25/Jan/2001, @15:10
One word: Amazing. I just downloaded and compiled the source code. Works like a charm. I got a new toolbar with the ABC spellcheck icon on it. The toolbar even magically goes away in FileManager mode. It's a wonderful feeling to run a browser that is as easily extendable as this.

How do I add the icon ABC automatically to the main toolbar? I tried editing plugin_htmlvalidator.rc by changing mainToolBar to Main Toolbar but that didn't work.

One funny thing is that the source code is only a few lines long but the Makefile stuff is hundreds of kilobytes. :-)
[ Reply To This | View ]
Re: Writing Plugins for KDE Applications
by Chucky / Outmax! on Friday 26/Jan/2001, @00:27
I'm pleased to see that I had to wait for KDE 2, but not for a bad WM !
It's really great ! It's perhaps more easy to add parts to the "explorer" under KDE in C++, than under Windows, with VB ;-)

I wish a long life to the KDE Project !
[ Reply To This | View ]
Re: Writing Plugins for KDE Applications
by steve_qui on Friday 26/Jan/2001, @03:50
Gnome what is your answer yet?
[ Reply To This | View ]
Re: Writing Plugins for KDE Applications
by Helmut Zechmann on Friday 26/Jan/2001, @03:53

I have tried out the libhtmlvalidatorplugin form the tutorial. After installation there was no entry for the plugin in the tools menu of konqueror. After I changed the line kpartgui name="htmlvalidator" library="libhtmlvalidatorplugin" to kpartgui name="htmlvalidator" library="libhtmlvalidatorplugin" version="1" in plugin_htmlvalidatior.rc it worked.


[ Reply To This | View ]
Changes to example + Babelfish plugin
by Kurt Granroth on Friday 26/Jan/2001, @12:29
After reading Rich's excellent tutorial, I was inspired to hack around for a bit. I downloaded the tutorial and starting cleaning things up. For instance:

  • BUGFIX: Put the ToolBar container outside of the MenuBar container. This was why the action created it's own toolbar instead of appending to an existing one.
  • BUGFIX: Put the toolbar action inside of "extraToolBar" instead of "mainToolBar" since that's what the extra toolbar is for.
  • CLEANUP: Got rid of a lot of the old KDE 1.x 'configure' and 'automake' stuff and replaced with new and improved KDE 2.x stuff.
  • OTHER: Created a 16x16 and 22x22 icon just for the validator
  • OTHER: Changed some references of 'spellcheck' to 'htmlvalidator'
  • OTHER: Changed '"&Validate Web Page (plugin)"' to 'i18n("&Validate Web Page")' since no other plugin claims to be a plugin AND it's always good practice to use i18n.
  • But while I was doing that, I wondered how easy it would be to create a plugin to do page translation as suggested in the above article. The result was the 'babelfish' plugin. It puts a KActionMenu list of all of BabelFish's translations (English to French, etc) in the menubar and toolbar. It's pretty slick.

    I'm not 100% sure what to do with all this so for now, I just put it up on the web for anybody to get:
    http://devel-home.kde.org/~granroth/plugins-0.2.tar.bz2

[ Reply To This | View ]
Re: Writing Plugins for KDE Applications
by Michael on Friday 26/Jan/2001, @12:36
Would it make sense to write a cd-writer plugin for konquerer? Or how should something like this look like?
[ Reply To This | View ]
Re: Writing Plugins for KDE Applications
by Kirby on Saturday 27/Jan/2001, @10:34
Excellent. And it looks way better than the ugly Gnome UI.
[ Reply To This | View ]
Re: Writing Plugins for KDE Applications
by gis on Sunday 28/Jan/2001, @05:42
Thanks Rich,

due to your nice tutorial I finally implemented qwertz' suggestion to configure Java/Javascript/Cookies/Image loading in a small dropdown menu, so you don't have to open the config-dialog for those often-changed settings.

Grab the plugin here. For the cookie settings to work, you need a current kdelibs snapshot (beta2 is not sufficient), but the other settings should work just fine with 2.0.

Cheers,
Carsten
[ Reply To This | View ]
Re: Writing Plugins for KDE Applications
by guran on Monday 29/Jan/2001, @07:03
Thanks to you programmers, what a nice world you create. An old man's wish; a plugin that brows' all the man-, info- and docu pages. Beatiful thanks guran
[ Reply To This | View ]
Re: Writing Plugins for KDE Applications
by anon on Tuesday 30/Jan/2001, @06:22
Anyone knows any __SIMPLE__ example of plugin app + ex. plugin? or is willing to write one?
[ Reply To This | View ]
factory name
by jimmy on Friday 15/Apr/2005, @03:59
Is it necessary for the plugin's factory method to be called 'create ()'?
[ Reply To This | View ]
The Fine Print: The previous comments are owned by whomever posted them.
( Reply )

  "Ironically, we are working on that right now!" -- Kurt Granroth
KDE®, "K Desktop Environment", "KDE Dot News", "got the dot?" and the KDE Logo® are trademarks or registered trademarks of KDE e.V. in the European Union, the United States and other countries. All other trademarks and copyrights on this page are owned by their respective owners. Comments are owned by the poster. The rest: Copyright © 2000-2008 KDE e.V. for The KDE Project. For further information or comments on this site, please contact the Webmaster.
[ home | post article | flat forty | subscribe | search | rdf ]