Archive for December, 2006

Using SQLite

Sometimes people tell me that sqlite is too slow to use in applications. I don’t think that’s a valid reason for discarding sqlite. But you have to keep things in mind while working with sqlite. Some of the things I learned while working on Mailody:

Scrooge

Onderstaand verhaal is geschreven door Anneke Albers en is een samenvatting van het bekende Scrooge verhaal. Het is opgedeeld in drie delen. Elke sectie hardop voorgelezen duurt ongeveer 5 minuten.

Indien je de tekst gaat gebruiken, wees dan zo vriendelijk om een berichtje onderaan achter te laten en bij verspreiden is het verplicht de auteur te vermelden.

Quick Filter

One of the nice things in KMail is that you can quickly search for the correct mail with the Quick Search Bar. A problem I always have is that i’m not sure in which mailbox the mail is which I’m searching.

One of the annoying things in KMail is that changing folders resets the quick search bar, so you need to type in the keyword again to filter the messages and see if it is in that folder. Doing that in 10 folders is not real fun.

But I can understand why KMail does that. If you have a keyword and switch folders and don’t see any messages that makes you think KMail is broken and you might not realise a search is active. The search simply did not result in any messages matching the search.

With Mailody I’ve decided to go for another solution. As soon as you as you switch folders and have a search string in the quick filter bar, the thing flashes for a fraction of a second. Enough to get your attention and realise why you are not seeing all messages of that folder.

[img_assist|nid=129|title=QuickSearch Flashing|desc=|link=node|align=left|width=549|height=151]

Simple class to do what i want.

After working on it for one and a half day I finally reached the headerview as I wanted it to be:

[img_assist|nid=127|title=headerview|desc=|link=node|align=center|width=551|height=131]

The amount of time I spent on it was caused by a couple of reasons:

- I wanted to have a widget with a maximized height, if there was more data it should add a scroll bar, but if it has less data, the widget should shrink.
- When clicked on a hyperlink (left and right mouse button), it should emit a signal telling me, so i can popup a composer or a context menu.
- when an address does not fit in the current width, it should wrap it.

So I examined a couple of options. First of was kurllabel, which is based on a QLabel. Which is almost perfect, except for the fact that it can only hold one address at a time. So I used that, made a kurllabel for each address and put it in a vbox. That wasted a lot of space, because you can sometimes put multiple addresses on one line without problem.

Next to that, i did not implement the scrollbars and maximum height, so receiving a message with 20 people on the cc list, made it impossible to read the body of the mail.

Next on the list was the kactivelabel. As you feed it html, wrapping and multiple addressess on a line is no broblem. It is based on a qtextbrowser, so it’s basically a full browser. One unsolvable problem for me was that the height of an kactivelabel is more than a qlabel and i could not find a way to reduce the spacing I saw. Besides that, using a browser for a simple label seemed a bit overkill to me.

Yesterday I switched back to a simple QLabel, as it is capable of displaying simple rich text, and that is all i need. Only a default QLabel does not emit signals when clicked on a link. I browsed a bit through the internals of a QLabel and found a class written by Waldo that makes use of a QSimpleRichText helper to determine the used width of a QLabel. I tried to do the same for determining if a there is a click on a link, because the QSimpleRichText class contains a anchorAt() function. And that worked.

And now I’ve the widget I wanted. Again a confirmation of the fact that 70% of the things take 30% of the time and 30% of the things take 70% of the time. Or was it 10% vs. 90%?

Mailody 0.2.0

After a month of fixes bugs, I’m proud to announce the next version of Mailody: 0.2.0. I’ve concentrated on making mailody work with more imap servers. It became clear to me that the previous release did not work for a lot of people. I hope this release fixes the majority of those problems.

Of course I could not resist to add a small amount of new features. An overview of what has changed since the release candidate is on the site. Packages will appear soon…

Time for some new features now. I’ve already prepared the ‘sort by youngest item in the thread’ one and a method to update the folder list without deleting the complete local cache. Next one in queue: multiple identities.