Archive for the 'KDE' Category

GSoC Weekly report 3-4: The Akonadi-Nepomuk connection

First of all I apologize because last week I was busy doing school stuff and I didn’t get to do much GSoC related stuff. I’m glad to be able to say that today I will assist to my last university class in this academic year and that my holidays (of code :P) period has thus virtual started, because I have also already done my last exam last week, yay.

BTW,  I am going to Akademy too! I already can’t wait to get there 😀

I’ve been investigating how well can I make Akonadi and Nepomuk play together. It seems that my decision of only using Nepomuk through Akonadi is possible. I will thus have an usual Akonadi Resource which provides a set of collections with their items (bookmarks) and subcollections (bookmark folders), and then also I will have some virtual collections.

A virtual collection is a new concept in Akonadi, which still is not enterely developed and Konqueror will probably the second (after Akonadiconsole) application taking advantage of it. A virtual collection has all the properties of a collection, but the items it contains are peculiar. They are not items as in a normal collection, but virtual items, which link to real items inside real collections.

Using virtual collections, besides having your usual bookmarks menu, you will also get in konqueror some virtual collections like: Recently added bookmarks, Most visited bookmarks, Recent tags, or <please suggest your virtual collection in a comment please!>.

You might then wonder… okey so Recently Added Bookmarks would be a virtual collection which contains urls which have been bookmarked recently. But how can an Akonadi virtual collection know which items comply with that? Only Nepomuk knows the relevant information. Here comes the Akonadi-Nepomuk connection:  you can create an Akonadi Virtual Collection with SearchCreatJob class, which takes two arguments: the title of the collection (Unclassified Bookmarks for example) and the SPARQL query string for Nepomuk.

Using SearchCreateJob, I just need to write a SPARQL query that returns only the recently added bookmarks, which is quite trivial. Then Akonadi will handle that query to a Nepomuk persistant query, and it will tell akonadi whenever resources are added or removed to that query. In turn, Akonadi will get the Uri of those added/removed resources, and use that as the remoteId of the Items in the virtual collection, and add/remove those items accordingly. Autotically if there the item with that very same remoteId in a real collection, Akonadi will know, and the item in the virtual collection will have the same properties: same payload, same name, etc.

Usecase to understand and recapitulate:

  1. You click on the star appearing in the location box to bookmark current url.
  2. The url gets added to some Konqueror bookmarks collection (if it’s an unclassified bookmark, it will added to a special-purpose Akonadi bookmark collection called “Unclassified bookmarks”).So now your bookmark has its corresponding real Akonadi item.
  3. Akonadi bookmarks use Nepomuk as storage, so the bookmark is also added in Nepomuk database. In fact it’s only stored persistently there, Akonadi only caches it.
  4. When the new bookmark is added to nepomuk, automatically nepomuk detects that the bookmark enters in the persistant query for “Recently added bookmarks” and adds the new bookmark resource to it, notifying to Akonadi server which was looking for changes in that persistant query.
  5. Akonadi server gets the notification of a new resource added to the “Recently added bookmarks” Nepomuk query,  and adds a new item to its “Recently Added Bookmarks” virtual collection. That new item will actually refer to the item added in step 1, with the same name, payload (a KonqBookmark instance), etc.
  6. Konqueror automagically gets the new bookmark in “Recently added bookmarks” subcollection!

To some people all this might seems like a lot of steps, but to me it sounds like angels. Because all this will make konqueror feel faster and it will make its bookmarking system responsive (non-blocking!) and improve it’s architecture. I am already thinking about how easy will it be to create kross plugins for bookmarks, to be able to support natively new types of bookmarks, to be able to sync with services, and even to easily make all this a bit more flexible and let other apps (Konsole, Kate, etc) use this new Bookmarks System. But, one step at a time :D.

GSoC weekly report: week 2

This week I’ll present you part of the technologies used in the brand new Konqueror bookmarks system. I’ll explaining how they work and how I’m going to use them, thereby showing part of the design of the new bookmarks model at the same time. Finally, I’ll also show you what’s the current development state and what I plan to do for next week.


Nepomuk is where I will store Konqueror bookmarks. It’s very easy to do so. In my code, I only need the following code to create a bookmark in Nepomuk and put it in a bookmark folder:

Nepomuk::Bookmark kdeBookmark("");
kdeBookmark.addTitle("KDE main site");
Nepomuk::BookmarkFolder rootFolder("konqbookmarks:/");

That’s it! This line of code will create the bookmark in the Nepomuk database if it wasn’t already there, set the title of the bookmark, and it will add the bookmark to the Konqueror’s root bookmark folder. After executing that code, if I can search in Krunner for, and the Nepomuk runner will find the bookmark. And any application who wishes to list the bookmarks in the root bookmark folder can do so with the following bit of code:

Nepomuk::BookmarkFolder rootFolder("konqbookmarks:/");
QList bookmarks = folder.containsBookmarks();

UHm..what if I wanted to remove a bookmark from Nepomuk? I can do so every easily too by just calling to bookmark.remove();. It also allows me to attach a lot more information related to a bookmark of course. All kinds of resources and properties can be attached to a Nepomuk bookmark: tag, creation time, whatever. All in all, Nepomuk stand for an easy to use semantic database.


Akonadi is a convenient way to access data stored elsewhere. It isn’t designed to store the data itself, because it’s a middle layer between the application and the data. It gives power to the develop by providing an abstraction layer in which all the data is represented by collections and items in a tree similar to the concept of dirs and files in a filesystem.

A Collection is made up of other subcollections and items. And of course, there is a root collection to rule them all, master of the puppets. To clasify the data, both collections and items have one or more mimetypes attached to them. For example, a collection has the mimetype Collection::mimetype(), but it can also have the mimetype “application/x-vnd.kde.konqbookmark” which is the one I’m using right now for Konqueror bookmarks.

Now a bit more talk about the items. You guessed it, the items can have some data attached to them, but how? Using payloads. A payload is a supported Akonadi class that stores some data. It could be an email, or in my case, a bookmark. I don’t use directly Nepomuk::Bookmark (but I could if I wanted), but a wrapper class that I called KonqBookmark.

When one application request the KonqBookmark payload of a bookmark item, that data needs to go from the akonadi server process to the application process. This is done serializing the data in the server and deserializing it in the other side. As KonqBookmark is not a natively supported class by akonadi, I have to give Akonadi a class that serializes it, and then it works.

An application connected to Akonadi can add new items to a Collection, modify them, delete them. Same with collections: they can be addd/modified/removed. Imagine I’ve got two instances running of my bookmarks editor. If I remove in instance 1 a boomark item via Akonadi, Akonadi itself updates instance 2 of the bookmark editor and shows there that item is gone. Without me needing to do anything! No need to sync via d-bus, etc. It’s like magic, but one that really works.

So far, we’ve got Collections and items in the Akonadi server.. but how? where do they come from? They come from Akonadi agents, concretely from an Akonadi resource. An Akonadi resource provides a set of collections and their items. I’ve created the Konqueror bookmarks resource that adds some collections of bookmarks to Akonadi. But you could add for example a new bookmarks resource different from mine using the same mimetype as me, and provide access to a collections. You just need to code for the resource the part in which you access to the bookmarks and create the correspondent collections and items in Akonadi.

Akonadi is a middle layer, it doesn’t really stores the data. Thus, the bookmarks resource I’m developing stores the data in Nepomuk, as I explained earlier. If you create a resource as I said in the previous paragraph, you could access your bookmarks but they wouldn’t be the same as those stored in nepomuk. A new kind of akonadi agent comes to the rescue: Akonadi feeders. You could create a feeder instead for konqueror bookmarks, and then when a new Konqueror bookmark is added, it would also be feeded to, etc.

And what if I’ve added a bookmark when I was offline? what happens there? Akonadi then caches the bookmark, and it would be added to when you connect to Internet. This is transparent to the feeder: it only needs to have a function to add bookmarks to, and Akonadi will simply call it when it’s appropiate. Again, it’s like magic.

Current state

So far, I’ve got an Akonadi resource which can list bookmarks in the Nepomuk database, add new bookmarks, modify them, remove them. The bookmark items use a KonqBookmark class payload, which is supported by Akonadi as payload because I’ve also implemented a KonqBookmark serializer/deserializer.

I’ve created a sample application using this resource, a bookmarks editor, which you can see in the screenshot below (I promised you would get one this time ;-). This bookmarks organizer shows you the bookmark folders and bookmarks as usual, using two views: a tree of bookmark folders and a listing of bookmarks.

First screenshot of the very simple Bookmarks Editor

The application itself is very simple, because it uses model-view & delegate classes for displaying and editing bookmarks and bookmark folders. Some of these classes are provided by Akonadi (the model for Bookmarks collection for example), and I developed the other classes, like the model and delegate for Konqueror bookmarks.

I’m developing all this in the most reusable way so that other web browser that wish to share with Konqueror the bookmarks system can do it very easily. I remind all those curious people that the code is available in github.

Next steps

Next week, I plan to improve both the editor and the resource. I also want to start playing with Akonadi virtual collections for doing searches in the bookmarks too, and maybe I start doing some tests with Kcompletion stuff for the new location bar. Have a nice day!

GSoC weekly report

I have decided to do the GSoC weekly report thing. Sometime after deciding that I noticed that I need to actually write and post in the blog the report because the report doesn’t write itself – go figure! Technology doesn’t seem to be so advanced to do it automatically just yet. So here I go.

In this project I will be reimplementing the Konqueror bookmarks system using Akonadi and Nepomuk. I already have KDE trunk compiled but I needed to be sure both Akonadi and Nepomuk are up and running correctly. Both worked fine in my Samsung laptop setup, but in my Netbook I needed to install libmysqlclient15-dev deb package, rebuild qt-copy with -plugin-sql-mysql config option, and of course rebuild Akonadi, because even if I had other DBs working, the only one currectly supported in Akonadi is Mysql.

Oh yeah you read it right, I do compile and develop in an Acer Aspire One netbook, with an Intel Atom and 1Gb of RAM, and it works just fine. It’s a bit slower when rebuilding a whole package, but other than that it’s ok. And when doing such a thing (rebuilding qt-copy for example) I can always use icecream and let the other machines at home handle the tough compiling stuff.

Alright, now I have a working environment. Next step? Get used to Akonadi and Nepomuk, learn how to use their APIs to make myself feel at home with them and thus be able to develop the concrete details about how to design the new Konqi bookmarks system. Thanks to the Akonadi and Nepomuk tutorials found in Techbase, the nice API documentation found in, the code itself of both libraries and the pieces of sofware which use those utilities (like krunner or dolphin), together with the invaluable help provided by friendly people in #akonadi and #nepomuk-kde channels, learning is a joy and it’s very easy to do so. That’s something to be proud of in the KDE community!

I’ve setup a public Github repository in which I will dump everything I’m doing related to my GSoC project. This way I will use it to synchronize easily my laptop and my netbook. That means this repo will really contain everything I’m working on. At the moments there’s nothing close to being useful for anyone else than me, it’s all tests and the tutorials of Techbase a bit modified for my needs. So children be aware this is not for public consumption, so you’ve been warned. On the other hand and once said that, it has the advantage that you can see what I’m doing right now if you are brave enough to do so.

This blog post is becoming larger than I pretend it to be, so I will stop here today. Next time I will talk about what’s Akonadi and what’s Nepomuk, how I’m going to design the architecture of the brand new bookmarks system and what is so cool about it. And I promise I will insert at least a picture in next gsoc weekly report even if that means choosing one randomly from or /dev/null (is there a difference anyway?). Have a nice day!

GSoC: Konqueror Bookmarks with Akonadi and Nepomuk

I’ve been accepted as a Google Summer of Code student too for KDE! Third time lucky. Of the two propossals I sent, the one about getting a brand new bookmarks system for konqueror is the one which got accepted.  That’s great, because current Konqueror bookmarks was showing its age. Most of the main browsers today have a more advanced bookmarking system. Currently it’s easier for a user to search his bookmarks with krunner than doing so with Konqueror itself. This will be no more. The bookmarks will now be stored with Nepomuk and Akonadi and will be easily found using an awesome location bar similar to firefox’ one, using krunner, the bookmarks editor or the bookmarks menu itself.

As Chani (who has also been accepted as a GSoC student this year) has suggested, I’ll do a GSoC weekly report of my project, so be tunned konqueror users! Now that we are in the community bonding period, I’ve started the project by fixing some konqueror bugs that I should have fixed long time ago, and will continue by testing the grounds of Akonadi and Nepomuk. Today it’s been quite productive, I commited 4 bugfix-patches to trunk, and I even had time to play the drums and continue working in a patch of mine whose purpose is adding virtual mesh networks support in VirtualBox. That will allow me to test meshias in my own laptop using virtual machines. What is meshias? it’s my final project in the university which is an implementation of the AODV mesh networks routing protocol. Good stuff :D.

Now it’s time to go to the university, so have a good afternoon and goodluck with your community bonding process to everyone participating in GSoC.

Better kwallet integration in konqueror is coming

This week has started the second four-month period of my (hopefully) last year studying Computer Science. And it’s been quite productive: I’ve been working in Meshias (my final-year project, an implementation of AODV protocol for mesh networks) the first days of the week, and then I’ve been working in Konqueror these last days.

Yesterday I fixed a bug in Konqueror by using the just discovered KConfig Anonymous Groups, which internally store its data only in memory instead of having it also stored in a file on the disk. It’s a little known feature of KConfig but very useful one, and you might as well use it in your application.

And if yesterday I only fixed a bug, today I reworked the KWallet integration in Konqi. Until now, when KHTML asked you if you wanted to save in KWallet the login information you entered in a web form, a modal dialog popped out and it would sit there, waiting for an answer from you, not doing nothing until you make up your mind or simply until you notice that you have to answer that dialog. That was wasting user’s valuable time, and it’s clear to me that the interface could be improved. This became obvious when navigators like Firefox implemented this feature using a non-modal dialog which sits quietly at the top of the navigator as a bar.

So that’s exactly what I implemented, in a non-invented here fashion. I’ve just finished implementing the code and it has not been committed/reviewed yet; it will be reviewed and hopefully committed soon to trunk so that all of you can test this new feature. For now, you can get a screenshot of how it’s looking right now: Better KWallet integration in Konqueror

Any ideas of how improving the UI? If you have an idea for bettering kwallet integration in konqueror, don’t be shy and comment it – I might even try to code it ;-).

Web Encryption Framework

Last year danigm, which is a good friend of mine told me about this new project he was going to undertake, that he will present to CUSL (Free Software University Contest). It’s GECO (Password Manager), which will allow you to store your passwords online so that you can sync them in different computers.

Of course, storing all your passwords must be done in a very secure way if you don’t like surprises. The connection with the server must be secure (SSL?) so that no one else can see your passwords. But what’s more, are you going to upload your passwords in clear? No way buddy, that’s too risky. I wouldn’t trust all my passwords not even to my best friend, and even if so, what if the server gets compromised?

So the thing is, GECO is designed to have both a web and desktop client. The problem here is that current web browsers like Firefox don’t provide a standard framework to cipher and decipher data on the client. You’ve got SSL, but that only ciphers communications with the server, and that doesn’t solve the problem.

So what did my friend danigm do? He will be using Slow AES, a free software implementation of AES both in Javascript and python. Because he not only needs to be able to cipher and decipher text in the client via Javascript, but he also needs to ensure that when he uses the gnome desktop client developed in python, exactly the same AES algorithm implementation is used, so that what is ciphered using the web client can be deciphered in the desktop client and vice-versa.

The penalty of this is that this AES implementation is, as it name shows, slow. That’s not much a problem for ciphering small text strings like passwords. But I’m using his project as an example of what I think is coming next in the future. Because web applications are becoming common in our daily Internet life. There’s Gmail for example, which is an astonishing piece of software, and I’m tempted of using it replacing the good old KMail, but there’s one big feature that I’m missing: GPG.

I’ve tried the GPG Firefox plugin for Gmail, but it doesn’t work very well and besides, it doesn’t in other web browsers, like our all times favourite Konqueror. I’ve even used sometimes the Gtalk chat Gmail’s feature, which connects via Jabber to my IM contacts but also with my email contacts that use Gmail, which is handy sometimes, but being me an avid user of Kopete’s OTR plugin, I miss the security it provides. Finally, there are also some web services which provide online data
storage, an online hard disk if you want to name it like that. Google itself seems to be playing with idea of launching the Google Drive. Storing more
and more data online will make yourself much more exposed to potential privacy loss risk unless they are stored encrypted.

As a consequence, I think SSL is not enough any-more as a way to protect your privacy online: we need a comprehensive, well-designed framework for encrypting and decrypting data in the web browser. The next question is, then, how should be such a framework?

I have some ideas about that too: it should use standard implementations of well-known algorithms, like GPG and RSA. Probably a Javacript binding of lybcrypto should be fine. But we need also a way to ensure users that the clear data is not going anywhere else, meaning that the Javascript code is not playing tricks like copying the clear data and sending it to the web server, and the web server will only get the ciphered data and not in clear.

Now, there’s no easy way to solve that. In order to accomplish that last point we need to isolate the part of the page that deals with the ciphered data from the part of the page which deals with the clear data, creating a software jail for the later. The idea is having special html tags or tags with special attributes, which:

  1. Can be stylized using css (remember? it’ not 1999 anymore)
  2. Ciphered data can be processed securely and transparently in the web browser without compromising its security.

So normal Javascript code would see this data ciphered, and would be able to communicate with the server via usual ways: either sending a form via POST/GET or using AJAX. In the other hand, the Javascript code that deals with the encrypted data would see the data in the clear, but would not be allowed to communicate
with anyone, to send the data anywhere. That code is in jail. And for various purposes like updating the encrypted data, some information would be allowed to flow from the normal Javascript code to the jailed Javascript code, but not in the opposite direction; information would flow only in one way: from insecure code to secure code, not compromising security.

Of course, if such framework gets developed, standardised and deployed in most web browsers, even then some sites won’t make use of it at least for a long time. It’s not in Google’s best interest to let you cipher easily your email and IM conversations if they want to be able to show contextual ads, for example. But other services like GECO, or other kind of services we can’t even think of yet, will surely make good use of such a framework, and that’s the idea. I think the potential use of a Web Encryption Framework (or WEF for friends) is not only in common-place web applications and web services, but also in business web applications where security is a must.

Don’t get me wrong, I haven’t thought the actual details of this proposal. What you see here is all I’ve got at the moment. This is only one idea that I wanted to write about so that you people tell me what do you think about it, so now it’s your turn.

Akademy-es 2008 A Coruña starts!

Hello everyone, it’s been a long time since I last blogged. None has said it yet so let me be the first to announce it via this blog: Akademy-es has started for spanish people. It starts today and it will end this Sunday. Yesterday morning Alejandro and I took a plane from Seville (South of Spain) to A Coruña which is in the northern coast of Spain and it’s where the event will happen. I’ll be a very nice experience to see again all those spanish people which I knew in Akademy 2008.

So how was yesterday? Basically we walked, walked up and down A Coruña first trying to find a good digital camera, then finding a place to eat, then buying some new shoes becase the boots I was wearing were killing me and then going with José Millan to a nice Kebabs having dinner and some beers. We hadn’t slept for al ong time and thus were very tired so we came back to José’s place (thanks for being so nice and providing us accomodation!) and slept there as a log for long hours.

Today will be a more productive way programatically-speaking, because we’re already in the university, we’re experiencing some difficulties with the network but as you can see we reach to Internet, and probably the wifi network will get better today beause the organization is setting up some AP for us. We’ll see what the time brings us today and I’ll try to blog it later =).

Back in black & Akregator news

So this summer I spent some nice holidays in Ireland, Akademy was fantastic, and then the September exams were not so nice but they at least already ended so that’s ok. Yeah, it’s been quite a while since last time I blogged but now I’m back in black, once again, to make KDE 4.2 rock.

I haven’t started the classes yet and I already I’ve got already a lot of exciting projects in my head. Since yesterday I’ve been touching the code of Akregator. It is one of the applications I use the most throughout the day, together with KMail, Konqueror and Kopete, because thanks to this excellent feed reader I read the news from meneame, digg, slashdot, Planet KDE, and so on.

But akregator 4.1 seemed to have a major leak of memory because after using it for some days I end up with it using more than 300Mb of memory and that’s not right. So I had to closed akregator and reopen it, but doing that I lose the tabs I had opened in akregator. So? No problem sir, I will go straight to the code and try to fix it. That’s what I did!

Today I’ve commited a patch to trunk that adds support in akregator to automatically save the tabs you have opened when you close it, and they are restored the next time you run akregator. And the same will happen when you close KDE and login again if you have KDE configured to save & restore session. This will be available in KDE 4.2. Also, I fixed a leak in akregator, because sometimes it was not freeing the tab when you closed one. That fix is backported to KDE 4.1 too.

I must say that the akregator people have been very friendly to me and I will probably send more patches to them in the future. However now what I have in mind is getting an even better session support in konqueror, so be tunned =). Ok, I think that’s all for today.

KDE 4.1 RC1 here I come

It’s been a long time since I wrote my last blog entry. Truth is I’ve been quite busy first with final exams and then with different related tasks like having fun, burning myself in the beach, collaborating with PIRATA and yes, fixing some konqueror bugs, as we are in bug-fixing only mode.

So I’ve fixed all the known bugs for the two main features I’ve developed for konqueror, the undo closed items and the session manager and crash recovery dialog: KDE 4.1 RC1 is going to rock! Please report any bug you notice in konqueror and specially in the mentioned areas so we can have a KDE 4.1 release with no bugs in them. And of course…

This will be my first akademy, and I already know I will have a very good time there 🙂 and I will be able to see face to face nice people with which I’ve been in contact with for a long time already.

Nokia does not get it

Dr Ari Jaaksi is Nokia’s vice president of software and head of its open-source operations. Note that Nokia recently acquired Trolltech so now he has an important role in Qt’s future. An I’m worried because he has been quoted saying nonsense like this:

“We want to educate open-source developers. There are certain business rules [developers] need to obey, such as DRM, IPR [intellectual property rights], SIM locks and subsidised business models.”

No thanks you very much, but I don’t want software defective by design (not even the evils at Apple like DRM anymore), I don’t believe in imaginary property, and I hate SIM locks as much as the next guy.

“As an industry, we plan to use open-source technologies but we are not yet ready to play by the rules; but this needs to work the other way round too.”

You better start playing by the rules because else the other companies might do it faster than Nokia and you will lose the opportunity. Oh: And just as a remind: when you go open source, you *must* play by the rules by honoring the license of the software.

Really, it’s sad to listen to things like this from someone controlling the company who owns Trolltech  I am sure that the vice-president of companies like Red Hat wouldn’t say nonsense like the above. But it’s no surprise coming from someone in a company that seems to be absolutely in favor of software patents in Europe according to FFII.