summaryrefslogtreecommitdiff
path: root/tubes
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@gmail.com>2012-07-20 15:05:33 +0200
committerMatúš Kukan <matus.kukan@gmail.com>2012-07-20 21:39:14 +0200
commit57e5be3fc356d9512007c92d7eb34eb41f6570a4 (patch)
tree5bfeebcdd5bc6efbaecc72d67069c158e67d83c4 /tubes
parent58d4ab69112ca1e1125b59a908fc48bb2f92c08f (diff)
tubes: move ScDocFuncRecv::fileReceived to TeleManager_fileReceived
Change-Id: Ie2ab2c2d545f6fcbdc21171868c99b1756c90792
Diffstat (limited to 'tubes')
-rw-r--r--tubes/Library_tubes.mk4
-rw-r--r--tubes/inc/tubes/manager.hxx3
-rw-r--r--tubes/source/manager.cxx76
3 files changed, 79 insertions, 4 deletions
diff --git a/tubes/Library_tubes.mk b/tubes/Library_tubes.mk
index 2c385d3bfd58..a08760c83841 100644
--- a/tubes/Library_tubes.mk
+++ b/tubes/Library_tubes.mk
@@ -32,12 +32,16 @@ $(eval $(call gb_Library_set_include,tubes,\
$$(INCLUDE) \
))
+$(eval $(call gb_Library_use_sdk_api,tubes))
+
$(eval $(call gb_Library_add_defs,tubes,\
-DTUBES_DLLIMPLEMENTATION \
))
$(eval $(call gb_Library_use_libraries,tubes,\
$(gb_STDLIBS) \
+ comphelper \
+ cppu \
sal \
salhelper \
))
diff --git a/tubes/inc/tubes/manager.hxx b/tubes/inc/tubes/manager.hxx
index 9f1689148ac3..21ee3c30eec9 100644
--- a/tubes/inc/tubes/manager.hxx
+++ b/tubes/inc/tubes/manager.hxx
@@ -39,7 +39,6 @@
#include <rtl/ref.hxx>
#include <tools/link.hxx>
#include <telepathy-glib/telepathy-glib.h>
-#include <tubes/warnings_guard_boost_signals2.hpp>
#include <map>
// For testing purposes, we might need more in future.
@@ -140,8 +139,6 @@ public:
void disconnect();
- boost::signals2::signal<void ( const rtl::OUString &localUri )> sigFileReceived;
-
/// Only for use with MainLoopFlusher
GMainLoop* getMainLoop() const;
diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx
index 4f6a6a8c00c4..c7ef062227a5 100644
--- a/tubes/source/manager.cxx
+++ b/tubes/source/manager.cxx
@@ -33,6 +33,21 @@
#include <osl/mutex.hxx>
#include <cstring>
+// new file send/recv fun ...
+#include <com/sun/star/uno/Sequence.hxx>
+#include <unotools/tempfile.hxx>
+#include <unotools/localfilehelper.hxx>
+#include <comphelper/mediadescriptor.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <com/sun/star/frame/XLoadable.hpp>
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/document/XDocumentRecovery.hpp>
+#include <com/sun/star/util/XCloseable.hpp>
+
+namespace css = ::com::sun::star;
#if defined SAL_LOG_INFO
namespace
@@ -172,6 +187,65 @@ bool TeleManager::hasWaitingConference()
return !pImpl->msCurrentUUID.isEmpty();
}
+// FIXME this is exported only because of ScDocFuncDemo
+SAL_DLLPUBLIC_EXPORT void TeleManager_fileReceived( const rtl::OUString &rStr )
+{
+ fprintf( stderr, "incoming file '%s'\n",
+ rtl::OUStringToOString( rStr, RTL_TEXTENCODING_UTF8 ).getStr() );
+
+ // using the frame::XLoadable interface fails with a DoubleInitializationException
+/* css::uno::Sequence < css::beans::PropertyValue > aLoadArgs(5);
+ aLoadArgs[0].Name = rtl::OUString( "URL" );
+ aLoadArgs[0].Value <<= rpStr;
+ aLoadArgs[1].Name = rtl::OUString( "FilterName" );
+ aLoadArgs[1].Value <<= rtl::OUString( "calc8" );
+ aLoadArgs[2].Name = rtl::OUString( "Referer" );
+ aLoadArgs[2].Value <<= rtl::OUString( "" );
+ // no interaction handler ?
+ aLoadArgs[3].Name = rtl::OUString( "MacroExecutionMode" );
+ aLoadArgs[3].Value <<= sal_Int32( 3 );
+ aLoadArgs[4].Name = rtl::OUString( "UpdateDocMode" );
+ aLoadArgs[4].Value <<= sal_Int32( 2 );
+ try
+ {
+ css::uno::Reference < css::frame::XLoadable > xLoad(
+ rDocShell.GetBaseModel(), css::uno::UNO_QUERY_THROW );
+ xLoad->load( aLoadArgs );
+ }
+ catch ( css::uno::Exception& e )
+ {
+ fprintf( stderr, "exception when loading '%s' !\n",
+ rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+ } */
+// #2 - tried out the SfxAutoReloadTimer_Impl - shove stuff at the SID_RELOAD slot ...
+
+// #3 - can we use the framework/inc/services/frame.hxx 's "sTargetFrameName"
+// magic to load into our current frame ? ... :-)
+
+ css::uno::Reference< css::lang::XMultiServiceFactory > rFactory =
+ ::comphelper::getProcessServiceFactory();
+
+ css::uno::Sequence < css::beans::PropertyValue > args(0);
+// FIXME: should this be hidden before it is synched & ready ? ...
+// args[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Hidden"));
+// args[0].Value <<= sal_True;
+ try
+ {
+ css::uno::Reference < css::frame::XComponentLoader > xLoader(
+ ::comphelper::getProcessServiceFactory()->createInstance(
+ "com.sun.star.frame.Desktop" ),
+ css::uno::UNO_QUERY_THROW );
+ css::uno::Reference < css::util::XCloseable > xDoc(
+ xLoader->loadComponentFromURL( rStr, "_blank", 0, args ),
+ css::uno::UNO_QUERY_THROW );
+ }
+ catch ( css::uno::Exception& e )
+ {
+ fprintf( stderr, "exception when loading '%s' !\n",
+ rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+ }
+}
+
void TeleManager::TransferDone( EmpathyFTHandler *handler, TpFileTransferChannel *, gpointer pUserData)
{
TeleManager* pManager = reinterpret_cast<TeleManager*>(pUserData);
@@ -187,7 +261,7 @@ void TeleManager::TransferDone( EmpathyFTHandler *handler, TpFileTransferChannel
OString sUuid( OUStringToOString( aUri.copy( first + 1, last - first - 1),
RTL_TEXTENCODING_UTF8));
pImpl->msCurrentUUID = sUuid;
- pManager->sigFileReceived( aUri );
+ TeleManager_fileReceived( aUri );
g_object_unref( handler);
}