serviceproviders/sapi_contacts_vpbk/contactservice/src/singlecontactfield.cpp
changeset 22 fc9cf246af83
parent 19 989d2f495d90
child 59 1aa6688bfd6b
equal deleted inserted replaced
19:989d2f495d90 22:fc9cf246af83
    57 */
    57 */
    58 EXPORT_C void CSingleContactField::GetFieldDataL(TPtrC8& aFieldKey,
    58 EXPORT_C void CSingleContactField::GetFieldDataL(TPtrC8& aFieldKey,
    59                                                  TPtrC& aLabel,
    59                                                  TPtrC& aLabel,
    60                                                  TPtrC& aValue)
    60                                                  TPtrC& aValue)
    61 	{
    61 	{
    62 	if(iFieldKey && iLabel && iValue)
    62 	if(iFieldKey->Compare(KXspid) == 0)
       
    63 	    {
       
    64 	    if(iFieldKey && iLabel)
       
    65 	            {
       
    66 	            aFieldKey.Set(*iFieldKey);
       
    67 	            aLabel.Set(*iLabel);
       
    68 	            }
       
    69 	    }
       
    70 	else if(iFieldKey && iLabel && iValue)
    63     	{
    71     	{
    64     	aFieldKey.Set(*iFieldKey);
    72     	aFieldKey.Set(*iFieldKey);
    65     	aLabel.Set(*iLabel);
    73     	aLabel.Set(*iLabel);
    66     	aValue.Set(*iValue);    
    74     	aValue.Set(*iValue);    
    67     	}
    75     	}
   102         iValue = NULL;
   110         iValue = NULL;
   103         }
   111         }
   104 	iFieldKey= aFieldKey.AllocL();
   112 	iFieldKey= aFieldKey.AllocL();
   105 	iLabel = aLabel.AllocL();
   113 	iLabel = aLabel.AllocL();
   106 	iValue = aValue.AllocL();
   114 	iValue = aValue.AllocL();
       
   115 	}
       
   116 
       
   117 
       
   118 EXPORT_C void CSingleContactField::
       
   119               SetUriFieldParamsL(const TDesC8& aFieldKey,
       
   120                               const TDesC& aLabel,
       
   121                               const RPointerArray<HBufC> aValue)
       
   122     {
       
   123     if(iFieldKey)
       
   124         {
       
   125         delete iFieldKey;
       
   126         iFieldKey = NULL;
       
   127         }
       
   128     if( iLabel )
       
   129         {
       
   130         delete iLabel;
       
   131         iLabel = NULL;
       
   132         }
       
   133     if( iValue )
       
   134         {
       
   135         delete iValue;
       
   136         iValue = NULL;
       
   137         }
       
   138     iFieldKey= aFieldKey.AllocL();
       
   139     iLabel = aLabel.AllocL();
       
   140     iidArray.ResetAndDestroy();
       
   141     iidArray = aValue;
       
   142     }
       
   143 
       
   144 EXPORT_C void CSingleContactField::GetUriFieldParamL(RPointerArray<HBufC>& axspidArray)
       
   145     {
       
   146     TInt count = iidArray.Count();
       
   147     if(count != 0)
       
   148             {
       
   149            
       
   150             for(TInt i=0;i<count;i++)
       
   151             {
       
   152             axspidArray.AppendL(iidArray[i]);         
       
   153             }
       
   154             }
       
   155         else
       
   156             {
       
   157             User::Leave(KErrNotFound);    
       
   158             }       
   107 	}
   159 	}
   108 
   160 
   109 //Gets the Group Data and returns them as output parameters
   161 //Gets the Group Data and returns them as output parameters
   110 /*
   162 /*
   111 -----------------------------------------------------------------------------
   163 -----------------------------------------------------------------------------
   156 EXPORT_C TTime CSingleContactField::GetDateTime()
   208 EXPORT_C TTime CSingleContactField::GetDateTime()
   157 	{
   209 	{
   158 	return iDateAndTime;
   210 	return iDateAndTime;
   159 	}
   211 	}
   160 
   212 
       
   213 //Private method used to set TTime variable
       
   214 EXPORT_C void CSingleContactField::SetXspidDataL(const TDesC8& aFieldKey,
       
   215         const TDesC& aLabel,
       
   216         RPointerArray<HBufC>& axspidArray)
       
   217     {
       
   218     if(iFieldKey)
       
   219             {
       
   220             delete iFieldKey;
       
   221             iFieldKey = NULL;
       
   222             }
       
   223         if( iLabel )
       
   224             {
       
   225             delete iLabel;
       
   226             iLabel = NULL;
       
   227             }    
       
   228         iFieldKey= aFieldKey.AllocL();
       
   229         iLabel = aLabel.AllocL();
       
   230         iArrayValue = axspidArray;
       
   231     }
       
   232 
       
   233 
       
   234 EXPORT_C void CSingleContactField::GetXspidDataL(RPointerArray<HBufC>& axspidArray)
       
   235     {
       
   236     TInt count = iArrayValue.Count();
       
   237     if(count != 0)
       
   238             {
       
   239            
       
   240             for(TInt i=0;i<count;i++)
       
   241             {
       
   242         /*    HBufC* val = iArrayValue[i];
       
   243             axspidArray.Append(val); */
       
   244             axspidArray.AppendL(iArrayValue[i]);         
       
   245             }
       
   246             }
       
   247         else
       
   248             {
       
   249             User::Leave(KErrNotFound);    
       
   250             }       
       
   251     }
   161 CSingleContactField::~CSingleContactField()
   252 CSingleContactField::~CSingleContactField()
   162     {
   253     {
   163     delete iFieldKey;
   254     delete iFieldKey;
   164     delete iLabel;
   255     delete iLabel;
   165     delete iValue;
   256     delete iValue;
   166     delete iGroupLabel;
   257     delete iGroupLabel;
   167     iContactIdArray.ResetAndDestroy();
   258     iContactIdArray.ResetAndDestroy();
   168     }
   259     iArrayValue.ResetAndDestroy();
       
   260     }
       
   261 EXPORT_C void CSingleContactField::SetUriData(TPtrC aUri)
       
   262     {
       
   263     HBufC* val = aUri.Alloc();
       
   264     
       
   265     iUriData.AppendL(val);
       
   266     }