From 466edaa9fb54f7f976c176635fb836f7cd85b456 Mon Sep 17 00:00:00 2001 From: Matúš Kukan Date: Mon, 20 Aug 2012 14:08:02 +0200 Subject: tubes: move getContacts() to TeleManager where it belongs, I believe Change-Id: I69ca3bde24890d809d8fad60398687c54aa1ca54 --- tubes/source/contacts.cxx | 64 ++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 34 deletions(-) (limited to 'tubes/source/contacts.cxx') diff --git a/tubes/source/contacts.cxx b/tubes/source/contacts.cxx index 1017fade4b14..3c0a3322bca1 100644 --- a/tubes/source/contacts.cxx +++ b/tubes/source/contacts.cxx @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include @@ -196,44 +195,41 @@ public: SAL_INFO( "tubes", "Populating contact list dialog" ); maList.Clear(); maACs.clear(); - ContactList *pContacts = TeleManager::getContactList(); - if ( pContacts ) + + AccountContactPairV aPairs = TeleManager::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 ) { - 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; + GFile *pAvatarFile = tp_contact_get_avatar_file( it->second ); + if( pAvatarFile ) { - 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 ) ) { - 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 ); - } + 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( AccountContactPair( it->first, it->second ) ); - pEntry->SetUserData( &maACs.back() ); - - g_object_unref (it->first); - g_object_unref (it->second); } + 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( AccountContactPair( it->first, it->second ) ); + pEntry->SetUserData( &maACs.back() ); + + g_object_unref (it->first); + g_object_unref (it->second); } Show(); } -- cgit