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

Thomas McGuire mcguire at kde.org
Tue Oct 20 18:09:27 BST 2009


Hi,

On Tuesday 20 October 2009 12:03:20 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?), 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 think you're getting the linker error because you use the Q_OBJECT macro in 
a .cpp file, which will not work, because moc isn't run on them. Classes that 
have the Q_OBJECT macro should be put into some header file.

But for this problem, I suggest something different: In 
addMailingListAction(), you create the KAction's and connect them to some 
slot. Just make that connect() connect to a slot in MessageActions instead. 
Instead of connecting to KAction::triggered, connect to the triggered( 
QAction* ) signal of the KActionMenu's menu().
Then, you can use QAction::setData() before the connect() to set the KUrl that 
is associated with that action, and in your slot, call QAction::data() to get 
that Url back and use it when calling KRun.

> 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

I'm not sure if it works, but KActionMenu has a method menu(), which returns a 
QMenu, which has the method clear(). Try that.

> really sorry to bother you folks on this but I'm really stuck.

Not a problem, asking here is encouraged, especially if you are stuck.

Regards,
Thomas
-------------- 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/d23fe658/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