homescreenpluginsrv/hspsmanager/inc/hspsmaintenancehandler.h
branchRCL_3
changeset 30 a5a39a295112
child 31 8baec10861af
equal deleted inserted replaced
29:0efa10d348c0 30:a5a39a295112
       
     1 /*
       
     2 * Copyright (c) 2008 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 "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 *  
       
    16 *  ChspsMaintenanceHandler is a server-side implementation of MhspsMaintenanceService API-definition of
       
    17 *  HSPS Theme Management Services.
       
    18 *  Theme Maintenance Service is intended to serve HSPS applications as well as S60 legacy 
       
    19 *  applications - especially Personalisation Application - with Theme Maintenance Services. 
       
    20 *  Theme maintenance can take place after a set of themes are installed by HSPS Theme 
       
    21 *  Installation Service. Maintenance services includes theme listings, theme activation, 
       
    22 *  theme removal, and default theme restoring functionality.
       
    23 *
       
    24 *  Maintenance functions deploy Definition Repository and Symbian Central Repository. 
       
    25 *  Definition Repository keeps Application Themes in save place and Central Repository keeps the
       
    26 *  information about which theme is active for  what application. Information in Central Repository
       
    27 *  is stored in pairs of application UID and active theme UID.
       
    28 *  ChspsMaintenanceHandler utilizes ChspsODT class to exchange the information of Application Themes. 
       
    29 *  DOM-document member of ChspsODT is not attached in theme maintenance operations, only the theme 
       
    30 *  header. For more information, see HSPS Theme Management Service APIs documentation.
       
    31 *
       
    32 *
       
    33 */
       
    34    
       
    35 
       
    36 #ifndef __hspsMAINTENANCEHANDLER_H__
       
    37 #define __hspsMAINTENANCEHANDLER_H__
       
    38 
       
    39 #ifdef HSPS_LOG_ACTIVE
       
    40 class ChspsLogBus;
       
    41 #endif
       
    42 
       
    43 class MhspsMaintenanceService;
       
    44 class ChspsDefinitionRepository;
       
    45 class ChspsSecurityEnforcer;
       
    46 class ChspsODT;
       
    47 class CRepository;
       
    48 class ChspsThemeServer;
       
    49 class ChspsThemeServerSession;
       
    50 class ChspsResult;
       
    51 class ChspsDomNode;
       
    52 
       
    53 /**
       
    54 *  Class ChspsMaintenanceHandler.
       
    55 *  ChspsMaintenanceHandler performs all theme maintenance related functionality for hspsThemeServer. 
       
    56 *  Maintenance services includes theme listing, theme activation, theme removal and default theme 
       
    57 *  restoring operations.
       
    58 *  
       
    59 *  Class inheritance:
       
    60 *  ==================
       
    61 *  ChspsMaintenanceHandler derives CTimer for active timer functionality. It implements 
       
    62 *  MhspsMaintenanceService-interface from HSPS Theme Management Service APIs. 
       
    63 *  For more information, see HSPS Theme Management Service API documentation.
       
    64 *  
       
    65 *  Functionality:
       
    66 *  ==============
       
    67 *  Maintenance functions are presented in high-level and low-level parametrization mode. 
       
    68 *  This is the same approach that was introduced with HSPS Theme Installation Service 
       
    69 *  - to support user-intefaces with human-readable high-level elements and on the other hand, 
       
    70 *  machine-originated users with low-level data.
       
    71 *  Most of the maintenance functions are synchronous, only one is asynchronous; hspsGetNextHeader().
       
    72 *  Others functions are straightforward to use but hspsGetListHeaders(). This will be explained next; synchronous 
       
    73 *  call hspsGetListHeaders() initiates the theme header listing by passing search mask to HSPS 
       
    74 *  Theme Server's Maintenance Service. This search mask is called a query. It also passes a list 
       
    75 *  object in where maintenance service should append theme-header objects (type of ChspsODT-class 
       
    76 *  without DOM-document) when one is retrieved asychronously. Search mask should be filled with 
       
    77 *  proper parameters matching the need in hand. If no parameters are given, all headers of 
       
    78 *  Application Themes available in Definition Repository will be delivered, otherwise, 
       
    79 *  only sub-set of theme-headers will be delivered. 
       
    80 *  After the query-call hspsGetListHeaders(), the delivering of the theme-headers is asynchronous.
       
    81 *  Asynchronous service must be initiated by calling hspsGetNextHeader() after checking that any 
       
    82 *  theme matching on current query is found. This action is called a subscription. 
       
    83 *  To receive theme listing, the client application must implement 
       
    84 *  MhspsThemeManagementServiceObserver-interface and start to listen call-back messages. 
       
    85 *  The headers matching on query will be delivered immediately. Query remains until 
       
    86 *  hspsCancelGetListHeaders() is called by client. If a new Application Theme exist in repository,
       
    87 *  it will be delivered. As mentioned, when hspsGetListHeaders() returns, the return value must 
       
    88 *  be checked. Return value could be one of the following:
       
    89 *  - EhspsGetListHeadersSuccess - there is at least one Application Theme available matching on 
       
    90 *                               query. Call first hspsGetNextHeader() to get the headers. Same call
       
    91 *                               will set the subscribtion of new ones possible coming available 
       
    92 *                               later on.
       
    93 *  - EhspsGetListHeadersEmpty   - there is no themes matching on the query available at the time, 
       
    94 *                               however, some might be exist later in due to installations. 
       
    95 *                               Client application should retain the subcription.
       
    96 *  - EhspsGetListHeadersFailed  - service request failed in some reason. Possible reasons are for 
       
    97 *                               e.g. the missing rights to list headers queried.  
       
    98 *   
       
    99 *  In the near future, there will be s.c. Additional Return Code Support feature available in 
       
   100 *  HSPS. This code will express for e.g. the number of headers to be delivered or possible system 
       
   101 *  error code in failed cases.
       
   102 *  
       
   103 *  By MhspsServiceObserver::HandlehspsServiceMessage() call-back function implementation, client 
       
   104 *  application must listen the following ThspsServiceCompletedMessage-messages:
       
   105 *  - EhspsGetListHeadersUpdate  - header list on the client side has a new object appended at the end
       
   106 *                               of the list,
       
   107 *  - EhspsGetListHeadersRestart - header list on server side has changed so much that the client must 
       
   108 *                               empty the list printed on screen. New list will be delivered 
       
   109 *                               immediately. The subscription stands.
       
   110 *  - EhspsGetListHeadersEmpty   - header list on server side is now empty. The client must empty 
       
   111 *                               the list on screen if printed. The subscription stands. 
       
   112 *  - EhspsGetListHeadersFailed  - operation has failed. Client should cancel request and restart, 
       
   113 *                               perhaps.
       
   114 *
       
   115 *  Maintenanace functions may also return one of the following codes:
       
   116 *  - EhspsServiceRequestSheduled, or
       
   117 *  - EhspsServiceRequestError.
       
   118 *
       
   119 *  For explanation of the meanings of these messages, see ThspsServiceCompletedMessage-documentation.
       
   120 *
       
   121 *  @ingroup group_hspsserversession
       
   122 *  @lib hspsThemeServer.exe
       
   123 *  @since S60 3.1
       
   124 */
       
   125 class ChspsMaintenanceHandler : public CTimer, public MhspsMaintenanceService, 
       
   126                                              public MhspsDefinitionRepositoryObserver
       
   127     {
       
   128     public:  // Constructors and destructor
       
   129         /**
       
   130         * NewL.
       
   131         * Two-phased constructor.
       
   132         * @since S60 5.0
       
   133         * @param aThemeServer Server instance
       
   134         * @param aSecureId Identifies the client application which uses the handler
       
   135         */
       
   136         static ChspsMaintenanceHandler* NewL( 
       
   137                 ChspsThemeServer& aThemeServer, 
       
   138                 const TUint aSecureId = 0 );
       
   139         
       
   140         /**
       
   141         * NewLC.
       
   142         * Two-phased constructor.
       
   143         * @since S60 5.0
       
   144         * @param aThemeServer Server instance
       
   145         * @param aSecureId Identifies the client application which uses the handler
       
   146         */
       
   147         static ChspsMaintenanceHandler* NewLC( 
       
   148                 ChspsThemeServer& aThemeServer, 
       
   149                 const TUint aSecureId = 0 );
       
   150         
       
   151         /**
       
   152         * Destructor.
       
   153         */
       
   154         virtual ~ChspsMaintenanceHandler();
       
   155   
       
   156     public: // New functions
       
   157         
       
   158         /**
       
   159         * ServiceGetListHeadersL
       
   160         * @since S60 3.1
       
   161         * @param aMessage contains the data received from the client
       
   162         */
       
   163         void ServiceGetListHeadersL(const RMessage2& aMessage);
       
   164         
       
   165         /**
       
   166         * ServiceGetNextHeaderL
       
   167         * @since S60 3.1
       
   168         * @param aMessage contains the data received from the client
       
   169         */
       
   170         void ServiceGetNextHeaderL(const RMessage2& aMessage);
       
   171         
       
   172         /**
       
   173         * ServiceSetActiveThemeL
       
   174         * @since S60 3.1
       
   175         * @param aMessage contains the data received from the client
       
   176         */
       
   177         void ServiceSetActiveThemeL(const RMessage2& aMessage); 
       
   178         
       
   179         /**
       
   180         * ServiceRestoreDefaultL
       
   181         * @since S60 3.1
       
   182         * @param aMessage contains the data received from the client
       
   183         */
       
   184         void ServiceRestoreDefaultL(const RMessage2& aMessage); 
       
   185         
       
   186         /**
       
   187         * ServiceRemoveThemeL
       
   188         * @since S60 3.1
       
   189         * @param aMessage contains the data received from the client
       
   190         */
       
   191         void ServiceRemoveThemeL(const RMessage2& aMessage);  
       
   192         
       
   193         /**
       
   194         * ServiceAddPluginL
       
   195         * @since S60 5.0
       
   196         * @param aMessage contains the data received from the client
       
   197         */
       
   198         void ServiceAddPluginL(const RMessage2& aMessage);
       
   199         
       
   200         /**
       
   201         * ServiceRemovePluginL
       
   202         * @since S60 5.0
       
   203         * @param aMessage contains the data received from the client
       
   204         */
       
   205         void ServiceRemovePluginL( const RMessage2& aMessage );
       
   206         
       
   207         /**
       
   208         * ServiceSetActivePluginL
       
   209         * @since S60 5.0
       
   210         * @param aMessage contains the data received from the client
       
   211         */
       
   212         void ServiceSetActivePluginL( const RMessage2& aMessage );
       
   213                 
       
   214         /**
       
   215         * ServiceReplacePluginL
       
   216         * @since S60 5.0
       
   217         * @param aMessage contains the data received from the client
       
   218         */
       
   219         void ServiceReplacePluginL( const RMessage2& aMessage );
       
   220         
       
   221         /**
       
   222         * ServiceSetPluginSettingsL
       
   223         * @since S60 5.0
       
   224         * @param aMessage contains the data received from the client
       
   225         */
       
   226         void ServiceSetPluginSettingsL( const RMessage2& aMessage );
       
   227   
       
   228         /* 
       
   229          * ServiceGetPluginOdtL
       
   230          * @since S60 5.0
       
   231          * @param aMessage contains
       
   232          */
       
   233         void ServiceGetPluginOdtL( const RMessage2& aMessage );
       
   234         
       
   235         /**  
       
   236         * ServiceMovePluginsL
       
   237         * @since S60 5.0
       
   238         * @param aMessage contains the data received from the client
       
   239         */
       
   240         void ServiceMovePluginsL( const RMessage2& aMessage );
       
   241 
       
   242         /**  
       
   243         * ServiceSetConfStateL
       
   244         * @since S60 5.0
       
   245         * @param aMessage contains the data received from the client
       
   246         */
       
   247         void ServiceSetConfStateL( const RMessage2& aMessage );
       
   248 
       
   249         /**  
       
   250         * ServiceRestoreActiveAppConfL
       
   251         * @since S60 5.0
       
   252         * @param aMessage contains the data received from the client
       
   253         */
       
   254         void ServiceRestoreActiveAppConfL( const RMessage2& aMessage );
       
   255 
       
   256 #ifdef HSPS_LOG_ACTIVE        
       
   257         /** 
       
   258         * Set log bus.
       
   259         */
       
   260         void SetLogBus( ChspsLogBus* aLogBus );
       
   261 #endif        
       
   262 
       
   263         /**
       
   264          * SetServerSession.
       
   265          * @since S60 5.0
       
   266          * @param @param aServerSession Pointer to owning server session
       
   267          */
       
   268         void SetServerSession( ChspsThemeServerSession* aServerSession );
       
   269 
       
   270         /**  
       
   271          * ServiceRestoreConfigurationsL
       
   272          * @since S60 5.2
       
   273          * @param aMessage contains the data received from the client
       
   274          */
       
   275         void ServiceRestoreConfigurationsL( const RMessage2& aMessage );                        
       
   276         
       
   277   public: // Functions from base classes
       
   278 
       
   279         /** 
       
   280         * From MhspsMaintenanceService hspsGetListHeaders
       
   281         * @since S60 3.1
       
   282         * @param aSearchMask is ChspsODT-object which attributes are filled to present search 
       
   283         *        parameters for theme set queried by client. This parametrisation follows 
       
   284         *        the high-level schema. 
       
   285         * @param aHeaderList is an list object able to carry ChspsODT-objects. 
       
   286         * @return ThspsServiceCompletedMessage expressing the result of the call.
       
   287         */
       
   288         ThspsServiceCompletedMessage hspsGetListHeaders(const TDesC8& aSearchMaskData, 
       
   289                 CArrayPtrSeg<HBufC8>& aHeaderDataList);
       
   290         
       
   291         /** 
       
   292         * From MhspsMaintenanceService hspsGetNextHeader
       
   293         * @since S60 3.1
       
   294         * @return ThspsServiceCompletedMessage expressing the result of the call.
       
   295         */
       
   296         ThspsServiceCompletedMessage hspsGetNextHeader();         
       
   297         
       
   298         /**
       
   299         * From MhspsMaintenanceService hspsCancelGetListHeaders
       
   300         * @since S60 3.1
       
   301         * @return ThspsServiceCompletedMessage expressing the result of the call.
       
   302         */
       
   303         ThspsServiceCompletedMessage hspsCancelGetListHeaders();  
       
   304         
       
   305         /**
       
   306         * From MhspsMaintenanceService hspsSetActiveTheme
       
   307         * @since S60 3.1
       
   308         * @param aSetMask represents parameters by which the new theme activation will be done.
       
   309                  There must be sufficient set of parameters presented, at least a theme UID.
       
   310         * @param aOdt is an empty ODT-object which will contain the ODT of activated 
       
   311         *        theme on the return of the call. This parametrisation follows the high-level 
       
   312         *        schema. There must be sufficient set of parameters presented, at least a theme UID.
       
   313         * @return ThspsServiceCompletedMessage expressing the result of the call.
       
   314         */
       
   315         ThspsServiceCompletedMessage hspsSetActiveTheme( const ChspsODT& aSetMask, ChspsODT& aOdt );
       
   316         
       
   317         /**
       
   318         * From MhspsMaintenanceService hspsRestoreDefault
       
   319         * @since S60 3.1
       
   320         * @param aSetMask is an ODT-header parametrized enough to express the theme to be made
       
   321         *        active.
       
   322         * @param aHeader is an empty ODT-header object that will contain the header of the theme
       
   323         *        actually made active if the request was successful.
       
   324         * @return ThspsServiceCompletedMessage expressing the result of the call.
       
   325         */
       
   326         ThspsServiceCompletedMessage hspsRestoreDefault( const ChspsODT& aSetMask, ChspsODT& aHeader );
       
   327         
       
   328         /**
       
   329         * From MhspsMaintenanceService hspsRemoveThemeL
       
   330         * @since S60 3.1
       
   331         * @param aSetMask is an ODT-header parametrized enough to express the theme to be removed.
       
   332         * @return ThspsServiceCompletedMessage expressing the result of the call.
       
   333         */        
       
   334         ThspsServiceCompletedMessage hspsRemoveThemeL( const ChspsODT& aSetMask );
       
   335                 
       
   336         /**
       
   337         * From MhspsMaintenanceService hspsGetListHeaders
       
   338         * @since S60 3.1
       
   339         * @param aSearchMaskData is serialized ChspsODT-object. Before serializing, attributes 
       
   340         *        in ChspsODT-object were filled to present a search parameters for theme set queried.
       
   341         *        Serialized data parametrisation follows the low-level schema.  
       
   342         * @param aHeaderList is an list object able to carry serialized ChspsODT-objects. 
       
   343         * @return ThspsServiceCompletedMessage expressing the result of the call.
       
   344         */
       
   345         ThspsServiceCompletedMessage hspsGetListHeaders(const ChspsODT& /*aSearchMask*/
       
   346                                                          , const TBool /*aCopyLogos*/ 
       
   347                                                          , CArrayPtrFlat<ChspsODT>& /*aHeaderList*/);
       
   348         
       
   349         /**
       
   350         * From MhspsMaintenanceService hspsSetActiveTheme
       
   351         * @since S60 3.1
       
   352         * @param aSetMaskData is externalized version of ChspsODT-object presenting parameters by 
       
   353         *        which the new theme activation will be done. There must be sufficient set of 
       
   354         *        parameters presented, at least a theme UID. This parametrisation follows the 
       
   355         *        low-level schema.
       
   356         * @param aHeaderData is an empty description for externalized ODT-object data. 
       
   357         *        When internalized, this object will contain the header of newly activated theme 
       
   358         *        as a result of the call.
       
   359         * @return ThspsServiceCompletedMessage expressing the result of the call.
       
   360         */   
       
   361         ThspsServiceCompletedMessage hspsSetActiveTheme(const TDesC8& /*aSetMaskData*/
       
   362                                                            , TDes8& /*aHeaderData*/);
       
   363         
       
   364         /**
       
   365         * From MhspsMaintenanceService hspsAddPlugin
       
   366         * Not used - see ServiceAddPluginL instead which has a diffrent input 
       
   367         * @since S60 5.0
       
   368         */
       
   369         ThspsServiceCompletedMessage hspsAddPlugin(
       
   370             const TInt /*aAppUid*/,
       
   371             const TInt /*aParentPluginId*/,
       
   372             const TInt /*aPluginUid*/,
       
   373             const TInt /*aPosition*/,
       
   374             TInt& /*aAddedPluginId*/ );                
       
   375  
       
   376         /**          
       
   377         * From MhspsMaintenanceService hspsRemovePlugin
       
   378         * Not used - see ServiceRemovePluginL instead which has a diffrent input
       
   379         */
       
   380         ThspsServiceCompletedMessage hspsRemovePlugin(
       
   381                const TInt /*aAppUid*/,                
       
   382                const TInt /*aPluginId*/ );
       
   383 
       
   384         /**          
       
   385         * From MhspsMaintenanceService hspsSetActivePlugin
       
   386         * Not used - see ServiceRemovePluginL instead which has a diffrent input
       
   387         */        
       
   388         ThspsServiceCompletedMessage hspsSetActivePlugin(
       
   389                 const TInt aAppUid,
       
   390                 const TInt aPluginId
       
   391                 );
       
   392 
       
   393         /**          
       
   394         * From MhspsMaintenanceService hspsReplacePlugin
       
   395         * Not used - see ServiceReplacePluginL instead which has a diffrent input
       
   396         */               
       
   397         ThspsServiceCompletedMessage hspsReplacePlugin(
       
   398             const TInt /*aAppUid*/,
       
   399             const TInt /*aPluginId*/,             
       
   400             const TInt /*aConfUid*/ );
       
   401         
       
   402         /** 
       
   403         * From MhspsMaintenanceService hspsSetSettings
       
   404         * Not used - see ServiceRemovePluginL instead which has a diffrent input
       
   405         */
       
   406         ThspsServiceCompletedMessage hspsSetPluginSettings(
       
   407                 const ChspsODT& /*aHeader*/,
       
   408                 const TInt /*aPluginId*/,
       
   409                 ChspsDomDocument& /*aDom*/,
       
   410                 const TBool /*aPluginStoringStatus*/);
       
   411 
       
   412         /**          
       
   413         * From MhspsMaintenanceService hspsMovePluginsL
       
   414         * Not used - see ServiceMovePluginsL instead which has a diffrent input
       
   415         */
       
   416         ThspsServiceCompletedMessage hspsMovePluginsL(
       
   417                const TInt /*aAppUid*/,
       
   418                const TInt /*aConfId*/,               
       
   419                const CArrayFixFlat<TInt>& /*aPluginIdList*/ );
       
   420          
       
   421         TInt UpdatePluginListL(
       
   422             ChspsODT& aAppODT,
       
   423             const TInt aConfigurationId, 
       
   424             const CArrayFixFlat<TInt>& aPluginIdList );       
       
   425 
       
   426         /**          
       
   427         * From MhspsMaintenanceService hspsSetConfState
       
   428         * Not used - see ServiceSetConfStateL instead which has a diffrent input
       
   429         */
       
   430         ThspsServiceCompletedMessage hspsSetConfState(
       
   431             const TInt /*aAppUid*/,
       
   432             const TInt /*aConfId*/,             
       
   433             const ThspsConfigurationState /*aState*/,
       
   434             const ThspsConfStateChangeFilter /*aFilter*/ );
       
   435 
       
   436         /**          
       
   437         * From MhspsMaintenanceService hspsRestoreActiveAppConf
       
   438         * Not used - see ServiceRestoreActiveAppConfL instead which has a diffrent input
       
   439         */
       
   440         ThspsServiceCompletedMessage hspsRestoreActiveAppConf(
       
   441             const TInt /*aAppUid*/ );
       
   442         
       
   443         /** 
       
   444          * Updates plugin configuration in all application configuration
       
   445          *  
       
   446          * @since S60 5.0
       
   447          * @param apluginUid identifies the plugin configuration                
       
   448          * @return ThspsServiceCompletedMessage expressing the result of the call.
       
   449          */
       
   450         ThspsServiceCompletedMessage hspsPluginUpdateL(
       
   451                 const ChspsODT& aOdt );
       
   452 
       
   453         
       
   454 
       
   455     public: // from MhspsDefinitioRepositoryObserver
       
   456          
       
   457         TBool HandleDefinitionRespositoryEvent( ThspsRepositoryInfo aRepositoryInfo );
       
   458         
       
   459     protected:  // Functions from base classes
       
   460         
       
   461        
       
   462         ChspsMaintenanceHandler( ChspsThemeServer& aThemeServer, const TUint aSecureId );
       
   463         
       
   464         /**
       
   465         * By default Symbian 2nd phase constructor is private.
       
   466         */
       
   467         void ConstructL();
       
   468         
       
   469         /**
       
   470         * From CActive, RunL.
       
   471         * Callback function.
       
   472         * Invoked to handle responses from the server.
       
   473         */
       
   474         void RunL();
       
   475 
       
   476         /**
       
   477         * From CActive, DoCancel.
       
   478         * Cancels any outstanding operation.
       
   479         */
       
   480         void DoCancel();
       
   481         
       
   482         /**
       
   483         * From CActive Called when asynchronous request has failed
       
   484         * @since S60 3.1
       
   485         */
       
   486         TInt RunError( TInt aError );
       
   487     
       
   488     
       
   489     private:
       
   490         /**
       
   491         * C++ default constructor.
       
   492         */
       
   493         void GetHeaderListL( CArrayPtrSeg<HBufC8>& aHeaderDataList, const ChspsODT& aSearchMask );
       
   494         ThspsServiceCompletedMessage GetHeaderListUpdateL();
       
   495         void RestoredDefaultL( const ChspsODT& aSetMask, ChspsODT& aHeader );
       
   496         void RemoveThemeL( const ChspsODT& aSetMask );
       
   497         TBool CompareHeadersL(const TDesC8& aOldHeaderData, const TDesC8& aNewHeaderData);
       
   498         TBool ComparePaths(const ChspsODT& aOldHeader, const ChspsODT& aNewHeader);
       
   499         TBool FilterHeader(const ChspsODT& aMask, const ChspsODT& aHeader);
       
   500         // Completes the request message
       
   501         void CompleteRequest(const ThspsServiceCompletedMessage aReturnMessage, 
       
   502             RMessagePtr2& aMessagePtr, const TDesC8& aHeaderData = KNullDesC8 );
       
   503                 
       
   504         /**
       
   505          * Finds last id value from the provided DOM.
       
   506          * @since S60 5.0
       
   507          * @param aDom is the application configuration in XML format
       
   508          * @param aLastUsedConfId is the largest used configurtion id
       
   509          * @param aLastUsedPluginId is the largest used plugin id
       
   510          */
       
   511         void GetUsedIdsL(
       
   512                 ChspsDomDocument& aDom,
       
   513                 TInt& aLastUsedConfId,
       
   514                 TInt& aLastUsedPluginId
       
   515                 );
       
   516         
       
   517         /**
       
   518          * Appends an application configuration with an instance of a plugin configuration.
       
   519          * @since S60 5.0
       
   520          * @param aAppODT is an instance of the the application configuration
       
   521          * @param aPluginODT is an ODT instance of the plugin configuration
       
   522          * @param aConfigurationId is an id of the configuration being modified, identifies a plugins list
       
   523          * @param aNewPosition is an index of the new position in the plugins list
       
   524          * @param aLastConfId is a value of the last configuration id
       
   525          * @param aLastPluginId is a value of the last plugin id 
       
   526          * @return KErrNone if the operation succeeded
       
   527          */
       
   528         TInt AppendConfigurationL(
       
   529                 ChspsODT& aAppODT,
       
   530                 const ChspsODT& aPluginODT,      
       
   531                 const TInt aConfigurationId,    
       
   532                 const TInt aNewPosition, 
       
   533                 TInt& aLastConfId,
       
   534                 TInt& aLastPluginId
       
   535                 );
       
   536                 
       
   537         /**
       
   538          * Finds the plugins node of the provided plugin node.
       
   539          * @since S60 5.0
       
   540          * @param aNode is the plugins node to be searched
       
   541          * @return plugins node or NULL if the node couldn't be found 
       
   542          */
       
   543         ChspsDomNode* FindPluginsNode(
       
   544                 ChspsDomNode& aNode 
       
   545                 );
       
   546         
       
   547         /**
       
   548          * Appends a plugins list with a new plugin configuration instance.
       
   549          * @since S60 5.0
       
   550          * @param aAppODT is the application configuration being modified
       
   551          * @param aPluginsNode is the plugins node where the new plugin instance should be added to
       
   552          * @param aPluginODT is an ODT instance of the plugin configuration to be added
       
   553          * @param aNewPosition is an index of the new position in the plugins list
       
   554          * @param aNewPluginId is an id of the new plugin instance 
       
   555          * @return KErrNone if the operation succeeded 
       
   556          */
       
   557         TInt AppendPluginConfigurationL(
       
   558                 ChspsODT& aAppODT,                
       
   559                 ChspsDomNode& aPluginsNode,                
       
   560                 const ChspsODT& aPluginODT,                
       
   561                 const TInt aNewPosition,
       
   562                 const TInt aNewPluginId
       
   563                 );
       
   564 
       
   565         
       
   566         /**
       
   567          * Finds plugin nodes from the plugin configuration being added,
       
   568          * appends referred configurations into the main plugin configuration,
       
   569          * and updates the plugin nodes with unique id attribute values. 
       
   570          * @since S60 5.0
       
   571          * @param aAppODT is an instance of the the application configuration
       
   572          * @param aPluginODT is an instance of the plugin configuration being added
       
   573          * @param aLastConfId is a value of the last configuration id
       
   574          * @param aLastPluginId is a value of the last plugin id
       
   575          * @return KErrNone
       
   576          */
       
   577         TInt HandlePluginReferencesL(
       
   578                 ChspsODT& aAppODT,
       
   579                 ChspsODT& aPluginODT,
       
   580                 TInt& aLastConfId,
       
   581                 TInt& aLastPluginId 
       
   582                 );
       
   583 
       
   584         /**
       
   585          * Checks if the provided plugin configuration is a collection of plugin
       
   586          * configurations, e.g. view configuration.
       
   587          * Alternatively, we could check the type from header cache
       
   588          * @since S60 5.2
       
   589          * @param aPluginNode Plugin node
       
   590          * @return True if it is a view configuration
       
   591          */
       
   592         TBool IsViewConfiguration(
       
   593                 ChspsDomNode& aPluginNode );
       
   594                 
       
   595         /**
       
   596          * Removes an plugin instance from the provided application configuration
       
   597          * @since S60 5.0
       
   598          * @param aAppODT is an instance of the the application configuration         
       
   599          * @param aPluginId is an ID of the plugin instance to be removed
       
   600          * @return KErrNone if succeeded
       
   601          */
       
   602         TInt RemoveConfigurationL(
       
   603                 ChspsODT& aAppODT,
       
   604                 const TInt aPluginId );                
       
   605         
       
   606         /**
       
   607          * Removes an plugin instance from the provided application configuration
       
   608          * @since S60 5.0
       
   609          * @param aAppODT is an instance of the the application configuration         
       
   610          * @param aPluginNode is a node of the plugin instance to be removed
       
   611          * @return KErrNone if succeeded
       
   612          */
       
   613         TInt RemoveConfigurationL(
       
   614                 ChspsODT& aAppODT,
       
   615                 ChspsDomNode& aPluginNode );
       
   616         
       
   617         /**
       
   618          * Finds a plugin node with the provided id which is also a children of 
       
   619          * the provided plugins node
       
   620          * @since S60 5.0
       
   621          * @param aPluginsNode is an instance of the plugins node
       
   622          * @param aPluginId is an ID of the plugin instance to be found within the plugins node
       
   623          * @return Pointer to the plugin node or NULL
       
   624          */
       
   625         ChspsDomNode* FindChildPluginNode(
       
   626                 ChspsDomNode& aPluginsNode,
       
   627                 const TInt aPluginId );
       
   628 
       
   629         /**
       
   630          * Returns a count of plugin instances.
       
   631          * @since S60 5.0
       
   632          * @param aAppODT is an instance of the the application configuration         
       
   633          * @param aPluginUid is an UID of the plugin instances to be found
       
   634          * @param aInstanceCount is the return value         
       
   635          */
       
   636         void GetPluginInstanceCountL(
       
   637                 const ChspsODT& aAppODT,        
       
   638                 const TInt aPluginUid,
       
   639                 TInt& aInstanceCount );
       
   640         
       
   641 
       
   642         
       
   643         /**
       
   644          * Adds plugin resouces to the provided ODT
       
   645          * @since S60 5.0
       
   646          * @param aAppODT is an instance of the the application configuration         
       
   647          * @param aPluginUid is an UID of the plugin instance         
       
   648          */
       
   649         void AddPluginResourcesL(
       
   650                 ChspsODT& aAppODT,
       
   651                 const TInt aPluginUid );
       
   652         
       
   653         /**
       
   654          * Sets Plugin settings
       
   655          * @since S60 5.0
       
   656          * @param aOdt is an instance of the the application configuration         
       
   657          * @param aPluginId is an ID of the plugin instance to be found
       
   658          * @param aDom is a Dom Document of the settings that is going to set/update 
       
   659          * @return KErrNone if succeeded
       
   660          */
       
   661         TInt hspsSetPluginSettingsL(
       
   662                 ChspsODT& aOdt,
       
   663                
       
   664                 TInt aPluginId,
       
   665                 ChspsDomDocument& aDom);
       
   666         
       
   667         /**
       
   668          * Saves Plugin settings
       
   669          * @since S60 5.0
       
   670          * @param aODT is an instance of the the plugin configuration         
       
   671          * @param aDom is a Dom Document of the settings that is going to saved 
       
   672          * @return KErrNone if succeeded
       
   673          */
       
   674         TInt hspsSavePluginSettingsL(  
       
   675                         ChspsODT& aOdt,
       
   676                         ChspsDomDocument&  aDom );  
       
   677         /**
       
   678          * Finds a item node with the provided item id
       
   679          * @since S60 5.0
       
   680          * @param aNodeIdentifier An Tag.
       
   681          * @param aDomNode A Dom node where the target node is searched from.
       
   682          * @return Result node.
       
   683          */
       
   684         ChspsDomNode& FindNodeByTagL( 
       
   685                            const TDesC8& aNodeTag,
       
   686                            ChspsDomNode& aDomNode );
       
   687         
       
   688         /**
       
   689          * Gets configuration node with the provided plugin id
       
   690          * @since S60 5.0
       
   691          * @param aAppODT is an instance of the the application configuration         
       
   692          * @param aPluginId is an ID of the plugin instance to be found
       
   693          * @param aPluginUid is an UID of the plugin instance
       
   694          * @param aPluginname is a name of the plugin instance
       
   695          * @return Error code
       
   696          */
       
   697         TInt GetConfigurationNodeDataL(
       
   698                         ChspsODT& aAppODT,      
       
   699                         const TInt aPluginId,
       
   700                         TInt&  aPluginUid,
       
   701                         TDes& aPluginName );
       
   702 
       
   703         /**
       
   704          * Set configuration node state attribute value
       
   705          * @since S60 5.0
       
   706          * @param aAppODT is an instance of the the application configuration         
       
   707          * @param aConfId is an ID of the configuration node to be found
       
   708          * @param aState is a new value of the configuration node state attribute
       
   709          * @return void
       
   710          */
       
   711         void SetConfStateL(
       
   712             ChspsODT& aAppODT,      
       
   713             TInt aConfId,
       
   714             ThspsConfigurationState aState,
       
   715             ThspsConfStateChangeFilter aFilter );
       
   716 
       
   717         /**
       
   718          * Restores default configuration defined for the application
       
   719          * @since S60 5.0
       
   720          * @param aHeader ODT header which defines the restored configuration
       
   721          * @param aOdt restored application configuration
       
   722          */
       
   723         void RestoreDefaultAppConfL(
       
   724             ChspsODT*& aHeader,
       
   725             ChspsODT& aOdt );
       
   726 
       
   727         /**
       
   728         * HandleDefinitionRespositoryEventL
       
   729         *
       
   730         * @since S60 5.0
       
   731         */
       
   732         
       
   733         TBool HandleDefinitionRespositoryEventL( ThspsRepositoryInfo aRepositoryInfo );                 
       
   734        
       
   735         /**
       
   736         * RemovePluginFromAppConfs
       
   737         *
       
   738         * @since S60 5.0
       
   739         */
       
   740         void RemovePluginFromAppConfsL( 
       
   741                 const ChspsODT& aOdt,
       
   742                 RArray<ThspsRepositoryInfo>& aNotificationParams);
       
   743         
       
   744         /**
       
   745         * InvalidateUninstalledPluginInstancesL
       
   746         * Removes uninstalled plugin instances from an inactive
       
   747         * application configuration by changing them to error state.
       
   748         * @since S60 5.2
       
   749         * @param aAppODT application configuration to be updated
       
   750         * @param aPluginUid plugin to be uninstalled
       
   751         * @param aPluginIds an array on plugin ids to be processed
       
   752         * @return ETrue if the ODT was updated. 
       
   753         */
       
   754         TBool InvalidateUninstalledPluginInstancesL(
       
   755                 ChspsODT& aAppODT,        
       
   756                 const TInt aPluginUid,
       
   757                 const RArray<TInt>& aPluginIds );
       
   758         
       
   759         /**
       
   760          * UpdatePluginFromAppConfsL
       
   761          *
       
   762          * @since S60 5.0
       
   763          */
       
   764         void UpdatePluginFromAppConfsL( ChspsODT& aOdt, 
       
   765                  RArray<ThspsRepositoryInfo>& aNotificationParams );
       
   766         /**
       
   767          * UpdatePluginConfigurationL
       
   768          *
       
   769          * @since S60 5.0
       
   770          */
       
   771         
       
   772         TInt UpdatePluginConfigurationL(
       
   773                 ChspsODT& aOdt, 
       
   774                 ChspsODT& aPluginOdt,
       
   775                 RArray<TInt>& aPluginIds );
       
   776         
       
   777         /**
       
   778          * Replaces plugin configuration in the provided 
       
   779          * application configuration
       
   780          * @since S60 5.0
       
   781          * @param aAppODT is an instance of the the application configuration
       
   782          * @param aPluginId is an id of the plugin to be replaced
       
   783          * @param aPluginODT is an instance of the plugin configuration to be added
       
   784          */
       
   785         TInt ReplaceConfigurationL(
       
   786                 ChspsODT& aAppODT,
       
   787                 const TInt aPluginId,
       
   788                 const ChspsODT& aPluginODT );
       
   789         
       
   790         /**
       
   791          * Returns position of a plugin in the plugins list
       
   792          * @since S60 5.0         
       
   793          * @param aPluginNode is a plugin to be found
       
   794          * @return position of -1
       
   795          */
       
   796         TInt FindPluginPosition(                
       
   797                 ChspsDomNode& aPluginNode );
       
   798         
       
   799         /**
       
   800          * Appends missing plugin with a dummy configuration where status="Error"
       
   801          * @since S60 5.0
       
   802          * @param aAppDom is a DOM of an application configuration 
       
   803          * @param aMissingPluginNode is a plug-in node which was not found from the Plugin Repository
       
   804          * @param aPluginUid is an UID of the missing plugin
       
   805          */
       
   806         void AddErrorConfigurationL(
       
   807                 ChspsDomDocument& aAppDom,
       
   808                 ChspsDomNode& aMissingPluginNode,
       
   809                 const TInt aPluginUid );
       
   810                                 
       
   811         /**
       
   812          * Restores plug-ins by reinstallation.
       
   813          * @since S60 5.2          
       
   814          * @param aInstallUdaEmmc Set if UDA and eMMC drives should used 
       
   815          */
       
   816         void HandleReinstallationL(
       
   817                 const TBool aInstallUdaEmmc );
       
   818                                 
       
   819         /**
       
   820          * Removes all plugins from the plugins node and related 
       
   821          * resources from the resource array.
       
   822          * @since S60 5.2
       
   823          * @param aAppODT Application configuration
       
   824          * @return error code
       
   825          */
       
   826         TInt RestoreActiveViewL(
       
   827                 ChspsODT& aAppODT );
       
   828         
       
   829         /**
       
   830          * Finds a plugin node which is the active view configuration.
       
   831          * @since S60 5.2
       
   832          * @param aAppODT Application configuration
       
   833          * @return Active plugin node or NULL
       
   834          */
       
   835         ChspsDomNode* FindActiveView(
       
   836                 ChspsODT& aAppODT );
       
   837         
       
   838         /**
       
   839          * Removes all plugin configurations from the provided
       
   840          * plugin node (view configuration).
       
   841          * @since S60 5.2         
       
   842          * @param aAppODT Application configuration
       
   843          * @param aActivePluginNode Plugin node to be modified
       
   844          * @return error code 
       
   845          */
       
   846         TInt RemovePluginConfigurationsL(
       
   847                 ChspsODT& aAppODT, 
       
   848                 ChspsDomNode& aActivePluginNode );
       
   849         
       
   850         /**
       
   851          * Removes all unlocked views and reset the active view.
       
   852          * Can leave if DOM is corrupted (objects are not found) or in OOM cases.
       
   853          * @since S60 5.2   
       
   854          * @param aAppODT Application configuration
       
   855          */
       
   856         void RemoveUnlockedViewsL(
       
   857                 ChspsODT& aAppODT );
       
   858         
       
   859         /**
       
   860          * Checks whether the plugin configuration was locked.
       
   861 		 * @since S60 5.2   
       
   862          * @param aConfNode Configuration node
       
   863 		 * @return True if it was locked
       
   864          */
       
   865         TBool IsConfigurationLocked(
       
   866                 ChspsDomNode& aConfNode );
       
   867         
       
   868     private:   // Data
       
   869         RMessagePtr2 iMessagePtr;
       
   870         ChspsResult* iResult;
       
   871         TBuf8<KMaxResultDataLength8> iResultData;
       
   872         ThspsServiceRequestMessage iRequestMessage;     
       
   873         ThspsServiceCompletedMessage iCompletedMessage;
       
   874         CArrayPtrSeg<HBufC8>* iHeaderDataList;
       
   875         TBool iSubscription;
       
   876         TInt iDeliveryCount;
       
   877         ChspsODT* iSearchMask;
       
   878         ChspsODT* iSetMask;        
       
   879         
       
   880         ChspsThemeServer& iThemeServer;
       
   881         // Identifies the client application
       
   882         TUint iSecureId;
       
   883         // Reference to central repository
       
   884         CRepository& iCentralRepository;
       
   885         // Reference to definition repository
       
   886         ChspsDefinitionRepository& iDefinitionRepository;
       
   887         // Reference to security enforcer
       
   888         ChspsSecurityEnforcer& iSecurityEnforcer;
       
   889         CArrayPtrSeg<ChspsODT>& iHeaderListCache;        
       
   890         ChspsThemeServerSession* iServerSession;	// Not owned.
       
   891         CFileMan* iFileMan;
       
   892         TBool iMaintainLogoResources;
       
   893 #ifdef HSPS_LOG_ACTIVE
       
   894         /**
       
   895          * Log bus.
       
   896          */        
       
   897         ChspsLogBus* iLogBus;
       
   898 #endif        
       
   899     };
       
   900 
       
   901 
       
   902 #endif //__hspsMAINTENANCEHANDLER_H__
       
   903 // End of File