[Libreoffice-commits] .: 3 commits - sc/source tubes/inc tubes/Library_tubes.mk tubes/source

Matus Kukan mkukan at kemper.freedesktop.org
Fri Jul 20 12:40:05 PDT 2012


 sc/source/ui/collab/contacts.cxx |    8 ---
 sc/source/ui/collab/sendfunc.cxx |   82 +--------------------------------------
 sc/source/ui/collab/sendfunc.hxx |    1 
 tubes/Library_tubes.mk           |    4 +
 tubes/inc/tubes/manager.hxx      |    4 -
 tubes/source/manager.cxx         |   47 +++++++++++++++++++---
 6 files changed, 48 insertions(+), 98 deletions(-)

New commits:
commit 6f606f8064d8dc7daa60960151da71943361d394
Author: Matúš Kukan <matus.kukan at gmail.com>
Date:   Fri Jul 20 15:35:27 2012 +0200

    tubes: remove unused parameters
    
    Change-Id: Ia1c683f5b9245d1673a610901636921619f47406

diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx
index e43612c..f6642f2 100644
--- a/tubes/source/manager.cxx
+++ b/tubes/source/manager.cxx
@@ -135,7 +135,7 @@ void TeleManager::DBusChannelHandler(
             SAL_INFO( "tubes", "accepting");
             aAccepted = true;
 
-            TeleConference* pConference = new TeleConference( pManager, pAccount, TP_DBUS_TUBE_CHANNEL( pChannel ), createUuid() );
+            TeleConference* pConference = new TeleConference( pManager, pAccount, TP_DBUS_TUBE_CHANNEL( pChannel ) );
             pConference->acceptTube();
             pManager->addConference( pConference );
         }
@@ -207,10 +207,8 @@ SAL_DLLPUBLIC_EXPORT void TeleManager_fileReceived( const rtl::OUString &rStr )
     }
 }
 
-void TeleManager::TransferDone( EmpathyFTHandler *handler, TpFileTransferChannel *, gpointer pUserData)
+void TeleManager::TransferDone( EmpathyFTHandler *handler, TpFileTransferChannel *, gpointer )
 {
-    TeleManager* pManager = reinterpret_cast<TeleManager*>(pUserData);
-
     SAL_INFO( "tubes", "TeleManager::TransferDone: hooray!");
     GFile *gfile = empathy_ft_handler_get_gfile( handler);
     char *uri = g_file_get_uri( gfile);
@@ -538,7 +536,7 @@ bool TeleManager::registerClients()
             getFullClientName().getStr(),                   // name
             TRUE,                                           // uniquify to get a different bus name to the main client, above
             TeleManager_FileTransferHandler,                // callback
-            this,                                           // user_data
+            this,                                           // user_data, unused
             NULL                                            // destroy
             );
     tp_base_client_take_handler_filter( pImpl->mpFileTransferClient,
commit baa7114906108b655f09fcd6d6c593d3212967bb
Author: Matúš Kukan <matus.kukan at gmail.com>
Date:   Fri Jul 20 15:17:44 2012 +0200

    tubes: clean up commented out code, headers
    
    Change-Id: I5962fb38d2320199e9c45c6f339131755f817960

diff --git a/tubes/inc/tubes/manager.hxx b/tubes/inc/tubes/manager.hxx
index 21ee3c3..f495c24 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 <map>
 
 // For testing purposes, we might need more in future.
 #define LIBO_TUBES_DBUS_INTERFACE "org.libreoffice.calc"
diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx
index c7ef062..e43612c 100644
--- a/tubes/source/manager.cxx
+++ b/tubes/source/manager.cxx
@@ -28,24 +28,17 @@
 
 #include "tubes/manager.hxx"
 #include "tubes/constants.h"
-#include <rtl/strbuf.hxx>
-#include <rtl/uuid.h>
-#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>
+#include <comphelper/processfactory.hxx>
+#include <osl/mutex.hxx>
+#include <rtl/strbuf.hxx>
+#include <rtl/uuid.h>
+#include <map>
 
 namespace css = ::com::sun::star;
 
@@ -193,42 +186,10 @@ 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(
@@ -239,7 +200,7 @@ SAL_DLLPUBLIC_EXPORT void TeleManager_fileReceived( const rtl::OUString &rStr )
                 xLoader->loadComponentFromURL( rStr, "_blank", 0, args ),
                 css::uno::UNO_QUERY_THROW );
     }
-    catch ( css::uno::Exception& e )
+    catch ( const css::uno::Exception& e )
     {
         fprintf( stderr, "exception when loading '%s' !\n",
                  rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
commit 57e5be3fc356d9512007c92d7eb34eb41f6570a4
Author: Matúš Kukan <matus.kukan at gmail.com>
Date:   Fri Jul 20 15:05:33 2012 +0200

    tubes: move ScDocFuncRecv::fileReceived to TeleManager_fileReceived
    
    Change-Id: Ie2ab2c2d545f6fcbdc21171868c99b1756c90792

diff --git a/sc/source/ui/collab/contacts.cxx b/sc/source/ui/collab/contacts.cxx
index c2cc8b6..02240d9 100644
--- a/sc/source/ui/collab/contacts.cxx
+++ b/sc/source/ui/collab/contacts.cxx
@@ -91,14 +91,6 @@ class TubeContacts : public ModelessDialog
         {
             fprintf( stderr, "Could not register client handlers.\n" );
         }
-        else
-        {
-            // FIXME: These signals should not be bind to a document specific code.
-
-            // Receiving file is not related to any document.
-            mpManager->sigFileReceived.connect( boost::bind(
-                        &ScDocFuncRecv::fileReceived, mpSender->GetReceiver(), _1 ) );
-        }
     }
 
     void StartBuddySession()
diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx
index 4b3d1c9..d30b393 100644
--- a/sc/source/ui/collab/sendfunc.cxx
+++ b/sc/source/ui/collab/sendfunc.cxx
@@ -28,7 +28,6 @@
 
 #include "sal/config.h"
 
-#include <tubes/warnings_guard_boost_signals2.hpp>
 #include <vector>
 
 #include "cell.hxx"
@@ -39,24 +38,18 @@
 #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>
 #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;
 
+// FIXME: this is only meant for demo I think
+extern void TeleManager_fileReceived( const OUString& );
+
 // FIXME: really ScDocFunc should be an abstract base
 ScDocFuncRecv::ScDocFuncRecv( ScDocFuncDirect *pChain )
     : mpChain( pChain )
@@ -115,64 +108,6 @@ void ScDocFuncRecv::packetReceived( TelePacket &rPacket )
     RecvMessage( aString );
 }
 
-void ScDocFuncRecv::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() );
-    }
-}
-
 /*
  * Provides a local bus that doesn't require an IM channel for
  * quick demoing, export INTERCEPT=demo # to enable.
@@ -202,15 +137,6 @@ class ScDocFuncDemo : public ScDocFuncRecv
                  = aCopy.begin(); i != aCopy.end(); ++i)
             (*i)->RecvMessage(rString);
     }
-
-    virtual void fileReceived( const rtl::OUString &rStr )
-    {
-        // FIXME: Lifecycle nightmare
-        std::vector< boost::shared_ptr<ScDocFuncRecv> > aCopy( maClients );
-        for (std::vector< boost::shared_ptr<ScDocFuncRecv> >::iterator i
-                 = aCopy.begin(); i != aCopy.end(); ++i)
-            (*i)->fileReceived( rStr );
-    }
 };
 
 extern "C"
@@ -262,7 +188,7 @@ void ScDocFuncSend::SendFile( const rtl::OUString &sUuid )
     if (mpConference)
         mpConference->sendFile( aFileURL, file_sent_cb, NULL );
     else
-        mpDirect->fileReceived( aFileURL );
+        TeleManager_fileReceived( aFileURL );
 
     // FIXME: unlink the file after send ...
 }
diff --git a/sc/source/ui/collab/sendfunc.hxx b/sc/source/ui/collab/sendfunc.hxx
index f9c2bcf..dde1dae 100644
--- a/sc/source/ui/collab/sendfunc.hxx
+++ b/sc/source/ui/collab/sendfunc.hxx
@@ -219,7 +219,6 @@ public:
 
     void packetReceived( TelePacket &rPacket );
 
-    virtual void fileReceived( const rtl::OUString &rStr );
     virtual void RecvMessage( const rtl::OString &rString );
 };
 
diff --git a/tubes/Library_tubes.mk b/tubes/Library_tubes.mk
index 2c385d3..a08760c 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 9f16891..21ee3c3 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 4f6a6a8..c7ef062 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);
 }


More information about the Libreoffice-commits mailing list