installationservices/swcomponentregistry/source/server/scrsubsession.cpp
branchRCL_3
changeset 25 7333d7932ef7
equal deleted inserted replaced
24:5cc91383ab1e 25:7333d7932ef7
       
     1 /*
       
     2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 * Implements CScrSubsession. See class and function definitions for more information.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 /**
       
    21  @file
       
    22 */
       
    23 
       
    24 #include "scrsubsession.h"
       
    25 #include "scrrequestimpl.h"
       
    26 #include "scrdatabase.h"
       
    27 #include <scs/ipcstream.h>
       
    28 #include <scs/cleanuputils.h>
       
    29 
       
    30 using namespace Usif;
       
    31 
       
    32 /////////////////
       
    33 // CScrSubsession
       
    34 /////////////////
       
    35 
       
    36 CScrSubsession::CScrSubsession(CScrSession &aSession)
       
    37 /**
       
    38 	This constructor is protected and prevents direct instantiation.
       
    39  */
       
    40 	: CScsSubsession(aSession)
       
    41 	{
       
    42 	iSession = static_cast<CScrSession *>(&aSession);
       
    43 	iServer = static_cast<CScrServer *>(&iSession->iServer);
       
    44 	}
       
    45 
       
    46 void CScrSubsession::ConstructL()
       
    47 /**
       
    48 	Second-phase constructor.
       
    49  */
       
    50 	{
       
    51 	iServer->AddSubsessionOwnerL(iSession);
       
    52 	}
       
    53 
       
    54 CScrSubsession::~CScrSubsession()
       
    55 /**
       
    56  	Virtual destructor. Closes the database session handle.
       
    57  */
       
    58 	{
       
    59 	iServer->RemoveSubsessionOwner(iSession);
       
    60 	delete iStatement;
       
    61 	}
       
    62 	
       
    63 ///////////////////////////
       
    64 // CCompViewSubsessionContext
       
    65 ///////////////////////////	
       
    66 	
       
    67 CCompViewSubsessionContext::~CCompViewSubsessionContext()
       
    68 	{
       
    69 	delete iLastSoftwareTypeName;
       
    70 	iComponentFilterSuperset.Close();
       
    71 	}
       
    72 	
       
    73 ///////////////////////////
       
    74 // CComponentViewSubsession
       
    75 ///////////////////////////
       
    76 
       
    77 CComponentViewSubsession* CComponentViewSubsession::NewL(CScrSession &aSession)
       
    78 /**
       
    79 	Factory function allocates a new instance of CComponentViewSubsession.
       
    80 	
       
    81 	Note that CComponentViewSubsession derives from CObject and therefore it MUST NOT be deleted directly,
       
    82 	instead it should be closed.
       
    83 	 
       
    84 	@return					The newly created instance of CComponentViewSubsession.
       
    85 							Ownership is transferred to the caller.
       
    86  */
       
    87 	{
       
    88 	CComponentViewSubsession* self = new(ELeave) CComponentViewSubsession(aSession);
       
    89 	CleanupClosePushL(*self);
       
    90 	self->ConstructL();
       
    91 	CleanupStack::Pop(self);
       
    92 	return self;
       
    93 	}
       
    94 
       
    95 CComponentViewSubsession::CComponentViewSubsession(CScrSession &aSession)
       
    96 /**
       
    97 	This constructor is private and prevents direct instantiation. It provides
       
    98 	a single point of definition from which to call the superclass c'tor.
       
    99  */
       
   100 	:	CScrSubsession(aSession)
       
   101 	{	
       
   102 	}
       
   103 
       
   104 void CComponentViewSubsession::ConstructL()
       
   105 /**
       
   106 	Second-phase constructor.
       
   107  */
       
   108 	{
       
   109 	iSubsessionContext = new (ELeave) CCompViewSubsessionContext;		
       
   110 	CScrSubsession::ConstructL();
       
   111 	}
       
   112 
       
   113 CComponentViewSubsession::~CComponentViewSubsession()
       
   114 /**
       
   115 	Destructor for the subsession object.
       
   116  */
       
   117 	{
       
   118 	delete iFilter;
       
   119 	delete iComponentEntry;
       
   120 	iComponentEntryList.ResetAndDestroy();
       
   121 	delete iSubsessionContext;
       
   122 	}
       
   123 
       
   124 TBool CComponentViewSubsession::DoServiceL(TInt aFunction, const RMessage2& aMessage)
       
   125 /**
       
   126 	Implement CComponentViewSubsession by handling the supplied message.
       
   127 
       
   128 	@param	aFunction		Function identifier without SCS code.
       
   129 	@param	aMessage		Standard server-side handle to message.
       
   130 	@return ETrue means complete client request now. EFalse for asynchronous tasks.
       
   131  */
       
   132 	{
       
   133 	TScrSubSessionFunction f = static_cast<TScrSubSessionFunction>(aFunction);
       
   134 	
       
   135 	switch (f)
       
   136 		{
       
   137 		case EOpenComponentsView:
       
   138 			{
       
   139 			DeleteObjectZ(iFilter);
       
   140 			iFilter = iServer->RequestImpL()->ReadComponentFilterL(aMessage);
       
   141 			DeleteObjectZ(iStatement);
       
   142 			iStatement = iServer->RequestImpL()->OpenComponentViewL(*iFilter, iSubsessionContext->iComponentFilterSuperset, iSubsessionContext->iFilterSupersetInUse);
       
   143 			break;
       
   144 			}
       
   145 		case EGetNextComponentSize:
       
   146 			iServer->RequestImpL()->NextComponentSizeL(aMessage, iStatement, iFilter, iComponentEntry, this->iSubsessionContext);
       
   147 			break;
       
   148 		case EGetNextComponentData:
       
   149 			iServer->RequestImpL()->NextComponentDataL(aMessage, iComponentEntry);
       
   150 			break;
       
   151 		case EGetNextComponentSetSize:
       
   152 			iServer->RequestImpL()->NextComponentSetSizeL(aMessage, iStatement, iFilter, iComponentEntryList, this->iSubsessionContext);
       
   153 			break;
       
   154 		case EGetNextComponentSetData:
       
   155 			iServer->RequestImpL()->NextComponentSetDataL(aMessage, iComponentEntryList);
       
   156 			break;
       
   157 		default:
       
   158 			User::Leave(KErrNotSupported);
       
   159 			break;
       
   160 		}
       
   161 	return ETrue;
       
   162 	}
       
   163 
       
   164 
       
   165 ///////////////////////
       
   166 // CFileListSubsession
       
   167 ///////////////////////
       
   168 
       
   169 CFileListSubsession* CFileListSubsession::NewL(CScrSession &aSession)
       
   170 /**
       
   171 	Factory function allocates a new instance of CFileListSubsession.
       
   172 	
       
   173 	Note that CFileListSubsession derives from CObject and therefore it MUST NOT be deleted directly,
       
   174 	instead it should be closed.
       
   175 	 
       
   176 	@return					The newly created instance of CFileListSubsession.
       
   177 							Ownership is transferred to the caller.
       
   178  */
       
   179 	{
       
   180 	CFileListSubsession* self = new(ELeave) CFileListSubsession(aSession);
       
   181 	CleanupStack::PushL(self);
       
   182 	self->ConstructL();
       
   183 	CleanupStack::Pop(self);
       
   184 	return self;
       
   185 	}
       
   186 
       
   187 CFileListSubsession::CFileListSubsession(CScrSession &aSession)
       
   188 /**
       
   189 	This constructor is private and prevents direct instantiation. It provides
       
   190 	a single point of definition from which to call the superclass c'tor.
       
   191  */
       
   192 	:	CScrSubsession(aSession)
       
   193 	{
       
   194 	// empty.
       
   195 	}
       
   196 
       
   197 CFileListSubsession::~CFileListSubsession()
       
   198 /**
       
   199 	Destructor for the subsession object.
       
   200  */
       
   201 	{		
       
   202 	delete iFilePath;
       
   203 	iFileList.Close();
       
   204 	}
       
   205 
       
   206 TBool CFileListSubsession::DoServiceL(TInt aFunction, const RMessage2& aMessage)
       
   207 /**
       
   208 	Implement CFileListSubsession by handling the supplied message.
       
   209 
       
   210 	@param	aFunction		Function identifier without SCS code.
       
   211 	@param	aMessage		Standard server-side handle to message.
       
   212 	@return ETrue means complete client request now. EFalse for asynchronous tasks.
       
   213  */
       
   214 	{
       
   215 	TScrSessionFunction f = static_cast<TScrSessionFunction>(aFunction);
       
   216 	
       
   217 	switch (f)
       
   218 		{
       
   219 		case EOpenFileList:
       
   220 			{
       
   221 			DeleteObjectZ(iStatement);
       
   222 			iStatement = iServer->RequestImpL()->OpenFileListL(aMessage);
       
   223 			break;
       
   224 			}
       
   225 		case EGetNextFileSize:
       
   226 			iServer->RequestImpL()->NextFileSizeL(aMessage, iStatement, iFilePath);
       
   227 			break;
       
   228 		case EGetNextFileData:
       
   229 			iServer->RequestImpL()->NextFileDataL(aMessage, iFilePath);
       
   230 			break;
       
   231 		case EGetNextFileSetSize:
       
   232 			iServer->RequestImpL()->NextFileSetSizeL(aMessage, iStatement, iFileList);
       
   233 			break;
       
   234 		case EGetNextFileSetData:
       
   235 			iServer->RequestImpL()->NextFileSetDataL(aMessage, iFileList);
       
   236 			break;
       
   237 		default:
       
   238 			User::Leave(KErrNotSupported);
       
   239 			break;
       
   240 		}
       
   241 	return ETrue;
       
   242 	}
       
   243 
       
   244 //////////////////////////////
       
   245 ///CCompViewSubsessionContext
       
   246 /////////////////////////////
       
   247 
       
   248 CAppInfoViewSubsessionContext::~CAppInfoViewSubsessionContext()
       
   249     {
       
   250     iApps.Close();
       
   251     }
       
   252 
       
   253 /////////////////////////
       
   254 ///CAppInfoViewSubsession
       
   255 ////////////////////////
       
   256 
       
   257 CAppInfoViewSubsession* CAppInfoViewSubsession::NewL(CScrSession& aSession)
       
   258     {
       
   259     CAppInfoViewSubsession* self = new(ELeave) CAppInfoViewSubsession(aSession);
       
   260     CleanupClosePushL(*self);
       
   261     self->ConstructL();
       
   262     CleanupStack::Pop(self);
       
   263     return self;
       
   264     }
       
   265 
       
   266 
       
   267 CAppInfoViewSubsession::CAppInfoViewSubsession(CScrSession &aSession) : CScrSubsession(aSession)
       
   268     {   
       
   269     }
       
   270 
       
   271 void CAppInfoViewSubsession::ConstructL()
       
   272 /**
       
   273     Second-phase constructor.
       
   274  */
       
   275     {
       
   276     iSubsessionContext = new (ELeave) CAppInfoViewSubsessionContext;       
       
   277     CScrSubsession::ConstructL();
       
   278     }
       
   279 
       
   280 CAppInfoViewSubsession::~CAppInfoViewSubsession()
       
   281 /**
       
   282     Destructor for the subsession object.
       
   283  */
       
   284     {
       
   285     delete iAppInfoFilter;   
       
   286     if(NULL != iApaAppInfo)
       
   287         delete iApaAppInfo;
       
   288     delete iSubsessionContext;
       
   289     }
       
   290 
       
   291 TBool CAppInfoViewSubsession::DoServiceL(TInt aFunction, const RMessage2& aMessage)
       
   292 /**
       
   293     Implement CFileListSubsession by handling the supplied message.
       
   294 
       
   295     @param  aFunction       Function identifier without SCS code.
       
   296     @param  aMessage        Standard server-side handle to message.
       
   297     @return ETrue means complete client request now. EFalse for asynchronous tasks.
       
   298  */
       
   299     {
       
   300     TScrSessionFunction f = static_cast<TScrSessionFunction>(aFunction);
       
   301     
       
   302     switch (f)
       
   303         {
       
   304         case EOpenAppInfoView:
       
   305             {
       
   306             DeleteObjectZ(iAppInfoFilter);
       
   307             iAppInfoFilter = iServer->RequestImpL()->ReadAppInfoFilterL(aMessage);
       
   308             DeleteObjectZ(iStatement);
       
   309             iSubsessionContext->iLocale = TLanguage(aMessage.Int1());
       
   310     
       
   311             if(iSubsessionContext->iLocale == KUnspecifiedLocale)
       
   312                 {
       
   313                 iSubsessionContext->iLocale = User::Language();
       
   314                 }
       
   315             iSubsessionContext->iAppInfoIndex = 0;
       
   316             iServer->RequestImpL()->OpenAppInfoViewL(*iAppInfoFilter, this->iSubsessionContext);
       
   317             break;
       
   318             }
       
   319         case EGetNextAppInfoSize:
       
   320              iServer->RequestImpL()->NextAppInfoSizeL(aMessage, iApaAppInfo, this->iSubsessionContext);
       
   321              break;
       
   322         case EGetNextAppInfoData:
       
   323              iServer->RequestImpL()->NextAppInfoDataL(aMessage, iApaAppInfo);
       
   324              break;
       
   325    
       
   326         default:
       
   327             User::Leave(KErrNotSupported);
       
   328             break;
       
   329         }
       
   330     return ETrue;
       
   331     }
       
   332 
       
   333 ///////////////////////////////////////////
       
   334 ///CApplicationRegInfoSubsessionContext
       
   335 //////////////////////////////////////////
       
   336 CApplicationRegInfoSubsessionContext::~CApplicationRegInfoSubsessionContext()
       
   337     {
       
   338     delete iAppServiceInfoFilter;   
       
   339     iServiceInfoArray.ResetAndDestroy(); 
       
   340     }
       
   341 
       
   342 /////////////////////////////////
       
   343 ///CApplicationRegInfoSubsession
       
   344 ////////////////////////////////
       
   345 CApplicationRegInfoSubsession* CApplicationRegInfoSubsession::NewL(CScrSession &aSession)
       
   346 /**
       
   347     Factory function allocates a new instance of CAppInfoQuerySubsession.
       
   348     
       
   349     Note that CAppInfoQuerySubsession derives from CObject and therefore it MUST NOT be deleted directly,
       
   350     instead it should be closed.
       
   351      
       
   352     @return                 The newly created instance of CAppInfoQuerySubsession.
       
   353                             Ownership is transferred to the caller.
       
   354  */
       
   355     {
       
   356     CApplicationRegInfoSubsession* self = new(ELeave) CApplicationRegInfoSubsession(aSession);
       
   357     CleanupStack::PushL(self);
       
   358     self->ConstructL();
       
   359     CleanupStack::Pop(self);
       
   360     return self;
       
   361     }
       
   362 
       
   363 CApplicationRegInfoSubsession::CApplicationRegInfoSubsession(CScrSession &aSession)
       
   364 /**
       
   365     This constructor is private and prevents direct instantiation. It provides
       
   366     a single point of definition from which to call the superclass c'tor.
       
   367  */
       
   368     :   CScrSubsession(aSession)
       
   369     {
       
   370     // empty.
       
   371     }
       
   372 
       
   373 void CApplicationRegInfoSubsession::ConstructL()
       
   374 /**
       
   375     Second-phase constructor.
       
   376  */
       
   377     {
       
   378     iSubsessionContext = new (ELeave) CApplicationRegInfoSubsessionContext;       
       
   379     CScrSubsession::ConstructL();
       
   380     }
       
   381 
       
   382 CApplicationRegInfoSubsession::~CApplicationRegInfoSubsession()
       
   383 /**
       
   384     Destructor for the subsession object.
       
   385  */
       
   386     {       
       
   387     delete iSubsessionContext;
       
   388     }
       
   389 
       
   390 TBool CApplicationRegInfoSubsession::DoServiceL(TInt aFunction, const RMessage2& aMessage)
       
   391 /**
       
   392     Implement CAppInfoQuerySubsession by handling the supplied message.
       
   393 
       
   394     @param  aFunction       Function identifier without SCS code.
       
   395     @param  aMessage        Standard server-side handle to message.
       
   396     @return ETrue means complete client request now. EFalse for asynchronous tasks.
       
   397  */
       
   398     {
       
   399     TScrSessionFunction f = static_cast<TScrSessionFunction>(aFunction);
       
   400     
       
   401     switch (f)
       
   402         {        
       
   403         case EGetAppForDataTypeAndService:
       
   404             iServer->RequestImpL()->GetAppForDataTypeAndServiceL(aMessage);
       
   405             break;
       
   406         case EGetAppForDataType:
       
   407             iServer->RequestImpL()->GetAppForDataTypeL(aMessage);
       
   408             break;                
       
   409         case EGetAppServiceInfoSize:
       
   410             iServer->RequestImpL()->GetAppServiceInfoSizeL(aMessage, this->iSubsessionContext);
       
   411             break;
       
   412         case EGetAppServiceInfoData:
       
   413             iServer->RequestImpL()->GetAppServiceInfoDataL(aMessage, this->iSubsessionContext);
       
   414             break;
       
   415         case EGetApplicationInfo:
       
   416             iServer->RequestImpL()->GetApplicationInfoL(aMessage);
       
   417             break;
       
   418         default:
       
   419             User::Leave(KErrNotSupported);
       
   420             break;
       
   421         }
       
   422     return ETrue;
       
   423     }
       
   424 
       
   425 ///////////////////////////////////////////
       
   426 ///CRegInfoForApplicationSubsessionContext
       
   427 //////////////////////////////////////////
       
   428 CRegInfoForApplicationSubsessionContext::~CRegInfoForApplicationSubsessionContext()
       
   429     {
       
   430     iViewInfoArray.ResetAndDestroy(); 
       
   431     iServiceUidList.Close(); 
       
   432     iAppOwnedFiles.ResetAndDestroy();
       
   433     }
       
   434 
       
   435 /////////////////////////////////////
       
   436 ///CRegInfoForApplicationSubsession
       
   437 ////////////////////////////////////
       
   438 CRegInfoForApplicationSubsession* CRegInfoForApplicationSubsession::NewL(CScrSession &aSession)
       
   439 /**
       
   440     Factory function allocates a new instance of CAppInfoQueryContextSubsession.
       
   441     
       
   442     Note that CAppInfoQueryContextSubsession derives from CObject and therefore it MUST NOT be deleted directly,
       
   443     instead it should be closed.
       
   444      
       
   445     @return                 The newly created instance of CAppInfoQueryContextSubsession.
       
   446                             Ownership is transferred to the caller.
       
   447  */
       
   448     {
       
   449     CRegInfoForApplicationSubsession* self = new(ELeave) CRegInfoForApplicationSubsession(aSession);
       
   450     CleanupStack::PushL(self);
       
   451     self->ConstructL();
       
   452     CleanupStack::Pop(self);
       
   453     return self;
       
   454     }
       
   455 
       
   456 CRegInfoForApplicationSubsession::CRegInfoForApplicationSubsession(CScrSession &aSession)
       
   457 /**
       
   458     This constructor is private and prevents direct instantiation. It provides
       
   459     a single point of definition from which to call the superclass c'tor.
       
   460  */
       
   461     :   CScrSubsession(aSession)
       
   462     {
       
   463     // empty.
       
   464     }
       
   465 
       
   466 void CRegInfoForApplicationSubsession::ConstructL()
       
   467 /**
       
   468     Second-phase constructor.
       
   469  */
       
   470     {
       
   471     iSubsessionContext = new (ELeave) CRegInfoForApplicationSubsessionContext;       
       
   472     CScrSubsession::ConstructL();
       
   473     }
       
   474 
       
   475 CRegInfoForApplicationSubsession::~CRegInfoForApplicationSubsession()
       
   476 /**
       
   477     Destructor for the subsession object.
       
   478  */
       
   479     {   
       
   480     delete iSubsessionContext;
       
   481     }
       
   482 
       
   483 TBool CRegInfoForApplicationSubsession::DoServiceL(TInt aFunction, const RMessage2& aMessage)
       
   484 /**
       
   485     Implement CAppInfoQueryContextSubsession by handling the supplied message.
       
   486 
       
   487     @param  aFunction       Function identifier without SCS code.
       
   488     @param  aMessage        Standard server-side handle to message.
       
   489     @return ETrue means complete client request now. EFalse for asynchronous tasks.
       
   490  */
       
   491     {
       
   492     TScrSessionFunction f = static_cast<TScrSessionFunction>(aFunction);
       
   493     
       
   494     switch (f)
       
   495         {        
       
   496         case ESetAppUid:
       
   497             {
       
   498             TUid appUid = TUid::Uid(aMessage.Int0());
       
   499             if(!(iServer->RequestImpL()->CheckIfAppUidExistsL(appUid)))
       
   500                 {
       
   501                 User::Leave(KErrNotFound);
       
   502                 }
       
   503             iAppUid = appUid;
       
   504             iServer->RequestImpL()->SetLocaleForRegInfoForApplicationSubsessionContextL(aMessage, this->iSubsessionContext);
       
   505             break;
       
   506             }
       
   507         case EGetServiceUidSize:
       
   508             iServer->RequestImpL()->GetServiceUidSizeL(aMessage,iAppUid, this->iSubsessionContext);
       
   509             break;
       
   510         case EGetServiceUidList:
       
   511             iServer->RequestImpL()->GetServiceUidDataL(aMessage, this->iSubsessionContext);
       
   512             break;
       
   513         case EGetApplicationLanguage:
       
   514             iServer->RequestImpL()->GetApplicationLanguageL(aMessage,this->iSubsessionContext);
       
   515             break;
       
   516         case EGetDefaultScreenNumber:
       
   517             iServer->RequestImpL()->GetDefaultScreenNumberL(aMessage,iAppUid);           
       
   518             break;
       
   519         case EGetNumberOfOwnDefinedIcons:
       
   520             iServer->RequestImpL()->GetNumberOfOwnDefinedIconsL(aMessage,iAppUid,this->iSubsessionContext);
       
   521             break;   
       
   522 		case EGetViewSize:
       
   523             iServer->RequestImpL()->GetViewSizeL(aMessage, iAppUid, this->iSubsessionContext);
       
   524             break;
       
   525         case EGetViewData:
       
   526             iServer->RequestImpL()->GetViewDataL(aMessage, this->iSubsessionContext);
       
   527             break;
       
   528         case EGetAppOwnedFilesSize:
       
   529             iServer->RequestImpL()->GetAppOwnedFilesSizeL(aMessage, iAppUid, this->iSubsessionContext);
       
   530             break;
       
   531         case EGetAppOwnedFilesData:
       
   532             iServer->RequestImpL()->GetAppOwnedFilesDataL(aMessage, this->iSubsessionContext);
       
   533             break;
       
   534         case EGetAppCharacteristics:
       
   535             iServer->RequestImpL()->GetAppCharacteristicsL(aMessage, iAppUid);
       
   536             break;
       
   537         case EGetAppIconForFileName:
       
   538             iServer->RequestImpL()->GetAppIconForFileNameL(aMessage, iAppUid, this->iSubsessionContext);
       
   539             break;
       
   540         case EGetAppViewIconFileName:
       
   541             iServer->RequestImpL()->GetAppViewIconFileNameL(aMessage, iAppUid, this->iSubsessionContext);
       
   542             break;
       
   543         default:
       
   544             User::Leave(KErrNotSupported);
       
   545             break;
       
   546         }
       
   547     return ETrue;
       
   548     }
       
   549 
       
   550 
       
   551 ////////////////////////////////////////////
       
   552 ///CAppRegistrySubsessionContext
       
   553 ///////////////////////////////////////////
       
   554 
       
   555 CAppRegistrySubsessionContext::~CAppRegistrySubsessionContext()
       
   556     {
       
   557     iAppUids.Close();
       
   558     }
       
   559 
       
   560 ////////////////////////////
       
   561 ///CAppRegistrySubsession
       
   562 ////////////////////////////
       
   563 
       
   564 CAppRegistrySubsession* CAppRegistrySubsession::NewL(CScrSession& aSession)
       
   565     {
       
   566     CAppRegistrySubsession* self = new(ELeave) CAppRegistrySubsession(aSession);
       
   567     CleanupClosePushL(*self);
       
   568     self->ConstructL();
       
   569     CleanupStack::Pop(self);
       
   570     return self;
       
   571     }
       
   572 
       
   573 
       
   574 CAppRegistrySubsession::CAppRegistrySubsession(CScrSession &aSession)
       
   575 /**
       
   576     This constructor is private and prevents direct instantiation. It provides
       
   577     a single point of definition from which to call the superclass c'tor.
       
   578  */
       
   579     :   CScrSubsession(aSession)
       
   580     {   
       
   581     }
       
   582 
       
   583 void CAppRegistrySubsession::ConstructL()
       
   584 /**
       
   585     Second-phase constructor.
       
   586  */
       
   587     {
       
   588     iSubsessionContext = new (ELeave) CAppRegistrySubsessionContext;       
       
   589     CScrSubsession::ConstructL();
       
   590     }
       
   591 
       
   592 CAppRegistrySubsession::~CAppRegistrySubsession()
       
   593 /**
       
   594     Destructor for the subsession object.
       
   595  */
       
   596     {
       
   597     if(NULL != iApplicationRegistrationInfo)
       
   598         delete iApplicationRegistrationInfo;
       
   599     delete iSubsessionContext;
       
   600     }
       
   601 
       
   602 TBool CAppRegistrySubsession::DoServiceL(TInt aFunction, const RMessage2& aMessage)
       
   603 /**
       
   604     Implement CFileListSubsession by handling the supplied message.
       
   605 
       
   606     @param  aFunction       Function identifier without SCS code.
       
   607     @param  aMessage        Standard server-side handle to message.
       
   608     @return ETrue means complete client request now. EFalse for asynchronous tasks.
       
   609  */
       
   610     {
       
   611     TScrSessionFunction f = static_cast<TScrSessionFunction>(aFunction);
       
   612     
       
   613     switch (f)
       
   614         {
       
   615         case EOpenApplicationRegistrationInfoView:
       
   616             {
       
   617             iSubsessionContext->iAppRegIndex = 0;
       
   618             iSubsessionContext->iAppUids.Reset();
       
   619             iServer->RequestImpL()->OpenApplicationRegistrationViewL(aMessage,this->iSubsessionContext);            
       
   620             break;
       
   621             }
       
   622         case EGetApplicationRegistrationSize:
       
   623              iServer->RequestImpL()->NextApplicationRegistrationInfoSizeL(aMessage, iApplicationRegistrationInfo, this->iSubsessionContext);
       
   624              break;
       
   625         case EGetApplicationRegistrationData:
       
   626              iServer->RequestImpL()->NextApplicationRegistrationInfoDataL(aMessage, iApplicationRegistrationInfo);
       
   627              break;
       
   628         case EOpenApplicationRegistrationInfoForAppUidsView:
       
   629             {
       
   630             iSubsessionContext->iAppRegIndex = 0;
       
   631             iSubsessionContext->iAppUids.Reset();
       
   632             iServer->RequestImpL()->OpenApplicationRegistrationForAppUidsViewL(aMessage,this->iSubsessionContext);            
       
   633             break;
       
   634             }
       
   635         default:
       
   636             User::Leave(KErrNotSupported);
       
   637             break;
       
   638         }
       
   639     return ETrue;
       
   640     }