[Kde-pim] Porting KMail to KMime/Akonadi

Mantia Andras amantia at kde.org
Sat Oct 17 23:03:05 BST 2009


Hi,

 here at the Akonadi sprint, my chosen task is to port KMail to the new 
millienium, so to use KMime and Akonadi. The Akonadi part is for the 
future, the KMime part is the present. With hacks, and bloody work, now 
I managed to make KMail compilable with many of its internal using KMime 
instead of KMMessage/KMMessageBase/KMMessageInfo/partNode/whatever. It 
compiles [*], though it doesn't link, sorry that would be too much for 
today. :)
 Now, to be serious, some words about what I did: the idea is to get rid 
of the above classes. Instead use KMime::Message (for KMMessage) and 
KMime::Content for the others. As the KM* classes contain other helper 
methods and extra information about the messages, I did a similar 
approach as in the MessageViewer: create a helper namespace 
(MessageHelper) for the first type of the methods and a helper singleton 
class for the second (MessageInfo). The process of porting is the 
following: 

A) porting away from KMMessage* and partNode:

1) you look if there is a KMime call that can be use 
2) Look if there is a MessageHelper/MessageInfo/MailViewer::NodeHelper 
method that you could use 
3) if the answer is no, extract the missing method from KMMessage* into 
one of the helper classes. 

B) porting to Akonadi:
- I let someone to fill it, but it is more or less porting KMFolder and 
the related stuff.

Now, I did most of A, but with shortcuts, and that is because KMMessage 
is everywhere, and I wanted to have a code that we can work on together. 
Having a completely broken, not compiling KMail locally on my machine 
doesn't help team development. The shortcuts are commented out code 
parts. I tried to keep it consistent, so they look like:
 #if 0 //TODO port to akonadi
 ...not ported code 
#else
    kDebug() << "AKONADI PORT: Disabled code in  " << Q_FUNC_INFO;
#endif

This way it is possible both to grep for not ported code and to see at 
runtime if something is commented out.
Unfortunately it isn't like that in every place, as when I did the first 
part of the port some weeks ago, I just commented out and added a TODO 
comment. And some other guys just commented out the code without any 
TODO... 

Note that not all of such code needs to be ported, some commands are 
handled inside the message viewer, the imap/pop3/whatever code is now 
replaced by Akonadi. 
My suggestion would be for those interested in KMail porting to try to 
run (haha), and port by functionality. Try to execute something, see if 
it works, and what is the output and port if it is not ported.
 The KMCommand* functionality is disabled 99%, but after two methods are 
ported (to retrieve the current message), there should be no problem 
porting them.

 Once done, comes the cleanup and code shuffling. Now there are methods 
in MessageViewer::NodeHelper and MessageViewer::ObjectTreeParser that 
are used in KMail and well, even in the composer part. I wouldn't give 
too much attention to this now, though.

 Probably there are other important things to tell, but it is late and 
I'm tired now. Have fun, and run/compile akonadi_ports only if you want 
to work on KMail (sorry for the others, please disable kmail in 
CMakeLists.txt if you work on other app, but compile the whole 
akonadi_ports).

Andras


[*] Compiled, now seems we have a missing file, not my fault. My fault 
is that it doesn't link, as some code seems to still use KMMessage, and 
KMMessage is not compiled into the executable anymore (so we can get rid 
of many other classes).

PS: Laurent and Leo, I CC'd to you, as I don't know if you follow this 
mailing list.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20091018/62eaecb5/attachment.sig>
-------------- next part --------------
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/


More information about the kde-pim mailing list