[Kde-pim] help : patch in progress that adds kmail support for RFC2369, List-* headers to display in context menyu

Ingo Klöcker kloecker at kde.org
Tue Oct 20 12:47:26 BST 2009


On Tuesday 20 October 2009, Daniel Black wrote:
> I'm getting stuck in the implementation from a lack of Qt/KDE
> programming experience and needs some guidance (or more hours in day
> but guidance was easier to ask for).
>
> In addition the the basic list header information extraction on the
> reviewboard attached is my work so far.
>
> 1.
>
> Biggest problem is I want to KRun a KUrl as KAction in a menu item.
>
> my thoughts were that if there was a run method in the KUrl class
> then use that in the connect construct. As there wasn't (should I
> just request a run interface change on KUrl?),

No. I doubt that such an interface change would be accepted given that 
you can simply use KRun for this.


> I made the private 
> class
> MessageActionsPrivate_KUrlRunner. This wouldn't link because of the
> following error:
>
>  kmail/messageactions.cpp:70: undefined reference to `vtable for
> KMail:: MessageActions'
>
> Seems to be common enough however the approaches of putting it as a
> forward declaration in the .h file, the .moc #included already at the
> bottom of this file. Am I meant to inherit off MessageActions? I
> don't  what I should be doing here.

I propose two alternatives to using MessageActionsPrivate_KUrlRunner:

a) Use QSignalMapper, i.e. connect all triggered(bool) signals of the 
mailing list actions to a QSignalMapper, set a mapping from the actions 
to their URLs (as QStrings) and connect a simple slot to the 
mapped(const QString&) signal of the mapper.

b) Store the URLs in the user data of the actions. Then connect all 
triggered(bool) signals of the mailing list actions to a single slot 
and extract the URL from the calling action (which you get with the 
sender() method).

The second alternative is probably the better one because it works 
without any extra objects.


> 2. Smaller problem
>
> Before I get into strife I'd ask about clearing the MenuItems on a
> KActionMenu. Can/should it be done? Should I just replace it? what's
> the impact if the menu is displayed
>
> really sorry to bother you folks on this but I'm really stuck.

I'd simply clear() mMailingListActionMenu and then fill it again. The 
menu cannot be displayed while you do this (unless very strange things 
happen).


Please upload the patch to Review Board so that we can much more easily 
comment on it.

Phrase puzzles like
  item + " " + protocol + " " + pUrl
are a nightmare for translators. You have to use QString::arg() for 
putting together such phrases, e.g.
  i18nc("%1 is a bla, %2 is a bla", "%1 (%2)" ).arg( item ).arg( 
protocol )

I wouldn't put the URL into the action. You could probably add the URL 
to the actions tooltip.


Regards,
Ingo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20091020/3dfe31d3/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