A Nepomuk Integration Plugin for Firefox

Published on ven 06 septembre 2013 in Nepomuk, (Comments)

Since the beginning of August, I'm experimenting with the idea of integrating Nepomuk and the most used web browsers. I started with a Konqueror plugin that detects when the user is reading an e-mail on a webmail in order to index the e-mail in Nepomuk. That was quite a challenge, but I'm now able to detect e-mails on Outlook, Yahoo! Mail, any Roundcube-based webmail, and GMail will come shortly (this webmail is very difficult to parse).

I chose Konqueror because I largely prefer to develop extensions in C++ (a compiled language with clear APIs, and the wonderful auto-completion of KDevelop), and I didn't want to fight with webmails and with Javascript at the same time.

The Firefox Extension

This week, I ported the Konqueror extension to Firefox. You can find it in my scratch repository. The extension can be found in the firefox/ directory and is currently unpackaged. If you want to get a proper .xpi file, just do the following:

1
2
cd firefox/
zip -r ../nepomukintegration.xpi *

After having installed this extension, you can begin to visit webmails. Outlook currently works best (I don't know how it is possible, but the HTML code is very well designed and crystal clear). You need to open e-mails to have them indexed, as the extension has no way to know the content of emails if you don't open them.

When you have read some emails, go to /tmp/kde-YOU/ and look for .mime files. If you open them (using KWrite for instance, the MIME format is very human-readable), you can see the content of your e-mails. There will be no "Date" field as I haven't yet figured how to implement this C++ function in Javascript:

1
2
3
4
5
6
QDateTime stringToDate(const QString &string, const QString &format, const QString &language)
{
    QLocale locale(language.toString());

    return locale.toDateTime(string, format);
}

You can also download files using Firefox. Every download is represented by a .webaction file in your temporary directory. This file starts with "DOWNLOAD" (more actions will be possible in the future, like "BOOKMARK" or "HISTORY"). The next lines are the website on which the file has been downloaded, the URL of the file, and the path where you downloaded the file.

Integration with Nepomuk

Now that your temporary directory is full of files that describe your web activity, you can pull the steckdenis-webindexers branch of my Nepomuk-Core repository. Build this Nepomuk-Core and install it where you have your KDE developer installation. Now, go to your temporary directory and type something like that:

1
2
nepomukindexer 8767d79459fbc4720083d06bed365236.webaction
nepomukindexer 88d86afe9938e87aa3324e3cd6ff8a55.mime

These two operations index the data that Firefox have just extracted in Nepomuk. You can also ask Nepomuk to watch your temporary directory and to index files in it automatically when they appear (this can be done in the "Desktop Search" configuration module). The result is as shown below:

Indexing downloads

Conclusion

First, I want to precise that the indexing of downloads is based on work by Martin (for the Firefox part) and Vishesh (for the Nepomuk part). I'm only responsible for gluing the Firefox part in my Firefox add-on and for adapting the Nepomuk part as a Nepomuk File Indexer.

This ends my experiment of indexing e-mails in Nepomuk. This experiment started because I thought that it would be good to allow users that use webmails to enjoy the niceties of Nepomuk. Not everyone uses KMail, that already index everything in Nepomuk.

If I remember correctly, the GSoC ends in two weeks. What I will try these coming two weeks is to merge my work in Nepomuk (the query parser and the query builder widget) and in Dolphin (I have a small patch that makes Dolphin use the new query builder and that I would like to merge if a future Dolphin version is planned). I will also propose this experiment for merging. The Nepomuk part is not invasive at all (I just added three file indexers : MIME/MBOX, vCard and web actions), and the Firefox add-on just have to be uploaded to Mozilla Add-Ons.

« Finishing Touches and GMail   The End of the Google Summer of Code »