diff options
author | Matúš Kukan <matus.kukan@gmail.com> | 2012-08-07 10:59:58 +0200 |
---|---|---|
committer | Matúš Kukan <matus.kukan@gmail.com> | 2012-08-08 10:04:17 +0200 |
commit | b870f1420ea926f231502272eec08c45e9da4cc5 (patch) | |
tree | c47bd194512b1450408a50cfd70049e372d87b7b /tubes/source | |
parent | 34c6421bddddb2128dd59acc867f73739ac1ca62 (diff) |
tubes: make contacts dialog a member of Collaboration class
Change-Id: Ib50b550f9486bc1abfeefd5d1aac57c0d712ec04
Diffstat (limited to 'tubes/source')
-rw-r--r-- | tubes/source/collaboration.cxx | 7 | ||||
-rw-r--r-- | tubes/source/contact-list.cxx | 5 | ||||
-rw-r--r-- | tubes/source/contacts.cxx | 30 | ||||
-rw-r--r-- | tubes/source/manager.cxx | 19 |
4 files changed, 30 insertions, 31 deletions
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 ); |