phonebookengines/contactsmodel/cntsrv/src/CCntRequest.cpp
changeset 0 e686773b3f54
child 24 0ba2181d7c28
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @internalTechnology
       
    19  @released 
       
    20 */
       
    21 
       
    22 #include "CCntRequest.h"
       
    23 #include "CCntStateMachine.h"
       
    24 #include "CCntPackager.h"
       
    25 #include <cntitem.h>
       
    26 
       
    27 // CCntRequest 
       
    28 // CCntRequest is the base class for all Request classes that handle external
       
    29 // requests (requests that originate from the CContactDatabase). Internal requests
       
    30 // derive from the CReqInternal class. 
       
    31 // Note 1: All unpacking of objects should be done within Construction.
       
    32 // Note 2: The destruction of request objects is a little unusual.
       
    33 //		   The destruction of requests objects is usually the responsibility of the CStatemachine or in the CRequestStore class.
       
    34 //         The destruction of requests is usually performed using the CCntRequest::CompletePD method. See below
       
    35 // Note 3: Each request has a timeout member - the time for which the request remains valid - and a timeouterror member variable.
       
    36 //		   The iTimeOutError is the error that will be returned to the client in the event of the request timing out. The default 
       
    37 //		   timeout value is KErrNotReady but the CStateMachine can reset this depending on the last action the statemachine attempted
       
    38 // 		   to perform before the request timedout.
       
    39 //		   Timeouts work as follows - the statemachine returns TDeferred indicating it could not process the request in the current state
       
    40 //		   The request is added to the request store, CRequestStore, and the timeout is activated via the CCntRequest::ActivateTimeOutL 		
       
    41 //		   method. There are two possible outcomes:
       
    42 //			1. The state changes, or a contact item is unlocked, and the request is activated and processed by the CStateMachine		
       
    43 //			2. The request times out, CCntRequestTimer::RunL is called and the request is completed with the iTimeOutError error code.
       
    44 
       
    45 /** 
       
    46   Base CCntRequest constructor
       
    47   @param  aSessionId The session from which the request originated
       
    48   @param  aMessage The RMessage from the client
       
    49   @param  aTimeOut The lenght of time in milliseconds for which the request remains valid
       
    50 */
       
    51 
       
    52 CCntRequest::CCntRequest(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut)
       
    53 						:iMessage(aMessage),
       
    54 						 iSessionId(aSessionId), 
       
    55 						 iTimeOut(aTimeOut),
       
    56 						 iTimeOutError(KErrNotReady)
       
    57 	{
       
    58 	ASSERT(aSessionId); // Should never be NULL
       
    59 	// All internal requests do not have a session ID, such requests derive from the CReqInternal
       
    60 	// and NOT from CCntRequest.
       
    61 	}
       
    62 
       
    63 /** 
       
    64   Complete the requests internal iMessage
       
    65 
       
    66   @param  aErrCode The error code with which the message will be completed
       
    67 */
       
    68 void CCntRequest::Complete(TInt aErrCode)
       
    69 	{
       
    70 	iMessage.Complete(aErrCode); 
       
    71 	}
       
    72 
       
    73 CCntRequest::~CCntRequest()
       
    74 	{
       
    75 	delete iTimer;
       
    76 	}
       
    77 
       
    78 /** 
       
    79   Start the timeout 
       
    80   A timer is only ever added when it does not exist and a non-zero timeout value has
       
    81   been specified, because the request may be activated, processed and deferred more than once.
       
    82   The result of request processing could be to add the request to the request queue again. 
       
    83  
       
    84   @param  aReqStore When a times out, the timer access the store to complete the request with
       
    85   	 		a timeout error.
       
    86  */
       
    87 void CCntRequest::ActivateTimeOutL(CRequestStore& aReqStore)
       
    88 	{
       
    89 	if ((iTimer == NULL) && (iTimeOut != 0))
       
    90 		{
       
    91 		iTimer = CCntRequestTimer::NewL(*this, aReqStore);
       
    92 		iTimer->Start();
       
    93 		}
       
    94 	}
       
    95 
       
    96 /**
       
    97   Stop the timeout
       
    98  */
       
    99 void CCntRequest::DeActivateTimeOut()
       
   100 	{
       
   101 	if (iTimer)
       
   102 		{
       
   103 		iTimer->Stop();	
       
   104 		}
       
   105 		
       
   106 	delete iTimer;
       
   107 	iTimer = NULL;
       
   108 	}
       
   109 
       
   110 /**
       
   111   Set the timeout error code
       
   112   Inorder to assure binary compatibility with the original Contacts Model,
       
   113   which did not retry processing client requests, the error code - reason 
       
   114   why an request can not be processed - needs to be stored and returned to
       
   115   to the client if a subsequest/retry to process the request fails.
       
   116   For example if a contact item has been locked by one session, a request
       
   117   to open the contact item by a second session should complete with KErrInUse
       
   118   however if the server has been put into a transaction state by one session,
       
   119   the seconds session request should complete with KErrNotReady 
       
   120   KErrNotReady is the default error timeout value set by the base state CState
       
   121   it is also be set the CCntRequest constructor
       
   122  
       
   123   @param  aError The error code with which the message will be completed if it times out 
       
   124   
       
   125  */ 
       
   126 void CCntRequest::SetTimeOutError(TInt aError)
       
   127 	{
       
   128 	iTimeOutError = aError;
       
   129 	}
       
   130 	
       
   131 /**
       
   132  Get the timeout error code	
       
   133  @return The timeout error code
       
   134 */ 
       
   135 TInt CCntRequest::TimeOutError()const
       
   136 	{
       
   137 	return iTimeOutError;
       
   138 	}
       
   139 
       
   140 
       
   141 /** 
       
   142   Does not complete a RMessage - Internal Request do not contain a RMessage
       
   143   as they don't originate from the client.  Do nothing.
       
   144   @param  aErrorCode Not used
       
   145 */
       
   146 void CReqInternal::Complete(TInt /* aErrorCode*/) 
       
   147 	{
       
   148 	}
       
   149 
       
   150 
       
   151 // Request Helper classes
       
   152 // -----------------------
       
   153 // CCntRequestTimer
       
   154 // CRequestStore
       
   155 
       
   156 /** 
       
   157   CCntRequestTimer constructor
       
   158   CCntRequestTimer is an active object derived from CTimer
       
   159   @param aRequest The request which will timeout
       
   160   @param aReqStore The array that holds the deferred request    
       
   161   				   The request must be removed from the request store after 
       
   162   				   it is completed with an error code.
       
   163 */
       
   164 CCntRequestTimer* CCntRequestTimer::NewL(CCntRequest& aRequest, CRequestStore& aReqStore)
       
   165 	{
       
   166 	CCntRequestTimer* self = new (ELeave) CCntRequestTimer(aRequest, aReqStore);
       
   167 	CleanupStack::PushL(self);
       
   168 	self->ConstructL();
       
   169 	CleanupStack::Pop(self);
       
   170 	return self;
       
   171 	}
       
   172 	
       
   173 	
       
   174 CCntRequestTimer::~CCntRequestTimer()
       
   175 	{
       
   176 	CTimer::Cancel();
       
   177 	}
       
   178 	
       
   179 	
       
   180 CCntRequestTimer::CCntRequestTimer(CCntRequest& aRequest, CRequestStore& aReqStore) 
       
   181 				 : CTimer(CActive::EPriorityIdle), 
       
   182 				 iRequest(aRequest), 
       
   183 				 iReqStore(aReqStore) 
       
   184 	{								  
       
   185 	}
       
   186 
       
   187 
       
   188 void CCntRequestTimer::ConstructL()
       
   189 	{
       
   190 	CTimer::ConstructL();
       
   191 	CActiveScheduler::Add(this);
       
   192 	}
       
   193 
       
   194 void CCntRequestTimer::RunL()
       
   195 	{
       
   196 	// Complete the contact with the timeout error
       
   197 	iRequest.Complete(iRequest.TimeOutError());
       
   198 	CTimer::Cancel();
       
   199 	iReqStore.RemoveD(&iRequest); 
       
   200 	}
       
   201 
       
   202 void CCntRequestTimer::Start()
       
   203 	{ 
       
   204 	CTimer::After(iRequest.TimeOut());
       
   205 	}
       
   206 		
       
   207 void CCntRequestTimer::Stop()
       
   208 	{
       
   209 	CTimer::Cancel();
       
   210 	}
       
   211 
       
   212 
       
   213 
       
   214 
       
   215 /**
       
   216  Object are added when the session requests a Transaction to begin
       
   217  but the database is already in a transaction state for another session
       
   218  There can only ever handle one transaction request - no concurrency!
       
   219 
       
   220  @param aStateMachine The request store calls the statemachine to process the
       
   221  					  request.
       
   222 */ 
       
   223 CRequestStore* CRequestStore::NewL(CCntStateMachine& aStateMachine)
       
   224 	{
       
   225 	CRequestStore* self = new (ELeave) CRequestStore(aStateMachine);
       
   226 	return self;
       
   227 	}
       
   228 
       
   229 CRequestStore::CRequestStore(CCntStateMachine& aStateMachine): 
       
   230 				iStateMachine(aStateMachine)
       
   231 	{
       
   232 	}
       
   233 
       
   234 CRequestStore::~CRequestStore()
       
   235 	{
       
   236 	iStore.ResetAndDestroy();
       
   237 	delete iActive;
       
   238 	}
       
   239 
       
   240 /**
       
   241  Remove the request from the store and delete the request
       
   242  
       
   243  @param aRequest The request that should be removed from the store and deleted
       
   244  				 The Request Store takes ownership of this object
       
   245 */
       
   246 void CRequestStore::RemoveD(CCntRequest* aRequest)
       
   247 	{
       
   248 	TInt index = iStore.Find(aRequest);
       
   249 	if (index > KErrNotFound)
       
   250 		{
       
   251 		iStore.Remove(index);	
       
   252 		}
       
   253 	delete aRequest;
       
   254 	aRequest = NULL;
       
   255 	}
       
   256 
       
   257 
       
   258 /**
       
   259  Append a request to the request store
       
   260 
       
   261  @param aRequest  The request that is to be appended to the store
       
   262 */	
       
   263 void CRequestStore::AppendL(CCntRequest* aRequest)
       
   264 	{
       
   265 	// The heap is safe since the request is appended to the contained store.
       
   266 	// Pop as the stack will be out of sync when the statemachine processes 
       
   267 	// the request.
       
   268 	User::LeaveIfError(iStore.Append(aRequest));
       
   269 	}
       
   270 
       
   271 /** 
       
   272  Get the first request from the store 
       
   273 
       
   274  @return The request a the beginning of the stores array
       
   275  		 Ownership of the request is given to the calling method
       
   276 */
       
   277 CCntRequest* CRequestStore::Request()
       
   278 	{
       
   279 	CCntRequest* request = iStore[KFirstRequest]; 
       
   280 	iStore.Remove(KFirstRequest);
       
   281 	
       
   282 	return request;     // Return ownership
       
   283 	}
       
   284 
       
   285 /**
       
   286  Is there requests in the store
       
   287  
       
   288  @return ETrue if there are no request, EFalse otherwise
       
   289 */
       
   290 TBool CRequestStore::IsEmpty()
       
   291 	{
       
   292 	if (iStore.Count() > 0)
       
   293 		return EFalse;
       
   294 	
       
   295 	return ETrue;
       
   296 	}
       
   297 
       
   298 /**
       
   299   Activate the store.
       
   300   The request store uses the CActiveLoop for callbacks on each iteration 
       
   301   of the CActiveLoop only one request is processed until all
       
   302   requests have been processed.
       
   303  */
       
   304 void CRequestStore::ActivateRequestsL()
       
   305 	{
       
   306 	if (!iActive)
       
   307 		{
       
   308 		iActive = CActiveLoop::NewL();
       
   309 		}
       
   310 	
       
   311 	// Only process the requests in the store when it has been activated.
       
   312 	// Don't process any requests added to the store after it has been activated.
       
   313 	// Requests may be readded to the store & should not be processed twice 
       
   314 	// in the same batch.
       
   315 	// The store may already have been activated. 
       
   316 	if ((!iActive->IsActive()) && (iNoOfRequests == 0))
       
   317 		{
       
   318 		iActive->Register(*this);	
       
   319 		iNoOfRequests = iStore.Count();
       
   320 		}
       
   321 	}
       
   322 
       
   323 /**
       
   324  Process the next request in the store.	
       
   325  If the request has timed out return an error
       
   326  otherwise process the request as normal.
       
   327  
       
   328  @ return ETrue if another step is required, EFalse if this is the last step
       
   329  */
       
   330 TBool CRequestStore::DoStepL()
       
   331 	{
       
   332 	ASSERT(iCurrentRequest == NULL);
       
   333 
       
   334 	iCurrentRequest = Request();
       
   335 	iStateMachine.ProcessRequestL(iCurrentRequest); // ownership transferred
       
   336 	
       
   337 	// ProcessRequestL received ownership of the request, iCurrentRequest can be 
       
   338 	// reset to NULL
       
   339 	iCurrentRequest = NULL;
       
   340 	
       
   341 	--iNoOfRequests;
       
   342 
       
   343 	if (iNoOfRequests == 0) 
       
   344 		{
       
   345 		return EFalse; // The store has tried to process all requests it holds	
       
   346 		}
       
   347 
       
   348 	return ETrue;
       
   349 	}
       
   350 	
       
   351 /** 
       
   352  Error callback from the CActiveLoop class.	
       
   353  
       
   354  @ param aError The error to complete the current request (the request that is
       
   355  				being processed)
       
   356 */
       
   357 void CRequestStore::DoError(TInt aError)
       
   358 	{
       
   359 	// there should always be a current request
       
   360 	ASSERT(iCurrentRequest);
       
   361 	if (iCurrentRequest)
       
   362 		{
       
   363 		iCurrentRequest->Complete(aError);
       
   364 		delete iCurrentRequest;
       
   365 		
       
   366 		iCurrentRequest = NULL;
       
   367 		}
       
   368 	}
       
   369 
       
   370 
       
   371 /** 
       
   372  CReqAsyncOpen constructor
       
   373  Request to open the database asyncronously 
       
   374  
       
   375  @see CCntRequest constructor   
       
   376 */
       
   377 CReqAsyncOpen* CReqAsyncOpen::NewLC(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut)
       
   378 	{
       
   379 	CReqAsyncOpen* self = new (ELeave) CReqAsyncOpen(aSessionId, aMessage, aTimeOut);
       
   380 	CleanupStack::PushL(self);
       
   381 	self->ConstructL();
       
   382 	return self;
       
   383 	}
       
   384 
       
   385 CReqAsyncOpen::CReqAsyncOpen(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut )
       
   386 : CCntRequest(aSessionId, aMessage, aTimeOut)
       
   387 	{
       
   388 	}
       
   389 
       
   390 void CReqAsyncOpen::ConstructL()
       
   391 	{
       
   392 	iMessage.ReadL(0,iFilename);
       
   393 	}
       
   394 
       
   395 /**
       
   396  Get the name of the file that is to be opened
       
   397  The DBManager may change this name. If no name has been passed by the client
       
   398  then the default is set by the manager
       
   399  
       
   400  @return The name of the file that should be opened
       
   401 */ 
       
   402 TDes& CReqAsyncOpen::FileName()
       
   403 	{
       
   404 	return iFilename;
       
   405 	}
       
   406 
       
   407 TAccept CReqAsyncOpen::VisitStateL(CState& aState)
       
   408 	{
       
   409 	return aState.AcceptRequestL(this);
       
   410 	}
       
   411 
       
   412 /**
       
   413  CReqCloseTables constructor
       
   414  Close the database tables
       
   415 
       
   416  @see CCntRequest constructor    
       
   417 */ 
       
   418 CReqCloseTables* CReqCloseTables::NewLC(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut)
       
   419   	{
       
   420   	CReqCloseTables* self = new (ELeave) CReqCloseTables(aSessionId, aMessage, aTimeOut);
       
   421   	CleanupStack::PushL(self);
       
   422   	return self;
       
   423   	};
       
   424   
       
   425 CReqCloseTables::CReqCloseTables(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut)
       
   426   :CCntRequest(aSessionId, aMessage, aTimeOut)
       
   427   	{
       
   428   	}
       
   429   
       
   430   
       
   431 TAccept CReqCloseTables::VisitStateL(CState& aState)
       
   432   	{
       
   433   	return aState.AcceptRequestL(this);
       
   434   	}
       
   435   
       
   436   
       
   437 /** 
       
   438   CReqReOpen 
       
   439   Re Open the database
       
   440   
       
   441   @see CCntRequest constructor    
       
   442 */
       
   443 CReqReOpen* CReqReOpen::NewLC(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut)
       
   444 	{
       
   445 	CReqReOpen* self = new (ELeave) CReqReOpen(aSessionId, aMessage, aTimeOut);
       
   446 	CleanupStack::PushL(self);
       
   447 	return self;
       
   448 	}
       
   449 
       
   450 CReqReOpen::CReqReOpen(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut)
       
   451 :CCntRequest(aSessionId, aMessage, aTimeOut)
       
   452 	{
       
   453 	}
       
   454 
       
   455 TAccept CReqReOpen::VisitStateL(CState& aState)
       
   456 	{
       
   457 	return aState.AcceptRequestL(this);
       
   458 	}
       
   459 
       
   460 
       
   461 /**
       
   462  CReqCancelAsyncOpen 
       
   463  Cancel an asyncronous open request
       
   464  
       
   465  @see CCntRequest constructor    
       
   466 */ 
       
   467 CReqCancelAsyncOpen* CReqCancelAsyncOpen::NewLC(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut)
       
   468 	{
       
   469 	CReqCancelAsyncOpen* self = new (ELeave) CReqCancelAsyncOpen(aSessionId, aMessage, aTimeOut);
       
   470 	CleanupStack::PushL(self);
       
   471 	return self;
       
   472 	}
       
   473 
       
   474 CReqCancelAsyncOpen::CReqCancelAsyncOpen(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut)
       
   475 :CCntRequest(aSessionId, aMessage, aTimeOut)
       
   476 	{
       
   477 	}
       
   478 	
       
   479 TAccept CReqCancelAsyncOpen::VisitStateL(CState& aState)
       
   480 	{
       
   481 	return aState.AcceptRequestL(this);
       
   482 	}
       
   483 
       
   484 
       
   485 
       
   486 /**
       
   487  CReqUpdate 
       
   488  Parent Class for CReqUpdateCnt & CReqCommitCnt
       
   489  
       
   490  @see CCntRequest constructor   
       
   491 */
       
   492 void CReqUpdate::ConstructL(CCntPackager& aPackager)
       
   493 	{
       
   494 	aPackager.SetBufferFromMessageL(iMessage);
       
   495 	iCntItem = aPackager.UnpackCntItemLC();
       
   496 	CleanupStack::Pop(iCntItem);
       
   497 	}
       
   498 
       
   499 CReqUpdate::~CReqUpdate()
       
   500 	{
       
   501 	delete iCntItem;
       
   502 	}
       
   503 
       
   504 CReqUpdate::CReqUpdate(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut)
       
   505 :CCntRequest(aSessionId, aMessage, aTimeOut)
       
   506 	{
       
   507 	}
       
   508 
       
   509 
       
   510 
       
   511 /** CReqUpdateCnt constructor
       
   512  Update a contact item - derived from CReqUpdate. Used in conjunction with CReqReadCnt. 
       
   513  Note: CReqCommitCnt is very similar to CReqUpdateCnt, but CReqCommitCnt is used with CReqOpenCnt
       
   514        and locks the contact. CReqUpdateCnt does not perform locking.
       
   515  
       
   516  @see CCntRequest constructor          
       
   517 */
       
   518 CReqUpdateCnt* CReqUpdateCnt::NewLC(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut, CCntPackager& aPackager)
       
   519 	{
       
   520 	CReqUpdateCnt* self = new (ELeave) CReqUpdateCnt(aSessionId, aMessage, aTimeOut);
       
   521 	CleanupStack::PushL(self);
       
   522 	self->ConstructL(aPackager);
       
   523 	return self;
       
   524 	}
       
   525 
       
   526 CReqUpdateCnt::CReqUpdateCnt(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut)
       
   527 :CReqUpdate(aSessionId, aMessage, aTimeOut)
       
   528 	{
       
   529 	}
       
   530 
       
   531 TAccept CReqUpdateCnt::VisitStateL(CState& aState)
       
   532 	{
       
   533 	return aState.AcceptRequestL(this);
       
   534 	}
       
   535 	
       
   536 	
       
   537 /** 
       
   538  CReqSetSpeedDial constructor
       
   539  Set a speed dial key
       
   540  
       
   541  @see CCntRequest constructor   
       
   542 */ 
       
   543 CReqSetSpeedDial* CReqSetSpeedDial::NewLC(	const TUint aSessionId, 
       
   544 									const RMessage2& aMessage, 
       
   545 									const TInt aTimeOut, 
       
   546 									CContactItemViewDef& aItemViewDef,
       
   547 									CCntServerSpeedDialManager& aSpeedDialManager,
       
   548 									const CCntServerSpeedDialTable& aTable,
       
   549 									MIniFileManager& aIniFileManager)
       
   550 	{
       
   551 	CReqSetSpeedDial* self = new (ELeave) CReqSetSpeedDial(	aSessionId, 
       
   552 															aMessage, 
       
   553 															aTimeOut, 
       
   554 															aItemViewDef,
       
   555 															aSpeedDialManager,
       
   556 															aTable,
       
   557 															aIniFileManager);
       
   558 	CleanupStack::PushL(self);
       
   559 	self->ConstructL();															
       
   560 	return self;
       
   561 	}
       
   562 
       
   563 CReqSetSpeedDial::CReqSetSpeedDial(	const TUint aSessionId, 
       
   564 									const RMessage2& aMessage, 
       
   565 									const TInt aTimeOut, 
       
   566 									CContactItemViewDef& aItemViewDef,
       
   567 									CCntServerSpeedDialManager& aSpeedDialManager,
       
   568 									const CCntServerSpeedDialTable& aTable,
       
   569 									MIniFileManager& aIniFileManager)
       
   570 :CCntRequest(aSessionId, aMessage, aTimeOut), iItemViewDef(&aItemViewDef), iSpeedDialManager(aSpeedDialManager), iTable(aTable), iIniFileManager(aIniFileManager)
       
   571 	{
       
   572 	}
       
   573 	
       
   574 void CReqSetSpeedDial::ConstructL()
       
   575 	{
       
   576 	// Read the message
       
   577 	// Read position
       
   578 	iSpeedDialIndex = iMessage.Int0();
       
   579 	// Read contact id
       
   580 	iContactId = static_cast<TContactItemId> (iMessage.Int1());
       
   581 	// Read Field Index
       
   582 	iTheFieldIndex = iMessage.Int2();	
       
   583 	}
       
   584 
       
   585 TAccept CReqSetSpeedDial::VisitStateL(CState& aState)
       
   586 	{
       
   587 	return aState.AcceptRequestL(this);
       
   588 	}
       
   589 	
       
   590 TInt CReqSetSpeedDial::SpeedDialIndex()
       
   591 	{
       
   592 	return iSpeedDialIndex;
       
   593 	}
       
   594 
       
   595 TContactItemId CReqSetSpeedDial::TheContactId()
       
   596 	{
       
   597 	return iContactId;
       
   598 	}
       
   599 
       
   600 TInt CReqSetSpeedDial::TheFieldIndex()
       
   601 	{
       
   602 	return iTheFieldIndex;	
       
   603 	}
       
   604 		
       
   605 const CContactItemViewDef& CReqSetSpeedDial::ItemViewDef()
       
   606 	{
       
   607 	return *iItemViewDef;
       
   608 	}
       
   609 	
       
   610 CCntServerSpeedDialManager& CReqSetSpeedDial::SpeedDialManager()
       
   611 	{
       
   612 	return iSpeedDialManager;	
       
   613 	}
       
   614 	
       
   615 const CCntServerSpeedDialTable& CReqSetSpeedDial::SpeedDialTable()
       
   616 	{
       
   617 	return iTable;
       
   618 	}
       
   619 	
       
   620 MIniFileManager& CReqSetSpeedDial::IniFileManager()
       
   621 	{
       
   622 	return iIniFileManager;
       
   623 	}
       
   624 
       
   625 /**
       
   626  CReqSetOwnCard constructor
       
   627  Set the own card
       
   628  
       
   629  @see CCntRequest constructor    
       
   630 */ 
       
   631 CReqSetOwnCard* CReqSetOwnCard::NewLC(	const TUint aSessionId, 
       
   632 									const RMessage2& aMessage, 
       
   633 									const TInt aTimeOut,
       
   634 									CCntPackager& aPackager, 
       
   635 									CContactItemViewDef& aItemViewDef,
       
   636 									MIniFileManager& aIniFileManager)
       
   637 	{
       
   638 	CReqSetOwnCard* self = new (ELeave) CReqSetOwnCard(	aSessionId, 
       
   639 														aMessage, 
       
   640 														aTimeOut, 
       
   641 														aItemViewDef,
       
   642 														aIniFileManager);
       
   643 	CleanupStack::PushL(self);
       
   644 	self->ConstructL(aPackager);															
       
   645 	return self;
       
   646 	}
       
   647 
       
   648 CReqSetOwnCard::CReqSetOwnCard(	const TUint aSessionId, 
       
   649 									const RMessage2& aMessage, 
       
   650 									const TInt aTimeOut, 
       
   651 									CContactItemViewDef& aItemViewDef,
       
   652 									MIniFileManager& aIniFileManager)
       
   653 :CReqUpdate(aSessionId, aMessage, aTimeOut), iItemViewDef(&aItemViewDef), iIniFileManager(aIniFileManager)
       
   654 	{
       
   655 	}
       
   656 	
       
   657 
       
   658 
       
   659 TAccept CReqSetOwnCard::VisitStateL(CState& aState)
       
   660 	{
       
   661 	return aState.AcceptRequestL(this);
       
   662 	}
       
   663 	
       
   664 TContactItemId CReqSetOwnCard::TheContactId()
       
   665 	{
       
   666 	return iContactId;
       
   667 	}
       
   668 		
       
   669 const CContactItemViewDef& CReqSetOwnCard::ItemViewDef()
       
   670 	{
       
   671 	return *iItemViewDef;
       
   672 	}
       
   673 	
       
   674 	
       
   675 MIniFileManager& CReqSetOwnCard::IniFileManager()
       
   676 	{
       
   677 	return iIniFileManager;
       
   678 	}
       
   679 	
       
   680 /** 
       
   681  CReqCommitCnt constructor
       
   682  Commit a contact item - used in conjunction with CReqOpenCnt
       
   683  Derived from CReqUpdate, and is very similar to CReqUpdateCnt but also locks the contact item
       
   684  so no other session can modify it.
       
   685  
       
   686  @see CCntRequest constructor   
       
   687 */ 
       
   688 CReqCommitCnt* CReqCommitCnt::NewLC(const TUint aSessionId, 
       
   689 									const RMessage2& aMessage, 
       
   690 									const TInt aTimeOut, 
       
   691 									CCntPackager& aPackager)
       
   692 	{
       
   693 	CReqCommitCnt* self = new (ELeave) CReqCommitCnt(aSessionId, aMessage, aTimeOut);
       
   694 	CleanupStack::PushL(self);
       
   695 	self->ConstructL(aPackager);
       
   696 	return self;
       
   697 	}
       
   698 
       
   699 CReqCommitCnt::CReqCommitCnt(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut)
       
   700 :CReqUpdate(aSessionId, aMessage, aTimeOut)
       
   701 	{
       
   702 	}
       
   703 
       
   704 TAccept CReqCommitCnt::VisitStateL(CState& aState)
       
   705 	{
       
   706 	return aState.AcceptRequestL(this);
       
   707 	}
       
   708 
       
   709 
       
   710 
       
   711 
       
   712 
       
   713 /** CReqRead constructor   
       
   714  Parent class of CReqReadCnt & CReqOpenCnt
       
   715  CReqOpenCnt and CReqReadCnt are very similar 
       
   716  CReqOpenCnt results in the contact item being locked by the session, so no other session
       
   717  can modify the contact item.
       
   718  CReqReadCnt results in no locking.
       
   719  Note: The CRequest::CompleteL method is overridden in this class
       
   720  
       
   721  @see CCntRequest constructor    
       
   722 */ 
       
   723 CReqRead::CReqRead(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut, CCntPackager& aPackager, CContactItemViewDef& aItemViewDef)
       
   724 	:CCntRequest(aSessionId, aMessage, aTimeOut), 
       
   725 	iPackager(aPackager), 
       
   726 	iItemViewDef(&aItemViewDef),
       
   727 	iViewDefCreated(EFalse)
       
   728 	{
       
   729 	}
       
   730 	
       
   731 void CReqRead::ConstructL()
       
   732 	{
       
   733 	if (iMessage.Int3())
       
   734 		{
       
   735 		iPackager.SetBufferFromMessageL(iMessage);
       
   736 		iItemViewDef = iPackager.UnpackCntItemViewDefLC();
       
   737 		iViewDefCreated = ETrue;
       
   738 		iPackager.Clear();
       
   739 		CleanupStack::Pop(iItemViewDef);
       
   740 		}
       
   741 	}
       
   742 
       
   743 CReqRead::~CReqRead()
       
   744 	{
       
   745 	if (iViewDefCreated)	// Required - determine CntItemViewdef was extracted from iMessage
       
   746 		{					// encapsulates ItemViewDef nicely. 
       
   747 		delete iItemViewDef;
       
   748 		}	
       
   749 	}
       
   750 
       
   751 const CContactItemViewDef& CReqRead::ItemViewDef()
       
   752 	{
       
   753 	return *iItemViewDef;
       
   754 	}
       
   755 
       
   756 /** Overridden CompleteL method 
       
   757  Completes the request item by packing the contact item into the RMessage slot
       
   758  and returning it to the client
       
   759  
       
   760  @param aCntItem The contact item that is returned to the client.
       
   761 */ 
       
   762 void CReqRead::CompleteL(const CContactItem& aCntItem)
       
   763 	{
       
   764 	TInt size(0);
       
   765 	TPtr8 cntItemBuff = iPackager.PackL(aCntItem, size); 
       
   766 	// Write data if client buffer is large enough
       
   767 	// otherwise return the required buffer size.
       
   768 	if(iMessage.GetDesMaxLength(1) >= size)
       
   769 		{ 
       
   770 		iMessage.WriteL(1, cntItemBuff); 
       
   771 		Complete(KErrNone);
       
   772 		}
       
   773 	else
       
   774 		{ 
       
   775 		Complete(size);	
       
   776 		}
       
   777 	}
       
   778 	
       
   779 
       
   780 /** CReqOpenCnt constructor
       
   781  Open a Contact Item - derived from CReqRead. 
       
   782  Very similar to CReqReadCnt but also results in the contact item being locked
       
   783 
       
   784  @see CReqRead constructor   
       
   785 */ 
       
   786 CReqOpenCnt* CReqOpenCnt::NewLC(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut, CCntPackager& aPackager, CContactItemViewDef& aItemViewDef)
       
   787 	{
       
   788 	CReqOpenCnt* self = new (ELeave) CReqOpenCnt(aSessionId, aMessage, aTimeOut, aPackager, aItemViewDef);
       
   789 	CleanupStack::PushL(self);
       
   790 	self->ConstructL();
       
   791 	return self;
       
   792 	}
       
   793 
       
   794 CReqOpenCnt::CReqOpenCnt(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut, CCntPackager& aPackager, CContactItemViewDef& aItemViewDef)
       
   795 	:CReqRead(aSessionId, aMessage, aTimeOut, aPackager, aItemViewDef) 
       
   796 	{
       
   797 	}
       
   798 
       
   799 CReqOpenCnt::~CReqOpenCnt()
       
   800 	{
       
   801 	}
       
   802 
       
   803 
       
   804 TAccept CReqOpenCnt::VisitStateL(CState& aState)
       
   805 	{
       
   806 	return aState.AcceptRequestL(this);
       
   807 	}
       
   808 
       
   809 
       
   810 /**
       
   811  CReqReadCnt constructor
       
   812  Read a contact item - derived from CReqRead
       
   813  Very similar to CReqOpenCnt but does not result in locking the contact item
       
   814 
       
   815  @see CReqRead constructor   
       
   816  
       
   817 */ 
       
   818 CReqReadCnt* CReqReadCnt::NewLC(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut, CCntPackager& aPackager, CContactItemViewDef& aItemViewDef)
       
   819 	{
       
   820 	CReqReadCnt* self = new (ELeave) CReqReadCnt(aSessionId, aMessage, aTimeOut, aPackager, aItemViewDef);
       
   821 	CleanupStack::PushL(self);
       
   822 	self->ConstructL();
       
   823 	return self;
       
   824 	}
       
   825 
       
   826 CReqReadCnt::CReqReadCnt(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut, CCntPackager& aPackager, CContactItemViewDef& aItemViewDef)
       
   827 	:CReqRead(aSessionId, aMessage, aTimeOut, aPackager, aItemViewDef) 
       
   828 	{
       
   829 	}
       
   830 
       
   831 CReqReadCnt::~CReqReadCnt()
       
   832 	{
       
   833 	}
       
   834 
       
   835 
       
   836 TAccept CReqReadCnt::VisitStateL(CState& aState)
       
   837 	{
       
   838 	return aState.AcceptRequestL(this);
       
   839 	}
       
   840 	
       
   841 	
       
   842 	
       
   843 /** 
       
   844  CReqDeleteCnt constructor
       
   845  Delete a contact Item
       
   846  
       
   847  @see CCntRequest constructor 
       
   848 */ 
       
   849 CReqDeleteCnt* CReqDeleteCnt::NewLC(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut)
       
   850 	{
       
   851 	CReqDeleteCnt* self = new (ELeave) CReqDeleteCnt(aSessionId, aMessage, aTimeOut);
       
   852 	CleanupStack::PushL(self);
       
   853 	return self;
       
   854 	}
       
   855 
       
   856 CReqDeleteCnt::CReqDeleteCnt(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut)
       
   857 :CCntRequest(aSessionId, aMessage, aTimeOut)
       
   858 	{
       
   859 	}
       
   860 
       
   861 CReqDeleteCnt::~CReqDeleteCnt()
       
   862 	{
       
   863 	}
       
   864 
       
   865 TAccept CReqDeleteCnt::VisitStateL(CState& aState)
       
   866 	{
       
   867 	return aState.AcceptRequestL(this);
       
   868 	}
       
   869 	
       
   870 	
       
   871 	
       
   872 	
       
   873 /** CReqCloseCnt 
       
   874  Close a contact Item - Used in conjunction with CReqOpenCnt to remove the lock on the contact item 
       
   875  without committing.
       
   876  
       
   877  @see CCntRequest constructor
       
   878 */ 
       
   879 CReqCloseCnt* CReqCloseCnt::NewLC(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut)
       
   880 	{
       
   881 	CReqCloseCnt* self = new (ELeave) CReqCloseCnt(aSessionId, aMessage, aTimeOut);
       
   882 	CleanupStack::PushL(self);
       
   883 	return self;
       
   884 	}
       
   885 
       
   886 CReqCloseCnt::CReqCloseCnt(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut)
       
   887 :CCntRequest(aSessionId, aMessage, aTimeOut)
       
   888 	{
       
   889 	}
       
   890 
       
   891 CReqCloseCnt::~CReqCloseCnt()
       
   892 	{
       
   893 	}
       
   894 
       
   895 TAccept CReqCloseCnt::VisitStateL(CState& aState)
       
   896 	{
       
   897 	return aState.AcceptRequestL(this);
       
   898 	}	
       
   899 	
       
   900 /** 
       
   901   CReqCreateCnt constructor
       
   902   Create a contact item, this request is completed with the new contact item id or an error code.
       
   903   
       
   904   @see CCntRequest constructor
       
   905 */ 
       
   906 CReqCreateCnt* CReqCreateCnt::NewLC(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut, CCntPackager& aPackager)
       
   907 	{
       
   908 	CReqCreateCnt* self = new (ELeave) CReqCreateCnt(aSessionId, aMessage, aTimeOut);
       
   909 	CleanupStack::PushL(self);
       
   910 	self->ConstructL(aPackager);
       
   911 	return self;
       
   912 	}
       
   913 
       
   914 CReqCreateCnt::CReqCreateCnt(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut)
       
   915 :CCntRequest(aSessionId, aMessage, aTimeOut)
       
   916 	{
       
   917 	}
       
   918 
       
   919 CReqCreateCnt::~CReqCreateCnt()
       
   920 	{
       
   921 	delete iCntItem;
       
   922 	}
       
   923 
       
   924 TAccept CReqCreateCnt::VisitStateL(CState& aState)
       
   925 	{
       
   926 	#if defined(__PROFILE_DEBUG__)
       
   927 		RDebug::Print(_L("[CNTMODEL] MTD: CCntStateMachine::ProcessRequestL"));
       
   928 	#endif 	
       
   929 	
       
   930 	return aState.AcceptRequestL(this);
       
   931 	}
       
   932 
       
   933 void CReqCreateCnt::ConstructL(CCntPackager& aPackager)
       
   934 	{
       
   935 	aPackager.SetBufferFromMessageL(iMessage);
       
   936 	iCntItem = aPackager.UnpackCntItemLC();
       
   937 	CleanupStack::Pop(iCntItem);
       
   938 	}
       
   939 
       
   940 
       
   941 
       
   942 
       
   943 // Database Transactin Request Class implemenations //
       
   944 
       
   945 
       
   946 /** 
       
   947  CReqDbBeginTrans constructor
       
   948  Request to begin a transaction - moves the state machine into a transaction state	
       
   949  
       
   950  @see CCntRequest constructor
       
   951 */
       
   952 CReqDbBeginTrans* CReqDbBeginTrans::NewLC(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut)
       
   953 	{
       
   954 	CReqDbBeginTrans* self = new (ELeave) CReqDbBeginTrans(aSessionId, aMessage, aTimeOut);
       
   955 	CleanupStack::PushL(self);
       
   956 	return self;
       
   957 	}
       
   958 	
       
   959 TAccept CReqDbBeginTrans::VisitStateL(CState& aState)
       
   960 	{
       
   961 	return aState.AcceptRequestL(this);
       
   962 	}
       
   963 
       
   964 
       
   965 	
       
   966 CReqDbBeginTrans::CReqDbBeginTrans(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut)
       
   967 				 :CCntRequest(aSessionId, aMessage, aTimeOut)
       
   968 	{
       
   969 	}
       
   970 
       
   971 /** 
       
   972  CReqDbCommitTrans constructor
       
   973  Request to Commit a transaction	
       
   974  Moves the database out of a transaction state and (usually) into a writable state
       
   975  
       
   976  @see CCntRequest constructor
       
   977  */
       
   978 CReqDbCommitTrans* CReqDbCommitTrans::NewLC(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut)
       
   979 	{
       
   980 	CReqDbCommitTrans* self = new (ELeave) CReqDbCommitTrans(aSessionId, aMessage, aTimeOut);
       
   981 	CleanupStack::PushL(self);
       
   982 	return self;	
       
   983 	}
       
   984 	
       
   985 TAccept CReqDbCommitTrans::VisitStateL(CState& aState)
       
   986 	{
       
   987 	return aState.AcceptRequestL(this);	
       
   988 	}
       
   989 
       
   990 CReqDbCommitTrans::CReqDbCommitTrans(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut)	
       
   991 				  :CCntRequest(aSessionId, aMessage, aTimeOut)
       
   992 
       
   993 	{
       
   994 	}
       
   995 	
       
   996 	
       
   997 /**
       
   998  CReqDbRollbackTrans constructor
       
   999  Request to Rollback a transaction - results in a database recovery 
       
  1000  so it closes and re-opens the database if it has been damaged
       
  1001  
       
  1002  @see CCntRequest constructor 
       
  1003 */ 
       
  1004 CReqDbRollbackTrans* CReqDbRollbackTrans::NewLC(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut)
       
  1005 	{
       
  1006 	CReqDbRollbackTrans* self = new (ELeave) CReqDbRollbackTrans(aSessionId, aMessage, aTimeOut);
       
  1007 	CleanupStack::PushL(self);
       
  1008 	return self;	
       
  1009 	}
       
  1010 	
       
  1011 TAccept CReqDbRollbackTrans::VisitStateL(CState& aState)
       
  1012 	{
       
  1013 	return aState.AcceptRequestL(this);	
       
  1014 	}
       
  1015 
       
  1016 CReqDbRollbackTrans::CReqDbRollbackTrans(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut)
       
  1017 				    :CCntRequest(aSessionId, aMessage, aTimeOut)
       
  1018 	{
       
  1019 	}
       
  1020 
       
  1021 	
       
  1022 /** 
       
  1023  CReqBackupRestoreBegin constructor
       
  1024  Notifys the state machine that a backup/restore is beginning
       
  1025 
       
  1026  @see CCntRequest constructor 
       
  1027 */ 
       
  1028 CReqBackupRestoreBegin* CReqBackupRestoreBegin::NewLC()
       
  1029 	{
       
  1030 	CReqBackupRestoreBegin* self = new (ELeave) CReqBackupRestoreBegin();
       
  1031 	CleanupStack::PushL(self);
       
  1032 	return self;
       
  1033 	}
       
  1034 
       
  1035 TAccept CReqBackupRestoreBegin::VisitStateL(CState& aState)
       
  1036 	{
       
  1037 	return aState.AcceptRequestL(this);
       
  1038 	}
       
  1039 
       
  1040 /**
       
  1041  CReqBackupRestoreEnd constructor
       
  1042  Notifys the state machine that a restore has ended
       
  1043  
       
  1044  @see CCntRequest constructor 
       
  1045  */
       
  1046 CReqBackupRestoreEnd* CReqBackupRestoreEnd::NewLC()
       
  1047 	{
       
  1048 	CReqBackupRestoreEnd* self = new (ELeave) CReqBackupRestoreEnd();
       
  1049 	CleanupStack::PushL(self);
       
  1050 	return self;
       
  1051 	}
       
  1052 
       
  1053 TAccept CReqBackupRestoreEnd::VisitStateL(CState& aState)
       
  1054 	{
       
  1055 	return aState.AcceptRequestL(this);
       
  1056 	}
       
  1057 
       
  1058 
       
  1059 /**
       
  1060  CReqDiskSpaceLow constructor
       
  1061  @see CCntRequest constructor 
       
  1062  */
       
  1063 CReqDiskSpaceLow* CReqDiskSpaceLow::NewLC()
       
  1064 	{
       
  1065 	CReqDiskSpaceLow* self = new (ELeave) CReqDiskSpaceLow();
       
  1066 	CleanupStack::PushL(self);
       
  1067 	return self;
       
  1068 	}
       
  1069 
       
  1070 TAccept CReqDiskSpaceLow::VisitStateL(CState& aState)
       
  1071 	{
       
  1072 	return aState.AcceptRequestL(this);
       
  1073 	}
       
  1074 
       
  1075 
       
  1076 /** 
       
  1077  CReqDiskSpaceNormal constructor
       
  1078  @see CCntRequest constructor
       
  1079 */
       
  1080 CReqDiskSpaceNormal* CReqDiskSpaceNormal::NewLC()
       
  1081 	{
       
  1082 	CReqDiskSpaceNormal* self = new (ELeave) CReqDiskSpaceNormal();
       
  1083 	CleanupStack::PushL(self);
       
  1084 	return self;
       
  1085 	}
       
  1086 
       
  1087 TAccept CReqDiskSpaceNormal::VisitStateL(CState& aState)
       
  1088 	{
       
  1089 	return aState.AcceptRequestL(this);
       
  1090 	}
       
  1091 
       
  1092 
       
  1093 /**
       
  1094  CReqAsyncActivity constructor
       
  1095  @see CCntRequest constructor 
       
  1096  */
       
  1097 CReqAsyncActivity* CReqAsyncActivity::NewLC(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut)
       
  1098 	{
       
  1099 	CReqAsyncActivity* self = new (ELeave) CReqAsyncActivity(aSessionId, aMessage, aTimeOut);
       
  1100 	CleanupStack::PushL(self);
       
  1101 	return self;
       
  1102 	}
       
  1103 
       
  1104 CReqAsyncActivity::CReqAsyncActivity(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut )
       
  1105 : CCntRequest(aSessionId, aMessage, aTimeOut)
       
  1106 	{
       
  1107 	}
       
  1108 
       
  1109 TAccept CReqAsyncActivity::VisitStateL(CState& aState)
       
  1110 	{
       
  1111 	return aState.AcceptRequestL(this);
       
  1112 	}
       
  1113 
       
  1114 
       
  1115 /** 
       
  1116  CReqNoAsyncActivity constructor
       
  1117  @see CCntRequest constructor
       
  1118 */
       
  1119 CReqNoAsyncActivity* CReqNoAsyncActivity::NewLC(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut)
       
  1120 	{
       
  1121 	CReqNoAsyncActivity* self = new (ELeave) CReqNoAsyncActivity(aSessionId, aMessage, aTimeOut);
       
  1122 	CleanupStack::PushL(self);
       
  1123 	return self;
       
  1124 	}
       
  1125 
       
  1126 CReqNoAsyncActivity::CReqNoAsyncActivity(const TUint aSessionId, const RMessage2& aMessage, const TInt aTimeOut )
       
  1127 : CCntRequest(aSessionId, aMessage, aTimeOut)
       
  1128 	{
       
  1129 	}
       
  1130 
       
  1131 TAccept CReqNoAsyncActivity::VisitStateL(CState& aState)
       
  1132 	{
       
  1133 	return aState.AcceptRequestL(this);
       
  1134 	}
       
  1135 
       
  1136 /**
       
  1137   CReqInternalSessionUnlock constructor
       
  1138   CReqInternalSessionUnlock unlocks all remaining locked contact items when
       
  1139   a session closes. It is called from the session class destructor
       
  1140   
       
  1141   @see CCntReqInternal constructor  	
       
  1142 */
       
  1143 CReqInternalSessionUnlock* CReqInternalSessionUnlock::NewLC(TInt aSessionId)
       
  1144 	{
       
  1145 	CReqInternalSessionUnlock* self = new (ELeave) CReqInternalSessionUnlock(aSessionId);
       
  1146 	CleanupStack::PushL(self);
       
  1147 	return self;		
       
  1148 	}
       
  1149 	
       
  1150 TAccept CReqInternalSessionUnlock::VisitStateL(CState& aState)
       
  1151 	{
       
  1152 	return aState.AcceptRequestL(this);		
       
  1153 	}
       
  1154 
       
  1155 	
       
  1156 //CReqInternalAsyncOpen //	
       
  1157 // Similar to CReqAsyncOpen but the request originates from inside the server.
       
  1158 CReqInternalAsyncOpen* CReqInternalAsyncOpen::NewLC(const TUint aSessionId, const TDesC& aFileName, TRequestStatus& aStatus)
       
  1159 	{
       
  1160 	CReqInternalAsyncOpen* self = new (ELeave) CReqInternalAsyncOpen(aSessionId, aFileName, aStatus);
       
  1161 	CleanupStack::PushL(self);
       
  1162 	self->ConstructL();
       
  1163 	return self;
       
  1164 	}
       
  1165 	
       
  1166 CReqInternalAsyncOpen::CReqInternalAsyncOpen(const TUint aSessionId, const TDesC& aFileName, TRequestStatus& aStatus)
       
  1167  : CReqAsyncOpen(aSessionId), iStatus(&aStatus)
       
  1168 	{
       
  1169 	iFilename = aFileName;
       
  1170 	}
       
  1171 
       
  1172 void CReqInternalAsyncOpen::ConstructL()
       
  1173 	{
       
  1174 	*iStatus = KRequestPending;	
       
  1175 	}
       
  1176 
       
  1177 void CReqInternalAsyncOpen::Complete(TInt aErrorCode)
       
  1178 	{
       
  1179 	User::RequestComplete(iStatus, aErrorCode);
       
  1180 	}
       
  1181 
       
  1182 //CReqCancelInternalAsyncOpen //	
       
  1183 // Similar to CReqCancelAsyncOpen but the request originates from inside the server,
       
  1184 // so there is no need to signal a RMessage that the request has completed
       
  1185 CReqCancelInternalAsyncOpen* CReqCancelInternalAsyncOpen::NewLC(const TUint aSessionId)
       
  1186 	{
       
  1187 	CReqCancelInternalAsyncOpen* self = new (ELeave) CReqCancelInternalAsyncOpen(aSessionId);
       
  1188 	CleanupStack::PushL(self);
       
  1189 	return self;	
       
  1190 	}
       
  1191 	
       
  1192 void CReqCancelInternalAsyncOpen::Complete(TInt /*errorCode*/)
       
  1193 	{
       
  1194 	}
       
  1195