With an Akonadi sprint in Berlin coming up, I thought I’d write a couple of lines for those who are interested in some PIM stuff in Plasma.
Lion Mail is a Plasmoid that shows information about emails. It can be used to display for example unread emails in a popup in Plasma. Lion Mail is much more powerful than that though. Lion Mail can load various collections, and handle them as independant applets or groups of applets on the desktop. It uses Plasma’s extenders which provide support for detaching parts of an applet. Lion Mail offers in fact two Plasmoids. The Lion Mail applet groups emails into collections and displays them in a configurable listview, either on the desktop or as popup applet in the panel. Then, there’s the emailmessage applet that can be put in either panel or on the desktop, and reveils more information as you make it bigger. It dynamically loads the body and displays it if you give it enough space by resizing. This happens transparantly for the user. The idea behind this is that you can drop interesting emails for reference onto desktop or panel, and throw them away when you don’t need them. The email applet also offers interaction buttons. You can flag the email as new, unread, important and task item right now. I’m planning to also offer a safe way to trash an email, so you don’t get to end up with the situation where you’re distracted once by some spam email, Lion Mail and the Email Message Plasmoids act as some sort of intermittent email reader.
The third and least visible part is the Akonadi dataengine. It’s actually there for a long time already, but hasn’t been much used. I’ve picked it up, brushed a bit of bit-rot off of it and extended it to do everything I need, and a bit more. I’ve also added support for contacts to the engine. Having a dataengine for this kind of stuff means that the data is very easily accessible for scripted applets, no special bindings for libraries in PIM or Akonadi are needed. (Naturally, the dataengine itself uses those libraries internally.) In the screenshot
, you can see the configuration dialog, the Lion Mail applet and an email applet, all placed on the desktop. The Lion Mail applet show a list of emails, with various bits of metainformation hidden or shown. As you can see, you can even view the full email from within Lion Mail. The buttons shown let you tag the emails, or mark read/unread. Clicking on the icon expands and collapses the header, clicking on the green expander shows and hides the body. It’s loaded dynamically from Akonadi. Typically, you’ll have Lion Mail sitting in your panel, if you click on it you’ll see a popup just like the right applet in the screenshot. If you’re using the email applet on the desktop (bottom left in the screenshot), you can reveal more information by resizing it using applet’s handle.
There are a couple of things that need more work, either because I’ve not gotten around to it yet, or because I didn’t find a good solution. In random order:
- Various layouting bugs. Qt 4.5 has improved the situation quite nicely,
and along with it my experience and wisdom of QGraphicsLayouts has increased a bit as well. Still there is something I’ve not completely sorted when displaying the applets in a list and expanding items in that listview (usually Lion Mail).
- Fetching the list of collections from akonadi often takes 20 seconds,
I’m not sure why. Fetching individual items is pretty darn fast. Fetching of all the lists and content from Akonadi happens fully a asynchronous, which is a big, big plus if we want to keep the UI responsive.
- Drag and Drop support. It works in a wacky way from Lion Mail onto the
desktop, but needs a cleaner solution. I’ve already called onto the gods and demi-gods of the holy Plasma to get me ideas. The issue is basically that we’re not dealing with email data but with URLs that deliver us one content type or the other. Checking the mimetype of some dropped URL and doing something sensible with it is something I didn’t get to work nicely yet. While the current code is totally disgusting, it’s pretty neat interaction-wise. Upon dragging an email, you get a nice large-ish email icon attached to your mouse cursor, and when you drop the email onto the desktop, it’s created from the akonadi URL, and loads its content from there. Eventually, the user should be able to just drag an email from her favourite email client (Mailody for sure, it’s the first app to use Akonadi for email) onto Plasma, and maybe the other way round as well.
- Sorting and more advanced querying (“virtual folders”). The way Lion Mail works right now, it’s not possible to sort emails. I’m not sure how to solve this best, since it’s two things I want. First and foremost, I don’t want to request full folders of emails (a couple of thousand emails in the common case) only to throw 99.9% of them away. That means that I need some way to query “8 news unread emails from all folders” or “all emails flagged important from imap folders private, work”, “emails tagged ‘petting zoo'”, “8 latest emails from Artur, Wade and George (Yes, you George!)”. That’s the kind of thing I want to be able to display with Lion Mail. The other side of the problem is of course that the display in Lion Mail itself doesn’t do any kind of sorting at the moment. I figured that would be futile, since I’m using the “throw away 99.9% method” right now anyway. (WTF++) Something that needs more of that tender, love and care. And probably some model-view-akonadi-fu as well. (I’m looking at you, Till. :-))
- Integration of activities. The collections shown may vary depending on the current activity. It should be straight-forward to set up Lion Mail so that it only shows you emails relevant to your current activity. Or in less abstract terms: When you’re free, you should be notified and shown emails from work or when you’re working on some project, to show emails relevant to that context. One of the TODO items.
- Notifications. Didn’t get to that yet, simple as that.
- Improved display in the panel. This means for example showing the number of unread emails in there, or something more fancy than that.
I’ll meet bright people at the Akonadi meeting in ten days at the KDAB offices in Berlin, and that I’ll find solutions for some of the things that I want to do in Lion Mail. Developer meetings are a wonderful way of learning and tapping into other’s knowledge and experience. Or simply to get someone to test it and see where things are breaking and falling apart. :)
Another couple of ideas I’m planning to implement for Lion Mail is more integration with Contacts
. Here I’m not necessarily talking about “entries in my addressbook” (only in the ideal case, where they actually have an entry in my addressbook). A contact goes further than what the entry in the addressbook provides. Contacts are one way to provide context to data. The sender of an email matters a lot, even more so when you’re looking at emails. Other emails by some person are probably relevant to show as well, pulling in instant messaging status, and possibly social network activity are surely interesting things to look at. Hmm, … “Lion Mail: Social Networking for Email Geeks”.
sounds like a nice vision statement for it. ;)
For that to happen, I need to figure out a way to ask Nepomuk about data related to the concept of a “Contact”. The exact relationship is a bit unclear to me right now though. Should all data be requested through Nepomuk? In how far can I use Nepomuk concepts in Akonadi? Think of the famous “give me all items (emails, chat logs, …) by this Nepomuk contact”.
If you’re interested in looking at Lion Mail code-wise, it’s currently in Plasma’s playground
. If you’re planning to use it, hold your breath for a while, it’s not ready for use at this point.
A nice side effect of all that hacking is that I’m starting to get the hang (addiction?) of the Monster that C++ can be. I’ve started learning C++ about two years ago. Over the last weeks, I’ve felt that I’m more confident with how I write code, I make less dumb errors, I understand more quickly what’s going on, and I can understand code quicker now. There’s so much more to learn, but at least I’m feeling I’ve moved from the “figuring out how I express this in C++” to “write code” mode. That said I’m all but an experienced C++ hacker. One of the things that continue to strike me is the overall clarity of KDE’s codebase. Combine that (providing huge amounts of examples for everything) with a lot of nice people that can help you figuring out things, and you get a very productive and rewarding learning environment.
Of course I’m not even talking about touching non-Qt/KDE code. That still is something I generally try to avoid, mostly to keep complexity down to a level that is manageable for me. And it’s icky.