installationservices/swcomponentregistry/source/server/scrsubsession.cpp
changeset 25 98b66e4fb0be
parent 24 84a16765cd86
equal deleted inserted replaced
24:84a16765cd86 25:98b66e4fb0be
     1 /*
     1 /*
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
   238 			User::Leave(KErrNotSupported);
   238 			User::Leave(KErrNotSupported);
   239 			break;
   239 			break;
   240 		}
   240 		}
   241 	return ETrue;
   241 	return ETrue;
   242 	}
   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     }