|Tutorial Series||Plasma Tutorial|
Before we start to program or little addon we need to do some setup. First of all, we create a directory called MyFirstJSAddon, where our addon will be located, with the following directory structure:
\- contents/ \- code/
In the root directory of our addon, we create a file metadata.desktop with the following content:
X-KDE-Library=<the value of this entry of your interface that loads your addon>
X-KDE-PluginInfo-Author=<Your name here>
X-KDE-PluginInfo-Email=<Your email here>
X-KDE-PluginInfo-Category=<the name of your interface that loads your Addon>
The X-KDE-Library value should have the same X-KDE-Library value of your interface, which uses your addon. Moreover should the X-KDE-PluginInfo-Category value be equal to the X-KDE-PluginInfo-Name value of your interface to tell plasma which interface (plasmoid or dataengine) this addon belongs to. With the help of that line, your interface knows what addon it should load.
A very simple Addon
The next step is to provide our Addon a method, which print out our input.
At the end of your Addon it is also important that you "publish" your class for other instances that would like to use it.
Now, we should save our written code into MyyFirstJSAddon/contents/code and name it main.js.