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

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!

 

Advertisements

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

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 :D. 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