Feature to show group image if a call comes from a group member
authorAmith Kumar Mahale <amith.m@samsung.com>
Tue, 23 Apr 2013 11:48:17 +0000 (17:18 +0530)
committerAmith Kumar Mahale <amith.m@samsung.com>
Tue, 23 Apr 2013 11:48:17 +0000 (17:18 +0530)
Change-Id: Ib0200b617af4625644ff4def2bc97bac7aa03c7d
Signed-off-by: Amith Kumar Mahale <amith.m@samsung.com>
inc/CallInfo.h
src/CallInfo.cpp

index 99f074f..d915984 100644 (file)
@@ -155,6 +155,8 @@ private:
 
        //used to store previously fetched contact.
        Tizen::Social::Contact* __pContact;
+       // having the address book here
+       Tizen::Social::Addressbook* __pAddressBook;
 };
 
 #endif // _PHN_CALL_INFO_H_
index ed7af01..1981d59 100644 (file)
@@ -27,6 +27,7 @@ using namespace Tizen::Base::Collection;
 using namespace Tizen::Graphics;
 using namespace Tizen::Media;
 using namespace Tizen::Social;
+using namespace Tizen::Telephony;
 
 AppCallInfo::AppCallInfo(void)
 {
@@ -41,6 +42,7 @@ AppCallInfo::AppCallInfo(void)
        __pEndCallCause = null;
        __pParticipantCallHandles = null;
        __pContact = null;
+       __pAddressBook = null;
 }
 
 AppCallInfo::~AppCallInfo(void)
@@ -64,6 +66,10 @@ AppCallInfo::~AppCallInfo(void)
        {
                delete __pContact;
        }
+       if(__pAddressBook != null)
+       {
+               delete __pAddressBook;
+       }
 }
 
 Long*
@@ -347,10 +353,23 @@ AppCallInfo::FetchCallerPhotoN(void)
        {
                String thumbnailPath;
                Bitmap* pThumbnail = null;
-       //      __pContact->GetValue(CONTACT_PROPERTY_ID_THUMBNAIL, thumbnailPath);
-               thumbnailPath = __pContact->GetThumbnailPath();
+               __pAddressBook = AddressbookManager::GetInstance()->GetAddressbookN();
+
+               result r = __pContact->GetValue(CONTACT_PROPERTY_ID_THUMBNAIL, thumbnailPath);
+               //Now check if there is a group ring tone
+               if(thumbnailPath.IsEmpty() == true)
+               {
+                       IList* pCategoryList = __pAddressBook->GetCategoriesByContactN(__pContact->GetRecordId());
+                       if(pCategoryList != null && pCategoryList->GetCount() > 0)
+                       {
+                               AppLogDebug("Changes to get thumbnail group photo");
+                               Category* pCategory = static_cast<Category*>(pCategoryList->GetAt(0));
+                               thumbnailPath = pCategory->GetThumbnailPath();
+                       }
+               }
+               //thumbnailPath = __pContact->GetThumbnailPath();
                ImageBuffer thumbnailImageBuffer;
-               result r = thumbnailImageBuffer.Construct(thumbnailPath);
+               r = thumbnailImageBuffer.Construct(thumbnailPath);
                if (r == E_SUCCESS)
                {
                        pThumbnail = thumbnailImageBuffer.GetBitmapN(BITMAP_PIXEL_FORMAT_ARGB8888, BUFFER_SCALING_NONE);