#32: Google Summer of Code : Pencils Down

Wow ! What a summer !

Roughly 12 weeks have passed since I started working on KDE Now (well formally). Results came out some couple of hours ago and I passed the full term evaluation. In this post, I’m going to talk about what I’m planning for the future of KDE Now. How the past weeks have been and some other stuff.


To start with, the summer was awesome. I got to learn so much and that certainly made me a better programmer. Before this summer, I had worked on some parts of large codebases but never really started one from scratch. KDE Now taught me a lot about all the things you have to face when starting a project. The design choices you have to make. Even down to the bottom most nitty gritty details like using const correctness or avoiding copy of data while function calls. All these tiny bits eventually contribute to a better, working, cohesive whole.


As for my work, you can find the formal work report here. KDE Now now has a quickgit repository . It’s currently lying in playground and will continue to do so for a couple of months until I have everything sorted out before a possible release. First off, I’m gonna work on documentation. This is to attract other developers to contribute to it. Who wants to work on an undocumented software anyway😛 . Next up, I will write unit tests. I have tested the application but only as a whole in some different scenarios. Unit Testing would be a lot better. But before all that can happen, I want a break. Haha ! I’ve been working for so long on this, that other things took a lower priority. School has started for much long and a lot of things require my attention. So I think, I should take a month off. You can hear me, with other updates from the start of October again. Meanwhile if you have any doubts/questions or want to contribute to KDE Now, I’ll be glad to to answer everything. Just comment below or drop me a mail🙂


I am very thankful to my mentor, Ashish Bansal. He is simply an awesome mentor. He would point me to some direction and leave the rest to me for finding out on my own. He would tell me what design choices were better, their trade offs but then again, left it to me to choose on my own. We talked on every other (or two) day. There were some times when I wasn’t very productive but he was pretty cool with that too, as long as I was not terribly behind schedule. I even poked him during his vacation, and he still managed to reply ! I’m really thankful to him. I couldn’t have asked for a better mentor. Also I am thankful to KDE for giving me this opportunity and finally to Google for organizing this awesome program.


Cheers !

See you later.

#31: GSoC with KDE Now – 9

Hey ! I’m making KDE Now, an application for the Plasma Desktop. It would help the user see important stuff from his email, on a plasmoid. It’s similar to what Google Now does on Android. To know more, click here.


Roughly three weeks have passed since I last blogged about my project. School started and it was tough finding time for everything let alone blogging. This year’s Summer of Code is reaching it’s end and I have much to talk about this time around. In the end I also have a surprise for you.


To start with, I worked on the Database I talked about earlier. Now all plugins save their maps into a Sqlite database and when the daemon runs, it finds these maps and prepares to load it into a card. There’s a catch here though, as I will have to pass the maps over to D-Bus and there are synchronizations issues. There’s still  a way to solve it but that involves editing an auto generated xml file manually. We wish to avoid this manual editing however, for easy maintenance in future. This might be some bug in the Qt based parsing/generation tool I use. But I need to still figure this out with my mentor.

Since I had worked on all the points I had proposed, my mentor asked me to add support for more than one email account. So, now you can add multiple accounts to KDE Now and the daemon will fetch emails from all those accounts.

I also worked on the credentials input mechanism. It has improved largely since I last blogged. Now the user is presented with a kind of form when KDE Now is started for the first time. You will be required to add your email credentials in the form. It adds your data to KWallet and the daemon retrieves it later.

Finally, have a look at the demo below.

As soon as the application logs into your account, it fetches all emails within a span of one month and if it finds an email of Event, Flight, Hotel or Restaurant reservation that confirms to the schemas of Google Now, a card will appear. In the later part of the video, I have shown you how KDE Now works when an email arrives and a new card is generated dynamically with that information. I send raw html much like how a vendor sends to you.


I will add another blog post regarding my final project report in a couple of days so be on the lookout.

PS: I’m still looking for a graphics designer familiar with svg for KDE Now. If you are interested in helping me, drop a comment below with your contact details. Don’t worry your contact details will be kept private, as I monitor all comments before publishing.

That’s all folks. Cheers !

#30: GSoC with KDE Now – 8

Hey ! I’m making KDE Now, an application for the Plasma Desktop. It would help the user see important stuff from his email, on a plasmoid. It’s similar to what Google Now does on Android. To know more, click here.


Time sure passes fast when you are enjoying something. And so, another week has passed and I’m back with another status update. Things look very very good from here on. At least, not until we decide to change something drastic that I hadn’t proposed earlier😄.

Last week was rough. I was struggling with viral fever and throat infection for the better part of the week. Plus I had some other things to attend to. Nonetheless, I managed to devote the needed time on my project. I managed to create the UI of the Flight and Restaurant cards. They look good and work as expected (the dynamically loading up of things and all)

Here are the obligatory screenshots

Other than that, I’m afraid I don’t have much to talk about. I still have not made the Database fix I had talked about in my earlier post. But I’ll do it next.If you look at it, then in a way I have managed to successfully deliver what all I had planned initially in my proposal🙂. This was a real confidence boost.

For the next few weeks, I plan to work on some tidbits I had left earlier (like the Database thingy I mentioned). I also might refine the UI. Plus, I also need to figure out a convenient way to make the plasmoid available for the end user in terms of his email credentials. I might look into KWallet but me and my mentor have to still talk about it.

Ending it with a request: If you are a graphics designer and have experience with making vector graphic images and want to help me out, feel free to contact me. Just comment your email id below (it’s private and I moderate comments :)) and I’ll contact you. I could really use your help.

Till next time



#29: GSoC with KDE Now – 7

Hey ! I’m making KDE Now, an application for the Plasma Desktop. It would help the user see important stuff from his email, on a plasmoid. It’s similar to what Google Now does on Android. To know more, click here


Another week has passed. And I’m back with more updates of what I’ve done over last week. I worked on the plasmoid side of things this time. Andres(Andy) Betts at the KDE-VDG was very generous and had given me some nice mockups for Event and Hotel cards.

I wrote the UI of these two cards based on the mockups I got. It was all in QML and went like a breeze. Next up, I worked on the plasmoid to make sure, that the cards get loaded dynamically in the correct way. It was an earlier commit but I figured out, it was not completely correct.

I also made some improvements on the daemon side of things. Mainly, devised a way to load the extractor plugins just once and set different map data. Earlier the plugins were getting loaded every time an update over email was received. My debugging skills were put to test, trying to find this one out. Along with some Database issues, I’m facing while the daemon is started by the plasmoid (over D-Bus). These two bugs coupled together were not letting the cards generate. I haven’t yet made the Database fix yet but that’s because it is low on my priority list. Also, some things are going in my mind regarding it, so I’ll rather postpone it.

Finally, a working model is ready. Well sort of. Not for the end user. But for the developer. Checkout the screenshots –



There are two cards here, Event and the Hotel Card. Both of them were dynamically generated from test emails. The first one (Hotel Card) was generated on the plasmoid, after I pinned the plasmoid to the desktop. The lower one (Event Card) was generated after I sent another test email, while the plasmoid was still on the desktop. This one utilised the IDLE feature of the IMAP client daemon FTW !

Things look good from here. Well I must say, I got a morale boost when I saw those cards “magically” generating for the first time. You see, I’ve been working for this a long time. And all I could see was just the debug output of the daemon. While that is informative and all, but that is not what I intended in the first place. Seeing the results made me very happy and I guess I even announced it on an IRC channel😄

For the next part, I’ll be working on Flight and Restaurant cards. Now I don’t have mockups for those. But I know they’ll be along the lines of what we have right now. It could take me sometime though, to come up and finalize the UI for them. Also, I have to find a way to get the user details. I’ve been testing with hard-coded values. But this has to change ofcourse.

Thanks for reading.

See you later !

#28: GSoC with KDE Now – 6

Hey ! I’m making KDE Now, an application for the Plasma Desktop. It would help the user see important stuff from his email, on a plasmoid. It’s similar to what Google Now does on Android. To know more, click here


Another week has passed since I last posted about my progress. This week I did more work primarily on the plasmoid side of things.

I added receivers for the data, that was being thrown over D-Bus. To be a bit more precise, I exposed update signals over D-Bus which are emitted by the extractor plugins. There is a Datahandler that connects to these signals and calls the relevant method over D-Bus that I told you in my last post. Moreover, I made the whole daemon install as an autostart service. So every time, someone starts the plasmoid, it checks whether the daemon is running. If it’s not, then the daemon is started. This check, is made possible, by detecting whether the relevant interface is registered to D-Bus at the time.

Next up I exposed properties to be used by the cards. For example, properties like name, reservation number, or date. These will be binded to the User Interface elements in the cards. At the time, we hadn’t finalized the User Interface for the cards. So I skipped those and started writing the plasmoid’s backend. In essence, we instantiate a datahandler we wrote earlier. On receiving signals, we call relevant functions, which will instantiate a card, set it’s data and add the card to the current model.

For the next steps, I will write the User Interface for cards. Andres(Andy) Betts at the KDE-VDG was very helpful in providing me mockups for Event and Restaurant cards. I will start with them, and work on the other two, when they are finalized.

I’m good with my proposed timeline till now, but GSoC timeline doesn’t match well with the way most of our schools, here in India work. Hence, I plan to do as much as I can before school starts (which it has, already😦 ) . That should leave with with just a few more things to do until Final Evaluations.

#27: GSoC with KDE Now – 5

Hey ! I’m making KDE Now, an application for the Plasma Desktop. It would help the user see important stuff from his email, on a plasmoid. It’s similar to what Google Now does on Android. To know more, click here


I know, I know. I haven’t blogged for a while. But the past couple of weeks have been busy. Not just in terms of my project, but also my personal life, with a lot of things happening lately that demand my attention. Thankfully, I have been able to commit proper time to my project.

This time, there’s a lot to talk about.

I implemented all the extractors as run time plugins this time around. Earlier the daemon was not independent of it, with the extractors implemented as part of processor itself. Now, thanks to plugin architecture they are independent, and the daemon loads the plugins at run time. This was also part of my Season of KDE project for Plasma Media Center last year. It was only a lot more fun this time around, since I was starting from scratch. The advantage of having this architecture is the ease with which you can add support for plugins/extractors in future. At the end of this post, I’ll describe roughly how you can do this.

Next up, I added support for database. It was always a plan to cache stuff, to avoid unnecessary network usage. But we had not decided on the exact details of this implementation. I wasn’t sure whether to cache on files or use a database. I went to IRC and asked around. Bhushan (bshah) suggested to use a database since that adds security. Trojita, which is  a Qt based IMAP client also uses a database for this. Hence, I planned to use a database altogether. My mentor suggested something along the lines of MongoDB in which I can save the whole data map and would not have to manually map everything (cheers !). My data was JSON so things would be a cakewalk. Both saving as well as retrieving data. Unfortunately, Qt doesn’t provide support for it. I looked for some C++ drivers around, but couldn’t find anything useful. In the end we settled for SQLite since it’s lightweight, supported by Qt and generally has compiled drivers for most distributions.

Next, I exposed data from these plugins to D-Bus. I must say, I enjoyed learning about D-Bus. I had read about it earlier, during community bonding stage. But I forgot most of it, with all the things going on during my semester exams. Lol😀. Hence, when I read about D-Bus now, it was as good as a fresh start. I wrote small test programs too, for trying out QDBus. I came across a rather nasty problem related to D-Bus however. I was registering the proper service and object, but on calling the method, I repeatedly got the error of D-Bus Unknown object. After many hours, I consulted my mentor. He guessed it might be because, the object was getting destroyed on leaving scope (since it was in stack memory). His guess was spot on. I changed the object to heap memory and it worked like a charm ! We later decided to completely remove the extra interface files I had made, and currently we expose data from the plugin itself.


As I promised earlier (did I ?), here’s how you can add plugins now.

  • Get into the reservations directory and create a directory for your plugin
  • Include the directory, in reservations/CMakeLists.txt
  • In yourPluginDirectory, you need to make four files: yourPlugin.desktop to describe the plugin, yourPlugin.h, yourPlugin.cpp and CMakeLists.txt files
  • Make sure that yourPlugin inherits publicly from AbstractReservationPlugin, and make sure to define the start() method in yourPlugin. (I have made it virtual in AbstactReservationPlugin, hence you must implement it).
  • Do whatever you need in your plugin.
  • Describe your plugin in a yourPlugin.desktop file, and make sure you set the ServiceTypes to KDENow/Plugin (*Hint* Look at the ones already made and make relevant changes )
  • You need to store stuff to Database. Cache what you extracted.
  • Expose your data map to D-Bus. For this, yourPlugin.h must have this macro: Q_CLASSINFO(“D-Bus Interface”, “org.kde.kdenow.<yourPlugin>”)
  • In yourPlugin.cpp, bind the D-Bus Adaptor, and register the object and service (Look at the ones I already have done)
  • Implement a public Q_SLOT for getting the data. It can be whatever, but preferably a QVariantMap. However, if it’s a custom data type that is not natively handled by Qt DBus then you need to implement the stream operator functions and pass data byte by byte. Look at the Qt D-Bus Type System docs, to see whether your data type is natively handled or not.
  • Make a CMakelists.txt describing the build specs. Make sure to call the qt5_generate_dbus_interface and qt5_add_dbus_adaptor and kcoreaddons_desktop_to_json methods with relevant arguments
  • Make sure to install all the things at the right place.
  • Or, you can just copy the CMakeLists.txt I made and make relevant changes😉
  • Test with relevant data


With all of this, I think most of my backend work regarding emails and all has finished. For the next few things, I plan to write the receivers for the D-Bus data and do something to get data, when the daemon is not running, but the plasmoid is running (Hence, fetch from database). Also, after that I need to write User Interfaces for the plasmoid and cards.

Cheers !

I’ll catch you in the next one

#26: GSoC with KDE Now – 4

Hey ! I’m making KDE Now, an application for the Plasma Desktop. It would help the user see important stuff from his email, on a plasmoid. It’s similar to what Google Now does on Android. To know more, click here


In the past week, I worked on the code reviews I got. Hence, I changed the classes’ design all over. The way it works now, is that there is a central dispatcher, the daemon, that handles all the jobs. I chose this design, since it was how originally KIMAP jobs, was supposed to be managed. My mentor and Daniel Vratil helped me in deciding this.

I previously said, that I’d change the update to a new thread. That might not have been entirely true😉 . From what I know, IDLE is an async process, so there might be some actual lag there. I’ll add this in my TODO during the time I test everything and just move to other things on my list.

The IMAP client was looking good, so I started to implement a parser. Now I must say, this took more time than I expected. I was adamant at using Qt JSON library which is pretty good for parsing JSON. But to parse that JSON, the first thing is that I need JSON data. I looked through the docs. Nothing seemed good enough. QtWebKit seemed overkill. Of course, me and my mentor were against using it. There’s no GUI in our application, and using it would have been a waste of precious resources. I checked some other 3’rd party C++ libraries like SGML for Qt, Gumbo Parser by Google but nothing seemed appropriate. SGML was a bit (well more) on the slower side. Gumbo seemed good at first, but since it was 3rd party, I was worried. Maybe some things about license too. I didn’t feel like adding a dependency. Finally I settled for regex (No Wait. Whattt ? I know ? Before you all charge at me, I didn’t use it). Yeah, so I settled for regex. I contacted my mentor and Dan, and they were against it (Well me too, but what choice did I have ?). To those of you, who still think, it would have been okay to use regexes, read this. Dan told me to use QXmlStreamReader. My initial reaction was whattt ? How can I parse HTML with an XML parser ? Hence I never even googled about it. On a second thought though, HTML if formatted nicely, is just plain XML. (Now do you get it ? Just the tags !). I tested it with my IMAP client. Everything seemed good. It’s fast and reliable. It’s also in the QtCore module. So, Speed; check. Reliability; check. No added dependencies;check. What else could I have asked for (A tank ?). So, now I had data between those script tags in HTML, after I parsed it through QXmlStreamReader. Next I parsed this data using Qt JSON Library (QJsonDocument, QJsonArrayQJsonObject). I store the required data in Maps. With the power and consistency of QVariant(Map) things became quite easy.

I got code reviews from my mentor. We discussed some stuff for the next stages.In the next part, I’ll perfect the extractors I have written. Implement them as plugins and load these plugins in the client. This will make writing extractors for other schemas and hence adding support very easy. I’ll also be working with a database (SQLite) to cache the fetched emails. One of the things, I noticed just now, is that I’m using the Incremental methodology of Software Engineering. I am adding new features one by one. Building and testing at each step. Never thought, I’d see the impact of the course classes this early😉

See you later.