diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2012-03-23 17:40:21 +0000 |
---|---|---|
committer | Matúš Kukan <matus.kukan@gmail.com> | 2012-07-17 16:39:58 +0200 |
commit | dcca79f6e74ea8b2347bbd87a85c04f2b6cb7646 (patch) | |
tree | 542685be97c3e196cbd23d80b0dd95f089df8ab7 | |
parent | 58499ea785ca7dd2661a54e9df4fa9d66f0d8895 (diff) |
Replace file received link with a signal.
-rw-r--r-- | sc/source/ui/collab/collab.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/collab/sendfunc.cxx | 12 | ||||
-rw-r--r-- | sc/source/ui/inc/collab.hxx | 12 |
3 files changed, 13 insertions, 17 deletions
diff --git a/sc/source/ui/collab/collab.cxx b/sc/source/ui/collab/collab.cxx index a68ba45f97a6..4c02045bd4ce 100644 --- a/sc/source/ui/collab/collab.cxx +++ b/sc/source/ui/collab/collab.cxx @@ -31,9 +31,8 @@ #include <tubes/conference.hxx> #include <tubes/contact-list.hxx> -ScCollaboration::ScCollaboration( const Link& rLinkFile ) +ScCollaboration::ScCollaboration() : - maLinkFile( rLinkFile ), mpAccount( NULL), mpContact( NULL), mpManager( NULL) @@ -57,8 +56,7 @@ void ScCollaboration::receivedFile( rtl::OUString &rFileURL ) { fprintf( stderr, "file recieved '%s'\n", rtl::OUStringToOString( rFileURL, RTL_TEXTENCODING_UTF8 ).getStr() ); - if ( maLinkFile.IsSet() ) - maLinkFile.Call( &rFileURL ); + sigFileReceived( &rFileURL ); } void ScCollaboration::packetReceivedCallback( TeleConference *pConference, TelePacket &rPacket ) diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx index 38c598fac84b..66db1d2fdefa 100644 --- a/sc/source/ui/collab/sendfunc.cxx +++ b/sc/source/ui/collab/sendfunc.cxx @@ -262,6 +262,7 @@ public: } void packetReceived( TeleConference* pConference, const rtl::OString & ); + void fileReceived( rtl::OUString *rStr ); DECL_LINK( ReceiveFileCallback, rtl::OUString * ); void RecvMessage( const rtl::OString &rString ) @@ -301,12 +302,12 @@ public: } }; -void ScDocFuncRecv::packetReceived( TeleConference* pConference, const rtl::OString &rStr) +void ScDocFuncRecv::packetReceived( TeleConference*, const rtl::OString &rStr) { RecvMessage( rStr); } -IMPL_LINK( ScDocFuncRecv, ReceiveFileCallback, rtl::OUString *, pStr ) +void ScDocFuncRecv::fileReceived( rtl::OUString *pStr ) { fprintf( stderr, "incoming file '%s'\n", rtl::OUStringToOString( *pStr, RTL_TEXTENCODING_UTF8 ).getStr() ); @@ -362,8 +363,6 @@ IMPL_LINK( ScDocFuncRecv, ReceiveFileCallback, rtl::OUString *, pStr ) fprintf( stderr, "exception when loading '%s' !\n", rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() ); } - - return 0; } class ScDocFuncSend : public ScDocFunc @@ -552,10 +551,11 @@ SC_DLLPRIVATE ScDocFunc *ScDocShell::CreateDocFunc() ScDocFuncRecv* pReceiver = new ScDocFuncRecv( *this, new ScDocFuncDirect( *this ) ); ScDocFuncSend* pSender = new ScDocFuncSend( *this, pReceiver ); bool bOk = true; - ScCollaboration* pCollab = new ScCollaboration( - LINK( pReceiver, ScDocFuncRecv, ReceiveFileCallback) ); + ScCollaboration* pCollab = new ScCollaboration(); pCollab->sigPacketReceived.connect( boost::bind( &ScDocFuncRecv::packetReceived, pReceiver, _1, _2 )); + pCollab->sigFileReceived.connect( + boost::bind( &ScDocFuncRecv::fileReceived, pReceiver, _1)); bOk = bOk && pCollab->initManager(); if (!strcmp( pEnv, "master")) { diff --git a/sc/source/ui/inc/collab.hxx b/sc/source/ui/inc/collab.hxx index 0337b793bdff..df059ad886fa 100644 --- a/sc/source/ui/inc/collab.hxx +++ b/sc/source/ui/inc/collab.hxx @@ -30,7 +30,6 @@ #define INCLUDED_SC_COLLAB_HXX #include <sal/config.h> -#include <tools/link.hxx> #include <boost/signals2.hpp> typedef struct _TpContact TpContact; @@ -44,10 +43,7 @@ class ScCollaboration { public: - /** @param rLink - Callback when a file is received, called with TeleConference* - */ - ScCollaboration( const Link& rLinkFile ); + ScCollaboration(); ~ScCollaboration(); bool initManager(); @@ -61,14 +57,16 @@ public: bool recvPacket( rtl::OString& rString, TeleConference* pConference ); void sendFile( rtl::OUString &rFileURL ); - void receivedFile( rtl::OUString &rFileURL ); + /** Emitted when a file is received + */ + boost::signals2::signal<void ( rtl::OUString *pFileURL )> sigFileReceived; /* Internal callbacks */ void packetReceivedCallback( TeleConference *pConference, TelePacket &rPacket ); + void receivedFile( rtl::OUString &rFileURL ); private: - Link maLinkFile; TpAccount* mpAccount; TpContact* mpContact; TeleManager* mpManager; |