phonebookui/Phonebook2/spbcontentprovider/src/spbphonenumberparser.cpp
branchRCL_3
changeset 3 04ab22b956c2
parent 0 e686773b3f54
child 14 81f8547efd4f
equal deleted inserted replaced
0:e686773b3f54 3:04ab22b956c2
    84         MVPbkContactOperationBase& /*aOperation*/,
    84         MVPbkContactOperationBase& /*aOperation*/,
    85         MVPbkStoreContact* aContact )
    85         MVPbkStoreContact* aContact )
    86     {
    86     {
    87     delete iOperation;
    87     delete iOperation;
    88     iOperation = NULL;
    88     iOperation = NULL;
    89     TRAPD( err, SolvePhoneNumberL( *aContact ) );
    89     TRAP_IGNORE( SolvePhoneNumberL( *aContact ) );
    90 	if( err )
       
    91 		{
       
    92 		//TODO error handling
       
    93 		}
       
    94 	delete aContact;
    90 	delete aContact;
    95     }
    91     }
    96 
    92 
    97 // ---------------------------------------------------------------------------
    93 // ---------------------------------------------------------------------------
    98 // CSpbPhoneNumberParser::VPbkSingleContactOperationFailed
    94 // CSpbPhoneNumberParser::VPbkSingleContactOperationFailed
   102         MVPbkContactOperationBase& /*aOperation*/, 
    98         MVPbkContactOperationBase& /*aOperation*/, 
   103         TInt /*aError*/ )
    99         TInt /*aError*/ )
   104     {
   100     {
   105     delete iOperation;
   101     delete iOperation;
   106     iOperation = NULL;
   102     iOperation = NULL;
   107     iContent.PhoneNumberUpdatedL(KNullDesC());
   103     TRAP_IGNORE( iContent.PhoneNumberUpdatedL( 
       
   104             KNullDesC, CSpbContentProvider::ETypePhoneNumber ) );
   108     }
   105     }
   109 
   106 
   110 // ---------------------------------------------------------------------------
   107 // ---------------------------------------------------------------------------
   111 // CSpbPhoneNumberParser::SolvePhoneNumberL
   108 // CSpbPhoneNumberParser::SolvePhoneNumberL
   112 // ---------------------------------------------------------------------------
   109 // ---------------------------------------------------------------------------
   157 						fieldType->FieldTypeResId() == R_VPBK_FIELD_TYPE_LANDPHONEWORK   ||
   154 						fieldType->FieldTypeResId() == R_VPBK_FIELD_TYPE_LANDPHONEWORK   ||
   158 						fieldType->FieldTypeResId() == R_VPBK_FIELD_TYPE_MOBILEPHONEWORK ||
   155 						fieldType->FieldTypeResId() == R_VPBK_FIELD_TYPE_MOBILEPHONEWORK ||
   159 						fieldType->FieldTypeResId() == R_VPBK_FIELD_TYPE_VIDEONUMBERWORK ||
   156 						fieldType->FieldTypeResId() == R_VPBK_FIELD_TYPE_VIDEONUMBERWORK ||
   160 						fieldType->FieldTypeResId() == R_VPBK_FIELD_TYPE_LANDPHONEGEN    ||
   157 						fieldType->FieldTypeResId() == R_VPBK_FIELD_TYPE_LANDPHONEGEN    ||
   161 						fieldType->FieldTypeResId() == R_VPBK_FIELD_TYPE_MOBILEPHONEGEN  ||
   158 						fieldType->FieldTypeResId() == R_VPBK_FIELD_TYPE_MOBILEPHONEGEN  ||
   162 						fieldType->FieldTypeResId() == R_VPBK_FIELD_TYPE_VIDEONUMBERGEN )
   159 						fieldType->FieldTypeResId() == R_VPBK_FIELD_TYPE_VIDEONUMBERGEN  ||
       
   160                         fieldType->FieldTypeResId() == R_VPBK_FIELD_TYPE_CARPHONE )
   163 						{
   161 						{
   164 						numberCount++;
   162 						numberCount++;
   165 						// if only one number, store it
   163 						// if only one number, store it
   166 						if( numberCount == 1 )
   164 						if( numberCount == 1 )
   167 							{
   165 							{
   171 							}
   169 							}
   172 						}
   170 						}
   173 					}
   171 					}
   174 				}
   172 				}
   175 			}
   173 			}
   176 		// if several numbers
       
   177 		if( numberCount > 1 )
       
   178 			{
       
   179 			// empty
       
   180 			number.Copy( KNullDesC );
       
   181 			// this is for future use.
       
   182 			// load localization text for multiple numbers
       
   183 			// number = StringLoader::LoadLC( QTN_PHOB_N_NUMBERS,
       
   184 			//							   numberCount,
       
   185 			//							   CCoeEnv::Static() );
       
   186 			}
       
   187 		}
   174 		}
       
   175 	
   188 	// no number was found
   176 	// no number was found
   189 	if( number.Length() == 0 )
   177 	if( number.Length() == 0 )
   190 		{
   178 		{
   191 		iContent.PhoneNumberUpdatedL( KNullDesC() );
   179         iContent.PhoneNumberUpdatedL( KNullDesC, 
       
   180             CSpbContentProvider::ETypePhoneNumber );
   192 		}
   181 		}
   193 	else
   182 	else if( numberCount > 1 )
   194 		{
   183 	    {
   195 		// inform the observer
   184         // contact has multiple numbers and no default
   196 		iContent.PhoneNumberUpdatedL( number );
   185         TBuf<12> count;
   197 		}
   186         count.Num( numberCount );
       
   187         iContent.PhoneNumberUpdatedL( 
       
   188             count, CSpbContentProvider::ETypePhoneNumberMultiple );
       
   189 	    }
       
   190     else
       
   191         {
       
   192         // inform the observer
       
   193         iContent.PhoneNumberUpdatedL( 
       
   194             number, CSpbContentProvider::ETypePhoneNumber );
       
   195         }
       
   196 
   198 	number.Close();
   197 	number.Close();
   199 	}
   198 	}
   200 
   199 
   201 // ---------------------------------------------------------------------------
   200 // ---------------------------------------------------------------------------
   202 // CSpbPhoneNumberParser::FetchPhoneNumber
   201 // CSpbPhoneNumberParser::FetchPhoneNumber
   203 // ---------------------------------------------------------------------------
   202 // ---------------------------------------------------------------------------
   204 //
   203 //
   205 void CSpbPhoneNumberParser::FetchPhoneNumber(
   204 void CSpbPhoneNumberParser::FetchPhoneNumberL(
   206             const MVPbkContactLink& aLink)
   205             const MVPbkContactLink& aLink)
   207     {
   206     {
   208     delete iOperation;
   207     delete iOperation;
   209     iOperation = NULL;
   208     iOperation = NULL;
   210                    
   209