How to: Nepomuk QML plugin

Hello all!

Today I’ll be talking about something useful (apparently) for all those wanting to use
data stored in Nepomuk via a QML plasmoid.

So, let’s start!

First of all you need a C++ class able to extract info from nepomuk and store it in a class (don’t ask me how to do that. It’s black magic for me at the moment).
In our case (KDE-Telepathy) we have contacts stored in nepomuk and the info we need are the usual im infos one would want to know about a contact: mail, nickname, online presence, presence message and all that kind of stuff.

So, once you’ve got this sorted out it’s time to create your “QML export plugin” or whatever you want to call it.

Your plugin class will have to inherit “QDeclarativeExtensionPlugin”.
Here is a header file so you can see what’s to be done (taken from my plugin in the ktelepathy library)



* @class DeclarativePlugins
* @brief Class to enable access via QML
* This class permits QML plasmoids to access data stored by the library
* @author Francesco Nwokeka

class DeclarativePlugins : public QDeclarativeExtensionPlugin

void registerTypes(const char *uri);

Q_EXPORT_PLUGIN2(declarativeplugins, DeclarativePlugins)

The QDeclarativeExtensionPlugin::registerTypes is a virtual funtion so it’s to be re-implemented.
“What is that function supposed to do?” you’re probably thinking.

Well as documentation says:

“Registers the QML types in the given uri. Subclasses should implement this to call qmlRegisterType() for all types which are provided by the extension plugin. The uri is an identifier for the plugin generated by the QML engine based on the name and path of the extension’s plugin library.”

so, let’s see how we’re supposed to re-implement this function.


#include "declarativeplugins.h"
#include "everyone-person-set-model.h"


void DeclarativePlugins::registerTypes(const char* uri)
Q_ASSERT(uri == QLatin1String("org.kde.telepathy.declarative"));

qmlRegisterType(uri, 0, 1, "ContactListModel");

#include "declarativeplugins.moc"

As you can see, the “uri” (identifier for the plugin) is the string to be used in your qml file to actually “import” the QML plugin.

Once you’ve defined how you want to import your plugin, you’ll have to define the C++ type in the QML system so that you can access it via import that in this case will be something like this:

import org.kde.telepathy.declarativeplugins 0.1 as TelepathyDeclarative

and the C++ class will be defined in QML like this:

qmlRegisterType(uri, 0, 1, "ContactListModel");

To access the class from your QML file you’ll have to write a line like the following:


So once you’ve defined these few things you’re ready to go! Hope this helped!

Tagged ,

KDE Telepathy 0.1 Part 3 of 5 – Presence Management

Part 3/5 of the KDE-Telepathy mega-awesome-killer preview release saga!

In this part I’ll illustrate the presence applet shipped in version 0.1 to handle your account presence status.

As you can see, there have been little graphical changes from the previous version. I mostly concentrated in fixing bugs and usability problems.
Soon in master will be added a context menu for fast presence setting and the other plasmoid components for the KDE-Telepathy frameworks are being worked on, so you’ll be hearing more on that soon.

In the mean time have fun using our components and report bugs so that we can let you have a better experience with kde-telepathy!


KDE-Telepathy presence plasmoid preview (alpha-release)

After various discussions and reading about users preferences and ideas, this is how the presence plasmoid will look in the kde-telepathy pre-alpha release.

normal view

As you can see I’ve opted for the extended view showing the user all his contacts and status info.
On the left panel there is what I call the “global” panel. From this panel you control all your im accounts and set nickname, status message, presence and avatar.
On the right there is the “detail” panel. Panel where all your im accounts are shown. These accounts can be modified individually for what concerns their presence and avatar.

You’ll have noticed that there is also a scroll bar in the right panel. I implemented this because not everyone is able to figure out how to scroll a list view *sigh* and also because it might be easier for people to use instead of the mouse wheel or dragging the list.

The scroll bar is shown when the height of the applet is inferior to the number of accounts to be shown. When the scroll bar is not needed, this will fade out and leave some extra space in you plasmoid (see below).

expanded view


There are some implementations I could not add in this version because I need version 4.7 of kde and plasma2 to be able to implement them.
So when kde will be updated you’ll find some extras like:
~ context menu for quick presence setting
~ explanatory tooltips
~ use of QML components from dakerfp’s GSoC project

The plasmoid has been merged into kde-telepathy’s main branch of the applet repo. You can find it here.

For those who can’t wait for kde-telepathy to be packaged and released, here are the instructions on how to get everything up and running.
For troubleshooting take a look here.


Tagged ,

Sneak peak at the new kde-telepathy-presence plasmoid

Hello hello KDE fans! New kid on the block! Let’s cut to the point shall we?

Who am I?

What is my GSoC project about?

It’s called “Integrating Kde-telepathy into the plasma workspace”. I’ll be creating some useful plasmoids aimed to be simple and easy to use without cluttering up the desktop of the user. These plasmoids will all be related to the kde-telepathy framework

So now that you know what you’ll be seeing from me during this summer, let me show you my first creation: the Presence Plasmoid.


Thanks to the oxygen team, we have a new icon! You can see it in my system tray (the blue bubble). This first screenshot shows how accounts will be shown (I have only one but if you have more accounts, they will all be displayed in the plasmoid).


This second screenshot shows how to set the account state.

You’ll have noticed two icons on the top right of the plasmoid. Those icons (from the left) are launchers used to start the kde-telepathy-contactlist and the account manager.
Easy eh?
This plasmoid is new and so, as all new things, it is and will be subject to “change”.

Get in touch

If anyone has feedback on how to make it graphically
better looking, add functionality or other, please feel free to contact me.
You’ll find me (nwoki) on the kde-telepathy mailing list or in irc #kde-telepathy@freenode.

P.S this plasmoid will be shipped in the beta release of kde-telepathy so don’t worry, you’ll get to try it out soon 😉

Tagged ,

My first blog – An introduction

Who the hell am I? And why am I writing a blog? I’m not good at expressing myself to others, my englishisn’t that good anymore and I’m a simple guy with nothing out of the ordinary going on.Well, let’s see.. My name is a secret. My nickname is “nwoki”. You can find me in #kde related channels on freenode.What I can tell is that I’m a uni student studying computer science.My programming language of choice is the (marvelous) Qt/C++ but I also know php, python and other stuff that matters. I’m not that keen of knowing the details of how things work unless they’re really really necessary to know. For example you won’t find super high skilled ninja techniques onhow to code on this blog. Forget it. I like to keep things as simple as possible. I belive that writing simple code that does coolstuff is way better than writing super hard ninja messed up code that has the same effect. Why go through all that fuss?I’ll be letting you know about my accomplishments in the world of programming. I’ve started to get my hands dirty on kde codeand hope to partecipate at the GSOC 2011 for the kde-telepathy part.It’s a cool project. You can find out more here.Well, you don’t need to know anything about my personal life. I’va already said enough. On this blog you might find some random rants about stuff that goes wrong in my life, the world or just simple thoughtsthat come to mind and that I want to talk about. If you don’t like them or not interested, then don’t read them.This blog is also a way of letting out some steam and if any of you are interested you can partecipate with some comments good or bad as they may be.

** This post was written on KWrite because wordpress refuses to work and doesn’t let me register an account yet. Nice start**