homescreenpluginsrv/hspsmanager/inc/hspsmaintenancehandler.h
changeset 0 79c6a41cd166
child 4 1a2a00e78665
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     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   public: // Functions from base classes
       
   271 
       
   272         /** 
       
   273         * From MhspsMaintenanceService hspsGetListHeaders
       
   274         * @since S60 3.1
       
   275         * @param aSearchMask is ChspsODT-object which attributes are filled to present search 
       
   276         *        parameters for theme set queried by client. This parametrisation follows 
       
   277         *        the high-level schema. 
       
   278         * @param aHeaderList is an list object able to carry ChspsODT-objects. 
       
   279         * @return ThspsServiceCompletedMessage expressing the result of the call.
       
   280         */
       
   281         ThspsServiceCompletedMessage hspsGetListHeaders(const TDesC8& aSearchMaskData, 
       
   282                 CArrayPtrSeg<HBufC8>& aHeaderDataList);
       
   283         
       
   284         /** 
       
   285         * From MhspsMaintenanceService hspsGetNextHeader
       
   286         * @since S60 3.1
       
   287         * @return ThspsServiceCompletedMessage expressing the result of the call.
       
   288         */
       
   289         ThspsServiceCompletedMessage hspsGetNextHeader();         
       
   290         
       
   291         /**
       
   292         * From MhspsMaintenanceService hspsCancelGetListHeaders
       
   293         * @since S60 3.1
       
   294         * @return ThspsServiceCompletedMessage expressing the result of the call.
       
   295         */
       
   296         ThspsServiceCompletedMessage hspsCancelGetListHeaders();  
       
   297         
       
   298         /**
       
   299         * From MhspsMaintenanceService hspsSetActiveTheme
       
   300         * @since S60 3.1
       
   301         * @param aSetMask represents parameters by which the new theme activation will be done.
       
   302                  There must be sufficient set of parameters presented, at least a theme UID.
       
   303         * @param aOdt is an empty ODT-object which will contain the ODT of activated 
       
   304         *        theme on the return of the call. This parametrisation follows the high-level 
       
   305         *        schema. There must be sufficient set of parameters presented, at least a theme UID.
       
   306         * @return ThspsServiceCompletedMessage expressing the result of the call.
       
   307         */
       
   308         ThspsServiceCompletedMessage hspsSetActiveTheme( const ChspsODT& aSetMask, ChspsODT& aOdt );
       
   309         
       
   310         /**
       
   311         * From MhspsMaintenanceService hspsRestoreDefault
       
   312         * @since S60 3.1
       
   313         * @param aSetMask is an ODT-header parametrized enough to express the theme to be made
       
   314         *        active.
       
   315         * @param aHeader is an empty ODT-header object that will contain the header of the theme
       
   316         *        actually made active if the request was successful.
       
   317         * @return ThspsServiceCompletedMessage expressing the result of the call.
       
   318         */
       
   319         ThspsServiceCompletedMessage hspsRestoreDefault( const ChspsODT& aSetMask, ChspsODT& aHeader );
       
   320         
       
   321         /**
       
   322         * From MhspsMaintenanceService hspsRemoveThemeL
       
   323         * @since S60 3.1
       
   324         * @param aSetMask is an ODT-header parametrized enough to express the theme to be removed.
       
   325         * @return ThspsServiceCompletedMessage expressing the result of the call.
       
   326         */        
       
   327         ThspsServiceCompletedMessage hspsRemoveThemeL( const ChspsODT& aSetMask );
       
   328                 
       
   329         /**
       
   330         * From MhspsMaintenanceService hspsGetListHeaders
       
   331         * @since S60 3.1
       
   332         * @param aSearchMaskData is serialized ChspsODT-object. Before serializing, attributes 
       
   333         *        in ChspsODT-object were filled to present a search parameters for theme set queried.
       
   334         *        Serialized data parametrisation follows the low-level schema.  
       
   335         * @param aHeaderList is an list object able to carry serialized ChspsODT-objects. 
       
   336         * @return ThspsServiceCompletedMessage expressing the result of the call.
       
   337         */
       
   338         ThspsServiceCompletedMessage hspsGetListHeaders(const ChspsODT& /*aSearchMask*/
       
   339                                                          , CArrayPtrFlat<ChspsODT>& /*aHeaderList*/);
       
   340         
       
   341         /**
       
   342         * From MhspsMaintenanceService hspsSetActiveTheme
       
   343         * @since S60 3.1
       
   344         * @param aSetMaskData is externalized version of ChspsODT-object presenting parameters by 
       
   345         *        which the new theme activation will be done. There must be sufficient set of 
       
   346         *        parameters presented, at least a theme UID. This parametrisation follows the 
       
   347         *        low-level schema.
       
   348         * @param aHeaderData is an empty description for externalized ODT-object data. 
       
   349         *        When internalized, this object will contain the header of newly activated theme 
       
   350         *        as a result of the call.
       
   351         * @return ThspsServiceCompletedMessage expressing the result of the call.
       
   352         */   
       
   353         ThspsServiceCompletedMessage hspsSetActiveTheme(const TDesC8& /*aSetMaskData*/
       
   354                                                            , TDes8& /*aHeaderData*/);
       
   355         
       
   356         /**
       
   357         * From MhspsMaintenanceService hspsAddPlugin
       
   358         * Not used - see ServiceAddPluginL instead which has a diffrent input 
       
   359         * @since S60 5.0
       
   360         */
       
   361         ThspsServiceCompletedMessage hspsAddPlugin(
       
   362             const TInt /*aAppUid*/,
       
   363             const TInt /*aParentPluginId*/,
       
   364             const TInt /*aPluginUid*/,
       
   365             const TInt /*aPosition*/,
       
   366             TInt& /*aAddedPluginId*/ );                
       
   367  
       
   368         /**          
       
   369         * From MhspsMaintenanceService hspsRemovePlugin
       
   370         * Not used - see ServiceRemovePluginL instead which has a diffrent input
       
   371         */
       
   372         ThspsServiceCompletedMessage hspsRemovePlugin(
       
   373                const TInt /*aAppUid*/,                
       
   374                const TInt /*aPluginId*/ );
       
   375 
       
   376         /**          
       
   377         * From MhspsMaintenanceService hspsSetActivePlugin
       
   378         * Not used - see ServiceRemovePluginL instead which has a diffrent input
       
   379         */        
       
   380         ThspsServiceCompletedMessage hspsSetActivePlugin(
       
   381                 const TInt aAppUid,
       
   382                 const TInt aPluginId
       
   383                 );
       
   384 
       
   385         /**          
       
   386         * From MhspsMaintenanceService hspsReplacePlugin
       
   387         * Not used - see ServiceReplacePluginL instead which has a diffrent input
       
   388         */               
       
   389         ThspsServiceCompletedMessage hspsReplacePlugin(
       
   390             const TInt /*aAppUid*/,
       
   391             const TInt /*aPluginId*/,             
       
   392             const TInt /*aConfUid*/ );
       
   393         
       
   394         /** 
       
   395         * From MhspsMaintenanceService hspsSetSettings
       
   396         * Not used - see ServiceRemovePluginL instead which has a diffrent input
       
   397         */
       
   398         ThspsServiceCompletedMessage hspsSetPluginSettings(
       
   399                 const ChspsODT& /*aHeader*/,
       
   400                 const TInt /*aPluginId*/,
       
   401                 ChspsDomDocument& /*aDom*/,
       
   402                 const TBool /*aPluginStoringStatus*/);
       
   403 
       
   404         /**          
       
   405         * From MhspsMaintenanceService hspsMovePluginsL
       
   406         * Not used - see ServiceMovePluginsL instead which has a diffrent input
       
   407         */
       
   408         ThspsServiceCompletedMessage hspsMovePluginsL(
       
   409                const TInt /*aAppUid*/,
       
   410                const TInt /*aConfId*/,               
       
   411                const CArrayFixFlat<TInt>& /*aPluginIdList*/ );
       
   412          
       
   413         TInt UpdatePluginListL(
       
   414             ChspsODT& aAppODT,
       
   415             const TInt aConfigurationId, 
       
   416             const CArrayFixFlat<TInt>& aPluginIdList );       
       
   417 
       
   418         /**          
       
   419         * From MhspsMaintenanceService hspsSetConfState
       
   420         * Not used - see ServiceSetConfStateL instead which has a diffrent input
       
   421         */
       
   422         ThspsServiceCompletedMessage hspsSetConfState(
       
   423             const TInt /*aAppUid*/,
       
   424             const TInt /*aConfId*/,             
       
   425             const ThspsConfigurationState /*aState*/,
       
   426             const ThspsConfStateChangeFilter /*aFilter*/ );
       
   427 
       
   428         /**          
       
   429         * From MhspsMaintenanceService hspsRestoreActiveAppConf
       
   430         * Not used - see ServiceRestoreActiveAppConfL instead which has a diffrent input
       
   431         */
       
   432         ThspsServiceCompletedMessage hspsRestoreActiveAppConf(
       
   433             const TInt /*aAppUid*/,
       
   434             const TInt /*aConfUid*/ );
       
   435         
       
   436         /** 
       
   437          * Updates plugin configuration in all application configuration
       
   438          *  
       
   439          * @since S60 5.0
       
   440          * @param apluginUid identifies the plugin configuration                
       
   441          * @return ThspsServiceCompletedMessage expressing the result of the call.
       
   442          */
       
   443         ThspsServiceCompletedMessage hspsPluginUpdateL(
       
   444                 const ChspsODT& aOdt );
       
   445 
       
   446         
       
   447 
       
   448     public: // from MhspsDefinitioRepositoryObserver
       
   449          
       
   450         TBool HandleDefinitionRespositoryEvent( ThspsRepositoryInfo aRepositoryInfo );
       
   451         
       
   452     protected:  // Functions from base classes
       
   453         
       
   454        
       
   455         ChspsMaintenanceHandler( ChspsThemeServer& aThemeServer, const TUint aSecureId );
       
   456         
       
   457         /**
       
   458         * By default Symbian 2nd phase constructor is private.
       
   459         */
       
   460         void ConstructL();
       
   461         
       
   462         /**
       
   463         * From CActive, RunL.
       
   464         * Callback function.
       
   465         * Invoked to handle responses from the server.
       
   466         */
       
   467         void RunL();
       
   468 
       
   469         /**
       
   470         * From CActive, DoCancel.
       
   471         * Cancels any outstanding operation.
       
   472         */
       
   473         void DoCancel();
       
   474         
       
   475         /**
       
   476         * From CActive Called when asynchronous request has failed
       
   477         * @since S60 3.1
       
   478         */
       
   479         TInt RunError( TInt aError );
       
   480     
       
   481     
       
   482     private:
       
   483         /**
       
   484         * C++ default constructor.
       
   485         */
       
   486         void GetHeaderListL( CArrayPtrSeg<HBufC8>& aHeaderDataList, const ChspsODT& aSearchMask );
       
   487         ThspsServiceCompletedMessage GetHeaderListUpdateL();
       
   488         void RestoredDefaultL( const ChspsODT& aSetMask, ChspsODT& aHeader );
       
   489         void RemoveThemeL( const ChspsODT& aSetMask );
       
   490         TBool CompareHeadersL(const TDesC8& aOldHeaderData, const TDesC8& aNewHeaderData);
       
   491         TBool ComparePaths(const ChspsODT& aOldHeader, const ChspsODT& aNewHeader);
       
   492         TBool FilterHeader(const ChspsODT& aMask, const ChspsODT& aHeader);
       
   493         // Completes the request message
       
   494         void CompleteRequest(const ThspsServiceCompletedMessage aReturnMessage, 
       
   495             RMessagePtr2& aMessagePtr, const TDesC8& aHeaderData = KNullDesC8 );
       
   496                 
       
   497         /**
       
   498          * Finds last id value from the provided DOM.
       
   499          * @since S60 5.0
       
   500          * @param aDom is the application configuration in XML format
       
   501          * @param aLastUsedConfId is the largest used configurtion id
       
   502          * @param aLastUsedPluginId is the largest used plugin id
       
   503          */
       
   504         void GetUsedIdsL(
       
   505                 ChspsDomDocument& aDom,
       
   506                 TInt& aLastUsedConfId,
       
   507                 TInt& aLastUsedPluginId
       
   508                 );
       
   509         
       
   510         /**
       
   511          * Appends an application configuration with an instance of a plugin configuration.
       
   512          * @since S60 5.0
       
   513          * @param aAppODT is an instance of the the application configuration
       
   514          * @param aPluginODT is an ODT instance of the plugin configuration
       
   515          * @param aConfigurationId is an id of the configuration being modified, identifies a plugins list
       
   516          * @param aNewPosition is an index of the new position in the plugins list
       
   517          * @param aLastConfId is a value of the last configuration id
       
   518          * @param aLastPluginId is a value of the last plugin id 
       
   519          * @return KErrNone if the operation succeeded
       
   520          */
       
   521         TInt AppendConfigurationL(
       
   522                 ChspsODT& aAppODT,
       
   523                 const ChspsODT& aPluginODT,      
       
   524                 const TInt aConfigurationId,    
       
   525                 const TInt aNewPosition, 
       
   526                 TInt& aLastConfId,
       
   527                 TInt& aLastPluginId
       
   528                 );
       
   529                 
       
   530         /**
       
   531          * Finds the plugins node of the provided plugin node.
       
   532          * @since S60 5.0
       
   533          * @param aNode is the plugins node to be searched
       
   534          * @return plugins node or NULL if the node couldn't be found 
       
   535          */
       
   536         ChspsDomNode* FindPluginsNode(
       
   537                 ChspsDomNode& aNode 
       
   538                 );
       
   539         
       
   540         /**
       
   541          * Appends a plugins list with a new plugin configuration instance.
       
   542          * @since S60 5.0
       
   543          * @param aAppODT is the application configuration being modified
       
   544          * @param aPluginsNode is the plugins node where the new plugin instance should be added to
       
   545          * @param aPluginODT is an ODT instance of the plugin configuration to be added
       
   546          * @param aNewPosition is an index of the new position in the plugins list
       
   547          * @param aNewPluginId is an id of the new plugin instance 
       
   548          * @return KErrNone if the operation succeeded 
       
   549          */
       
   550         TInt AppendPluginConfigurationL(
       
   551                 ChspsODT& aAppODT,                
       
   552                 ChspsDomNode& aPluginsNode,                
       
   553                 const ChspsODT& aPluginODT,                
       
   554                 const TInt aNewPosition,
       
   555                 const TInt aNewPluginId
       
   556                 );
       
   557 
       
   558         
       
   559         /**
       
   560          * Finds plugin nodes from the plugin configuration being added,
       
   561          * appends referred configurations into the main plugin configuration,
       
   562          * and updates the plugin nodes with unique id attribute values. 
       
   563          * @since S60 5.0
       
   564          * @param aAppODT is an instance of the the application configuration
       
   565          * @param aPluginODT is an instance of the plugin configuration being added
       
   566          * @param aLastConfId is a value of the last configuration id
       
   567          * @param aLastPluginId is a value of the last plugin id
       
   568          * @return KErrNone
       
   569          */
       
   570         TInt HandlePluginReferencesL(
       
   571                 ChspsODT& aAppODT,
       
   572                 ChspsODT& aPluginODT,
       
   573                 TInt& aLastConfId,
       
   574                 TInt& aLastPluginId 
       
   575                 );
       
   576 
       
   577         /**
       
   578          * Removes an plugin instance from the provided application configuration
       
   579          * @since S60 5.0
       
   580          * @param aAppODT is an instance of the the application configuration         
       
   581          * @param aPluginId is an ID of the plugin instance to be removed
       
   582          * @return KErrNone if succeeded
       
   583          */
       
   584         TInt RemoveConfigurationL(
       
   585                 ChspsODT& aAppODT,
       
   586                 const TInt aPluginId );
       
   587         
       
   588         /**
       
   589          * Finds a plugin node with the provided id which is also a children of 
       
   590          * the provided plugins node
       
   591          * @since S60 5.0
       
   592          * @param aPluginsNode is an instance of the plugins node
       
   593          * @param aPluginId is an ID of the plugin instance to be found within the plugins node
       
   594          * @return Pointer to the plugin node or NULL
       
   595          */
       
   596         ChspsDomNode* FindChildPluginNode(
       
   597                 ChspsDomNode& aPluginsNode,
       
   598                 const TInt aPluginId );
       
   599 
       
   600         /**
       
   601          * Returns a count of plugin instances.
       
   602          * @since S60 5.0
       
   603          * @param aAppODT is an instance of the the application configuration         
       
   604          * @param aPluginUid is an UID of the plugin instances to be found
       
   605          * @param aInstanceCount is the return value         
       
   606          */
       
   607         void GetPluginInstanceCountL(
       
   608                 const ChspsODT& aAppODT,        
       
   609                 const TInt aPluginUid,
       
   610                 TInt& aInstanceCount );
       
   611         
       
   612         /**
       
   613          * Removes plugin resources from the provided ODT
       
   614          * @since S60 5.0
       
   615          * @param aAppODT is an instance of the the application configuration         
       
   616          * @param aPluginUid is an UID of the plugin instance
       
   617          * @return KErrNone if succeeded
       
   618          */
       
   619         TInt RemovePluginResourcesL(
       
   620                 ChspsODT& aAppODT,
       
   621                 const TInt aPluginUid );
       
   622         
       
   623         /**
       
   624          * Adds plugin resouces to the provided ODT
       
   625          * @since S60 5.0
       
   626          * @param aAppODT is an instance of the the application configuration         
       
   627          * @param aPluginUid is an UID of the plugin instance         
       
   628          */
       
   629         void AddPluginResourcesL(
       
   630                 ChspsODT& aAppODT,
       
   631                 const TInt aPluginUid );
       
   632         
       
   633         /**
       
   634          * Sets Plugin settings
       
   635          * @since S60 5.0
       
   636          * @param aOdt is an instance of the the application configuration         
       
   637          * @param aPluginId is an ID of the plugin instance to be found
       
   638          * @param aDom is a Dom Document of the settings that is going to set/update 
       
   639          * @return KErrNone if succeeded
       
   640          */
       
   641         TInt hspsSetPluginSettingsL(
       
   642                 ChspsODT& aOdt,
       
   643                
       
   644                 TInt aPluginId,
       
   645                 ChspsDomDocument& aDom);
       
   646         
       
   647         /**
       
   648          * Saves Plugin settings
       
   649          * @since S60 5.0
       
   650          * @param aODT is an instance of the the plugin configuration         
       
   651          * @param aDom is a Dom Document of the settings that is going to saved 
       
   652          * @return KErrNone if succeeded
       
   653          */
       
   654         TInt hspsSavePluginSettingsL(  
       
   655                         ChspsODT& aOdt,
       
   656                         ChspsDomDocument&  aDom );  
       
   657         /**
       
   658          * Finds a item node with the provided item id
       
   659          * @since S60 5.0
       
   660          * @param aNodeIdentifier An Tag.
       
   661          * @param aDomNode A Dom node where the target node is searched from.
       
   662          * @return Result node.
       
   663          */
       
   664         ChspsDomNode& FindNodeByTagL( 
       
   665                            const TDesC8& aNodeTag,
       
   666                            ChspsDomNode& aDomNode );
       
   667         
       
   668         /**
       
   669          * Gets configuration node with the provided plugin id
       
   670          * @since S60 5.0
       
   671          * @param aAppODT is an instance of the the application configuration         
       
   672          * @param aPluginId is an ID of the plugin instance to be found
       
   673          * @param aPluginUid is an UID of the plugin instance
       
   674          * @param aPluginname is a name of the plugin instance
       
   675          * @return Error code
       
   676          */
       
   677         TInt GetConfigurationNodeDataL(
       
   678                         ChspsODT& aAppODT,      
       
   679                         const TInt aPluginId,
       
   680                         TInt&  aPluginUid,
       
   681                         TDes& aPluginName );
       
   682 
       
   683         /**
       
   684          * Set configuration node state attribute value
       
   685          * @since S60 5.0
       
   686          * @param aAppODT is an instance of the the application configuration         
       
   687          * @param aConfId is an ID of the configuration node to be found
       
   688          * @param aState is a new value of the configuration node state attribute
       
   689          * @return void
       
   690          */
       
   691         void SetConfStateL(
       
   692             ChspsODT& aAppODT,      
       
   693             TInt aConfId,
       
   694             ThspsConfigurationState aState,
       
   695             ThspsConfStateChangeFilter aFilter );
       
   696 
       
   697         /**
       
   698          * Restores default configuration defined for the application
       
   699          * @since S60 5.0
       
   700          * @param aHeader ODT header which defines the restored configuration
       
   701          * @param aOdt restored application configuration
       
   702          */
       
   703         void RestoreDefaultAppConfL(
       
   704             ChspsODT*& aHeader,
       
   705             ChspsODT& aOdt );
       
   706 
       
   707         /**
       
   708         * HandleDefinitionRespositoryEventL
       
   709         *
       
   710         * @since S60 5.0
       
   711         */
       
   712         
       
   713         TBool HandleDefinitionRespositoryEventL( ThspsRepositoryInfo aRepositoryInfo );                 
       
   714        
       
   715         /**
       
   716         * RemovePluginFromAppConfs
       
   717         *
       
   718         * @since S60 5.0
       
   719         */
       
   720         void RemovePluginFromAppConfsL( 
       
   721                 const ChspsODT& aOdt,
       
   722                 RArray<ThspsRepositoryInfo>& aNotificationParams);
       
   723         
       
   724         /**
       
   725         * InvalidateUninstalledPluginInstancesL
       
   726         * Removes uninstalled plugin instances from an inactive
       
   727         * application configuration by changing them to error state.
       
   728         * @since S60 5.2
       
   729         * @param aAppODT application configuration to be updated
       
   730         * @param aPluginUid plugin to be uninstalled
       
   731         * @param aPluginIds an array on plugin ids to be processed
       
   732         * @return ETrue if the ODT was updated. 
       
   733         */
       
   734         TBool InvalidateUninstalledPluginInstancesL(
       
   735                 ChspsODT& aAppODT,        
       
   736                 const TInt aPluginUid,
       
   737                 const RArray<TInt>& aPluginIds );
       
   738         
       
   739         /**
       
   740          * UpdatePluginFromAppConfsL
       
   741          *
       
   742          * @since S60 5.0
       
   743          */
       
   744         void UpdatePluginFromAppConfsL( ChspsODT& aOdt, 
       
   745                  RArray<ThspsRepositoryInfo>& aNotificationParams );
       
   746         /**
       
   747          * UpdatePluginConfigurationL
       
   748          *
       
   749          * @since S60 5.0
       
   750          */
       
   751         
       
   752         TInt UpdatePluginConfigurationL(
       
   753                 ChspsODT& aOdt, 
       
   754                 ChspsODT& aPluginOdt,
       
   755                 RArray<TInt>& aPluginIds );
       
   756         
       
   757         /**
       
   758          * Replaces plugin configuration in the provided 
       
   759          * application configuration
       
   760          * @since S60 5.0
       
   761          * @param aAppODT is an instance of the the application configuration
       
   762          * @param aPluginId is an id of the plugin to be replaced
       
   763          * @param aPluginODT is an instance of the plugin configuration to be added
       
   764          */
       
   765         TInt ReplaceConfigurationL(
       
   766                 ChspsODT& aAppODT,
       
   767                 const TInt aPluginId,
       
   768                 const ChspsODT& aPluginODT );
       
   769         
       
   770         /**
       
   771          * Returns position of a plugin in the plugins list
       
   772          * @since S60 5.0         
       
   773          * @param aPluginNode is a plugin to be found
       
   774          * @return position of -1
       
   775          */
       
   776         TInt FindPluginPosition(                
       
   777                 ChspsDomNode& aPluginNode );
       
   778         
       
   779         /**
       
   780          * Copies logo icons to Homescreen's private folder
       
   781          * @since S60 5.1
       
   782          * @param aAppUid Identifies the client process         
       
   783          */
       
   784         void CopyIconsToHomescreenL(
       
   785                 const TUint aAppUid );
       
   786 
       
   787         /**
       
   788          * Appends missing plugin with a dummy configuration where status="Error"
       
   789          * @since S60 5.0
       
   790          * @param aAppDom is a DOM of an application configuration 
       
   791          * @param aMissingPluginNode is a plug-in node which was not found from the Plugin Repository
       
   792          * @param aPluginUid is an UID of the missing plugin
       
   793          */
       
   794         void AddErrorConfigurationL(
       
   795                 ChspsDomDocument& aAppDom,
       
   796                 ChspsDomNode& aMissingPluginNode,
       
   797                 const TInt aPluginUid );
       
   798 
       
   799     private:   // Data
       
   800         RMessagePtr2 iMessagePtr;
       
   801         ChspsResult* iResult;
       
   802         TBuf8<KMaxResultDataLength8> iResultData;
       
   803         ThspsServiceRequestMessage iRequestMessage;     
       
   804         ThspsServiceCompletedMessage iCompletedMessage;
       
   805         CArrayPtrSeg<HBufC8>* iHeaderDataList;
       
   806         TBool iSubscription;
       
   807         TInt iDeliveryCount;
       
   808         ChspsODT* iSearchMask;
       
   809         ChspsODT* iSetMask;
       
   810         TLanguage iLanguage;
       
   811         
       
   812         ChspsThemeServer& iThemeServer;
       
   813         // Identifies the client application
       
   814         TUint iSecureId;
       
   815         // Reference to central repository
       
   816         CRepository& iCentralRepository;
       
   817         // Reference to definition repository
       
   818         ChspsDefinitionRepository& iDefinitionRepository;
       
   819         // Reference to security enforcer
       
   820         ChspsSecurityEnforcer& iSecurityEnforcer;
       
   821         CArrayPtrSeg<ChspsODT>& iHeaderListCache;        
       
   822         ChspsThemeServerSession* iServerSession;	// Not owned.
       
   823         CFileMan* iFileMan;
       
   824 #ifdef HSPS_LOG_ACTIVE
       
   825         /**
       
   826          * Log bus.
       
   827          */        
       
   828         ChspsLogBus* iLogBus;
       
   829 #endif        
       
   830     };
       
   831 
       
   832 
       
   833 #endif //__hspsMAINTENANCEHANDLER_H__
       
   834 // End of File