predictivesearch/PcsUtils/src/CPsSettings.cpp
branchRCL_3
changeset 13 a6539d1e8e43
parent 0 e686773b3f54
equal deleted inserted replaced
12:4ae315f230bc 13:a6539d1e8e43
    34 	CPsSettings* self = new (ELeave) CPsSettings();	
    34 	CPsSettings* self = new (ELeave) CPsSettings();	
    35     CleanupStack::PushL(self);
    35     CleanupStack::PushL(self);
    36     self->ConstructL();
    36     self->ConstructL();
    37     CleanupStack::Pop();
    37     CleanupStack::Pop();
    38     return self;
    38     return self;
    39 	
       
    40 }
    39 }
    41 
    40 
    42 // ----------------------------------------------------------------------------
    41 // ----------------------------------------------------------------------------
    43 // CPsSettings::CPsSettings
    42 // CPsSettings::CPsSettings
    44 // Default constructor
    43 // Default constructor
    69     // Set the Max reslts
    68     // Set the Max reslts
    70 	self->SetMaxResults(iMaxResults);
    69 	self->SetMaxResults(iMaxResults);
    71 	self->SetSortType(iSortType);
    70 	self->SetSortType(iSortType);
    72     
    71     
    73     // Copy the search uris
    72     // Copy the search uris
    74     RPointerArray <TDesC>  newUris;
    73     RPointerArray<TDesC> newUris;
    75 
    74 
    76     for(TInt i =0; i < iSearchUri.Count() ; i++)
    75     for(TInt i =0; i < iSearchUri.Count() ; i++)
    77 	{
    76 	{
    78 		newUris.Append(iSearchUri[i]->AllocL());
    77 		newUris.Append(iSearchUri[i]->AllocL());
    79 	}
    78 	}
   106 EXPORT_C void CPsSettings::SetSearchUrisL(const RPointerArray<TDesC>& aSearchUri)
   105 EXPORT_C void CPsSettings::SetSearchUrisL(const RPointerArray<TDesC>& aSearchUri)
   107 {   
   106 {   
   108 	iSearchUri.ResetAndDestroy();
   107 	iSearchUri.ResetAndDestroy();
   109     for(TInt i =0 ; i < aSearchUri.Count();i++)
   108     for(TInt i =0 ; i < aSearchUri.Count();i++)
   110 	{
   109 	{
   111 		const HBufC* uriToAppend =aSearchUri[i]->AllocL();
   110 		const HBufC* uriToAppend = aSearchUri[i]->AllocL();
   112 		iSearchUri.Append(uriToAppend);
   111 		iSearchUri.Append(uriToAppend);
   113 	}
   112 	}
   114 
       
   115 }
   113 }
   116 
   114 
   117 // ----------------------------------------------------------------------------
   115 // ----------------------------------------------------------------------------
   118 // CPsSettings::SetDisplayFieldsL
   116 // CPsSettings::SetDisplayFieldsL
   119 // Sets the list of fields to display.
   117 // Sets the list of fields to display.
   123 	iDisplayFields.Reset();
   121 	iDisplayFields.Reset();
   124     for(TInt i =0 ; i < aDisplayFields.Count();i++)
   122     for(TInt i =0 ; i < aDisplayFields.Count();i++)
   125 	{
   123 	{
   126 		iDisplayFields.Append(aDisplayFields[i]);
   124 		iDisplayFields.Append(aDisplayFields[i]);
   127 	}
   125 	}
   128 	
       
   129 }
   126 }
   130 
   127 
   131 // ----------------------------------------------------------------------------
   128 // ----------------------------------------------------------------------------
   132 // CPsSettings::SetMaxResults
   129 // CPsSettings::SetMaxResults
   133 // Sets the number of elements (contacts) to be given to client.
   130 // Sets the number of elements (contacts) to be given to client.
   150 // ----------------------------------------------------------------------------
   147 // ----------------------------------------------------------------------------
   151 EXPORT_C void CPsSettings::SetSortType(const TSortType aSortType)
   148 EXPORT_C void CPsSettings::SetSortType(const TSortType aSortType)
   152 {
   149 {
   153 	iSortType = aSortType;
   150 	iSortType = aSortType;
   154 }
   151 }
       
   152 
   155 // CPsSettings::SearchUrisL
   153 // CPsSettings::SearchUrisL
   156 // Returns the list of URIs configured to search from.
   154 // Returns the list of URIs configured to search from.
   157 // ----------------------------------------------------------------------------
   155 // ----------------------------------------------------------------------------
   158 EXPORT_C void CPsSettings:: SearchUrisL(RPointerArray<TDesC>& aSearchUri) const
   156 EXPORT_C void CPsSettings:: SearchUrisL(RPointerArray<TDesC>& aSearchUri) const
   159 {
   157 {
   173 {
   171 {
   174     for(TInt i =0 ; i < iDisplayFields.Count();i++)
   172     for(TInt i =0 ; i < iDisplayFields.Count();i++)
   175 	{
   173 	{
   176 		aDisplayFields.Append(iDisplayFields[i]);
   174 		aDisplayFields.Append(iDisplayFields[i]);
   177 	}
   175 	}
   178 
       
   179 }
   176 }
   180 
   177 
   181 // ----------------------------------------------------------------------------
   178 // ----------------------------------------------------------------------------
   182 // CPsSettings::MaxResults
   179 // CPsSettings::MaxResults
   183 // Returns the number of elements (contacts) to be given to client.
   180 // Returns the number of elements (contacts) to be given to client.
   184 // ----------------------------------------------------------------------------
   181 // ----------------------------------------------------------------------------
   185 EXPORT_C TInt CPsSettings::MaxResults() const
   182 EXPORT_C TInt CPsSettings::MaxResults() const
   186 {
   183 {
   187 	return iMaxResults;
   184 	return iMaxResults;
   188 }
   185 }
       
   186 
   189 // ----------------------------------------------------------------------------
   187 // ----------------------------------------------------------------------------
   190 // CPsSettings::GetSortType
   188 // CPsSettings::GetSortType
   191 // Returns the sort type based on which results will be sorted.
   189 // Returns the sort type based on which results will be sorted.
   192 // ----------------------------------------------------------------------------
   190 // ----------------------------------------------------------------------------
   193 EXPORT_C TSortType CPsSettings::GetSortType() const
   191 EXPORT_C TSortType CPsSettings::GetSortType() const
   230 			}
   228 			}
   231 				   
   229 				   
   232 			// Cleanup memory
   230 			// Cleanup memory
   233 			delete   grpIdBuf;
   231 			delete   grpIdBuf;
   234 			grpIdBuf = NULL;
   232 			grpIdBuf = NULL;
   235            
       
   236 		}
   233 		}
   237 	}		
   234 	}		
   238 }
   235 }
   239 
   236 
   240 // ----------------------------------------------------------------------------
   237 // ----------------------------------------------------------------------------
   285     {
   282     {
   286         // Read uri size
   283         // Read uri size
   287 	    TUint8 szUri = aStream.ReadUint8L();
   284 	    TUint8 szUri = aStream.ReadUint8L();
   288     	    
   285     	    
   289     	HBufC* uri =  HBufC::NewL(aStream, szUri);
   286     	HBufC* uri =  HBufC::NewL(aStream, szUri);
   290 	    iSearchUri.InsertL(uri, index);
   287 	    iSearchUri.InsertL(uri, index);   
   291 	    
       
   292     }
   288     }
   293     
   289     
   294     // Read number of display fields
   290     // Read number of display fields
   295     TInt szNumFields = aStream.ReadUint8L();
   291     TInt szNumFields = aStream.ReadUint8L();
   296     for ( int index = 0; index < szNumFields; index++ )
   292     for ( int index = 0; index < szNumFields; index++ )
   299     }
   295     }
   300     
   296     
   301     // Read Number of contacts that will be displayed to the client
   297     // Read Number of contacts that will be displayed to the client
   302     iMaxResults = aStream.ReadInt16L();
   298     iMaxResults = aStream.ReadInt16L();
   303     iSortType = (TSortType)aStream.ReadInt8L();
   299     iSortType = (TSortType)aStream.ReadInt8L();
   304 	
   300 }
   305 }
       
   306