Bug 29998

Summary: Connecting to signal Tp::TextChannel::chatStateChanged needs typedef if not done in Tp namespace
Product: Telepathy Reporter: Lutz Schoenemann <lutz.schoenemann>
Component: tp-qtAssignee: Andre Moreira Magalhaes <andrunko>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium    
Version: git master   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: patch to the text-channel.h file

Description Lutz Schoenemann 2010-09-03 08:15:00 UTC
Created attachment 38405 [details] [review]
patch to the text-channel.h file

I have a class in my own namespace and wanted to connect the signal Tp::TextChannel::chatStateChanged(const Tp::ContactPtr &, ChannelChatState) to a slot of this class 
MyNamespace::MyClass::onChatStateChanged(const Tp::ContactPtr &, Tp::ChannelChatState).

I have tried it with 3 different connects:
1. connect( channel, SIGNAL(chatStateChanged(Tp::ContactPtr, ChannelChatState)), SLOT(onChatStateChanged(Tp::ContactPtr, Tp::ChannelChatState)) );
2. connect( channel, SIGNAL(chatStateChanged(Tp::ContactPtr, Tp::ChannelChatState)), SLOT(onChatStateChanged(Tp::ContactPtr, Tp::ChannelChatState)) );
3. connect( channel, SIGNAL(chatStateChanged(Tp::ContactPtr, ChannelChatState)), SLOT(onChatStateChanged(Tp::ContactPtr, ChannelChatState)) );

the first wasn't possible because the meta-object system complains about not compatible types (ChannelChatState != Tp::ChannelChatState)
the second wasn't possible because the meta-object system wasn't able to find that signal
the third wasn't possible because the meta-object system wasn't able to find the slot

Finally I was able to connect the signal to the slot by using this typedef:
typedef Tp::ChannelChatState ChannelChatState
and the 3rd version of the connects
3. connect( channel, SIGNAL(chatStateChanged(Tp::ContactPtr, ChannelChatState)), SLOT(onChatStateChanged(Tp::ContactPtr, ChannelChatState)) );


It would be a lot easier to change the header by adding the namespace Tp:: in front of ChannelChatState type
Comment 1 Olli Salli 2010-11-05 01:06:35 UTC
Will be fixed in 0.5.0.
Comment 2 Olli Salli 2010-11-16 07:02:38 UTC
Fix merged to master. Will be in 0.5.0.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.