summaryrefslogtreecommitdiff
path: root/tubes
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@gmail.com>2012-08-07 16:04:52 +0200
committerMatúš Kukan <matus.kukan@gmail.com>2012-08-08 10:04:18 +0200
commit6766c6a2a0a933b507e8e98a30280d1963f5b7db (patch)
tree33ac15838749cd81e32682bbe0ecc3a120c3d0c5 /tubes
parent510576b6d8ba1cbd0bac6584f5ce56c93abc36ae (diff)
tubes: re-use typedefs from contact-list.hxx
Change-Id: I7b1ac653d22275a64d00913f014ca2536be3ffed
Diffstat (limited to 'tubes')
-rw-r--r--tubes/source/contacts.cxx36
1 files changed, 16 insertions, 20 deletions
diff --git a/tubes/source/contacts.cxx b/tubes/source/contacts.cxx
index 37a9de46a904..ef772dee58db 100644
--- a/tubes/source/contacts.cxx
+++ b/tubes/source/contacts.cxx
@@ -43,7 +43,6 @@
#include <map>
#include <vector>
-#include <boost/ptr_container/ptr_vector.hpp>
#include <telepathy-glib/telepathy-glib.h>
namespace {
@@ -76,25 +75,18 @@ class TubeContacts : public ModelessDialog
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;
+ AccountContactPairV maACs;
void Invite()
{
- AccountContact *pAC = NULL;
+ AccountContactPair *pAC = NULL;
if (maList.FirstSelected())
- pAC = static_cast<AccountContact*> (maList.FirstSelected()->GetUserData());
+ pAC = static_cast<AccountContactPair*> (maList.FirstSelected()->GetUserData());
if (pAC)
{
if (mpCollaboration->GetConference())
{
- TpContact* pContact = pAC->mpContact;
+ TpContact* pContact = pAC->second;
mpCollaboration->GetConference()->invite( pContact );
mpCollaboration->SaveAndSendFile( pContact, OStringToOUString(
mpCollaboration->GetConference()->getUuid(), RTL_TEXTENCODING_UTF8 ) );
@@ -123,13 +115,13 @@ class TubeContacts : public ModelessDialog
void StartBuddySession()
{
- AccountContact *pAC = NULL;
+ AccountContactPair *pAC = NULL;
if (maList.FirstSelected())
- pAC = static_cast<AccountContact*> (maList.FirstSelected()->GetUserData());
+ pAC = static_cast<AccountContactPair*> (maList.FirstSelected()->GetUserData());
if (pAC)
{
- TpAccount* pAccount = pAC->mpAccount;
- TpContact* pContact = pAC->mpContact;
+ TpAccount* pAccount = pAC->first;
+ TpContact* pContact = pAC->second;
SAL_INFO( "tubes", "picked " << tp_contact_get_identifier( pContact ) );
TeleConference* pConference = TeleManager::startBuddySession( pAccount, pContact );
if (!pConference)
@@ -146,12 +138,12 @@ class TubeContacts : public ModelessDialog
void StartGroupSession()
{
- AccountContact *pAC = NULL;
+ AccountContactPair *pAC = NULL;
if (maList.FirstSelected())
- pAC = static_cast<AccountContact*> (maList.FirstSelected()->GetUserData());
+ pAC = static_cast<AccountContactPair*> (maList.FirstSelected()->GetUserData());
if (pAC)
{
- TpAccount* pAccount = pAC->mpAccount;
+ TpAccount* pAccount = pAC->first;
SAL_INFO( "tubes", "picked " << tp_account_get_display_name( pAccount ) );
TeleConference* pConference = TeleManager::startGroupSession( pAccount,
rtl::OUString("liboroom"), rtl::OUString("conference.jabber.org") );
@@ -211,11 +203,15 @@ public:
{
SAL_INFO( "sc.tubes", "Populating contact list dialog" );
maList.Clear();
+ maACs.clear();
ContactList *pContacts = TeleManager::getContactList();
if ( pContacts )
{
AccountContactPairV aPairs = pContacts->getContacts();
AccountContactPairV::iterator it;
+ // make sure we have enough memory to not need re-allocation
+ // which would invalidate pointers stored in maList entries
+ maACs.reserve( aPairs.size() );
for( it = aPairs.begin(); it != aPairs.end(); ++it )
{
Image aImage;
@@ -240,7 +236,7 @@ public:
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 ) );
+ maACs.push_back( AccountContactPair( it->first, it->second ) );
pEntry->SetUserData( &maACs.back() );
}
}