Konqueror • Technical • Embedded tutorial • Part 7

Embedded Components Tutorial - Page 7

Final Thoughts

The Steps to a Component: Recap

You may have noticed that converting an application to an embedded component is pretty easy. In fact, this tutorial could have easily condensed the four steps into one or two with no loss of clarity. That said, you will likely do your conversion in the four stages outlined, so maybe that wasn't such a bad idea.

To recap, the four stages are:

  1. Convert your application to a shared library

    This requires only a change to the Makefile.am file

  2. Add the skeleton KParts code

    This requires two files to be added to the project, and two minor changes to the Makefile.am and your application's .desktop file

  3. Add in your own code

    This is probably the hardest step.. where you integrate your existing code into the KParts interface.

  4. Connect GUI elements to control your code

    This is where you insert items into the toolbar and edit menu to allow the user to control your component.

What is Boilerplate? What is App-Specific?

Whenever you do a tutorial, the question is what of the tutorial can you use in your own and what is specific to the app itself. Well, you're in luck for this tutorial -- nearly all of the code in this tutorial was boilerplate, cut-and-paste type code!

In general, you can copy over the files and just change all references to 'aktion' and 'Aktion' to your own app naming convention.

The only thing that is totally app specific is in the AktionPart class. Wherever you see references to the widget object, that's where you need to insert your app specific things.

"Gotcha"s. What to Look Out For

Most of the things to look out for were mentioned in the steps of the tutorial. Two things that stand out, though, are these:
  1. Pay attention to the .desktop file

    If you wonder why Konqueror isn't embedding your app, it's almost surely because something is wrong with your .desktop file. Pay close attention to that section in the tutorial.

  2. Make sure your app has a pre-existing "view" class

    This is probably the most important point in this tutorial. If you app already has a existing view class that provides a coherent interface to your apps UI functionality, then everything is trivial. If your code is ad-hoc, then this could be a nightmare.

Links

Here are some links that you may find useful:

Original location of this tutorial:
http://developer.kde.org/documentation/tutorials/components/index.html

Tutorial pages packaged up (no source)
http://developer.kde.org/documentation/tutorials/components/components-tutorial.tar.bz2

Source package for the base aKtion 1.99:
http://developer.kde.org/documentation/tutorials/components/aktion-1.99-base.tar.gz

Source package for the finished (component) aKtion 1.99:
http://developer.kde.org/documentation/tutorials/components/aktion-1.99-final.tar.gz

Official aKtion! homepage
http://www.geocities.com/SiliconValley/Haven/3864/aktion.html

Sample AVI file for testing (needs to be unzipped)
http://cmg.simplenet.com/avi_clips/pepe_pen.zip

Plugins needed for xanim/aktion to play sample AVI file (Intel Indeo 4.1)
http://xanim.va.pubnix.com/xa_dlls.html

[ Edit ]

Global navigation links