serviceproviders/sapi_mediamanagement/mediamanagementservice/src/mgclfoperationobserver.cpp
changeset 22 fc9cf246af83
parent 19 989d2f495d90
child 33 50974a8b132e
equal deleted inserted replaced
19:989d2f495d90 22:fc9cf246af83
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 #include <mclfitemlistmodel.h>
    19 #include <mclfitemlistmodel.h>
       
    20 #include <mclfsortingstyle.h>
    20 
    21 
    21 #include "mgclfoperationobserver.h"
    22 #include "mgclfoperationobserver.h"
    22 #include "mgservice.h"
    23 #include "mgservice.h"
    23 #include "mgoperationobserver.h"
    24 #include "mgoperationobserver.h"
       
    25 #include "asynchrequestmanager.h"
       
    26 #include "mgpostfilter.h"
    24 
    27 
    25 
    28 
    26 // -----------------------------------------------------------------------------
    29 // -----------------------------------------------------------------------------
    27 // CClfOperationObserver::NewL
    30 // CClfOperationObserver::NewL
    28 // Returns the instance of CClfOperationObserver.
    31 // Returns the instance of CClfOperationObserver.
    57 
    60 
    58     	if( NULL !=  iServiceObserver ) //Asynchronous
    61     	if( NULL !=  iServiceObserver ) //Asynchronous
    59     	{
    62     	{
    60          
    63          
    61          iServiceObserver->MgNotifyL( iTransactionID,iListModel, mgEvent, aError );
    64          iServiceObserver->MgNotifyL( iTransactionID,iListModel, mgEvent, aError );
       
    65         
       
    66          // calling request complete on asyncrequestmanager
       
    67          iAsyncRequestManager->RequestComplete( iTransactionID );
    62          
    68          
    63          //Ownership of the List model is transfered to the Iterator class
    69          //Ownership of the List model is transfered to the Iterator class
    64          iListModel = NULL;
    70          iListModel = NULL;
    65          //In future at the time of supporting back to back call
    71          //In future at the time of supporting back to back call
    66 		//call delete this	
    72 		//call delete this	
    67          iServiceObserver = NULL;
    73          iServiceObserver = NULL;
    68   	     iMGService = NULL;
    74   	     iMGService = NULL;
       
    75   	     
       
    76   	     delete this;
    69   	     
    77   	     
    70     	}
    78     	}
    71     	
    79     	
    72 	}
    80 	}
    73 
    81 
    79 // set the member varibale for the current request.
    87 // set the member varibale for the current request.
    80 // -----------------------------------------------------------------------------
    88 // -----------------------------------------------------------------------------
    81 void CClfOperationObserver::SetMemberVar( TUint  aTransactionID,
    89 void CClfOperationObserver::SetMemberVar( TUint  aTransactionID,
    82                                           MMgOperationObserver* aServiceObserver,
    90                                           MMgOperationObserver* aServiceObserver,
    83 										  MCLFItemListModel* aListModel,
    91 										  MCLFItemListModel* aListModel,
    84 										  CMgService* aMGService )
    92 										  CMgService* aMGService,CAsynchRequestManager* aAsyncReqManager,
       
    93 										  CPostFilter* aFilter,MCLFSortingStyle* aSortingStyle)
    85 	{
    94 	{
    86 
    95 
    87 	iServiceObserver = aServiceObserver;
    96 	iServiceObserver = aServiceObserver;
    88   	iListModel = aListModel;
    97   	iListModel = aListModel;
    89     iMGService = aMGService;
    98     iMGService = aMGService;
    90     iTransactionID = aTransactionID;
    99     iTransactionID = aTransactionID;
    91 
   100     iAsyncRequestManager = aAsyncReqManager;
       
   101     iFilter = aFilter;
       
   102     iSortingStyle= aSortingStyle;
       
   103     
    92 	}
   104 	}
    93 
   105 
    94 
   106 
    95 // -----------------------------------------------------------------------------
   107 // -----------------------------------------------------------------------------
    96 // CClfOperationObserver::Cancel
   108 // CClfOperationObserver::Cancel
   122 // -----------------------------------------------------------------------------
   134 // -----------------------------------------------------------------------------
   123 
   135 
   124 CClfOperationObserver::~CClfOperationObserver()
   136 CClfOperationObserver::~CClfOperationObserver()
   125                        
   137                        
   126     {
   138     {
   127         
   139        
   128         // If this observer is waiting for response
   140         // If this observer is waiting for response
   129         // then cancel the request
   141         // then cancel the request
   130         if( iListModel )
   142         if( iListModel )
   131     	    {
   143     	    {
   132 			/*iListModel->CancelRefresh();
   144 			/*iListModel->CancelRefresh();
   133 			delete iListModel;
   145 			delete iListModel;
   134 			iListModel = NULL;*/
   146 			iListModel = NULL;*/
   135 			CancelL();
   147 			CancelL();
   136 			}
   148 			}
   137     
   149         if(iAsyncRequestManager)
       
   150             {
       
   151             iAsyncRequestManager = NULL;
       
   152             }
       
   153         
       
   154         if(iFilter)
       
   155             {
       
   156             delete iFilter;
       
   157             }
       
   158         if(iSortingStyle)
       
   159             {
       
   160             delete iSortingStyle;
       
   161             }
   138 	//In future at the time of supporting 
   162 	//In future at the time of supporting 
   139 	// back to back Calls we have to delete the iServiceOberver
   163 	// back to back Calls we have to delete the iServiceOberver
   140 	
   164     iServiceObserver = NULL;
   141 	}
   165 	}
   142 
   166 
   143 // -----------------------------------------------------------------------------
   167 // -----------------------------------------------------------------------------
   144 // CClfOperationObserver::CClfOperationObserver
   168 // CClfOperationObserver::CClfOperationObserver
   145 // Constructor
   169 // Constructor