summaryrefslogtreecommitdiff
path: root/tubes
diff options
context:
space:
mode:
Diffstat (limited to 'tubes')
-rw-r--r--tubes/Package_inc.mk1
-rw-r--r--tubes/inc/tubes/collaboration.hxx3
-rw-r--r--tubes/inc/tubes/contacts.hxx38
-rw-r--r--tubes/inc/tubes/manager.hxx6
-rw-r--r--tubes/source/collaboration.cxx7
-rw-r--r--tubes/source/contact-list.cxx5
-rw-r--r--tubes/source/contacts.cxx30
-rw-r--r--tubes/source/manager.cxx19
8 files changed, 39 insertions, 70 deletions
diff --git a/tubes/Package_inc.mk b/tubes/Package_inc.mk
index be6266aeca49..3ed92f922466 100644
--- a/tubes/Package_inc.mk
+++ b/tubes/Package_inc.mk
@@ -27,7 +27,6 @@
$(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/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))
diff --git a/tubes/inc/tubes/collaboration.hxx b/tubes/inc/tubes/collaboration.hxx
index 15d59d4abf66..8378ddae6823 100644
--- a/tubes/inc/tubes/collaboration.hxx
+++ b/tubes/inc/tubes/collaboration.hxx
@@ -21,6 +21,8 @@ typedef struct _TpContact TpContact;
class TUBES_DLLPUBLIC Collaboration
{
TeleConference* mpConference;
+ // This is in fact of type TubeContacts* from anonymous namespace
+ void* mpContacts;
public:
Collaboration();
virtual ~Collaboration();
@@ -33,6 +35,7 @@ public:
TUBES_DLLPRIVATE TeleConference* GetConference() const;
TUBES_DLLPRIVATE sal_uInt64 GetId() const;
+ void DisplayContacts();
void SendFile( TpContact* pContact, const OUString& rURL ) const;
void SendPacket( const OString& rPacket ) const;
void SetConference( TeleConference* pConference );
diff --git a/tubes/inc/tubes/contacts.hxx b/tubes/inc/tubes/contacts.hxx
deleted file mode 100644
index a2b1f7fb42b6..000000000000
--- a/tubes/inc/tubes/contacts.hxx
+++ /dev/null
@@ -1,38 +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@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/inc/tubes/manager.hxx b/tubes/inc/tubes/manager.hxx
index ab5e39a0ae51..533233a102b0 100644
--- a/tubes/inc/tubes/manager.hxx
+++ b/tubes/inc/tubes/manager.hxx
@@ -39,6 +39,7 @@
#define LIBO_TUBES_DBUS_PATH "/org/libreoffice/calc"
namespace osl { class Mutex; }
+class Collaboration;
class ContactList;
class TeleConference;
class TeleManagerImpl;
@@ -128,6 +129,11 @@ public:
/** Get a conference with current UUID to set a session. */
TUBES_DLLPUBLIC static TeleConference* getConference();
+ static void registerCollaboration( Collaboration* pCollaboration );
+ static void unregisterCollaboration( Collaboration* pCollaboration );
+ /** Display contact list dialog for all documents. */
+ static void displayAllContacts();
+
static void registerDemoConference( TeleConference* pConference );
static void unregisterDemoConference( TeleConference* pConference );
/** Broadcast packet to all conferences. Used for demo mode. */
diff --git a/tubes/source/collaboration.cxx b/tubes/source/collaboration.cxx
index 846f5dc51cc7..65c24c546ec3 100644
--- a/tubes/source/collaboration.cxx
+++ b/tubes/source/collaboration.cxx
@@ -10,13 +10,18 @@
#include <tubes/collaboration.hxx>
#include <tubes/conference.hxx>
+#include <tubes/manager.hxx>
-Collaboration::Collaboration()
+Collaboration::Collaboration() :
+ mpConference( NULL ),
+ mpContacts( NULL )
{
+ TeleManager::registerCollaboration( this );
}
Collaboration::~Collaboration()
{
+ TeleManager::unregisterCollaboration( this );
if (mpConference)
mpConference->close();
}
diff --git a/tubes/source/contact-list.cxx b/tubes/source/contact-list.cxx
index b238a2cc24be..163f4e0b0030 100644
--- a/tubes/source/contact-list.cxx
+++ b/tubes/source/contact-list.cxx
@@ -101,16 +101,13 @@ bool tb_contact_is_online( TpContact *contact )
return tb_presence_is_online (tp_contact_get_presence_type (contact));
}
-namespace tubes {
- void reDrawAllContacts();
-}
static void presence_changed_cb( TpContact* /* contact */,
guint /* type */,
gchar* /* status */,
gchar* /* message */,
gpointer /* pContactList*/ )
{
- tubes::reDrawAllContacts();
+ TeleManager::displayAllContacts();
}
AccountContactPairV ContactList::getContacts()
diff --git a/tubes/source/contacts.cxx b/tubes/source/contacts.cxx
index 508322a69257..c6037f42bd96 100644
--- a/tubes/source/contacts.cxx
+++ b/tubes/source/contacts.cxx
@@ -35,7 +35,6 @@
#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>
@@ -282,34 +281,13 @@ IMPL_LINK_NOARG( TubeContacts, BtnListenHdl )
return 0;
}
-// Mapping contacts dialog instance for each document
-typedef std::map< sal_uInt64, TubeContacts* > DialogsMap;
-static DialogsMap aDialogsMap;
-
-TubeContacts* ContactsFactory( Collaboration* pCollaboration )
-{
- sal_uInt64 Id = pCollaboration->GetId();
- if (aDialogsMap.find( Id ) == aDialogsMap.end())
- aDialogsMap[ Id ] = new TubeContacts( pCollaboration );
- return aDialogsMap[ Id ];
-}
-
} // anonymous namespace
-namespace tubes {
-void createContacts( Collaboration* pCollaboration )
+void Collaboration::DisplayContacts()
{
- TubeContacts* pContacts = ContactsFactory( pCollaboration );
- pContacts->Populate();
-}
-
-void reDrawAllContacts()
-{
- for (DialogsMap::const_iterator it = aDialogsMap.begin();
- it != aDialogsMap.end(); ++it)
- it->second->Populate();
-}
-
+ if (!mpContacts)
+ mpContacts = new TubeContacts( this );
+ reinterpret_cast<TubeContacts*> (mpContacts)->Populate();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx
index 3d87f1969393..4d0fc66946c2 100644
--- a/tubes/source/manager.cxx
+++ b/tubes/source/manager.cxx
@@ -103,6 +103,8 @@ public:
MapStringConference maAcceptedConferences;
typedef std::set< TeleConference* > DemoConferences;
DemoConferences maDemoConferences;
+ typedef std::set< Collaboration* > Collaborations;
+ Collaborations maCollaborations;
TeleManagerImpl();
~TeleManagerImpl();
@@ -225,6 +227,23 @@ TeleConference* TeleManager::getConference()
return pConference;
}
+void TeleManager::registerCollaboration( Collaboration* pCollaboration )
+{
+ pImpl->maCollaborations.insert( pCollaboration );
+}
+
+void TeleManager::unregisterCollaboration( Collaboration* pCollaboration )
+{
+ pImpl->maCollaborations.erase( pCollaboration );
+}
+
+void TeleManager::displayAllContacts()
+{
+ for (TeleManagerImpl::Collaborations::iterator it = pImpl->maCollaborations.begin();
+ it != pImpl->maCollaborations.end(); ++it)
+ (*it)->DisplayContacts();
+}
+
void TeleManager::registerDemoConference( TeleConference* pConference )
{
pImpl->maDemoConferences.insert( pConference );