[Libreoffice-commits] .: 3 commits - sc/AllLangResTarget_sc.mk sc/CppunitTest_sc_ucalc.mk sc/Library_sc.mk scp2/inc scp2/macros scp2/source sc/source tubes/AllLangResTarget_tubes.mk tubes/CppunitTest_tubes_test.mk tubes/inc tubes/Library_tubes.mk tubes/Module_tubes.mk tubes/Package_inc.mk tubes/source
Matus Kukan
mkukan at kemper.freedesktop.org
Thu Aug 2 09:04:17 PDT 2012
sc/AllLangResTarget_sc.mk | 1
sc/CppunitTest_sc_ucalc.mk | 10 -
sc/Library_sc.mk | 12 -
sc/source/ui/collab/contacts.cxx | 290 -------------------------------
sc/source/ui/collab/contacts.hrc | 11 -
sc/source/ui/collab/contacts.hxx | 35 ---
sc/source/ui/collab/contacts.src | 61 ------
sc/source/ui/collab/sccollaboration.cxx | 62 ++++++
sc/source/ui/collab/sendfunc.cxx | 7
sc/source/ui/inc/sccollaboration.hxx | 31 +++
sc/source/ui/view/cellsh3.cxx | 7
scp2/inc/macros.inc | 1
scp2/macros/macro.pl | 11 -
scp2/source/ooo/file_resource_ooo.scp | 3
scp2/source/ooo/module_lang_template.scp | 1
tubes/AllLangResTarget_tubes.mk | 19 ++
tubes/CppunitTest_tubes_test.mk | 4
tubes/Library_tubes.mk | 8
tubes/Module_tubes.mk | 1
tubes/Package_inc.mk | 2
tubes/inc/tubes/collaboration.hxx | 34 +++
tubes/inc/tubes/conference.hxx | 8
tubes/inc/tubes/contacts.hxx | 38 ++++
tubes/source/conference.cxx | 29 ++-
tubes/source/contacts.cxx | 280 +++++++++++++++++++++++++++++
tubes/source/contacts.hrc | 11 +
tubes/source/contacts.src | 60 ++++++
tubes/source/manager.cxx | 2
28 files changed, 592 insertions(+), 447 deletions(-)
New commits:
commit bc21b49a464ae153341ee8d836993ca89b1a6919
Author: Matúš Kukan <matus.kukan at gmail.com>
Date: Mon Jul 30 11:49:10 2012 +0200
tubes: move sc/source/ui/collab/contacts.* to tubes
- sc no longer directly links against telepathy
- there is new class ScCollaboration derived from abstract Collaboration
describing collaboration functionality for apps used in tubes/
- also added resource manager into tubes/
Change-Id: Ic89ae955f5b47490f4f4b8781bcee5dea5336bae
diff --git a/sc/AllLangResTarget_sc.mk b/sc/AllLangResTarget_sc.mk
index 90ff378..2d3c64c 100644
--- a/sc/AllLangResTarget_sc.mk
+++ b/sc/AllLangResTarget_sc.mk
@@ -83,7 +83,6 @@ $(eval $(call gb_SrsTarget_add_files,sc/res,\
sc/source/ui/src/condformatdlg.src \
sc/source/ui/src/condformatmgr.src \
sc/source/ui/cctrl/checklistmenu.src \
- sc/source/ui/collab/contacts.src \
sc/source/ui/navipi/navipi.src \
sc/source/ui/docshell/tpstat.src \
sc/source/ui/optdlg/calcoptionsdlg.src \
diff --git a/sc/CppunitTest_sc_ucalc.mk b/sc/CppunitTest_sc_ucalc.mk
index 8301416..2796242 100644
--- a/sc/CppunitTest_sc_ucalc.mk
+++ b/sc/CppunitTest_sc_ucalc.mk
@@ -44,15 +44,7 @@ $(call gb_CxxObject_get_target,sc/qa/unit/ucalc): \
$(WORKDIR)/AllLangRes/sc \
ifeq ($(ENABLE_TELEPATHY),TRUE)
-
-$(eval $(call gb_CppunitTest_use_libraries,sc_ucalc,\
- tubes \
-))
-
-$(eval $(call gb_CppunitTest_use_externals,sc_ucalc,\
- telepathy \
-))
-
+$(eval $(call gb_CppunitTest_use_libraries,sc_ucalc,tubes))
endif
$(eval $(call gb_CppunitTest_use_libraries,sc_ucalc, \
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 998ca60..1a68be6 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -43,24 +43,16 @@ $(eval $(call gb_Library_add_defs,sc,\
$(eval $(call gb_Library_use_sdk_api,sc))
ifeq ($(ENABLE_TELEPATHY),TRUE)
-
-$(eval $(call gb_Library_use_libraries,sc,\
- tubes \
-))
+$(eval $(call gb_Library_use_libraries,sc,tubes))
$(eval $(call gb_Library_add_defs,sc,\
-DENABLE_TELEPATHY \
))
-$(eval $(call gb_Library_use_externals,sc,\
- telepathy \
-))
-
$(eval $(call gb_Library_add_exception_objects,sc,\
- sc/source/ui/collab/contacts \
+ sc/source/ui/collab/sccollaboration \
sc/source/ui/collab/sendfunc \
))
-
endif
$(eval $(call gb_Library_use_libraries,sc,\
diff --git a/sc/source/ui/collab/contacts.cxx b/sc/source/ui/collab/contacts.cxx
deleted file mode 100644
index e6e2239..0000000
--- a/sc/source/ui/collab/contacts.cxx
+++ /dev/null
@@ -1,290 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * Version: MPL 1.1 / GPLv3+ / LGPLv3+
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License or as specified alternatively below. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * Major Contributor(s):
- * Copyright (C) 2012 Michael Meeks <michael.meeks at suse.com> (initial developer)
- *
- * All Rights Reserved.
- *
- * For minor contributions see the git repository.
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
- * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
- * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
- * instead of those above.
- */
-
-#include "sal/config.h"
-
-#include <vector>
-#include "contacts.hrc"
-#include "sendfunc.hxx"
-#include "docsh.hxx"
-#include "scresid.hxx"
-#include <svtools/filter.hxx>
-#include <tubes/conference.hxx>
-#include <tubes/contact-list.hxx>
-#include <tubes/manager.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/dialog.hxx>
-#include <svx/simptabl.hxx>
-
-#include <telepathy-glib/telepathy-glib.h>
-
-#define CONTACTS_DLG
-
-#ifdef CONTACTS_DLG
-namespace {
-class TubeContacts : public ModelessDialog
-{
- FixedLine maLabel;
- PushButton maBtnConnect;
- PushButton maBtnGroup;
- PushButton maBtnInvite;
- PushButton maBtnListen;
- SvxSimpleTableContainer maListContainer;
- SvxSimpleTable maList;
- TeleManager* mpManager;
-
- DECL_LINK( BtnConnectHdl, void * );
- DECL_LINK( BtnGroupHdl, void * );
- DECL_LINK( BtnInviteHdl, void * );
- DECL_LINK( BtnListenHdl, void * );
-
- struct AccountContact
- {
- TpAccount* mpAccount;
- TpContact* mpContact;
- AccountContact( TpAccount* pAccount, TpContact* pContact ):
- mpAccount(pAccount), mpContact(pContact) {}
- };
- boost::ptr_vector<AccountContact> maACs;
-
- ScDocFuncSend* GetScDocFuncSendInCurrentSfxObjectShell()
- {
- ScDocShell *pScDocShell = dynamic_cast<ScDocShell*> (SfxObjectShell::Current());
- ScDocFunc *pDocFunc = pScDocShell ? &pScDocShell->GetDocFunc() : NULL;
- return dynamic_cast<ScDocFuncSend*> (pDocFunc);
- }
-
- ScDocFuncSend* EnsureScDocFuncSendInCurrentSfxObjectShell()
- {
- ScDocShell *pScDocShell = dynamic_cast<ScDocShell*> (SfxObjectShell::Current());
- ScDocFunc *pDocFunc = pScDocShell ? &pScDocShell->GetDocFunc() : NULL;
- ScDocFuncSend *pSender = dynamic_cast<ScDocFuncSend*> (pDocFunc);
- if (!pSender)
- {
- // This means pDocFunc has to be ScDocFuncDirect* and we are not collaborating yet.
- ScDocFuncDirect *pDirect = dynamic_cast<ScDocFuncDirect*> (pDocFunc);
- ScDocFuncRecv *pReceiver = new ScDocFuncRecv( pDirect );
- pSender = new ScDocFuncSend( *pScDocShell, pReceiver );
- pScDocShell->SetDocFunc( pSender );
- }
- return pSender;
- }
-
- void Invite()
- {
- AccountContact *pAC = NULL;
- if (maList.FirstSelected())
- pAC = static_cast<AccountContact*> (maList.FirstSelected()->GetUserData());
- if (pAC)
- {
- ScDocFuncSend *pSender = GetScDocFuncSendInCurrentSfxObjectShell();
- if (pSender && pSender->GetConference())
- {
- TpContact* pContact = pAC->mpContact;
- pSender->GetConference()->invite( pContact );
- pSender->SendFile( pContact, OStringToOUString(
- pSender->GetConference()->getUuid(), RTL_TEXTENCODING_UTF8 ) );
- }
- }
- }
-
- void Listen()
- {
- if (!mpManager->registerClients())
- SAL_INFO( "sc.tubes", "Could not register client handlers." );
- }
-
- void StartBuddySession()
- {
- AccountContact *pAC = NULL;
- if (maList.FirstSelected())
- pAC = static_cast<AccountContact*> (maList.FirstSelected()->GetUserData());
- if (pAC)
- {
- TpAccount* pAccount = pAC->mpAccount;
- TpContact* pContact = pAC->mpContact;
- fprintf( stderr, "picked %s\n", tp_contact_get_identifier( pContact ) );
- TeleConference* pConference = mpManager->startBuddySession( pAccount, pContact );
- if (!pConference)
- fprintf( stderr, "could not start session with %s\n",
- tp_contact_get_identifier( pContact ) );
- else
- {
- ScDocFuncSend* pSender = EnsureScDocFuncSendInCurrentSfxObjectShell();
- pSender->SetCollaboration( pConference );
- pSender->SendFile( pContact, OStringToOUString(
- pConference->getUuid(), RTL_TEXTENCODING_UTF8 ) );
- }
- }
- }
-
- void StartGroupSession()
- {
- AccountContact *pAC = NULL;
- if (maList.FirstSelected())
- pAC = static_cast<AccountContact*> (maList.FirstSelected()->GetUserData());
- if (pAC)
- {
- TpAccount* pAccount = pAC->mpAccount;
- fprintf( stderr, "picked %s\n", tp_account_get_display_name( pAccount ) );
- TeleConference* pConference = mpManager->startGroupSession( pAccount,
- rtl::OUString("liboroom"), rtl::OUString("conference.jabber.org") );
- if (!pConference)
- fprintf( stderr, "could not start group session\n" );
- else
- {
- ScDocFuncSend* pSender = EnsureScDocFuncSendInCurrentSfxObjectShell();
- pSender->SetCollaboration( pConference );
- }
- }
- }
-
-public:
- TubeContacts() :
- ModelessDialog( NULL, ScResId( RID_SCDLG_CONTACTS ) ),
- maLabel( this, ScResId( FL_LABEL ) ),
- maBtnConnect( this, ScResId( BTN_CONNECT ) ),
- maBtnGroup( this, ScResId( BTN_GROUP ) ),
- maBtnInvite( this, ScResId( BTN_INVITE ) ),
- maBtnListen( this, ScResId( BTN_LISTEN ) ),
- maListContainer( this, ScResId( CTL_LIST ) ),
- maList( maListContainer ),
- mpManager( new TeleManager() )
- {
- Hide();
- maBtnConnect.SetClickHdl( LINK( this, TubeContacts, BtnConnectHdl ) );
- maBtnGroup.SetClickHdl( LINK( this, TubeContacts, BtnGroupHdl ) );
- maBtnInvite.SetClickHdl( LINK( this, TubeContacts, BtnInviteHdl ) );
- maBtnListen.SetClickHdl( LINK( this, TubeContacts, BtnListenHdl ) );
-
- static long aStaticTabs[]=
- {
- 3 /* count */, 0, 20, 100, 150, 200
- };
-
- maList.SvxSimpleTable::SetTabs( aStaticTabs );
- String sHeader( '\t' );
- sHeader += String( ScResId( STR_HEADER_ALIAS ) );
- sHeader += '\t';
- sHeader += String( ScResId( STR_HEADER_NAME ) );
- sHeader += '\t';
- maList.InsertHeaderEntry( sHeader, HEADERBAR_APPEND, HIB_LEFT );
-
- mpManager->getContactList()->sigContactListChanged.connect(
- boost::bind( &TubeContacts::Populate, this ) );
- }
- virtual ~TubeContacts()
- {
- delete mpManager;
- }
-
- static rtl::OUString fromUTF8( const char *pStr )
- {
- return rtl::OStringToOUString( rtl::OString( pStr, strlen( pStr ) ),
- RTL_TEXTENCODING_UTF8 );
- }
-
- void Populate()
- {
- SAL_INFO( "sc.tubes", "Populating contact list dialog" );
- maList.Clear();
- ContactList *pContacts = mpManager->getContactList();
- if ( pContacts )
- {
- AccountContactPairV aPairs = pContacts->getContacts();
- AccountContactPairV::iterator it;
- for( it = aPairs.begin(); it != aPairs.end(); ++it )
- {
- Image aImage;
- GFile *pAvatarFile = tp_contact_get_avatar_file( it->second );
- if( pAvatarFile )
- {
- const rtl::OUString sAvatarFileUrl = fromUTF8( g_file_get_path ( pAvatarFile ) );
- Graphic aGraphic;
- if( GRFILTER_OK == GraphicFilter::LoadGraphic( sAvatarFileUrl, rtl::OUString(""), aGraphic ) )
- {
- BitmapEx aBitmap = aGraphic.GetBitmapEx();
- double fScale = 30.0 / aBitmap.GetSizePixel().Height();
- aBitmap.Scale( fScale, fScale );
- aImage = Image( aBitmap );
- }
- }
- rtl::OUStringBuffer aEntry( 128 );
- aEntry.append( sal_Unicode( '\t' ) );
- aEntry.append( fromUTF8 ( tp_contact_get_alias( it->second ) ) );
- aEntry.append( sal_Unicode( '\t' ) );
- aEntry.append( fromUTF8 ( tp_contact_get_identifier( it->second ) ) );
- aEntry.append( sal_Unicode( '\t' ) );
- SvLBoxEntry* pEntry = maList.InsertEntry( aEntry.makeStringAndClear(), aImage, aImage );
- // FIXME: ref the TpAccount, TpContact ...
- maACs.push_back( new AccountContact( it->first, it->second ) );
- pEntry->SetUserData( &maACs.back() );
- }
- }
- Show();
- }
-};
-
-IMPL_LINK_NOARG( TubeContacts, BtnConnectHdl )
-{
- StartBuddySession();
- return 0;
-}
-
-IMPL_LINK_NOARG( TubeContacts, BtnGroupHdl )
-{
- StartGroupSession();
- return 0;
-}
-
-IMPL_LINK_NOARG( TubeContacts, BtnInviteHdl )
-{
- Invite();
- return 0;
-}
-
-IMPL_LINK_NOARG( TubeContacts, BtnListenHdl )
-{
- Listen();
- return 0;
-}
-
-} // anonymous namespace
-#endif
-
-namespace tubes {
-void createContacts()
-{
-#ifdef CONTACTS_DLG
- static TubeContacts *pContacts = new TubeContacts();
- pContacts->Populate();
-#endif
-}
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/collab/contacts.hrc b/sc/source/ui/collab/contacts.hrc
deleted file mode 100644
index 4d7cc5f..0000000
--- a/sc/source/ui/collab/contacts.hrc
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "sc.hrc" // -> RID_SCDLG_CONTACTS
-
-#define FL_LABEL 1
-#define CTL_LIST 2
-#define BTN_CONNECT 3
-#define BTN_INVITE 4
-#define BTN_LISTEN 5
-#define BTN_GROUP 6
-
-#define STR_HEADER_ALIAS 20
-#define STR_HEADER_NAME 21
diff --git a/sc/source/ui/collab/contacts.hxx b/sc/source/ui/collab/contacts.hxx
deleted file mode 100644
index 9c8345e..0000000
--- a/sc/source/ui/collab/contacts.hxx
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * Version: MPL 1.1 / GPLv3+ / LGPLv3+
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License or as specified alternatively below. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * Major Contributor(s):
- * Copyright (C) 2012 Michael Meeks <michael.meeks at suse.com> (initial developer)
- *
- * All Rights Reserved.
- *
- * For minor contributions see the git repository.
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
- * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
- * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
- * instead of those above.
- */
-
-#include "sal/config.h"
-
-namespace tubes {
- void createContacts();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/collab/contacts.src b/sc/source/ui/collab/contacts.src
deleted file mode 100644
index 6a868ae..0000000
--- a/sc/source/ui/collab/contacts.src
+++ /dev/null
@@ -1,61 +0,0 @@
-#include "sc.hrc"
-#include "contacts.hrc"
-
-ModelessDialog RID_SCDLG_CONTACTS
-{
- HelpId = HID_SCPAGE_AREAS; // has to be something ...
- OutputSize = TRUE ;
- SVLook = TRUE ;
- Hide = FALSE ;
- Moveable = TRUE ;
- Closeable = TRUE ;
- Size = MAP_APPFONT ( 220 , 225 ) ;
- OutputSize = TRUE ;
- Text [ en-US ] = "Contacts" ;
-
- FixedLine FL_LABEL
- {
- Pos = MAP_APPFONT ( 8 , 2 ) ;
- Size = MAP_APPFONT ( 198 , 8 ) ;
- Text [ en-US ] = "Select a contact to collaborate with" ;
- };
- PushButton BTN_CONNECT
- {
- Pos = MAP_APPFONT( 70 , 200 );
- Size = MAP_APPFONT( 50 , 10 );
- Text [ en-US ] = "startBuddySession";
- };
- PushButton BTN_GROUP
- {
- Pos = MAP_APPFONT( 70 , 212 );
- Size = MAP_APPFONT( 50 , 10 );
- Text [ en-US ] = "startGroupSession";
- };
- PushButton BTN_INVITE
- {
- Pos = MAP_APPFONT( 130 , 200 );
- Size = MAP_APPFONT( 50 , 10 );
- Text [ en-US ] = "Invite";
- };
- PushButton BTN_LISTEN
- {
- Pos = MAP_APPFONT( 8 , 200 );
- Size = MAP_APPFONT( 50 , 10 );
- Text [ en-US ] = "Listen";
- };
- Control CTL_LIST
- {
- Pos = MAP_APPFONT ( 8 , 10 ) ;
- Size = MAP_APPFONT ( 200 , 190 ) ;
- Border = TRUE ;
- TabStop = TRUE ;
- };
- String STR_HEADER_ALIAS
- {
- Text [ en-US ] = "Alias" ;
- };
- String STR_HEADER_NAME
- {
- Text [ en-US ] = "Name" ;
- };
-};
diff --git a/sc/source/ui/collab/sccollaboration.cxx b/sc/source/ui/collab/sccollaboration.cxx
new file mode 100644
index 0000000..758db89
--- /dev/null
+++ b/sc/source/ui/collab/sccollaboration.cxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "sccollaboration.hxx"
+
+#include "docsh.hxx"
+#include "sendfunc.hxx"
+
+ScCollaboration::ScCollaboration()
+{
+}
+
+ScCollaboration::~ScCollaboration()
+{
+}
+
+TeleConference* ScCollaboration::GetConference() const
+{
+ ScDocFuncSend* pSender = GetScDocFuncSend();
+ if (pSender)
+ return pSender->GetConference();
+
+ return NULL;
+}
+
+void ScCollaboration::SetCollaboration( TeleConference* pConference )
+{
+ ScDocShell* pScDocShell = dynamic_cast<ScDocShell*> (SfxObjectShell::Current());
+ ScDocFunc* pDocFunc = pScDocShell ? &pScDocShell->GetDocFunc() : NULL;
+ ScDocFuncSend* pSender = dynamic_cast<ScDocFuncSend*> (pDocFunc);
+ if (!pSender)
+ {
+ // This means pDocFunc has to be ScDocFuncDirect* and we are not collaborating yet.
+ ScDocFuncDirect *pDirect = dynamic_cast<ScDocFuncDirect*> (pDocFunc);
+ ScDocFuncRecv *pReceiver = new ScDocFuncRecv( pDirect );
+ pSender = new ScDocFuncSend( *pScDocShell, pReceiver );
+ pScDocShell->SetDocFunc( pSender );
+ }
+ pSender->SetCollaboration( pConference );
+}
+
+void ScCollaboration::SendFile( TpContact* pContact, const OUString& rURL )
+{
+ ScDocFuncSend* pSender = GetScDocFuncSend();
+ if (pSender)
+ pSender->SendFile( pContact, rURL );
+}
+
+ScDocFuncSend* ScCollaboration::GetScDocFuncSend() const
+{
+ ScDocShell *pScDocShell = dynamic_cast<ScDocShell*> (SfxObjectShell::Current());
+ ScDocFunc *pDocFunc = pScDocShell ? &pScDocShell->GetDocFunc() : NULL;
+ return dynamic_cast<ScDocFuncSend*> (pDocFunc);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx
index 58af1ba..1a1203d 100644
--- a/sc/source/ui/collab/sendfunc.cxx
+++ b/sc/source/ui/collab/sendfunc.cxx
@@ -31,12 +31,13 @@
#include <vector>
#include "cell.hxx"
-#include "contacts.hxx"
#include "docsh.hxx"
#include "docfunc.hxx"
+#include "sccollaboration.hxx"
#include "sendfunc.hxx"
-#include <tubes/manager.hxx>
#include <tubes/conference.hxx>
+#include <tubes/contacts.hxx>
+#include <tubes/manager.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <unotools/tempfile.hxx>
@@ -252,7 +253,7 @@ sal_Bool ScDocFuncSend::SetNormalString( bool& o_rbNumFmtSet, const ScAddress& r
SendFile( NULL, rText );
if ( rtl::OUString( rText ) == "contacts" )
- tubes::createContacts();
+ tubes::createContacts( new ScCollaboration() );
return true; // needs some code auditing action
}
diff --git a/sc/source/ui/inc/sccollaboration.hxx b/sc/source/ui/inc/sccollaboration.hxx
new file mode 100644
index 0000000..545db92
--- /dev/null
+++ b/sc/source/ui/inc/sccollaboration.hxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SC_COLLABORATION_HXX
+#define INCLUDED_SC_COLLABORATION_HXX
+
+#include <tubes/collaboration.hxx>
+class ScDocFuncSend;
+
+class ScCollaboration : public Collaboration
+{
+public:
+ ScCollaboration();
+ virtual ~ScCollaboration();
+
+ virtual TeleConference* GetConference() const;
+ virtual void SetCollaboration( TeleConference* pConference );
+ virtual void SendFile( TpContact* pContact, const OUString& rURL );
+private:
+ ScDocFuncSend* GetScDocFuncSend() const;
+};
+
+#endif // INCLUDED_SC_COLLABORATION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx
index 19b2541..32b5a00 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -53,9 +53,8 @@
#include "scabstdlg.hxx"
#ifdef ENABLE_TELEPATHY
-namespace tubes {
- void createContacts();
-}
+#include "sccollaboration.hxx"
+#include <tubes/contacts.hxx>
#endif
#define IS_EDITMODE() GetViewData()->HasEditView( GetViewData()->GetActivePart() )
@@ -119,7 +118,7 @@ void ScCellShell::Execute( SfxRequest& rReq )
case SID_COLLABORATION:
#ifdef ENABLE_TELEPATHY
- tubes::createContacts();
+ tubes::createContacts( new ScCollaboration() );
#endif
break;
diff --git a/scp2/source/ooo/file_resource_ooo.scp b/scp2/source/ooo/file_resource_ooo.scp
index 8526d97..a065312 100644
--- a/scp2/source/ooo/file_resource_ooo.scp
+++ b/scp2/source/ooo/file_resource_ooo.scp
@@ -124,3 +124,6 @@ STD_RES_FILE( gid_File_Res_T602Filter, t602filter )
STD_RES_FILE( gid_File_Res_Forui, forui )
STD_RES_FILE( gid_File_Res_For, for )
+#ifdef ENABLE_TELEPATHY
+STD_RES_FILE( gid_File_Res_Tubes, tubes )
+#endif
diff --git a/scp2/source/ooo/module_lang_template.scp b/scp2/source/ooo/module_lang_template.scp
index c1235ff..aa34608 100644
--- a/scp2/source/ooo/module_lang_template.scp
+++ b/scp2/source/ooo/module_lang_template.scp
@@ -88,6 +88,7 @@ Module gid_Module_Langpack_Resource_Template
gid_File_Res_Tk,
gid_File_Res_Acc,
gid_File_Res_Tpl,
+ gid_File_Res_Tubes,
gid_File_Res_Uui,
gid_File_Res_Vcl,
gid_File_Res_Wzi,
diff --git a/tubes/AllLangResTarget_tubes.mk b/tubes/AllLangResTarget_tubes.mk
new file mode 100644
index 0000000..9cd4e1f
--- /dev/null
+++ b/tubes/AllLangResTarget_tubes.mk
@@ -0,0 +1,19 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+$(eval $(call gb_AllLangResTarget_AllLangResTarget,tubes))
+
+$(eval $(call gb_AllLangResTarget_add_srs,tubes,tubes/res))
+
+$(eval $(call gb_SrsTarget_SrsTarget,tubes/res))
+
+$(eval $(call gb_SrsTarget_add_files,tubes/res,\
+ tubes/source/contacts.src \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/tubes/CppunitTest_tubes_test.mk b/tubes/CppunitTest_tubes_test.mk
index c229b2a..597102c 100644
--- a/tubes/CppunitTest_tubes_test.mk
+++ b/tubes/CppunitTest_tubes_test.mk
@@ -38,7 +38,11 @@ $(eval $(call gb_CppunitTest_use_libraries,tubes_test, \
comphelper \
cppu \
sal \
+ svt \
+ svxcore \
+ tl \
utl \
+ vcl \
$(gb_STDLIBS) \
))
diff --git a/tubes/Library_tubes.mk b/tubes/Library_tubes.mk
index 0acd0a9..2ff9ab2 100644
--- a/tubes/Library_tubes.mk
+++ b/tubes/Library_tubes.mk
@@ -43,6 +43,11 @@ $(eval $(call gb_Library_use_libraries,tubes,\
comphelper \
cppu \
sal \
+ svt \
+ svxcore \
+ tl \
+ utl \
+ vcl \
))
$(eval $(call gb_Library_use_externals,tubes,\
@@ -51,8 +56,9 @@ $(eval $(call gb_Library_use_externals,tubes,\
$(eval $(call gb_Library_add_exception_objects,tubes,\
tubes/source/conference \
- tubes/source/manager \
tubes/source/contact-list \
+ tubes/source/contacts \
+ tubes/source/manager \
))
$(eval $(call gb_Library_add_cobjects,tubes,\
diff --git a/tubes/Module_tubes.mk b/tubes/Module_tubes.mk
index bc54f18..7eec798 100644
--- a/tubes/Module_tubes.mk
+++ b/tubes/Module_tubes.mk
@@ -30,6 +30,7 @@ $(eval $(call gb_Module_Module,tubes))
ifeq ($(ENABLE_TELEPATHY),TRUE)
$(eval $(call gb_Module_add_targets,tubes,\
+ AllLangResTarget_tubes \
Library_tubes \
Package_inc \
Executable_liboapprover \
diff --git a/tubes/Package_inc.mk b/tubes/Package_inc.mk
index ff63f18..1502b90 100644
--- a/tubes/Package_inc.mk
+++ b/tubes/Package_inc.mk
@@ -26,8 +26,10 @@
$(eval $(call gb_Package_Package,tubes_inc,$(SRCDIR)/tubes/inc))
+$(eval $(call gb_Package_add_file,tubes_inc,inc/tubes/collaboration.hxx,tubes/collaboration.hxx))
$(eval $(call gb_Package_add_file,tubes_inc,inc/tubes/conference.hxx,tubes/conference.hxx))
$(eval $(call gb_Package_add_file,tubes_inc,inc/tubes/contact-list.hxx,tubes/contact-list.hxx))
+$(eval $(call gb_Package_add_file,tubes_inc,inc/tubes/contacts.hxx,tubes/contacts.hxx))
$(eval $(call gb_Package_add_file,tubes_inc,inc/tubes/manager.hxx,tubes/manager.hxx))
$(eval $(call gb_Package_add_file,tubes_inc,inc/tubes/tubesdllapi.h,tubes/tubesdllapi.h))
$(eval $(call gb_Package_add_file,tubes_inc,inc/tubes/warnings_guard_boost_signals2.hpp,tubes/warnings_guard_boost_signals2.hpp))
diff --git a/tubes/inc/tubes/collaboration.hxx b/tubes/inc/tubes/collaboration.hxx
new file mode 100644
index 0000000..5a3dddc
--- /dev/null
+++ b/tubes/inc/tubes/collaboration.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TUBES_COLLABORATION_HXX
+#define INCLUDED_TUBES_COLLABORATION_HXX
+
+#include <sal/config.h>
+
+#include <rtl/ustring.hxx>
+
+class TeleConference;
+typedef struct _TpContact TpContact;
+
+class Collaboration
+{
+public:
+ Collaboration() {}
+ virtual ~Collaboration() {}
+
+ virtual TeleConference* GetConference() const = 0;
+ virtual void SetCollaboration( TeleConference* pConference ) = 0;
+ // TODO: I think this could be moved to TeleManager later.
+ virtual void SendFile( TpContact* pContact, const OUString& rURL ) = 0;
+};
+
+#endif // INCLUDED_TUBES_COLLABORATION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/tubes/inc/tubes/contacts.hxx b/tubes/inc/tubes/contacts.hxx
new file mode 100644
index 0000000..a2b1f7f
--- /dev/null
+++ b/tubes/inc/tubes/contacts.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Michael Meeks <michael.meeks at suse.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include "sal/config.h"
+#include <tubes/tubesdllapi.h>
+
+class Collaboration;
+
+namespace tubes {
+ void TUBES_DLLPUBLIC createContacts( Collaboration* pCollaboration );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/tubes/source/contacts.cxx b/tubes/source/contacts.cxx
new file mode 100644
index 0000000..046be97
--- /dev/null
+++ b/tubes/source/contacts.cxx
@@ -0,0 +1,280 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Michael Meeks <michael.meeks at suse.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <sal/config.h>
+
+#include "contacts.hrc"
+#include <svtools/filter.hxx>
+#include <svx/simptabl.hxx>
+#include <tools/resid.hxx>
+#include <tubes/conference.hxx>
+#include <tubes/collaboration.hxx>
+#include <tubes/contact-list.hxx>
+#include <tubes/contacts.hxx>
+#include <tubes/manager.hxx>
+#include <unotools/confignode.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/unohelp.hxx>
+
+#include <vector>
+#include <boost/ptr_container/ptr_vector.hpp>
+#include <telepathy-glib/telepathy-glib.h>
+
+ResId TubesResId( sal_uInt32 nId )
+{
+ static ResMgr* pResMgr = NULL;
+ if (!pResMgr)
+ {
+ pResMgr = ResMgr::CreateResMgr( "tubes" );
+ }
+ return ResId( nId, *pResMgr );
+}
+
+#define CONTACTS_DLG
+
+#ifdef CONTACTS_DLG
+namespace {
+class TubeContacts : public ModelessDialog
+{
+ FixedLine maLabel;
+ PushButton maBtnConnect;
+ PushButton maBtnGroup;
+ PushButton maBtnInvite;
+ PushButton maBtnListen;
+ SvxSimpleTableContainer maListContainer;
+ SvxSimpleTable maList;
+ TeleManager* mpManager;
+ Collaboration* mpCollaboration;
+
+ DECL_LINK( BtnConnectHdl, void * );
+ DECL_LINK( BtnGroupHdl, void * );
+ DECL_LINK( BtnInviteHdl, void * );
+ DECL_LINK( BtnListenHdl, void * );
+
+ struct AccountContact
+ {
+ TpAccount* mpAccount;
+ TpContact* mpContact;
+ AccountContact( TpAccount* pAccount, TpContact* pContact ):
+ mpAccount(pAccount), mpContact(pContact) {}
+ };
+ boost::ptr_vector<AccountContact> maACs;
+
+ void Invite()
+ {
+ AccountContact *pAC = NULL;
+ if (maList.FirstSelected())
+ pAC = static_cast<AccountContact*> (maList.FirstSelected()->GetUserData());
+ if (pAC)
+ {
+ if (mpCollaboration->GetConference())
+ {
+ TpContact* pContact = pAC->mpContact;
+ mpCollaboration->GetConference()->invite( pContact );
+ mpCollaboration->SendFile( pContact, OStringToOUString(
+ mpCollaboration->GetConference()->getUuid(), RTL_TEXTENCODING_UTF8 ) );
+ }
+ }
+ }
+
+ void Listen()
+ {
+ if (!mpManager->registerClients())
+ SAL_INFO( "sc.tubes", "Could not register client handlers." );
+ }
+
+ void StartBuddySession()
+ {
+ AccountContact *pAC = NULL;
+ if (maList.FirstSelected())
+ pAC = static_cast<AccountContact*> (maList.FirstSelected()->GetUserData());
+ if (pAC)
+ {
+ TpAccount* pAccount = pAC->mpAccount;
+ TpContact* pContact = pAC->mpContact;
+ fprintf( stderr, "picked %s\n", tp_contact_get_identifier( pContact ) );
+ TeleConference* pConference = mpManager->startBuddySession( pAccount, pContact );
+ if (!pConference)
+ fprintf( stderr, "could not start session with %s\n",
+ tp_contact_get_identifier( pContact ) );
+ else
+ {
+ mpCollaboration->SetCollaboration( pConference );
+ mpCollaboration->SendFile( pContact, OStringToOUString(
+ pConference->getUuid(), RTL_TEXTENCODING_UTF8 ) );
+ }
+ }
+ }
+
+ void StartGroupSession()
+ {
+ AccountContact *pAC = NULL;
+ if (maList.FirstSelected())
+ pAC = static_cast<AccountContact*> (maList.FirstSelected()->GetUserData());
+ if (pAC)
+ {
+ TpAccount* pAccount = pAC->mpAccount;
+ fprintf( stderr, "picked %s\n", tp_account_get_display_name( pAccount ) );
+ TeleConference* pConference = mpManager->startGroupSession( pAccount,
+ rtl::OUString("liboroom"), rtl::OUString("conference.jabber.org") );
+ if (!pConference)
+ fprintf( stderr, "could not start group session\n" );
+ else
+ {
+ mpCollaboration->SetCollaboration( pConference );
+ }
+ }
+ }
+
+public:
+ TubeContacts( Collaboration* pCollaboration ) :
+ ModelessDialog( NULL, TubesResId( RID_TUBES_DLG_CONTACTS ) ),
+ maLabel( this, TubesResId( FL_LABEL ) ),
+ maBtnConnect( this, TubesResId( BTN_CONNECT ) ),
+ maBtnGroup( this, TubesResId( BTN_GROUP ) ),
+ maBtnInvite( this, TubesResId( BTN_INVITE ) ),
+ maBtnListen( this, TubesResId( BTN_LISTEN ) ),
+ maListContainer( this, TubesResId( CTL_LIST ) ),
+ maList( maListContainer ),
+ mpManager( new TeleManager() ),
+ mpCollaboration( pCollaboration )
+ {
+ Hide();
+ maBtnConnect.SetClickHdl( LINK( this, TubeContacts, BtnConnectHdl ) );
+ maBtnGroup.SetClickHdl( LINK( this, TubeContacts, BtnGroupHdl ) );
+ maBtnInvite.SetClickHdl( LINK( this, TubeContacts, BtnInviteHdl ) );
+ maBtnListen.SetClickHdl( LINK( this, TubeContacts, BtnListenHdl ) );
+
+ static long aStaticTabs[]=
+ {
+ 3 /* count */, 0, 20, 100, 150, 200
+ };
+
+ maList.SvxSimpleTable::SetTabs( aStaticTabs );
+ String sHeader( '\t' );
+ sHeader += String( TubesResId( STR_HEADER_ALIAS ) );
+ sHeader += '\t';
+ sHeader += String( TubesResId( STR_HEADER_NAME ) );
+ sHeader += '\t';
+ maList.InsertHeaderEntry( sHeader, HEADERBAR_APPEND, HIB_LEFT );
+
+ mpManager->getContactList()->sigContactListChanged.connect(
+ boost::bind( &TubeContacts::Populate, this ) );
+ }
+ virtual ~TubeContacts()
+ {
+ delete mpCollaboration;
+ delete mpManager;
+ }
+
+ static rtl::OUString fromUTF8( const char *pStr )
+ {
+ return rtl::OStringToOUString( rtl::OString( pStr, strlen( pStr ) ),
+ RTL_TEXTENCODING_UTF8 );
+ }
+
+ void Populate()
+ {
+ SAL_INFO( "sc.tubes", "Populating contact list dialog" );
+ maList.Clear();
+ ContactList *pContacts = mpManager->getContactList();
+ if ( pContacts )
+ {
+ AccountContactPairV aPairs = pContacts->getContacts();
+ AccountContactPairV::iterator it;
+ for( it = aPairs.begin(); it != aPairs.end(); ++it )
+ {
+ Image aImage;
+ GFile *pAvatarFile = tp_contact_get_avatar_file( it->second );
+ if( pAvatarFile )
+ {
+ const rtl::OUString sAvatarFileUrl = fromUTF8( g_file_get_path ( pAvatarFile ) );
+ Graphic aGraphic;
+ if( GRFILTER_OK == GraphicFilter::LoadGraphic( sAvatarFileUrl, rtl::OUString(""), aGraphic ) )
+ {
+ BitmapEx aBitmap = aGraphic.GetBitmapEx();
+ double fScale = 30.0 / aBitmap.GetSizePixel().Height();
+ aBitmap.Scale( fScale, fScale );
+ aImage = Image( aBitmap );
+ }
+ }
+ rtl::OUStringBuffer aEntry( 128 );
+ aEntry.append( sal_Unicode( '\t' ) );
+ aEntry.append( fromUTF8 ( tp_contact_get_alias( it->second ) ) );
+ aEntry.append( sal_Unicode( '\t' ) );
+ aEntry.append( fromUTF8 ( tp_contact_get_identifier( it->second ) ) );
+ aEntry.append( sal_Unicode( '\t' ) );
+ SvLBoxEntry* pEntry = maList.InsertEntry( aEntry.makeStringAndClear(), aImage, aImage );
+ // FIXME: ref the TpAccount, TpContact ...
+ maACs.push_back( new AccountContact( it->first, it->second ) );
+ pEntry->SetUserData( &maACs.back() );
+ }
+ }
+ Show();
+ }
+};
+
+IMPL_LINK_NOARG( TubeContacts, BtnConnectHdl )
+{
+ StartBuddySession();
+ return 0;
+}
+
+IMPL_LINK_NOARG( TubeContacts, BtnGroupHdl )
+{
+ StartGroupSession();
+ return 0;
+}
+
+IMPL_LINK_NOARG( TubeContacts, BtnInviteHdl )
+{
+ Invite();
+ return 0;
+}
+
+IMPL_LINK_NOARG( TubeContacts, BtnListenHdl )
+{
+ Listen();
+ return 0;
+}
+
+} // anonymous namespace
+#endif
+
+namespace tubes {
+void createContacts( Collaboration* pCollaboration )
+{
+#ifdef CONTACTS_DLG
+ static TubeContacts *pContacts = new TubeContacts( pCollaboration );
+ pContacts->Populate();
+#endif
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/tubes/source/contacts.hrc b/tubes/source/contacts.hrc
new file mode 100644
index 0000000..84c5c33
--- /dev/null
+++ b/tubes/source/contacts.hrc
@@ -0,0 +1,11 @@
+#define RID_TUBES_DLG_CONTACTS 1000
+
+#define FL_LABEL 1
+#define CTL_LIST 2
+#define BTN_CONNECT 3
+#define BTN_INVITE 4
+#define BTN_LISTEN 5
+#define BTN_GROUP 6
+
+#define STR_HEADER_ALIAS 20
+#define STR_HEADER_NAME 21
diff --git a/tubes/source/contacts.src b/tubes/source/contacts.src
new file mode 100644
index 0000000..0cd386a
--- /dev/null
+++ b/tubes/source/contacts.src
@@ -0,0 +1,60 @@
+#include "contacts.hrc"
+
+ModelessDialog RID_TUBES_DLG_CONTACTS
+{
+ HelpId = "TUBES_HID"; // has to be something ...
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Hide = FALSE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Size = MAP_APPFONT ( 220 , 225 ) ;
+ OutputSize = TRUE ;
+ Text [ en-US ] = "Contacts" ;
+
+ FixedLine FL_LABEL
+ {
+ Pos = MAP_APPFONT ( 8 , 2 ) ;
+ Size = MAP_APPFONT ( 198 , 8 ) ;
+ Text [ en-US ] = "Select a contact to collaborate with" ;
+ };
+ PushButton BTN_CONNECT
+ {
+ Pos = MAP_APPFONT( 70 , 200 );
+ Size = MAP_APPFONT( 50 , 10 );
+ Text [ en-US ] = "startBuddySession";
+ };
+ PushButton BTN_GROUP
+ {
+ Pos = MAP_APPFONT( 70 , 212 );
+ Size = MAP_APPFONT( 50 , 10 );
+ Text [ en-US ] = "startGroupSession";
+ };
+ PushButton BTN_INVITE
+ {
+ Pos = MAP_APPFONT( 130 , 200 );
+ Size = MAP_APPFONT( 50 , 10 );
+ Text [ en-US ] = "Invite";
+ };
+ PushButton BTN_LISTEN
+ {
+ Pos = MAP_APPFONT( 8 , 200 );
+ Size = MAP_APPFONT( 50 , 10 );
+ Text [ en-US ] = "Listen";
+ };
+ Control CTL_LIST
+ {
+ Pos = MAP_APPFONT ( 8 , 10 ) ;
+ Size = MAP_APPFONT ( 200 , 190 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ String STR_HEADER_ALIAS
+ {
+ Text [ en-US ] = "Alias" ;
+ };
+ String STR_HEADER_NAME
+ {
+ Text [ en-US ] = "Name" ;
+ };
+};
commit 4311938f7e838c6263b0e5774e611ec213cb02c6
Author: Matúš Kukan <matus.kukan at gmail.com>
Date: Sat Jul 28 11:16:01 2012 +0200
tubes: impose strict ordering on 1-1 collaboration
- master (the one who started the session) echoes back packets from
slave, who only then, after receiving own commands executes them
Change-Id: I8b5a1d1bae0d665b65fe2ec0121430178728274d
diff --git a/tubes/inc/tubes/conference.hxx b/tubes/inc/tubes/conference.hxx
index e5c5d37..6a02604 100644
--- a/tubes/inc/tubes/conference.hxx
+++ b/tubes/inc/tubes/conference.hxx
@@ -46,7 +46,11 @@ class TeleConference
{
public:
- TeleConference( TeleManager* pManager, TpAccount *pAccount, TpDBusTubeChannel* pChannel, const OString sUuid = OString() );
+ TeleConference( TeleManager* pManager,
+ TpAccount* pAccount,
+ TpDBusTubeChannel* pChannel,
+ const OString sUuid = OString(),
+ bool bMaster = false );
~TeleConference();
/// Close channel and call finalize()
@@ -80,6 +84,7 @@ public:
bool setTube( GDBusConnection* pTube );
void setTubeOfferedHandlerInvoked( bool b );
bool isTubeOfferedHandlerInvoked() const;
+ bool isMaster() const;
/** Queue incoming data as OString */
void queue( const OString& rPacket );
void setUuid( const OString& rUuid ) { msUuid = rUuid; }
@@ -97,6 +102,7 @@ private:
TpAccount* mpAccount;
TpDBusTubeChannel* mpChannel;
OString msUuid;
+ bool mbMaster;
TeleConferenceImpl* pImpl;
};
diff --git a/tubes/source/conference.cxx b/tubes/source/conference.cxx
index bc2dc75..f024685 100644
--- a/tubes/source/conference.cxx
+++ b/tubes/source/conference.cxx
@@ -131,7 +131,13 @@ static void TeleConference_MethodCallHandler(
SAL_INFO( "tubes", "TeleConference_MethodCallHandler: received packet from sender "
<< (pSender ? pSender : "(null)") << " with size " << nPacketSize);
- pConference->queue( OString( pPacketData, nPacketSize ) );
+ OString aPacket( pPacketData, nPacketSize );
+ pConference->queue( aPacket );
+ // Master needs to send the packet back to impose ordering,
+ // so the slave can execute his command.
+ if (pConference->isMaster())
+ pConference->sendPacket( aPacket );
+
g_dbus_method_invocation_return_value( pInvocation, 0 );
g_variant_unref( ay);
@@ -226,12 +232,14 @@ static void TeleConference_TubeAcceptedHandler(
}
-TeleConference::TeleConference( TeleManager* pManager, TpAccount* pAccount, TpDBusTubeChannel* pChannel, const OString sUuid )
+TeleConference::TeleConference( TeleManager* pManager, TpAccount* pAccount,
+ TpDBusTubeChannel* pChannel, const OString sUuid, bool bMaster )
:
- mpManager( pManager),
- mpAccount( NULL),
- mpChannel( NULL),
- msUuid( sUuid),
+ mpManager( pManager ),
+ mpAccount( NULL ),
+ mpChannel( NULL ),
+ msUuid( sUuid ),
+ mbMaster( bMaster ),
pImpl( new TeleConferenceImpl() )
{
setChannel( pAccount, pChannel );
@@ -431,12 +439,17 @@ bool TeleConference::sendPacket( const OString& rPacket )
G_DBUS_CALL_FLAGS_NONE,
-1, NULL, NULL, NULL);
- /* FIXME: need to impose an ordering on packets. */
- queue( rPacket );
+ // If we started the session, we can execute commands immediately.
+ if (mbMaster)
+ queue( rPacket );
return true;
}
+bool TeleConference::isMaster() const
+{
+ return mbMaster;
+}
void TeleConference::queue( const OString &rPacket )
{
diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx
index c0f7427..40754a4 100644
--- a/tubes/source/manager.cxx
+++ b/tubes/source/manager.cxx
@@ -676,7 +676,7 @@ TeleConference* TeleManager::startBuddySession( TpAccount *pAccount, TpContact *
setChannelReadyHandlerInvoked( false);
- TeleConference* pConference = new TeleConference( this, NULL, NULL, createUuid() );
+ TeleConference* pConference = new TeleConference( this, NULL, NULL, createUuid(), true );
tp_account_channel_request_create_and_handle_channel_async(
pChannelRequest, NULL, TeleManager_ChannelReadyHandler, pConference );
commit 326235584f9dc17c0adf4c02180f45d4c3dc1e64
Author: Matúš Kukan <matus.kukan at gmail.com>
Date: Thu Aug 2 00:07:03 2012 +0200
scp2: SHORT_RESFILE_ALL_LANG seems to be unused
Change-Id: I62b313fc8d8c6dfc821012783365307c8280a96c
diff --git a/scp2/inc/macros.inc b/scp2/inc/macros.inc
index 5982668..afd65e2 100755
--- a/scp2/inc/macros.inc
+++ b/scp2/inc/macros.inc
@@ -58,7 +58,6 @@
#endif
#define RESFILENAME(name,lang) STRING(CONCAT3(name,lang,.res))
-#define SHORTRESFILENAME(name,lang) STRING(CONCAT3(name,lang,.res))
#define READMETXTFILENAME(name,lang,ext) STRING(CONCAT4(name,lang,.,ext))
#define READMEFILENAME(name,lang) STRING(CONCAT2(name,lang))
#define EXTRAFILENAME(name,lang) STRING(CONCAT3(name,lang,.zip))
diff --git a/scp2/macros/macro.pl b/scp2/macros/macro.pl
index ef492b0..9ea949c 100644
--- a/scp2/macros/macro.pl
+++ b/scp2/macros/macro.pl
@@ -67,7 +67,6 @@ write_EXTRA_ALL_LANG_BUT_EN_US();
write_EXTRA_ALL_GOOD_HELP_LOCALIZATIONS_LANG();
write_EXTRA_IDENT_ALL_LANG();
write_RESFILE_ALL_LANG();
-write_SHORT_RESFILE_ALL_LANG();
write_README_ALL_LANG();
write_README_TXT_ALL_LANG();
write_VALUE_ALL_LANG_LETTER_DIR();
@@ -195,16 +194,6 @@ sub write_RESFILE_ALL_LANG
print OUTFILE "\n\n";
}
-sub write_SHORT_RESFILE_ALL_LANG
-{
- print OUTFILE "#define SHORT_RESFILE_ALL_LANG(name) ";
- foreach $lang (@completelangiso) {
- print OUTFILE "\\\n\tName ($lang) = SHORTRESFILENAME(name,$lang)";
- print OUTFILE "; " if ( $lang ne $completelangiso[$#completelangiso]);
- }
- print OUTFILE "\n\n";
-}
-
sub write_README_ALL_LANG
{
print OUTFILE "#define README_ALL_LANG(key, name) ";
More information about the Libreoffice-commits
mailing list