summaryrefslogtreecommitdiff
path: root/sc/source/ui/collab
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@gmail.com>2012-07-20 00:12:19 +0200
committerMatúš Kukan <matus.kukan@gmail.com>2012-07-20 12:46:59 +0200
commit37c67a137882cc1a9e113552dcab42a7d6337358 (patch)
tree5c1fa1c471f1719e70240a61689e8c9672771326 /sc/source/ui/collab
parentd41903eb7b6936bbf98639d39ddc7558409d63be (diff)
tubes: send a file for collaboration when buddy session starts
Channels for file and for tube are independent in telepathy, so let sender create UUID and pass it to receiver, who then can bind the document to the channel. UUID for tube channel goes through telepathy. UUID for file channel is encoded in the filename for now. Tubes specific CreateDocFunc is re-introduced, so we could set current UUID after file is received and when the document is being constructed, get channel from TeleManager with this UUID. This is not immune to constructing other documents in the middle of binding proccess. Change-Id: I57c7e57a5d7d3ccd7d94677a8cf2719c78baa2fd
Diffstat (limited to 'sc/source/ui/collab')
-rw-r--r--sc/source/ui/collab/contacts.cxx9
-rw-r--r--sc/source/ui/collab/sendfunc.cxx28
-rw-r--r--sc/source/ui/collab/sendfunc.hxx3
3 files changed, 25 insertions, 15 deletions
diff --git a/sc/source/ui/collab/contacts.cxx b/sc/source/ui/collab/contacts.cxx
index d81ff9a65b58..c2cc8b6488ef 100644
--- a/sc/source/ui/collab/contacts.cxx
+++ b/sc/source/ui/collab/contacts.cxx
@@ -98,11 +98,6 @@ class TubeContacts : public ModelessDialog
// Receiving file is not related to any document.
mpManager->sigFileReceived.connect( boost::bind(
&ScDocFuncRecv::fileReceived, mpSender->GetReceiver(), _1 ) );
-
- // TODO: It's still not clear to me who should take care of this signal
- // and what exactly it is supposed to happen.
- mpManager->sigConferenceCreated.connect( boost::bind(
- &ScDocFuncSend::SetCollaboration, mpSender, _1 ) );
}
}
@@ -124,7 +119,11 @@ class TubeContacts : public ModelessDialog
fprintf( stderr, "could not start session with %s\n",
tp_contact_get_identifier( pContact ) );
else
+ {
mpSender->SetCollaboration( pConference );
+ mpSender->SendFile( OStringToOUString(
+ pConference->getUuid(), RTL_TEXTENCODING_UTF8 ) );
+ }
}
}
diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx
index d22e4ba3b143..4b3d1c92f769 100644
--- a/sc/source/ui/collab/sendfunc.cxx
+++ b/sc/source/ui/collab/sendfunc.cxx
@@ -39,6 +39,7 @@
#include <tubes/manager.hxx>
#include <tubes/conference.hxx>
#include <tubes/contact-list.hxx>
+#include <tubes/constants.h>
// new file send/recv fun ...
#include <com/sun/star/uno/Sequence.hxx>
@@ -232,12 +233,13 @@ void ScDocFuncSend::SendMessage( ScChangeOpWriter &rOp )
mpDirect->RecvMessage( rOp.toString() );
}
-void ScDocFuncSend::SendFile( const rtl::OUString &rURL )
+void ScDocFuncSend::SendFile( const rtl::OUString &sUuid )
{
- (void)rURL;
-
String aTmpPath = utl::TempFile::CreateTempName();
- aTmpPath.Append( rtl::OUString( ".ods" ) );
+ aTmpPath.Append( OUString("_") );
+ aTmpPath.Append( sUuid );
+ aTmpPath.Append( OUString("_") );
+ aTmpPath.Append( OUString(".ods") );
rtl::OUString aFileURL;
::utl::LocalFileHelper::ConvertPhysicalNameToURL( aTmpPath, aFileURL );
@@ -416,22 +418,30 @@ sal_Bool ScDocFuncSend::MergeCells( const ScCellMergeOption& rOption, sal_Bool b
return ScDocFunc::MergeCells( rOption, bContents, bRecord, bApi );
}
-#ifdef INTERCEPT
-SC_DLLPRIVATE ScDocFunc *ScDocShell::CreateDocFunc()
+ScDocFunc *ScDocShell::CreateDocFunc()
{
if (getenv ("INTERCEPT"))
{
- boost::shared_ptr<ScDocFuncDirect> pDirect( new ScDocFuncDirect( *this ) );
+ ScDocFuncDirect* pDirect = new ScDocFuncDirect( *this );
boost::shared_ptr<ScDocFuncRecv> pReceiver( new ScDocFuncRecv( pDirect ) );
static boost::shared_ptr<ScDocFuncDemo> aDemoBus( new ScDocFuncDemo() );
aDemoBus->add_client( pReceiver ); // a lifecycle horror no doubt.
- return new ScDocFuncSend( *this, boost::shared_ptr<ScDocFuncRecv>( aDemoBus.get() ) );
+ return new ScDocFuncSend( *this, aDemoBus.get() );
+ }
+ else if (TeleManager::hasWaitingConference())
+ {
+ ScDocFuncDirect *pDirect = new ScDocFuncDirect( *this );
+ ScDocFuncRecv *pReceiver = new ScDocFuncRecv( pDirect );
+ ScDocFuncSend *pSender = new ScDocFuncSend( *this, pReceiver );
+ TeleManager *pManager = TeleManager::get();
+ pSender->SetCollaboration( pManager->getConference() );
+ pManager->unref();
+ return pSender;
}
else
return new ScDocFuncDirect( *this );
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/collab/sendfunc.hxx b/sc/source/ui/collab/sendfunc.hxx
index 981363358065..f9c2bcfaa239 100644
--- a/sc/source/ui/collab/sendfunc.hxx
+++ b/sc/source/ui/collab/sendfunc.hxx
@@ -229,7 +229,6 @@ class ScDocFuncSend : public ScDocFunc
TeleConference *mpConference;
void SendMessage( ScChangeOpWriter &rOp );
- void SendFile( const rtl::OUString &rURL );
public:
// FIXME: really ScDocFunc should be an abstract base, so
@@ -240,6 +239,8 @@ public:
void SetCollaboration( TeleConference* pConference );
TeleConference* GetConference();
ScDocFuncRecv* GetReceiver();
+ // TODO: I think this could be moved to TeleManager later.
+ void SendFile( const rtl::OUString &rURL );
virtual void EnterListAction( sal_uInt16 nNameResId );
virtual void EndListAction();