serviceproviders/sapi_contacts_vpbk/contactservice/src/getliststorelistobserver.cpp
changeset 22 fc9cf246af83
parent 19 989d2f495d90
child 33 50974a8b132e
equal deleted inserted replaced
19:989d2f495d90 22:fc9cf246af83
   148 			 					   iIter,
   148 			 					   iIter,
   149 			 					   iContactService,
   149 			 					   iContactService,
   150 			 					   iUri,
   150 			 					   iUri,
   151 			 					   iSortOrder,
   151 			 					   iSortOrder,
   152 			 					   iTransId, 
   152 			 					   iTransId, 
   153 			 					   schedulerWait);
   153 			 					   schedulerWait, iVal);
   154         CleanupStack::PushL(defaultView);
   154         CleanupStack::PushL(defaultView);
   155         if(iSearchVal->Length() <= 0)
   155         if(iSearchVal->Length() <= 0)
   156     	    {
   156     	    {
   157     	    defaultView->ReturnDefaultView();	
   157     	    defaultView->ReturnDefaultView();	
   158     	    }
   158     	    }
   203 	    						   iIter,
   203 	    						   iIter,
   204 	    						   iContactService,
   204 	    						   iContactService,
   205 								   iUri,
   205 								   iUri,
   206 								   iSortOrder,
   206 								   iSortOrder,
   207 			 					   iTransId, 
   207 			 					   iTransId, 
   208 			 					   schedulerWait); 
   208 			 					   schedulerWait,iVal); 
   209            	    											 					    	    
   209            	    											 					    	    
   210 	    CleanupStack::PushL(filteredView);
   210 	    CleanupStack::PushL(filteredView);
   211 	    //Filtering the view to find the iFindStrings
   211 	    //Filtering the view to find the iFindStrings
   212 	    MVPbkContactViewBase* findView = 
   212 	    MVPbkContactViewBase* findView = 
   213 	    contactView->ViewFiltering()->CreateFilteredViewLC(*filteredView,
   213 	    contactView->ViewFiltering()->CreateFilteredViewLC(*filteredView,
   226     	 }
   226     	 }
   227     else if(iType == EGroups)
   227     else if(iType == EGroups)
   228     	{
   228     	{
   229     	//Get the linkarray of the groups in the database
   229     	//Get the linkarray of the groups in the database
   230     	MVPbkContactLinkArray* array = aContactStore.ContactGroupsLC();        	
   230     	MVPbkContactLinkArray* array = aContactStore.ContactGroupsLC();        	
   231     	if(array->Count())
   231         TInt count = array->Count();
   232         	{
   232         if(count)
   233         	//Set the iterator with the result
   233             {
   234         	iIter->SetParams(array, iUri, EAsc, iTransId, EGroups, iContactService);
   234             if(iVal == EGetList)
   235        		
   235                 {
   236 			iContactService->RequestComplete(iTransId);	
   236                 //Set the iterator with the result
   237        		//Notify the user
   237                 iIter->SetParams(array, iUri, EAsc, iTransId, EGroups, iContactService);
   238        		iCallback->HandleReturnIter(KErrNone, iIter, iTransId);
   238                 
   239         	}
   239                 iContactService->RequestComplete(iTransId); 
   240     	else
   240                 //Notify the user
   241     		{
   241                 iCallback->HandleReturnIter(KErrNone, iIter, iTransId);
   242 			iContactService->RequestComplete(iTransId);	
   242                 }
       
   243             else
       
   244                 {
       
   245                 RPointerArray<HBufC8> idArray(count);
       
   246                 MVPbkContactLink *link = NULL;
       
   247                 //Set the array with the ids
       
   248                 for(TInt index(0); index < count; index++)
       
   249                     {
       
   250                     link = const_cast<MVPbkContactLink*>(&((*array)[index]));
       
   251                     idArray.AppendL(link->PackLC());
       
   252                     CleanupStack::Pop();
       
   253                     }
       
   254                 //iIter->SetIdsPtr(idArray, count);
       
   255                 iContactService->RequestComplete(iTransId);
       
   256                 //Notify the user
       
   257                 iCallback->HandleReturnArray(KErrNone , idArray , iTransId);
       
   258                 idArray.Reset();
       
   259                 //CleanupStack::PopAndDestroy(link);
       
   260                 delete link;
       
   261                 link = NULL;
       
   262                 //CleanupStack::Pop();
       
   263                 //delete array;
       
   264                 //array = NULL;
       
   265                 //iCallback->HandleReturnIter(KErrNone, iIter, iTransId);
       
   266                 }
       
   267             }
       
   268         else
       
   269             {
       
   270             iContactService->RequestComplete(iTransId); 
   243     		//Notify the user
   271     		//Notify the user
   244     		iCallback->HandleReturnValue(EOpComplete, KErrNotFound, iTransId);	
   272     		iCallback->HandleReturnValue(EOpComplete, KErrNotFound, iTransId);	
       
   273 		 delete iIter;
       
   274 	        iIter = NULL;
   245     		}    	
   275     		}    	
   246     	CleanupStack::Pop();
   276     	CleanupStack::Pop();       
   247     	}
   277     	}
   248     else if(iType == EOthers)
   278     else if(iType == EOthers)
   249     	{
   279     	{
   250     	TRequestStatus* status = &(iIter->iSyncIter->iStatus);
   280     	TRequestStatus* status = &(iIter->iSyncIter->iStatus);
   251     	User::RequestComplete(status, KErrNone);
   281     	User::RequestComplete(status, KErrNone);
   290      TOrder aSortOrder,
   320      TOrder aSortOrder,
   291      MContactCallback *aCallback,
   321      MContactCallback *aCallback,
   292       CContactService *aContactService,
   322       CContactService *aContactService,
   293      CContactIter* aIter, 
   323      CContactIter* aIter, 
   294      enum Ttype aType, TInt aTransId,
   324      enum Ttype aType, TInt aTransId,
   295      MVPbkContactStore* aContactStore)
   325      MVPbkContactStore* aContactStore, TCmdType val)
   296      
   326      
   297     {
   327     {
   298     CGetListStoreListObserver* self = 
   328     CGetListStoreListObserver* self = 
   299     new( ELeave ) CGetListStoreListObserver(aUri,
   329     new( ELeave ) CGetListStoreListObserver(aUri,
   300                                             aContactId, 
   330                                             aContactId, 
   304                                             aCallback,
   334                                             aCallback,
   305                                             aContactService,
   335                                             aContactService,
   306                                             aIter,
   336                                             aIter,
   307                                             aType, 
   337                                             aType, 
   308                                             aTransId,
   338                                             aTransId,
   309                                             aContactStore);    
   339                                             aContactStore, val);
   310     self->ConstructL(aContactId, aSearchVal);									 
   340     self->ConstructL(aContactId, aSearchVal);									 
   311     return self;
   341     return self;
   312     }
   342     }
   313 
   343 
   314 
   344 
   334 						  TOrder aSortOrder,
   364 						  TOrder aSortOrder,
   335 						  MContactCallback *aCallback,
   365 						  MContactCallback *aCallback,
   336 						   CContactService *aContactService,
   366 						   CContactService *aContactService,
   337 						  CContactIter* aIter, 
   367 						  CContactIter* aIter, 
   338 						  enum Ttype aType, TInt aTransId,
   368 						  enum Ttype aType, TInt aTransId,
   339 						  MVPbkContactStore* aContactStore)
   369 						  MVPbkContactStore* aContactStore, TCmdType val)
   340     {
   370     {
   341 	iUri = aUri;			
   371 	iUri = aUri;			
   342     iSearchFields = aSearchFields;
   372     iSearchFields = aSearchFields;
   343     iSortOrder = aSortOrder;
   373     iSortOrder = aSortOrder;
   344     iCallback=aCallback;
   374     iCallback=aCallback;
   347 	iType = aType;	
   377 	iType = aType;	
   348 	iTransId = aTransId;
   378 	iTransId = aTransId;
   349 	iFieldsList = NULL;
   379 	iFieldsList = NULL;
   350 	iRetOp = NULL;
   380 	iRetOp = NULL;
   351 	iContactStore = aContactStore;
   381 	iContactStore = aContactStore;
       
   382     iVal = val;
   352     }
   383     }
   353 
   384 
   354 
   385 
   355 CGetListStoreListObserver::~CGetListStoreListObserver()
   386 CGetListStoreListObserver::~CGetListStoreListObserver()
   356 	{
   387 	{