[Kde-pim] Rq for hacking info: How to specify the name of a dropped message
Daniel Vrátil
dvratil at redhat.com
Tue Jun 3 10:00:32 BST 2014
On Monday 02 of June 2014 16:36:12 Alistair Hamilton wrote:
> Hello
>
> If this is the wrong place to post this request, please tell me to go
> away (but it would be nice to know where better to post it).
Hi,
this is exactly the right place for this question :-)
>
> I can drag a message from the message list and drop it onto a view of a
> folder in Konqueror. This creates a file that if clicked, opens as a
> message in a Kmail view window. This is ideal behaviour for me.
>
> The problem is that the name of the file created is just a number. By
> default, if I do the same thing with Evolution, the filename comprises a
> date stamp plus a version of the message title. I have hacked Evolution
> such that it drops a file with a name in exactly my preferred format
> (different to the default). The clicked file opens in Kmal.
Right, the number is a unique Akonadi identifier, not really a useful
information for users.
> I am in the ridiculous position that I use Kmail for everything, apart
> from this drag-and-drop operation -- but that is central to my business,
> because I want to store every email message in its own case directory in
> the filesystem, and not on the IMAP server.
>
> So, I am well prepared to hack my own version of Kmail (and make the
> hacks available for backporting if they are wanted). However, I just
> cannot figure which files need to be hacked to do this. (I found the
> source of Evolution far easier to get into than that of Kmail.)
No need to hack on KMail. This is handled by the Akonadi KIO Slave, which
lives in kdepim-runtime repository. The KIO Slave works generically for any
Akonadi item - be it a contact, a calendar event, an email,....
> So, what I would like to know is: - when a message is dragged from the
> message list and dropped into a Konqueror window, how and where is the
> name of the resulting determined? If it is not obvious from the context,
> can someone point me in the direction of how I can get the message
> metadata to generate a filename that reflects the date and the subject
> of the message?
>
> While this is an indication of a feature that is wanted, it is not a
> feature request, as such. All I need is some guidance, and I will
> implement the feature myself (if I can) and submit it back to the
> community if it is wanted.
The entire "problem" lies in akonadislave.cpp in entryForItem() method, which
currently sets UDS_NAME to item.id(). What you need to do is to extract
payload from the Akonadi::Item (I guess supporting emails, contacts and events
is enough for the start) and get the right title (subject for mails, name for
contacts, etc.) and set it as UDS_NAME for the file entry. That should do the
trick ;-)
You can read a bit about how Akonadi works here [0] and here[1].
If you have any questions, just ask here or on IRC.
Cheers,
Dan
[0] http://api.kde.org/4.x-api/kdepimlibs-apidocs/akonadi/html/index.html
[1]
http://techbase.kde.org/Development/Tutorials#Personal_Information_Management_.28Akonadi.29
> Way back when, dropped messages *did* have a useful filename, but that
> was in the KDE3* days. That is why this is not a pure "Wishlist" feature
> - rather, a request to re-implement something that is of relatively
> minor interest. However, IF I CAN I WILL DO THE WORK - it is just
> quidance I need.
>
> Thanks
> Alistair Hamilton
>
> _______________________________________________
> 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/
--
Daniel Vrátil | dvratil at redhat.com | dvratil on #kde-devel, #kontact, #akonadi
KDE Desktop Team
Associate Software Engineer, Red Hat
GPG Key: 0xC59D614F6F4AE348
Fingerprint: 4EC1 86E3 C54E 0B39 5FDD B5FB C59D 614F 6F4A E348
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20140603/7e872e3d/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