Development/Tutorials/Services/Plugins

< Development‎ | Tutorials
Revision as of 14:59, 30 October 2008 by Alediaferia (Talk | contribs)

Jump to: navigation, search
Creating and Loading Plugins Using KService
Tutorial Series   Services
Previous   Traders: Querying the System
What's Next   n/a
Further Reading   n/a

Contents

Abstract

Before starting with the code let's see which advantages we can undertake developing a plugin structured application. First of all an application capable of managing plugins can extend its features with apparently no limits. Anyway, rather than developing a plugin structured application because "it's so coool!!" the developer should think about the real advantages of this kind of development. For instance we can think about an archive manager application: the main program can delegate the creation/extraction/editing of each type of archive to specific plugins. This way we give modularity to the application so that supporting brand new archive types in the future will simply consist in writing the specific plugin and not rewriting the whole application. Ok, then let's stop talking.. and start coding =).

The Text Editor Example

So, even if an archiving application would be nicer to look at, here we will examine a simple text editing application capable of plugin loading. Each plugin will simply give a specific text editing feature.

Creating a Plugin Interface Class

The Plugin Factory Macro

Registering a Plugin Type

Registering a Plugin With the SyCoCa

Finding Plugins

Instantiating Plugins


KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V.Legal