Featured

#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

Cheers!

 

#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.

1

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.

#25: Summers !

I had my last exam on the 27th of May. And with that, I bid adieu to my sophomore year. Now when I look back, things seem to have flown past. Just the other day, I was excited about starting another year at college, and here I am writing about it’s end. Life sure moves fast, mate.

Last year (or academic session) was a mix bag. We had some good courses, and some not so good ones. (Yes, Microprocessors and Computer Arch, I’m referring to you). Well, in my opinion at least.

I’m happy that finally my exams came to an end. It goes on for a fucking month. Well roughly. We have our Minors – 2, that takes about  a week. Then practicals for another week. Then about 14-15 days for the University exams. I meant every word of it, when I posted the following on my Facebook wall when my exams ended.

Walk into your house like, when the semester ends!

vlcsnap-2016-05-26-18h29m02s781

My University exams went fine. No that I expect something like a 9 CGPA, but anything close to 8 will do.

I haven’t had much time to blog about anything except my updates with the Google Summer of Code this year. It has been keeping me busy lately. I wonder how things are gonna roll, when the next semester starts. Which reminds me, the last two semesters were awful in terms of schedules. All week, our classes used to end at 5 pm. That makes it kind of a 9-5 job😛 . Last semester, our labs were 3 hours long. I mean, can you even believe it ? And all we had to do in those 3 hours, was perform just a single experiment. Terrible waste of time. An hour would have been more than enough. As a result, we were exhausted when finally reached hostel at about 6 pm. Then the assignments, lab work, etc took another couple of hours. No wonder, things seemed to have moved very fast ! I kind of cringe at the thought, that even now if it’s getting difficult to take out time for hobbies, what will happen when we’ll be working ?

I’m about 12-13 days in my summer vacations. I have a shitload of things going on. About a month more remains. I need to pull my socks up. And not sit around random subreddits !!! As expected, I’ve been keenly following Game of Thrones. It’s already 7 episodes down. (What ? 7 weeks ? How ?) Yeah. Just the other day, I bunked a lecture to watch the first episode with my friend. I will watch it all, one day when this season ends. 10 hours straight.

With that I end my blog(rant ?)

See you later