serviceproviders/sapi_mediamanagement/mediamanagementservice/src/mgclfoperationobserver.cpp
changeset 23 50974a8b132e
parent 10 fc9cf246af83
equal deleted inserted replaced
19:8d692d9f828f 23:50974a8b132e
    14 * Description:  This Class is observer for the CLF framework
    14 * Description:  This Class is observer for the CLF framework
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 #include <mclfitemlistmodel.h>
    19 #include <MCLFItemListModel.h>
    20 #include <mclfsortingstyle.h>
    20 #include <MCLFSortingStyle.h>
    21 
    21 
    22 #include "mgclfoperationobserver.h"
    22 #include "mgclfoperationobserver.h"
    23 #include "mgservice.h"
    23 #include "mgservice.h"
    24 #include "mgoperationobserver.h"
    24 #include "mgoperationobserver.h"
    25 #include "asynchrequestmanager.h"
    25 #include "asynchrequestmanager.h"
    56     	{
    56     	{
    57     	    // clear the state so that next request can be taken
    57     	    // clear the state so that next request can be taken
    58     		iMGService->Clear();
    58     		iMGService->Clear();
    59     	}
    59     	}
    60 
    60 
    61     	if( NULL !=  iServiceObserver ) //Asynchronous
    61     	if( NULL !=  iServiceObserver && (mgEvent == ECLFRefreshComplete)) //Asynchronous
    62     	{
    62     	{
    63          
    63          
    64          iServiceObserver->MgNotifyL( iTransactionID,iListModel, mgEvent, aError );
    64 		iServiceObserver->MgNotifyL( iTransactionID,iListModel,this,mgEvent, aError );
    65         
    65         
    66          // calling request complete on asyncrequestmanager
    66          // calling request complete on asyncrequestmanager
    67          iAsyncRequestManager->RequestComplete( iTransactionID );
    67          iAsyncRequestManager->RequestComplete( iTransactionID );
    68          
    68          
    69          //Ownership of the List model is transfered to the Iterator class
    69 		//Ownership of the List model and the observer are transferred to the Iterator class
    70          iListModel = NULL;
    70          iListModel = NULL;
    71          //In future at the time of supporting back to back call
    71          //In future at the time of supporting back to back call
    72 		//call delete this	
    72 		//call delete this	
    73          iServiceObserver = NULL;
    73          iServiceObserver = NULL;
    74   	     iMGService = NULL;
    74   	     iMGService = NULL;
    75   	     
    75   	     
    76   	     delete this;
    76 		//delete this;
    77   	     
    77 	     
    78     	}
    78     	}
    79     	
    79     	
    80 	}
    80 	}
    81 
    81 
    82 
    82 
   116 			iListModel->CancelRefresh();
   116 			iListModel->CancelRefresh();
   117 			delete iListModel;
   117 			delete iListModel;
   118 			iListModel = NULL;
   118 			iListModel = NULL;
   119 			}
   119 			}
   120 	
   120 	
   121    	iServiceObserver->MgNotifyL(iTransactionID, NULL , mgEvent, KErrNone );
   121    	iServiceObserver->MgNotifyL(iTransactionID, NULL, NULL, mgEvent, KErrNone );
   122    	iMGService = NULL;
   122    	iMGService = NULL;
   123     iTransactionID = 0;	
   123     iTransactionID = 0;	
   124     //In future at the time of supporting back to back call
   124     //In future at the time of supporting back to back call
   125 	//call delete this	
   125 	//call delete this	
   126 	iServiceObserver = NULL;
   126 	iServiceObserver = NULL;
   134 // -----------------------------------------------------------------------------
   134 // -----------------------------------------------------------------------------
   135 
   135 
   136 CClfOperationObserver::~CClfOperationObserver()
   136 CClfOperationObserver::~CClfOperationObserver()
   137                        
   137                        
   138     {
   138     {
   139        
   139         iListModel = NULL;
   140         // If this observer is waiting for response
       
   141         // then cancel the request
       
   142         if( iListModel )
       
   143     	    {
       
   144 			/*iListModel->CancelRefresh();
       
   145 			delete iListModel;
       
   146 			iListModel = NULL;*/
       
   147 			CancelL();
       
   148 			}
       
   149         if(iAsyncRequestManager)
   140         if(iAsyncRequestManager)
   150             {
   141             {
   151             iAsyncRequestManager = NULL;
   142             iAsyncRequestManager = NULL;
   152             }
   143             }
   153         
   144