serviceproviders/sapi_contacts_vpbk/src/contactiterator.cpp
changeset 10 fc9cf246af83
parent 5 989d2f495d90
equal deleted inserted replaced
5:989d2f495d90 10:fc9cf246af83
    99 TBool CContactIterator::NextL(TLiwVariant& aEntry)
    99 TBool CContactIterator::NextL(TLiwVariant& aEntry)
   100 	{
   100 	{
   101 
   101 
   102 	CLiwMap* pContactMap = NULL;
   102 	CLiwMap* pContactMap = NULL;
   103 	TBool retVal = EFalse;
   103 	TBool retVal = EFalse;
   104 	
   104 	RPointerArray<HBufC> xspidArray;
       
   105 	CLiwList* IdList = NULL;
       
   106 	TLiwVariant outputVal;
   105 	//If iterator is iterating over contacts
   107 	//If iterator is iterating over contacts
   106 	if(iContactIter->iIndicator == EContacts)
   108 	if(iContactIter->iIndicator == EContacts)
   107 		{
   109 		{
   108 	    CSingleContact* contact = NULL;
   110 	    CSingleContact* contact = NULL;
   109 	    HBufC8* cntId = NULL ;
   111 	    HBufC8* cntId = NULL ;
   118 			TPtrC8 fieldName;
   120 			TPtrC8 fieldName;
   119         	TPtrC  fieldLabel;
   121         	TPtrC  fieldLabel;
   120         	TPtrC  fieldValue;
   122         	TPtrC  fieldValue;
   121         	TTime  fieldTime;
   123         	TTime  fieldTime;
   122         	TBool date = EFalse;
   124         	TBool date = EFalse;
       
   125         	TBool xspid = EFalse;
   123         	
   126         	
   124         	CleanupStack :: PushL(contact);        	        	
   127         	CleanupStack :: PushL(contact);        	        	
   125         							    		    		    			    	        	
   128         							    		    		    			    	        	
   126 			pContactMap = CLiwDefaultMap::NewL();
   129 			pContactMap = CLiwDefaultMap::NewL();
   127 			CleanupStack :: PushL(pContactMap);	
   130 			CleanupStack :: PushL(pContactMap);	
   146 				//Get the next field
   149 				//Get the next field
   147 				field = contact->FieldAt(i);
   150 				field = contact->FieldAt(i);
   148 				
   151 				
   149 				//Get field data and populate the map structure
   152 				//Get field data and populate the map structure
   150 				field->GetFieldDataL(fieldName, fieldLabel, fieldValue);
   153 				field->GetFieldDataL(fieldName, fieldLabel, fieldValue);
   151 				if((fieldName.Compare(KDate) == 0) || (fieldName.Compare(KAnniversary) == 0))
   154 				if(fieldName.Compare(KXspid) == 0)
       
   155 				    {
       
   156 				    xspid = ETrue;
       
   157 				    fieldLabel.Set(KXspidLabel);
       
   158 				    field->GetUriFieldParamL(xspidArray);
       
   159 				    if(xspidArray.Count() > 0)
       
   160 				           {
       
   161 				           
       
   162 				           TInt count = xspidArray.Count();
       
   163 				           TInt i;
       
   164 				           IdList = CLiwDefaultList::NewL();
       
   165 				           for(i=0; i<count; i++)
       
   166 				               {
       
   167 				               TDesC* idVal = xspidArray[i];
       
   168 				               outputVal.Set(*idVal);
       
   169 				               IdList->AppendL(outputVal);
       
   170 				               }
       
   171 				           
       
   172 				           }
       
   173 				    xspidArray.ResetAndDestroy();
       
   174 				    
       
   175 				    }
       
   176 				if((fieldName.Compare(KDate) == 0) || (fieldName.Compare(KAnniversary) == 0)) // || fieldName.Compare(KBirthDay) == 0)
   152 					{
   177 					{
   153 					date = ETrue;
   178 					date = ETrue;
   154 					fieldTime = field->GetDateTime();
   179 					fieldTime = field->GetDateTime();
   155 					}
   180 					}
   156 				
   181 				
   161 					pFieldLinkedMap->InsertL(KFieldLabel,TLiwVariant(fieldLabel));
   186 					pFieldLinkedMap->InsertL(KFieldLabel,TLiwVariant(fieldLabel));
   162 					if(date)
   187 					if(date)
   163 						{
   188 						{
   164 						pFieldLinkedMap->InsertL(KFieldValue,TLiwVariant(fieldTime));				
   189 						pFieldLinkedMap->InsertL(KFieldValue,TLiwVariant(fieldTime));				
   165 						}
   190 						}
       
   191 					else if(xspid)
       
   192 					    {
       
   193 					  //  CLiwMap* pFieldLinkedMap = CLiwDefaultMap::NewL();
       
   194                        // CleanupClosePushL(*pFieldLinkedMap);
       
   195                         pFieldLinkedMap->InsertL(KFieldValue,TLiwVariant(IdList));
       
   196 						}
   166 					else
   197 					else
   167 						{
   198 						{
   168 						pFieldLinkedMap->InsertL(KFieldValue,TLiwVariant(fieldValue));				
   199 						pFieldLinkedMap->InsertL(KFieldValue,TLiwVariant(fieldValue));				
   169 						}
   200 						}
   170 					pFieldLinkedMap->InsertL(KFieldNext,TLiwVariant(val));
   201 					pFieldLinkedMap->InsertL(KFieldNext,TLiwVariant(val));
   175 					pFieldLinkedMap->InsertL(KFieldLabel,TLiwVariant(fieldLabel));
   206 					pFieldLinkedMap->InsertL(KFieldLabel,TLiwVariant(fieldLabel));
   176 					if(date)
   207 					if(date)
   177 						{
   208 						{
   178 						date = EFalse;
   209 						date = EFalse;
   179 						pFieldLinkedMap->InsertL(KFieldValue,TLiwVariant(fieldTime));				
   210 						pFieldLinkedMap->InsertL(KFieldValue,TLiwVariant(fieldTime));				
       
   211 						}
       
   212 					else if(xspid)
       
   213                         {
       
   214                         xspid = EFalse;
       
   215                         pFieldLinkedMap->InsertL(KFieldValue,TLiwVariant(IdList));
   180 						}
   216 						}
   181 					else
   217 					else
   182 						{
   218 						{
   183 						pFieldLinkedMap->InsertL(KFieldValue,TLiwVariant(fieldValue));				
   219 						pFieldLinkedMap->InsertL(KFieldValue,TLiwVariant(fieldValue));				
   184 						}
   220 						}