2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.1 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file CtContactPresentationModel.cpp
19 * @brief This is the implementation file for the ContactPresentationModel class.
22 #include <FGraphics.h>
24 #include "CtContactPresentationModel.h"
25 #include "CtIContactEventListener.h"
26 #include "CtResourceManager.h"
28 using namespace Tizen::Base;
29 using namespace Tizen::Base::Collection;
30 using namespace Tizen::Graphics;
31 using namespace Tizen::Io;
32 using namespace Tizen::Locales;
33 using namespace Tizen::Social;
35 static const wchar_t* IDB_ACCOUNT_ICON_ICQ = L"C02_Icon_ICQ.png";
36 static const wchar_t* IDB_ACCOUNT_ICON_YAHOO = L"C02_Icon_yahoo.png";
37 static const wchar_t* IDB_ACCOUNT_ICON_MSN = L"C02_Icon_windows_live.png";
38 static const wchar_t* IDB_ACCOUNT_ICON_OTHERS = L"C02_Icon_others.png";
40 static const wchar_t* CHARACTER_HYPHEN = L"-";
41 static const wchar_t* CHARACTER_EMPTY = L"";
43 ContactPresentationModel::ContactPresentationModel(void)
44 : __pAssignedCategoryList(null)
45 , __pContactListenerList(null)
47 , __pAddressbook(null)
48 , __defaultNumberIndex(0)
49 , __lastRemovedContactIndex(-1)
50 , __lastRemovedEmailIndex(-1)
56 ContactPresentationModel::~ContactPresentationModel(void)
58 delete __pAddressbook;
61 if (__pContactListenerList != null)
63 __pContactListenerList->RemoveAll(true);
64 delete __pContactListenerList;
67 if (__pAssignedCategoryList != null)
69 __pAssignedCategoryList->RemoveAll(true);
70 delete __pAssignedCategoryList;
75 ContactPresentationModel::Construct(void)
79 AddressbookManager* pAddressbookManager = AddressbookManager::GetInstance();
81 __pAddressbook = pAddressbookManager->GetAddressbookN(DEFAULT_ADDRESSBOOK_ID);
82 if (__pAddressbook == null)
87 r = __pAddressbook->SetAddressbookChangeEventListener(this);
88 TryCatch(r == E_SUCCESS, , "[%s] Unable to set event listener", GetErrorMessage(r));
90 __pContactListenerList = new (std::nothrow) ArrayList();
91 __pContactListenerList->Construct();
93 __pAssignedCategoryList = new (std::nothrow) ArrayList();
94 __pAssignedCategoryList->Construct();
99 delete __pAddressbook;
100 __pAddressbook = null;
102 __pContactListenerList->RemoveAll();
103 delete __pContactListenerList;
104 __pContactListenerList = null;
106 __pAssignedCategoryList->RemoveAll();
107 delete __pAssignedCategoryList;
108 __pAssignedCategoryList = null;
114 ContactPresentationModel::PrepareNewContact(void)
116 __pContact = new (std::nothrow) Contact();
124 ContactPresentationModel::SetContactId(const Tizen::Social::RecordId contactId, bool isEditing)
126 result r = E_SUCCESS;
129 __pContact = __pAddressbook->GetContactN(contactId);
132 TryReturn(__pContact != null && r == E_SUCCESS, r, "[%s] selected Contact is invalid", GetErrorMessage(r));
134 IList* pList = __pContact->GetValuesN(CONTACT_MPROPERTY_ID_PHONE_NUMBERS);
140 Person* pPerson = AddressbookManager::GetInstance()->GetPersonN(__pContact->GetPersonId());
143 pList->RemoveAll(true);
149 PhoneNumber defaultNumber = pPerson->GetPrimaryPhoneNumber();
151 for (int i = 0; i < pList->GetCount(); i++)
153 PhoneNumber* pPhoneNumber = static_cast<PhoneNumber*>(pList->GetAt(i));
154 if (pPhoneNumber != null && pPhoneNumber->Equals(defaultNumber))
156 __defaultNumberIndex = i;
163 __isEditing = isEditing;
165 IList* pAssignedCategoriesList = __pAddressbook->GetCategoriesByContactN(__pContact->GetRecordId());
166 if (pAssignedCategoriesList == null)
170 IEnumerator* pEnum = pAssignedCategoriesList->GetEnumeratorN();
176 for (int index = 0; pEnum->MoveNext() == E_SUCCESS; index++)
178 Category* pCategory = static_cast<Category *>(pEnum->GetCurrent());
180 if (pCategory != null)
182 AddContactToCategory(pCategory->GetRecordId());
186 pAssignedCategoriesList->RemoveAll(true);
187 delete pAssignedCategoriesList;
191 pList->RemoveAll(true);
199 ContactPresentationModel::SetVcfPath(const Tizen::Base::String& filePath, bool isNewContact)
201 __vcfPath = filePath;
202 __newMode = isNewContact;
204 IList* pPhoneNumberList = null;
205 IList* pList = AddressbookManager::GetInstance()->ParseContactsFromVcardN(filePath);
206 result r = GetLastResult();
207 TryCatch(r == E_SUCCESS && pList != null && pList->GetCount() > 0, r = E_FAILURE, "[%s] ParseContactsFromVcardN() failed", GetErrorMessage(r));
209 __pContact = static_cast<Contact*>(pList->GetAt(0));
210 TryCatch(__pContact != null, r = E_FAILURE, "[E_FAILURE] Unable to cast Contact");
212 pPhoneNumberList = __pContact->GetValuesN(CONTACT_MPROPERTY_ID_PHONE_NUMBERS);
214 if (pPhoneNumberList != null)
216 PhoneNumber* pPhoneNumber = static_cast<PhoneNumber*>(pPhoneNumberList->GetAt(0));
217 if (pPhoneNumber != null)
219 Person* pPerson = AddressbookManager::GetInstance()->GetPersonN(__pContact->GetPersonId());
222 pPerson->SetAsPrimaryPhoneNumber(*pPhoneNumber);
227 delete pPhoneNumberList;
237 ContactPresentationModel::GetVcfPath(void)
243 ContactPresentationModel::GetContactId(void)
245 return __pContact->GetRecordId();
249 ContactPresentationModel::AddContactToCategory(Tizen::Social::RecordId categoryId)
251 result r = E_SUCCESS;
253 if (__newMode || __isEditing)
255 String* pCategoryStringId = new (std::nothrow) String();
257 pCategoryStringId->Append(categoryId);
259 r = __pAssignedCategoryList->Add(*pCategoryStringId);
263 r = AddressbookManager::GetInstance()->AddMemberToCategory(categoryId, __pContact->GetRecordId());
270 ContactPresentationModel::RemoveContactFromAllCategories(void)
272 result r = E_SUCCESS;
274 if (__newMode || __isEditing)
276 if (__pAssignedCategoryList != null)
278 __pAssignedCategoryList->RemoveAll(true);
283 TryReturn(__pContact != null, E_FAILURE, "[E_FAILURE] The contact is invalid.");
285 IList* pCategoryList = __pAddressbook->GetCategoriesByContactN(__pContact->GetRecordId());
286 TryReturn(pCategoryList != null, E_FAILURE, "Unable to get category list");
288 IEnumerator* pEnum = pCategoryList->GetEnumeratorN();
289 while (pEnum->MoveNext() == E_SUCCESS)
291 Category* pCategory = static_cast<Category*>(pEnum->GetCurrent());
292 if (pCategory != null)
294 AddressbookManager::GetInstance()->RemoveMemberFromCategory(pCategory->GetRecordId(), __pContact->GetRecordId());
299 pCategoryList->RemoveAll(true);
300 delete pCategoryList;
307 ContactPresentationModel::RemoveContact(void)
309 return __pAddressbook->RemoveContact(__pContact->GetRecordId());
313 ContactPresentationModel::IsContactRemoved(void)
315 return (__pContact ? false : true);
319 ContactPresentationModel::AddContact(void)
321 return __pAddressbook->AddContact(*__pContact);
325 ContactPresentationModel::UpdateContact(void)
327 return __pAddressbook->UpdateContact(*__pContact);
331 ContactPresentationModel::GetValue(DetailProperty id, int index)
336 TryReturn(__pContact != null, String(), "[E_FAILURE] The contact is invalid.");
340 case DETAIL_PROPERTY_GROUP:
341 returnString = GetCategory();
343 case DETAIL_PROPERTY_RINGTONE:
344 returnString = GetRingtone();
346 case DETAIL_PROPERTY_DEFAULT_PHONE_NUMBER:
348 DetailPhoneNumberType type;
349 returnString = GetDefaultNumber(type);
352 case DETAIL_PROPERTY_PHONE_NUMBER:
354 DetailPhoneNumberType type;
355 returnString = GetPhoneNumber(index, type);
358 case DETAIL_PROPERTY_EMAIL:
360 DetailEmailType type;
361 returnString = GetEmail(index, type);
364 case DETAIL_PROPERTY_IM_ADDRESS:
366 DetailImAddressType type;
367 returnString = GetImAddress(index, type);
370 case DETAIL_PROPERTY_ADDRESS: //fall through
371 case DETAIL_PROPERTY_ADDRESS_POSTAL_CODE: //fall through
372 case DETAIL_PROPERTY_ADDRESS_COUNTRY: //fall through
373 case DETAIL_PROPERTY_ADDRESS_PROVINCE: //fall through
374 case DETAIL_PROPERTY_ADDRESS_CITY: //fall through
375 case DETAIL_PROPERTY_ADDRESS_STREET:
377 DetailAddressType type;
378 returnString = GetAddress(id, index, type);
381 case DETAIL_PROPERTY_BIRTHDAY:
383 returnString = GetDateTime(id);
386 case DETAIL_PROPERTY_URL:
389 returnString = GetUrl(index, type);
392 case DETAIL_PROPERTY_NOTE:
394 IList* pList = __pContact->GetValuesN(CONTACT_MPROPERTY_ID_NOTES);
401 String* pNote = static_cast<String *>(pList->GetAt(0));
407 returnString = *pNote;
410 case DETAIL_PROPERTY_DISPLAY_NAME:
412 __pContact->GetValue(CONTACT_PROPERTY_ID_DISPLAY_NAME, returnString);
415 case DETAIL_PROPERTY_FIRST_NAME:
417 __pContact->GetValue(CONTACT_PROPERTY_ID_FIRST_NAME, returnString);
420 case DETAIL_PROPERTY_LAST_NAME:
422 __pContact->GetValue(CONTACT_PROPERTY_ID_LAST_NAME, returnString);
425 case DETAIL_PROPERTY_MIDDLE_NAME:
427 __pContact->GetValue(CONTACT_PROPERTY_ID_MIDDLE_NAME, returnString);
430 case DETAIL_PROPERTY_NICK_NAME:
432 pList = __pContact->GetValuesN(CONTACT_MPROPERTY_ID_NICKNAMES);
439 String* pNickName = static_cast<String *>(pList->GetAt(0));
440 if (pNickName == null)
445 returnString = *pNickName;
448 case DETAIL_PROPERTY_NAME_SUFFIX:
450 __pContact->GetValue(CONTACT_PROPERTY_ID_NAME_SUFFIX, returnString);
453 case DETAIL_PROPERTY_JOB_TITLE:
455 pList = __pContact->GetValuesN(CONTACT_MPROPERTY_ID_ORGANIZATIONS);
462 Organization* pOrganization = static_cast<Organization *>(pList->GetAt(0));
463 if (pOrganization == null)
468 returnString = pOrganization->GetJobTitle();
471 case DETAIL_PROPERTY_DEPARTMENT:
473 pList = __pContact->GetValuesN(CONTACT_MPROPERTY_ID_ORGANIZATIONS);
480 Organization* pOrganization = static_cast<Organization *>(pList->GetAt(0));
481 if (pOrganization == null)
486 returnString = pOrganization->GetDepartment();
489 case DETAIL_PROPERTY_COMPANY:
491 pList = __pContact->GetValuesN(CONTACT_MPROPERTY_ID_ORGANIZATIONS);
498 Organization* pOrganization = static_cast<Organization *>(pList->GetAt(0));
499 if (pOrganization == null)
504 returnString = pOrganization->GetName();
507 case DETAIL_PROPERTY_THUMBNAIL:
509 returnString = __pContact->GetThumbnailPath();
518 pList->RemoveAll(true);
526 ContactPresentationModel::GetBirthday(Tizen::Base::DateTime& value)
528 result r = E_SUCCESS;
530 TryReturn(__pContact != null, E_FAILURE, "[E_FAILURE] The contact is invalid.");
532 IList* pEventList = __pContact->GetValuesN(CONTACT_MPROPERTY_ID_EVENTS);
533 if (pEventList == null)
538 ContactEvent* pBirthday = static_cast<ContactEvent *>(pEventList->GetAt(0));
539 if (pBirthday == null)
544 value = pBirthday->GetDate();
546 pEventList->RemoveAll(true);
553 ContactPresentationModel::GetType(DetailProperty id, int index)
560 case DETAIL_PROPERTY_DEFAULT_PHONE_NUMBER:
562 DetailPhoneNumberType type;
564 value = GetDefaultNumber(type);
565 returnString = GetPhoneNumberTypeString(type);
568 case DETAIL_PROPERTY_PHONE_NUMBER:
570 DetailPhoneNumberType type;
572 value = GetPhoneNumber(index, type);
573 returnString = GetPhoneNumberTypeString(type);
576 case DETAIL_PROPERTY_EMAIL:
578 DetailEmailType type;
580 value = GetEmail(index, type);
581 returnString = GetEmailTypeString(type);
584 case DETAIL_PROPERTY_IM_ADDRESS:
586 DetailImAddressType type;
588 value = GetImAddress(index, type);
589 returnString = GetImAddressTypeString(type);
592 case DETAIL_PROPERTY_ADDRESS:
594 DetailAddressType type;
596 value = GetAddress(id, index, type);
597 returnString = GetAddressTypeString(type);
600 case DETAIL_PROPERTY_URL:
604 value = GetUrl(index, type);
605 returnString = GetUrlTypeString(type);
615 Tizen::Graphics::Bitmap*
616 ContactPresentationModel::GetThumbnailN(void)
618 TryReturn(__pContact != null, null, "[E_FAILURE] The contact is invalid.");
620 return __pContact->GetThumbnailN();
623 Tizen::Graphics::Bitmap*
624 ContactPresentationModel::GetAccountIconN(const Tizen::Base::String& account)
626 if (account.Equals(IM_ADDRESS_YAHOO, true))
628 return ResourceManager::GetBitmapN(IDB_ACCOUNT_ICON_YAHOO);
630 else if (account.Equals(IM_ADDRESS_MSN, true))
632 return ResourceManager::GetBitmapN(IDB_ACCOUNT_ICON_MSN);
634 else if (account.Equals(IM_ADDRESS_ICQ, true))
636 return ResourceManager::GetBitmapN(IDB_ACCOUNT_ICON_ICQ);
638 // else if (account.Equals(IM_ADDRESS_AIM, true))
642 // else if (account.Equals(IM_ADDRESS_SKYPE, true))
646 // else if (account.Equals(IM_ADDRESS_QQ, true))
650 // else if (account.Equals(IM_ADDRESS_GOOGLE_TALK, true))
654 // else if (account.Equals(IM_ADDRESS_JABBER, true))
660 return ResourceManager::GetBitmapN(IDB_ACCOUNT_ICON_OTHERS);
667 ContactPresentationModel::GetMultiValuesCount(DetailProperty id)
672 TryReturn(__pContact != null, returnValue, "[E_FAILURE] The contact is invalid.");
676 case DETAIL_PROPERTY_PHONE_NUMBER:
678 pList = __pContact->GetValuesN(CONTACT_MPROPERTY_ID_PHONE_NUMBERS);
681 returnValue = pList->GetCount();
685 case DETAIL_PROPERTY_EMAIL:
687 pList = __pContact->GetValuesN(CONTACT_MPROPERTY_ID_EMAILS);
690 returnValue = pList->GetCount();
694 case DETAIL_PROPERTY_IM_ADDRESS:
696 pList = __pContact->GetValuesN(CONTACT_MPROPERTY_ID_IMADDRESSES);
699 returnValue = pList->GetCount();
703 case DETAIL_PROPERTY_ADDRESS:
705 pList = __pContact->GetValuesN(CONTACT_MPROPERTY_ID_ADDRESSES);
708 returnValue = pList->GetCount();
712 case DETAIL_PROPERTY_URL:
714 pList = __pContact->GetValuesN(CONTACT_MPROPERTY_ID_URLS);
717 returnValue = pList->GetCount();
727 pList->RemoveAll(true);
735 ContactPresentationModel::GetCategoryCount(void)
737 return __pAddressbook->GetCategoryCount();
740 Tizen::Base::Collection::IList*
741 ContactPresentationModel::GetAssignedCategoryIdListN(void)
743 IEnumerator* pEnum = null;
744 ArrayList* pCategoryList = new (std::nothrow) ArrayList();
745 pCategoryList->Construct();
747 if (__newMode || __isEditing)
749 pEnum = __pAssignedCategoryList->GetEnumeratorN();
751 for (int index = 0; pEnum->MoveNext() == E_SUCCESS; index++)
753 String* pCategoryStringId = static_cast<String *>(pEnum->GetCurrent());
755 if (pCategoryStringId != null)
757 String* pRetrunCategoryStringId = new (std::nothrow) String(*pCategoryStringId);
759 pCategoryList->Add(*pRetrunCategoryStringId);
765 return pCategoryList;
769 IList* pList = __pAddressbook->GetCategoriesByContactN(__pContact->GetRecordId());
773 pEnum = pList->GetEnumeratorN();
775 for (int index = 0; pEnum->MoveNext() == E_SUCCESS; index++)
777 Category* pCategory = static_cast<Category *>(pEnum->GetCurrent());
779 if (pCategory != null)
781 String* pRetrunCategoryStringId = new (std::nothrow) String();
783 pRetrunCategoryStringId->Append(pCategory->GetRecordId());
784 pCategoryList->Add(*pRetrunCategoryStringId);
788 pList->RemoveAll(true);
793 return pCategoryList;
798 ContactPresentationModel::GetCategory(void)
802 TryReturn(__pContact != null, String(), "[E_FAILURE] The contact is invalid.");
804 if (__newMode || __isEditing)
806 IEnumerator* pEnum = __pAssignedCategoryList->GetEnumeratorN();
807 Category* pCategory = null;
808 String* pCategoryStringId = null;
811 for (int index = 0; pEnum->MoveNext() == E_SUCCESS; index++)
813 pCategoryStringId = static_cast<String*>(pEnum->GetCurrent());
815 if (pCategoryStringId != null)
817 Integer::Parse(*pCategoryStringId, categoryId);
818 pCategory = __pAddressbook->GetCategoryN(categoryId);
821 if (pCategory != null)
823 categoryName = pCategory->GetName();
824 // Not supported - if (pCategory->IsDefault())
826 GetDefaultCategoryName(categoryName);
831 returnString = categoryName;
835 returnString += L", ";
836 returnString += categoryName;
846 Category* pCategory = null;
847 IList* pCategoryList = __pAddressbook->GetCategoriesByContactN(__pContact->GetRecordId());
848 if (pCategoryList == null)
853 IEnumerator* pEnum = pCategoryList->GetEnumeratorN();
854 for (int index = 0; pEnum->MoveNext() == E_SUCCESS; index++)
856 pCategory = static_cast<Category*>(pEnum->GetCurrent());
859 if (pCategory != null)
861 categoryName = pCategory->GetName();
862 // Not supported - if (pCategory->IsDefault())
864 GetDefaultCategoryName(categoryName);
869 returnString = categoryName;
873 returnString += L", ";
874 returnString += categoryName;
880 pCategoryList->RemoveAll(true);
881 delete pCategoryList;
888 ContactPresentationModel::GetDefaultCategoryName(Tizen::Base::String& categoryName)
890 if (categoryName.Equals(DEFAULT_GROUP_FAMILY, true))
892 categoryName.Clear();
893 categoryName = ResourceManager::GetString(L"IDS_PB_BODY_DEFAULT_GROUP_FAMILY");
895 else if (categoryName.Equals(DEFAULT_GROUP_FRIENDS, true))
897 categoryName.Clear();
898 categoryName = ResourceManager::GetString(L"IDS_PB_BODY_DEFAULT_GROUP_FRIENDS");
900 else if (categoryName.Equals(DEFAULT_GROUP_COWORKERS, true))
902 categoryName.Clear();
903 categoryName = ResourceManager::GetString(L"IDS_PB_BODY_CO_WORKERS");
910 ContactPresentationModel::GetRingtone(void)
913 TryReturn(__pContact != null, String(), "[E_FAILURE] The contact is invalid.");
915 result r = __pContact->GetValue(CONTACT_PROPERTY_ID_RINGTONE, returnString);
916 TryReturn(r == E_SUCCESS, String(), "[E_FAILURE] Unable to get value");
918 if (returnString.IsEmpty())
920 returnString = ResourceManager::GetString(L"IDS_PB_BODY_DEFAULT");
926 isFileExisting = file.IsFileExist(returnString);
929 SetValue(DETAIL_PROPERTY_RINGTONE, String());
931 returnString = ResourceManager::GetString(L"IDS_PB_BODY_DEFAULT");
939 ContactPresentationModel::GetDefaultNumber(DetailPhoneNumberType& type)
941 TryReturn(__pContact != null, String(), "[E_FAILURE] The contact is invalid.");
945 IList* pList = __pContact->GetValuesN(CONTACT_MPROPERTY_ID_PHONE_NUMBERS);
946 TryReturn(pList != null, String(), "[E_FAILURE] The contact doesn't have a phone number at least.");
948 PhoneNumber* pPhoneNumber = static_cast<PhoneNumber*>(pList->GetAt(__defaultNumberIndex));
949 if (pPhoneNumber != null)
951 returnString = pPhoneNumber->GetPhoneNumber();
952 if (returnString.Contains(CHARACTER_HYPHEN))
954 returnString.Replace(CHARACTER_HYPHEN, CHARACTER_EMPTY);
956 type = (DetailPhoneNumberType)pPhoneNumber->GetType();
959 pList->RemoveAll(true);
966 ContactPresentationModel::GetDefaultNumberIndex(void)
968 return __defaultNumberIndex;
972 ContactPresentationModel::GetPhoneNumber(int index, DetailPhoneNumberType& type)
976 TryReturn(__pContact != null, String(), "[E_FAILURE] The contact is invalid.");
983 IList* pPhoneNumberList = __pContact->GetValuesN(CONTACT_MPROPERTY_ID_PHONE_NUMBERS);
984 AppAssert(pPhoneNumberList);
986 PhoneNumber* pNumber = static_cast<PhoneNumber *>(pPhoneNumberList->GetAt(index));
989 returnString = pNumber->GetPhoneNumber();
991 if (returnString.Contains(CHARACTER_HYPHEN))
993 returnString.Replace(CHARACTER_HYPHEN, CHARACTER_EMPTY);
995 type = (DetailPhoneNumberType)pNumber->GetType();
998 pPhoneNumberList->RemoveAll(true);
999 delete pPhoneNumberList;
1001 return returnString;
1005 ContactPresentationModel::GetEmail(int index, DetailEmailType& type)
1007 String returnString;
1009 TryReturn(__pContact != null, String(), "[E_FAILURE] The contact is invalid.");
1013 return returnString;
1016 IList* pEmailList = __pContact->GetValuesN(CONTACT_MPROPERTY_ID_EMAILS);
1017 AppAssert(pEmailList);
1019 Email* pEmail = static_cast<Email *>(pEmailList->GetAt(index));
1022 returnString = pEmail->GetEmail();
1023 type = (DetailEmailType)pEmail->GetType();
1026 pEmailList->RemoveAll(true);
1029 return returnString;
1033 ContactPresentationModel::GetImAddress(int index, DetailImAddressType& type)
1035 String returnString;
1037 TryReturn(__pContact != null, String(), "[E_FAILURE] The contact is invalid.");
1041 return returnString;
1044 IList* pImAddressList = __pContact->GetValuesN(CONTACT_MPROPERTY_ID_IMADDRESSES);
1045 AppAssert(pImAddressList);
1047 ImAddress* pImAddress = static_cast<ImAddress *>(pImAddressList->GetAt(index));
1048 if (pImAddress != null)
1050 returnString = pImAddress->GetImAddress();
1052 String typeString = pImAddress->GetServiceProviderName();
1054 if (typeString.Equals(IM_ADDRESS_AIM, true))
1056 type = DETAIL_IM_ADDRESS_TYPE_AIM;
1058 else if (typeString.Equals(IM_ADDRESS_MSN, true))
1060 type = DETAIL_IM_ADDRESS_TYPE_MSN;
1062 else if (typeString.Equals(IM_ADDRESS_YAHOO, true))
1064 type = DETAIL_IM_ADDRESS_TYPE_YAHOO;
1066 else if (typeString.Equals(IM_ADDRESS_SKYPE, true))
1068 type = DETAIL_IM_ADDRESS_TYPE_SKYPE;
1070 else if (typeString.Equals(IM_ADDRESS_QQ, true))
1072 type = DETAIL_IM_ADDRESS_TYPE_QQ;
1074 else if (typeString.Equals(IM_ADDRESS_GOOGLE_TALK, true))
1076 type = DETAIL_IM_ADDRESS_TYPE_GOOGLE_TALK;
1078 else if (typeString.Equals(IM_ADDRESS_ICQ, true))
1080 type = DETAIL_IM_ADDRESS_TYPE_ICQ;
1082 else if (typeString.Equals(IM_ADDRESS_JABBER, true))
1084 type = DETAIL_IM_ADDRESS_TYPE_JABBER;
1088 type = DETAIL_IM_ADDRESS_TYPE_OTHER;
1092 pImAddressList->RemoveAll(true);
1093 delete pImAddressList;
1095 return returnString;
1099 ContactPresentationModel::GetAddress(DetailProperty id, int index, DetailAddressType& type)
1101 String returnString;
1103 TryReturn(__pContact != null, String(), "[E_FAILURE] The contact is invalid.");
1107 return returnString;
1110 IList* pAddressList = __pContact->GetValuesN(CONTACT_MPROPERTY_ID_ADDRESSES);
1111 AppAssert(pAddressList);
1113 Address* pAddress = static_cast<Address *>(pAddressList->GetAt(index));
1114 if (pAddress != null)
1116 String street = pAddress->GetStreet();
1117 String city = pAddress->GetCity();
1118 String state = pAddress->GetState();
1119 String country = pAddress->GetCountry();
1120 String postalCode = pAddress->GetPostalCode();
1124 case DETAIL_PROPERTY_ADDRESS_POSTAL_CODE:
1125 returnString = postalCode;
1127 case DETAIL_PROPERTY_ADDRESS_COUNTRY:
1128 returnString = country;
1130 case DETAIL_PROPERTY_ADDRESS_PROVINCE:
1131 returnString = state;
1133 case DETAIL_PROPERTY_ADDRESS_CITY:
1134 returnString = city;
1136 case DETAIL_PROPERTY_ADDRESS_STREET:
1137 returnString = street;
1139 case DETAIL_PROPERTY_ADDRESS:
1140 if (postalCode.IsEmpty() == false)
1142 returnString.Append(postalCode);
1143 returnString.Append(CHARACTER_SPACE);
1145 if (country.IsEmpty() == false)
1147 returnString.Append(country);
1148 returnString.Append(CHARACTER_SPACE);
1150 if (state.IsEmpty() == false)
1152 returnString.Append(state);
1153 returnString.Append(CHARACTER_SPACE);
1155 if (city.IsEmpty() == false)
1157 returnString.Append(city);
1158 returnString.Append(CHARACTER_SPACE);
1160 if (street.IsEmpty() == false)
1162 returnString.Append(street);
1169 type = (DetailAddressType)pAddress->GetType();
1172 pAddressList->RemoveAll(true);
1173 delete pAddressList;
1175 return returnString;
1179 ContactPresentationModel::GetDateTime(DetailProperty id)
1181 result r = E_SUCCESS;
1182 String returnString;
1186 DateTimeSymbols dateTimeSymbols;
1188 r = dateTimeSymbols.Construct(CALENDAR_GREGORIAN);
1189 TryReturn(r == E_SUCCESS, String(), "[E_FAILURE] Given locale is not supported.");
1190 const IList* pMonthList = dateTimeSymbols.GetShortMonths();
1192 TryReturn(__pContact != null, String(), "[E_FAILURE] The contact is invalid.");
1194 DateTime* pDateTime = new (std::nothrow) DateTime();
1196 if (id == DETAIL_PROPERTY_BIRTHDAY)
1198 const Object* pGettingMonth = null;
1200 r = GetBirthday(*pDateTime);
1201 TryCatch(r == E_SUCCESS, , "[%s] Unable to get value", GetErrorMessage(r));
1203 day = pDateTime->GetDay();
1204 year = pDateTime->GetYear();
1206 pGettingMonth = pMonthList->GetAt(pDateTime->GetMonth() - 1);
1207 TryCatch(pGettingMonth != null, , "[E_FAILURE] Unable to get a month", GetErrorMessage(r));
1209 month.Append(*static_cast<String*>(const_cast<Object*>(pGettingMonth)));
1211 returnString.Append(day);
1212 returnString.Append(CHARACTER_SPACE);
1213 returnString.Append(month);
1214 returnString.Append(CHARACTER_SPACE);
1215 returnString.Append(year);
1221 return returnString;
1225 ContactPresentationModel::GetUrl(int index, DetailUrlType& type)
1227 String returnString;
1229 TryReturn(__pContact != null, String(), "[E_FAILURE] The contact is invalid.");
1231 IList* pUrlList = __pContact->GetValuesN(CONTACT_MPROPERTY_ID_URLS);
1232 if (pUrlList == null)
1234 return returnString;
1237 Url* pUrl = static_cast<Url*>(pUrlList->GetAt(index));
1240 returnString = pUrl->GetUrl();
1241 type = (DetailUrlType)pUrl->GetType();
1244 pUrlList->RemoveAll(true);
1247 return returnString;
1251 ContactPresentationModel::AddContactChangeListener(const IContactEventListener& listener)
1253 __pContactListenerList->Add(listener);
1257 ContactPresentationModel::RemoveContactChangeListener(const IContactEventListener& listener)
1259 __pContactListenerList->Remove(listener, false);
1263 ContactPresentationModel::OnContactsChanged(const Tizen::Base::Collection::IList& contactChangeInfoList)
1265 if (__newMode == false && __isEditing == false)
1267 if (__pContact != null)
1269 SetContactId(__pContact->GetRecordId());
1272 else if (__isEditing)
1274 IEnumerator* pEnum = contactChangeInfoList.GetEnumeratorN();
1276 if (pEnum != null && __pContact != null)
1278 while (pEnum->MoveNext() == E_SUCCESS)
1280 const ContactChangeInfo* pChangeInfo = static_cast<const ContactChangeInfo *>(pEnum->GetCurrent());
1282 if (pChangeInfo != null && pChangeInfo->GetChangeType() == RECORD_CHANGE_TYPE_REMOVED && __pContact->GetRecordId() == pChangeInfo->GetContactId())
1284 SetContactId(INVALID_RECORD_ID);
1292 IContactEventListener* pInterface = null;
1293 IEnumerator* pEnum = __pContactListenerList->GetEnumeratorN();
1294 while(pEnum->MoveNext() == E_SUCCESS)
1296 pInterface = static_cast<IContactEventListener*>(pEnum->GetCurrent());
1297 if (pInterface == null)
1302 pInterface->OnContactsChanged();
1309 ContactPresentationModel::OnCategoriesChanged(const Tizen::Base::Collection::IList& categoryChangeInfoList)
1311 IContactEventListener* pInterface = null;
1312 IEnumerator* pEnum = __pContactListenerList->GetEnumeratorN();
1313 while(pEnum->MoveNext() == E_SUCCESS)
1315 pInterface = static_cast<IContactEventListener*>(pEnum->GetCurrent());
1316 if (pInterface == null)
1321 pInterface->OnCategoriesChanged();
1328 ContactPresentationModel::SetValue(DetailProperty id, const Tizen::Base::String& value, int index)
1330 result r = E_SUCCESS;
1332 TryReturn(__pContact != null, E_FAILURE, "[E_FAILURE] The contact is invalid.");
1334 String trimmedString(value);
1335 trimmedString.Trim();
1337 Email email = Email();
1338 ImAddress imAddress = ImAddress();
1340 PhoneNumber phoneNumber = PhoneNumber();
1344 case DETAIL_PROPERTY_RINGTONE:
1346 r = __pContact->SetValue(CONTACT_PROPERTY_ID_RINGTONE, trimmedString);
1349 case DETAIL_PROPERTY_DEFAULT_PHONE_NUMBER:
1351 __defaultNumberIndex = index;
1354 case DETAIL_PROPERTY_PHONE_NUMBER:
1356 r = SetPhoneNumber(DETAIL_PHONENUMBER_TYPE_MOBILE, trimmedString, index);
1359 case DETAIL_PROPERTY_EMAIL:
1361 r = SetEmail(DETAIL_EMAIL_TYPE_HOME, trimmedString, index);
1364 case DETAIL_PROPERTY_IM_ADDRESS:
1366 r = SetImAddress(DETAIL_IM_ADDRESS_TYPE_MSN, trimmedString, index);
1369 case DETAIL_PROPERTY_ADDRESS: //fall through
1370 case DETAIL_PROPERTY_ADDRESS_POSTAL_CODE: //fall through
1371 case DETAIL_PROPERTY_ADDRESS_COUNTRY: //fall through
1372 case DETAIL_PROPERTY_ADDRESS_PROVINCE: //fall through
1373 case DETAIL_PROPERTY_ADDRESS_CITY: //fall through
1374 case DETAIL_PROPERTY_ADDRESS_STREET:
1376 SetAddress(id, trimmedString);
1377 __pContact->RemoveAt(CONTACT_MPROPERTY_ID_ADDRESSES, index);
1378 r = __pContact->SetAddressAt(index, __address);
1381 r = __pContact->AddAddress(__address);
1385 case DETAIL_PROPERTY_URL:
1387 SetUrl(DETAIL_URL_TYPE_HOME, trimmedString, index);
1390 case DETAIL_PROPERTY_NOTE:
1392 if (value.IsEmpty() == true)
1394 r = __pContact->RemoveAt(CONTACT_MPROPERTY_ID_NOTES, index);
1399 r = __pContact->SetNoteAt(index, value);
1402 r = __pContact->AddNote(value);
1406 case DETAIL_PROPERTY_DISPLAY_NAME:
1408 r = __pContact->SetValue(CONTACT_PROPERTY_ID_DISPLAY_NAME, trimmedString);
1411 case DETAIL_PROPERTY_FIRST_NAME:
1413 r = __pContact->SetValue(CONTACT_PROPERTY_ID_FIRST_NAME, trimmedString);
1416 case DETAIL_PROPERTY_LAST_NAME:
1418 r = __pContact->SetValue(CONTACT_PROPERTY_ID_LAST_NAME, trimmedString);
1421 case DETAIL_PROPERTY_MIDDLE_NAME:
1423 r = __pContact->SetValue(CONTACT_PROPERTY_ID_MIDDLE_NAME, trimmedString);
1426 case DETAIL_PROPERTY_NICK_NAME:
1428 if (trimmedString.IsEmpty() == true)
1430 r = __pContact->RemoveAt(CONTACT_MPROPERTY_ID_NICKNAMES, index);
1435 r = __pContact->SetNicknameAt(index, trimmedString);
1438 r = __pContact->AddNickname(trimmedString);
1442 case DETAIL_PROPERTY_NAME_SUFFIX:
1444 r = __pContact->SetValue(CONTACT_PROPERTY_ID_NAME_SUFFIX, trimmedString);
1447 case DETAIL_PROPERTY_JOB_TITLE:
1449 r = SetOrganization(DETAIL_PROPERTY_JOB_TITLE, trimmedString);
1452 case DETAIL_PROPERTY_DEPARTMENT:
1454 r = SetOrganization(DETAIL_PROPERTY_DEPARTMENT, trimmedString);
1457 case DETAIL_PROPERTY_COMPANY:
1459 r = SetOrganization(DETAIL_PROPERTY_COMPANY, trimmedString);
1470 ContactPresentationModel::AddAddressBook(void)
1472 result r = E_SUCCESS;
1474 if (__newMode == true)
1478 RecordId newPersonId;
1479 AddressbookManager* pAddressbookManager = AddressbookManager::GetInstance();
1480 IList* pList = pAddressbookManager->GetContactsByPersonN(__pContact->GetPersonId());
1482 if (pList != null && pList->GetCount() > 1)
1484 r = pAddressbookManager->UnlinkContact(__pContact->GetPersonId(), __pContact->GetRecordId(), newPersonId);
1491 r = UpdateContact();
1496 IList* pList = __pContact->GetValuesN(CONTACT_MPROPERTY_ID_PHONE_NUMBERS);
1497 TryReturn(pList != null, r, "[E_FAILURE] The contact doesn't have a phone number at least.");
1499 PhoneNumber* pPhoneNumber = static_cast<PhoneNumber*>(pList->GetAt(__defaultNumberIndex));
1500 if (pPhoneNumber != null)
1502 Person* pPerson = AddressbookManager::GetInstance()->GetPersonN(__pContact->GetPersonId());
1503 if (pPerson != null)
1505 pPerson->SetAsPrimaryPhoneNumber(*pPhoneNumber);
1510 pList->RemoveAll(true);
1514 if (__newMode || __isEditing)
1516 if (__isEditing == true)
1518 __isEditing = false;
1519 RemoveContactFromAllCategories();
1523 IEnumerator* pEnum = __pAssignedCategoryList->GetEnumeratorN();
1524 String* pCategoryStringId = null;
1525 RecordId categoryId;
1527 while (pEnum->MoveNext() == E_SUCCESS)
1529 pCategoryStringId = static_cast<String*>(pEnum->GetCurrent());
1531 if (pCategoryStringId != null)
1533 Integer::Parse(*pCategoryStringId, categoryId);
1534 r = __pAddressbook->AddMemberToCategory(categoryId, __pContact->GetRecordId());
1544 ContactPresentationModel::SetAddress(DetailProperty id, const Tizen::Base::String& value)
1546 result r = E_SUCCESS;
1550 case DETAIL_PROPERTY_ADDRESS_POSTAL_CODE:
1551 r = __address.SetPostalCode(value);
1553 case DETAIL_PROPERTY_ADDRESS_COUNTRY:
1554 r = __address.SetCountry(value);
1556 case DETAIL_PROPERTY_ADDRESS_PROVINCE:
1557 r = __address.SetState(value);
1559 case DETAIL_PROPERTY_ADDRESS_CITY:
1560 r = __address.SetCity(value);
1562 case DETAIL_PROPERTY_ADDRESS_STREET:
1563 r = __address.SetStreet(value);
1573 ContactPresentationModel::SetBirthday(const Tizen::Base::DateTime& value)
1575 result r = E_SUCCESS;
1577 TryReturn(__pContact != null, E_FAILURE, "[E_FAILURE] The contact is invalid.");
1579 ContactEvent birthday;
1580 birthday.SetDate(value);
1582 r = __pContact->SetEventAt(0, birthday);
1585 r = __pContact->AddEvent(birthday);
1592 ContactPresentationModel::SetPhoneNumber(DetailPhoneNumberType type, const Tizen::Base::String& value, int index)
1594 result r = E_SUCCESS;
1598 __lastRemovedContactIndex=-1;
1601 if (value.IsEmpty() == true)
1603 r = __pContact->RemoveAt(CONTACT_MPROPERTY_ID_PHONE_NUMBERS, index);
1604 __lastRemovedContactIndex=index;
1606 if(index == __defaultNumberIndex)
1610 __defaultNumberIndex = __defaultNumberIndex-1;
1617 PhoneNumber phoneNumber;
1618 phoneNumber.SetPhoneNumber(value);
1619 phoneNumber.SetType((PhoneNumberType)type);
1621 if(__lastRemovedContactIndex!=-1 && index>__lastRemovedContactIndex)
1623 r = __pContact->SetPhoneNumberAt(index-1, phoneNumber);
1627 r = __pContact->SetPhoneNumberAt(index, phoneNumber);
1632 r = __pContact->AddPhoneNumber(phoneNumber);
1639 ContactPresentationModel::SetEmail(DetailEmailType type, const Tizen::Base::String& value, int index)
1641 result r = E_SUCCESS;
1645 __lastRemovedEmailIndex = -1;
1648 if (value.IsEmpty() == true)
1650 r = __pContact->RemoveAt(CONTACT_MPROPERTY_ID_EMAILS, index);
1651 __lastRemovedEmailIndex = index;
1657 email.SetEmail(value);
1658 email.SetType((EmailType)type);
1661 if (__lastRemovedEmailIndex >= 0 && __lastRemovedEmailIndex < index)
1663 r = __pContact->SetEmailAt(index - 1, email);
1667 r = __pContact->SetEmailAt(index, email);
1673 r = __pContact->AddEmail(email);
1680 ContactPresentationModel::SetAddress(DetailAddressType type, const Tizen::Base::String& value, int index)
1682 result r = E_SUCCESS;
1684 if (value.IsEmpty() == true)
1686 r = __pContact->RemoveAt(CONTACT_MPROPERTY_ID_ADDRESSES, index);
1692 address.SetType((AddressType)type);
1694 r = __pContact->SetAddressAt(index, address);
1697 r = __pContact->AddAddress(__address);
1704 ContactPresentationModel::SetUrl(DetailUrlType type, const Tizen::Base::String& value, int index)
1706 result r = E_SUCCESS;
1708 if (value.IsEmpty() == true)
1710 r = __pContact->RemoveAt(CONTACT_MPROPERTY_ID_URLS, index);
1716 url.SetType(UrlType(type));
1719 r = __pContact->SetUrlAt(index, url);
1722 r = __pContact->AddUrl(url);
1729 ContactPresentationModel::SetImAddress(DetailImAddressType type, const Tizen::Base::String& value, int index)
1731 result r = E_SUCCESS;
1733 if (value.IsEmpty() == true)
1735 r = __pContact->RemoveAt(CONTACT_MPROPERTY_ID_IMADDRESSES, index);
1740 ImAddress imAddress;
1741 imAddress.SetImAddress(value);
1742 imAddress.SetServiceProviderName(GetImAddressTypeString(type));
1743 r = __pContact->SetImAddressAt(index, imAddress);
1747 r = __pContact->AddImAddress(imAddress);
1754 ContactPresentationModel::SetThumbnail(const Tizen::Base::String& filePath)
1756 result r = E_SUCCESS;
1758 TryReturn(__pContact != null, E_FAILURE, "[E_FAILURE] The contact is invalid.");
1760 r = __pContact->SetThumbnail(filePath);
1766 ContactPresentationModel::SetOrganization(DetailProperty id, const Tizen::Base::String& value)
1768 TryReturn((id >= DETAIL_PROPERTY_JOB_TITLE && id <= DETAIL_PROPERTY_COMPANY), E_FAILURE, "[E_FAILURE] Unable to set the specific id");
1770 result r = E_SUCCESS;
1772 IList* pList = __pContact->GetValuesN(CONTACT_MPROPERTY_ID_ORGANIZATIONS);
1779 if (pList->GetCount() == 0)
1781 if (value.IsEmpty())
1786 Organization organization;
1790 case DETAIL_PROPERTY_JOB_TITLE:
1792 organization.SetJobTitle(value);
1795 case DETAIL_PROPERTY_DEPARTMENT:
1797 organization.SetDepartment(value);
1800 case DETAIL_PROPERTY_COMPANY:
1802 organization.SetName(value);
1807 r = __pContact->AddOrganization(organization);
1811 Organization* pOrganization = static_cast<Organization *>(pList->GetAt(0));
1812 if (pOrganization == null)
1819 case DETAIL_PROPERTY_JOB_TITLE:
1821 pOrganization->SetJobTitle(value);
1824 case DETAIL_PROPERTY_DEPARTMENT:
1826 pOrganization->SetDepartment(value);
1829 case DETAIL_PROPERTY_COMPANY:
1831 pOrganization->SetName(value);
1836 if (pOrganization->GetJobTitle().IsEmpty() && pOrganization->GetDepartment().IsEmpty() && pOrganization->GetName().IsEmpty())
1838 r = __pContact->RemoveAt(CONTACT_MPROPERTY_ID_ORGANIZATIONS, 0);
1842 if (value.IsEmpty())
1844 r = __pContact->RemoveAt(CONTACT_MPROPERTY_ID_ORGANIZATIONS, 0);
1848 r = __pContact->AddOrganization(*pOrganization);
1853 r = __pContact->SetOrganizationAt(0, *pOrganization);
1858 pList->RemoveAll(true);
1865 ContactPresentationModel::GetPhoneNumberTypeString(DetailPhoneNumberType type)
1867 String returnString;
1871 case DETAIL_PHONENUMBER_TYPE_HOME:
1873 returnString = ResourceManager::GetString(L"IDS_PB_BODY_HOME");
1876 case DETAIL_PHONENUMBER_TYPE_WORK:
1878 returnString = ResourceManager::GetString(L"IDS_PB_BODY_WORK");
1881 case DETAIL_PHONENUMBER_TYPE_MOBILE:
1883 returnString = ResourceManager::GetString(L"IDS_PB_BODY_MOBILE");
1886 case DETAIL_PHONENUMBER_TYPE_HOME_FAX:
1888 returnString = ResourceManager::GetString(L"IDS_PB_BODY_FAX_HHOME");
1891 case DETAIL_PHONENUMBER_TYPE_WORK_FAX:
1893 returnString = ResourceManager::GetString(L"IDS_PB_BODY_FAX_HWORK");
1896 case DETAIL_PHONENUMBER_TYPE_PAGER:
1898 returnString = ResourceManager::GetString(L"IDS_PB_BODY_PAGER");
1901 case DETAIL_PHONENUMBER_TYPE_OTHER:
1903 returnString = ResourceManager::GetString(L"IDS_PB_BODY_OTHER");
1908 return returnString;
1912 ContactPresentationModel::GetEmailTypeString(DetailEmailType type)
1914 String returnString;
1918 case DETAIL_EMAIL_TYPE_HOME:
1920 returnString = ResourceManager::GetString(L"IDS_PB_BODY_HOME");
1923 case DETAIL_EMAIL_TYPE_WORK:
1925 returnString = ResourceManager::GetString(L"IDS_PB_BODY_WORK");
1928 case DETAIL_EMAIL_TYPE_OTHER:
1930 returnString = ResourceManager::GetString(L"IDS_PB_BODY_OTHER");
1935 return returnString;
1939 ContactPresentationModel::GetAddressTypeString(DetailAddressType type)
1941 String returnString;
1945 case DETAIL_ADDRESS_TYPE_HOME:
1947 returnString = ResourceManager::GetString(L"IDS_PB_BODY_HOME");
1950 case DETAIL_ADDRESS_TYPE_WORK:
1952 returnString = ResourceManager::GetString(L"IDS_PB_BODY_WORK");
1955 case DETAIL_ADDRESS_TYPE_OTHER:
1957 returnString = ResourceManager::GetString(L"IDS_PB_BODY_OTHER");
1962 return returnString;
1966 ContactPresentationModel::GetUrlTypeString(DetailUrlType type)
1968 String returnString;
1972 case DETAIL_URL_TYPE_HOME:
1974 returnString = ResourceManager::GetString(L"IDS_PB_BODY_HOME");
1977 case DETAIL_URL_TYPE_WORK:
1979 returnString = ResourceManager::GetString(L"IDS_PB_BODY_WORK");
1982 case DETAIL_URL_TYPE_OTHER:
1984 returnString = ResourceManager::GetString(L"IDS_PB_BODY_OTHER");
1989 return returnString;
1993 ContactPresentationModel::GetImAddressTypeString(DetailImAddressType type)
1995 String returnString;
1999 case DETAIL_IM_ADDRESS_TYPE_AIM:
2001 returnString = IM_ADDRESS_AIM;
2004 case DETAIL_IM_ADDRESS_TYPE_MSN:
2006 returnString = IM_ADDRESS_MSN;
2009 case DETAIL_IM_ADDRESS_TYPE_YAHOO:
2011 returnString = IM_ADDRESS_YAHOO;
2014 case DETAIL_IM_ADDRESS_TYPE_SKYPE:
2016 returnString = IM_ADDRESS_SKYPE;
2019 case DETAIL_IM_ADDRESS_TYPE_QQ:
2021 returnString = IM_ADDRESS_QQ;
2024 case DETAIL_IM_ADDRESS_TYPE_GOOGLE_TALK:
2026 returnString = IM_ADDRESS_GOOGLE_TALK;
2029 case DETAIL_IM_ADDRESS_TYPE_ICQ:
2031 returnString = IM_ADDRESS_ICQ;
2034 case DETAIL_IM_ADDRESS_TYPE_JABBER:
2036 returnString = IM_ADDRESS_JABBER;
2039 case DETAIL_IM_ADDRESS_TYPE_OTHER:
2041 returnString = ResourceManager::GetString(L"IDS_PB_BODY_OTHER");
2046 return returnString;
2049 DetailPhoneNumberType
2050 ContactPresentationModel::GetPhoneNumberType(int index)
2052 DetailPhoneNumberType type;
2055 value = GetPhoneNumber(index, type);
2061 ContactPresentationModel::GetEmailType(int index)
2063 DetailEmailType type;
2066 value = GetEmail(index, type);
2072 ContactPresentationModel::GetAddressType(DetailProperty id, int index)
2074 DetailAddressType type;
2077 value = GetAddress(id, index, type);
2083 ContactPresentationModel::GetUrlType(int index)
2088 value = GetUrl(index, type);
2094 ContactPresentationModel::GetImAddressType(int index)
2096 DetailImAddressType type;
2099 value = GetImAddress(index, type);
2105 ContactPresentationModel::SetAsFavorite(bool isFavorite)
2107 AddressbookManager::GetInstance()->SetPersonAsFavorite(__pContact->GetPersonId(), isFavorite);
2111 ContactPresentationModel::IsFavorite(void)
2113 bool isFavorite = false;
2114 PersonId personId = __pContact->GetPersonId();
2116 Person* pPerson = AddressbookManager::GetInstance()->GetPersonN(personId);
2117 if (pPerson == null)
2122 isFavorite = pPerson->IsFavorite();