[Kde-pim] Kmail API: deleting emails from a kmail maildir folder.

augustin augustin-kde-devel at overshoot.tv
Mon Apr 23 06:46:56 BST 2012


Hello Kevin and all,

Thanks for your detailed reply.


On Saturday, April 21, 2012 12:00:38 AM Kevin Krammer wrote:
> I recommend you subscribe to the KDE PIM developer mailing list and we
> continue the thread there.

I just did. Thanks.

> What version of KMail / KDE PIM are you targetting?


This already in an important issue.
I am still using Kubuntu 11.04 with KDE 4.6.5 and Kmail  1.13.6.
The reason I have not yet upgraded to newer versions is precisely because of 
kmail. 

I meant to ask the following questions elsewhere, at another time, but since I 
am here...

I have almost 10 years worth of emails, with family pictures attachments, .pps 
and movie clips forwarded by friends, etc.... so much that my mail directory 
is quite imposing and my hard drive quite full (with other stuff as well!)

A while ago, I noticed the following note in the (at that time beta) release / 
upgrade notes:
"
 IMPORTANT: Do note that this is a major upgrade to the mail, calendar and 
addressbook systems, and as such still needs usage and migration testing. 
While loss of data should not be an issue, it is highly recommended to back up 
all important data, mail, contact information, and calendars if you plan to 
test upgrading to 11.10.
"
https://wiki.kubuntu.org/OneiricOcelot/Beta2/Kubuntu#KDE_Personal_Information_Management_Suite_4.7
 
So my first question is:
1- how much extra space does kmail need to upgrade? Does it need space to copy 
data from an old format to a new one? HDD space is an issue.

2- Are there known issues for kubuntu 11.04 -> 11.11 upgrade (kmail 1 -> kmail 
2)? Do I really need to be worried?

Of course, in any case, I will make a proper backup before I perform the 
upgrade!

--

You  probably start to see my motivation behind my earlier development 
questions.... I need to tidy up my mails! ;)


> In a KMail 2 / KDE PIM 4.7 setup programmatic access to e-mails is handled
> via Akonadi so any program can work with e-mail just like KMail itself
> does.

Yep. I'd like to work with kmail2, but there is a chicken and egg question:

Do I tidy my mails and make space on the drive before attempting the upgrade? 
In which case I'd like to take the time to develop a helper tool (using Kmail 
1 API) beforehand.

Or do I upgrade first and tidy later (using a Kmail 2 / Akodani helper tool)? 

I haven't yet taken the time to properly investigate the distro's upgrade 
path.

 
> > I can write the application to browse the maildirs, and parse the MIME. I
> > have found a couple of APIs that I might use (any recommendations?).
> 
> libkmime (kdepimlibs/kmime), libmaildir (kdepim-
> runtime/resources/maildir/libmaildir)

Ok. I'll check them out.
 
> > But where I am a bit uncertain, is how to handle the deletion of the
> > emails. Deleting a specific email is certainly easy (delete the
> > corresponding file), but what about regenerating indexes?
> 
> Depends on the targetted KDE PIM version.
> With KMail 1 you can not do that, it assumes full ownership of its maildir
> tree.


Well, I could still use a very ugly hack.

With a maildir format, I can easily delete the mail (the corresponding file). 
As to the index, I noticed the following:
http://userbase.kde.org/KMail/FAQs_Hints_and_Tips#Problem:_You_are_losing_mail 
I see that there is an option to manually rebuild an index, or as suggested I 
could delete the index file, which would be recreated when I next start kmail.

Ugly, yes, but only a temporary hack. Unless of course I upgrade first.

 
> With KMail 2 it depends on what Akonadi resource is handling the maildir
> tree. The maildir resource can deal with file notifications (right
> Andras?), the "KMail Folders" (mixed maildir) resource can't do that yet.
> However in the case of a KMail 2 setup, mail manipulation facilities are
> available for all programs, not just KMail.

"Kmail folders"? They are not in the (I assume standard) maildir format? 
What's the difference?


 
> > Wouldn't I be better off using some d-bus API? Let kmail perform the
> > deletion itself? Does one d-bus API exist for email deletion?
> 
> I don't think there is such an API yet, but somebody else might know
> better.

Using 'qdbus', I browsed the available methods, but didn't find anything 
related to deletion.

 
> > Would you recommend any specific API to browse the maildirs, parse the
> > MIME and, obviously, delete the emails from within my application?
> 
> On a KMail 2 system Akonadi::CollectionFetchJob, Akonadi::ItemFetchJob,
> Akonadi::ItemDeleteJob and KMime::Message.

Thanks. I'll look at that when the time arrives....



Thank you Kevin for your time and your answers. And thank you for all the 
developers out there.

As I have hinted above, I am a long term, very happy KDE user (kmail, 
konqueror... etc.). My professional and personal life leaves me with little 
time, but I really would like to find appropriate ways to contribute. I am a 
very beginner C++ developer and learning (very) slowly. 

I will not be contributing the helper tool that I wish to develop for myself, 
simply because what I wish to do is highly specific to my personal case, and 
I'll be trying to cut corners and speed the development time by hard-coding 
many details, using temporary ugly-hacks if it can save time (which, for me 
like for almost anyone else, is an issue).

However, we already noticed that API documentation was an issue. And I am very 
willing to extract the essence of your help here and put it in a more 
appropriate place (in an official KDE wiki, in a tutorial in my own web site, 
etc...) so that future developers can learn from my own learning process... 
Please, do let me know which ways would be the most appropriate to achieve 
this. 




Thanks for your help so far.

Blessings,


Augustin.





-- 
Friends: http://www.reuniting.info/
My projects:
http://astralcity.org/ http://les3enjeux.fr/ http://linux.overshoot.tv/ 
http://overshoot.tv/ http://charityware.info/ http://masquilier.org/
http://openteacher.info/ http://minguo.info/ http:://jacqueslemaire.fr/ 
http://www.wechange.org/ http://searching911.info/












.
_______________________________________________
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