Tag Archives: QML

Telepathy Contact Applet Goes Public!

As promised, I bring you KDE-Telepathy-Contacts!
The KDE sysadmins have kindly accepted my kde repo request and now my plasmoid is in the Telepathy playground.

Before I release version 0.1 I need to wait for reviewboard to be set up and do some final checks on my code with the help of my kde-telepathy colleagues.

If you can’t wait for the release (should be in just a few daysthis will be discussed at our sprint) you can checkout the git repo git clone http://anongit.kde.org/telepathy-contact-applet and build from source.

Have fun! 🙂

Tagged , , , ,

I bring you KDE-Telepathy contacts!

Hello all!
Cool thing happened today, I finished the Contact plasmoid for KDE-Telepathy! Yaaaaay!
This plasmoid is a simple 128×128 plasmoid that sits on your desktop and let’s you keep your favorite contact (or contacts if you have many friends) always at hand.
The contact presence status is displayed by a coloured frame on the outside. If you click on the plasmoid you’ll get a drop down menu with the possible/available actions you can use with that contact according
to your kde-telepathy capabilities and the ones of the selected contact.
I started off using the ktelepathy library nepomuk model for this plasmoid but ran into some problems halfway through so I had to fallback to the telepathy model (model we use in our contactlist component).
But no worries, we kde-telepathy devs have a sprint coming soon (September) where we will discuss problems and the future of the project and solve annoying issues.
I really believe in the integration of KDE apps data into nepomuk so don’t worry, we’ll get there.
Until my plasmoid goes public you can take a look at this nice video I hope you all will appreciate.


Tagged , , ,

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 ,