DCM-1707
authorGwangbok Kim <gwangbok.kim@samsung.com>
Fri, 7 Jun 2013 11:37:41 +0000 (20:37 +0900)
committerGwangbok Kim <gwangbok.kim@samsung.com>
Fri, 7 Jun 2013 11:37:41 +0000 (20:37 +0900)
Change-Id: Iba2d6b05f62a8560e90495f0541bd1bf55992595
Signed-off-by: Gwangbok Kim <gwangbok.kim@samsung.com>
src/FScl_ContactImpl.cpp
src/FScl_PhoneNumberImpl.cpp
src/FScl_PhoneNumberImpl.h

index 39b6464..fd6177d 100644 (file)
@@ -2256,6 +2256,7 @@ _ContactImpl::SetPhoneNumberAt(int index, const PhoneNumber& phoneNumber)
        int type = 0;
        int oriType = 0;
        PhoneNumberType phoneNumberType = PHONENUMBER_TYPE_HOME;
+       bool isChanged = false;
 
        contacts_record_get_child_record_count(__contactHandle, _contacts_contact.number, &count);
        SysTryReturn(NID_SCL, count > (unsigned int) index, E_OUT_OF_RANGE, E_OUT_OF_RANGE, "[%s] index=%d must be less than the current count(%d) of phone numbers.", GetErrorMessage(E_OUT_OF_RANGE), index, count);
@@ -2292,8 +2293,14 @@ _ContactImpl::SetPhoneNumberAt(int index, const PhoneNumber& phoneNumber)
                        type = CONTACTS_NUMBER_TYPE_ASSISTANT;
                        break;
                case PHONENUMBER_TYPE_OTHER:
-                       contacts_record_get_int(recordHandle, _contacts_number.type, &oriType);
+                       isChanged = _PhoneNumberImpl::GetInstance(phoneNumber)->IsPhoneNumberTypeChanged();
+                       if (isChanged)
+                       {
+                               type = CONTACTS_NUMBER_TYPE_OTHER;
+                               break;
+                       }
 
+                       contacts_record_get_int(recordHandle, _contacts_number.type, &oriType);
                        phoneNumberType = GetNativePhoneNumberType(oriType);
                        if (phoneNumberType == PHONENUMBER_TYPE_OTHER)
                        {
index fade7ea..76c2ca0 100644 (file)
@@ -34,6 +34,7 @@ namespace Tizen { namespace Social
 _PhoneNumberImpl::_PhoneNumberImpl(void)
 : __recordId(-1)
 , __type(PHONENUMBER_TYPE_HOME)
+, __isPhoneTypeChanged(false)
 {
 
 }
@@ -42,6 +43,7 @@ _PhoneNumberImpl::_PhoneNumberImpl(PhoneNumberType type, const String& number)
 : __recordId(-1)
 , __type(type)
 , __number(number)
+, __isPhoneTypeChanged(false)
 {
 
 }
@@ -52,11 +54,11 @@ _PhoneNumberImpl::_PhoneNumberImpl(const _PhoneNumberImpl& rhs)
        __type = rhs.__type;
        __label = rhs.__label;
        __number = rhs.__number;
+       __isPhoneTypeChanged = rhs.__isPhoneTypeChanged;
 }      
 
 _PhoneNumberImpl::~_PhoneNumberImpl(void)
 {
-
 }
 
 _PhoneNumberImpl&
@@ -71,6 +73,7 @@ _PhoneNumberImpl::operator =(const _PhoneNumberImpl& rhs)
        __type = rhs.__type;
        __label = rhs.__label;
        __number = rhs.__number;
+       __isPhoneTypeChanged = rhs.__isPhoneTypeChanged;
 
        return *this;
 }
@@ -132,6 +135,7 @@ void
 _PhoneNumberImpl::SetType(PhoneNumberType type)
 {
        __type = type;
+       __isPhoneTypeChanged = true;
 }
 
 result
@@ -174,6 +178,12 @@ _PhoneNumberImpl::IsEmpty(void) const
        return __number.IsEmpty();
 }
 
+bool
+_PhoneNumberImpl::IsPhoneNumberTypeChanged(void) const
+{
+       return __isPhoneTypeChanged;
+}
+
 _PhoneNumberImpl*
 _PhoneNumberImpl::GetInstance(PhoneNumber& phoneNumber)
 {
index b99c3e4..edd822c 100644 (file)
@@ -70,7 +70,6 @@ public:
 
        result SetPhoneNumber(const Tizen::Base::String& number);
 
-
        // getter
        int GetRecordId(void) const;
 
@@ -82,6 +81,8 @@ public:
 
        bool IsEmpty(void) const;
 
+       bool IsPhoneNumberTypeChanged(void) const;
+
        static _PhoneNumberImpl* GetInstance(PhoneNumber& phoneNUmber);
 
        static const _PhoneNumberImpl* GetInstance(const PhoneNumber& phoneNUmber);
@@ -98,6 +99,7 @@ private:
        PhoneNumberType __type;
        Tizen::Base::String __label;
        Tizen::Base::String __number;
+       bool __isPhoneTypeChanged;
 }; // _PhoneNumberImpl
 
 }} // Tizen::Social