menufw/hierarchynavigator/hnmetadatamodel/inc/hnxmlmodelprovider.h
branchRCL_3
changeset 26 1b758917cafc
parent 0 f72a12da539e
equal deleted inserted replaced
25:137ebc85284b 26:1b758917cafc
    34  *
    34  *
    35  * @lib hnmetadatamodel
    35  * @lib hnmetadatamodel
    36  * @since S60 5.0
    36  * @since S60 5.0
    37  * @ingroup group_hnmetadatamodel
    37  * @ingroup group_hnmetadatamodel
    38  */
    38  */
    39 NONSHARABLE_CLASS(CHnXmlModelProvider) : public CActive
    39 NONSHARABLE_CLASS(CHnXmlModelProvider) : public CBase
    40     {
    40     {
    41 public:
    41 public:
    42     /**
    42     /**
    43      * Standard factory method.
    43      * Standard factory method.
    44      *
    44      *
    58     /**
    58     /**
    59      * Standard virtual destructor.
    59      * Standard virtual destructor.
    60      */
    60      */
    61     IMPORT_C virtual ~CHnXmlModelProvider();
    61     IMPORT_C virtual ~CHnXmlModelProvider();
    62     
    62     
    63     /**
       
    64      * @see CAsctive::DoCancel
       
    65      */
       
    66     void DoCancel();
       
    67 
       
    68     /**
       
    69      * Services the suite synchronization steps according to class iterator.
       
    70      *
       
    71      * @see CAsctive::RunL
       
    72      */
       
    73     void RunL();
       
    74 
       
    75 private:
    63 private:
    76     
    64     
    77     /**
    65     /**
    78      * ReadFileLC reads file.
    66      * ReadFileLC reads file.
    79      *
    67      *
    95      
    83      
    96      /**
    84      /**
    97      * Builds root of xml model from suite definition.
    85      * Builds root of xml model from suite definition.
    98      *
    86      *
    99      * @since S60 v5.0
    87      * @since S60 v5.0
   100      * @param aSuiteName Suite name.
       
   101      * @param aXmlDoc XLM model of the suite.
    88      * @param aXmlDoc XLM model of the suite.
   102      * @return Error code.
    89      * @return Error code.
   103      */
    90      */
   104      TInt CollectSuiteL( const TDesC& aSuiteName, RXmlEngDocument& aXmlDoc );
    91      TInt CollectSuiteL( RXmlEngDocument& aXmlDoc );
   105      
    92      
   106      /**
    93      /**
   107      * appends items to suite in model,
    94      * appends items to suite in model,
   108      *
    95      *
   109      * @since S60 v5.0
    96      * @since S60 v5.0
   110      * @param aSuiteName Name of suite to append items to.
       
   111      * @param aXmlDoc XLM model of the suite.
    97      * @param aXmlDoc XLM model of the suite.
   112      */
    98      */
   113      void CollectItemsL(const TDesC& aSuiteName, RXmlEngDocument& aXmlDoc );
    99      void CollectItemsL( RXmlEngDocument& aXmlDoc );
   114      
   100 
   115      /**
       
   116      * Copies suites and items definitions to working dir.
       
   117      *
       
   118      * @since S60 v5.0
       
   119      * @return Error code.
       
   120      */
       
   121      TBool SynchronizeSuitesL();
       
   122      
       
   123     /**
   101     /**
   124      * Creates model from suite definition.
   102      * Creates model from suite definition.
   125      *
   103      *
   126      * @since S60 v5.0
   104      * @since S60 v5.0
   127      * @param aStr Name of suite.
       
   128      * @param aXmlDoc XML model of the suite.
   105      * @param aXmlDoc XML model of the suite.
   129      */
   106      */
   130     void CreateModelL( const TDesC& aStr, RXmlEngDocument& aXmlDoc  );   
   107     void CreateModelL( RXmlEngDocument& aXmlDoc  );
   131     
   108     
   132     /**
   109     /**
   133      * Changes event names to ids.
   110      * Changes event names to ids.
   134      *
   111      *
   135      * @since S60 v5.0
   112      * @since S60 v5.0
   164      *
   141      *
   165      * @param aPath Path to a file.
   142      * @param aPath Path to a file.
   166      * @return RXmlEngDocument.
   143      * @return RXmlEngDocument.
   167      */
   144      */
   168      RXmlEngDocument ParseFileL( const TDesC& aPath );
   145      RXmlEngDocument ParseFileL( const TDesC& aPath );
   169      
   146 
   170      /**
       
   171       * Resets cached models.
       
   172       */
       
   173      void ResetCache();
       
   174      
       
   175     /**
       
   176      * Reparses a document.
       
   177      */
       
   178      IMPORT_C void ReloadModelL();
       
   179    
       
   180     /**
   147     /**
   181      * Parses a document - searching proper suite.
   148      * Parses a document - searching proper suite.
   182      *
   149      *
   183      * @param aStr Name of the model.
   150      * @param aStr Name of the model.
   184      * @param aXmlDoc A reference to document of RXmlEngDocument class;
   151      * @param aXmlDoc A reference to document of RXmlEngDocument class;
   191       *
   158       *
   192       * @param aEventName Event name.
   159       * @param aEventName Event name.
   193       * @return Event id.
   160       * @return Event id.
   194       */     
   161       */     
   195      TInt GetNewEventId( HBufC* aEventName );
   162      TInt GetNewEventId( HBufC* aEventName );
   196      
   163 
   197      /**
       
   198       * Check if suite exists.
       
   199       *
       
   200       * @since S60 5.0
       
   201       * @param aSuite Suite name.
       
   202       * @return ETrue if suite exists, otherwise EFalse.
       
   203       */
       
   204      TBool SuiteExistsL( const TDesC& aSuite );
       
   205     
       
   206 private:
   164 private:
   207      
   165      
   208     /**
       
   209      * Invoked after asynchronous synchronization is finished.
       
   210      */
       
   211      void SynchronizationFinishedL();
       
   212 
       
   213     /**
       
   214      * Sets up normal path to suites.
       
   215      *
       
   216      * @param aPath Path to be searched for suites.
       
   217      */	
       
   218      void SearchPathForSuitesL( const TDesC& aPath );
       
   219 	
       
   220     /**
       
   221      * Sets up normal path to suites.
       
   222      */   
       
   223      void SetupSuitePathL();
       
   224 	
       
   225     /**
       
   226      * Sets up fail sage path to suites.
       
   227      */   
       
   228     void SetupFailSafeSuitePathL();
       
   229 	
       
   230     /**
   166     /**
   231      * Standard C++ constructor.
   167      * Standard C++ constructor.
   232      */     
   168      */     
   233     CHnXmlModelProvider();
   169     CHnXmlModelProvider();
   234 
   170 
   235     /**
   171     /**
   236      * Standard symbian 2nd phase constructor.
   172      * Standard symbian 2nd phase constructor.
   237      */     
   173      */     
   238     void ConstructL();
   174     void ConstructL();
   239 
       
   240     /**
       
   241     * Finds drive letter where suite definition is.
       
   242     *
       
   243     * @since S60 v5.0
       
   244     * @return Error code
       
   245     */
       
   246     void CheckDrivesL(); 
       
   247                
       
   248     
   175     
   249 #ifdef _DEBUG
   176 #ifdef _DEBUG
   250 private:
   177 private:
   251     void LogSuiteModel( const TDesC& aName, 
   178     void LogSuiteModel( const TDesC& aName, 
   252                                          RXmlEngDocument& aDoc );
   179                                          RXmlEngDocument& aDoc );
   263      * Xml DOM parser.
   190      * Xml DOM parser.
   264      */
   191      */
   265     RXmlEngDOMParser iDomParser;
   192     RXmlEngDOMParser iDomParser;
   266                 
   193                 
   267     /**
   194     /**
   268      * File server session
       
   269      */
       
   270     RFs iFs;
       
   271         
       
   272     /**
       
   273      * File manager
       
   274      */
       
   275     CFileMan* iFileMan;                
       
   276     
       
   277     /**
       
   278      * List containing names of suites (suite name is same as dir name)
       
   279      * that should be installed from all drives
       
   280      */    
       
   281     RHashSet< HBufC* > iInstSuites;
       
   282     
       
   283     /**
       
   284      * Event map.
   195      * Event map.
   285      */
   196      */
   286     RHashMap< HBufC*, TInt > iEventMap;
   197     RHashMap< HBufC*, TInt > iEventMap;
   287     
   198 
   288     /**
       
   289      * Main path.
       
   290      */
       
   291     RBuf iPath;
       
   292     
       
   293     /**
   199     /**
   294      * Cached suites.
   200      * Cached suites.
   295      */
   201      */
   296     CHnXmlModelCache* iCache;
   202     CHnXmlModelCache* iCache;
   297     
   203     
   298     /**
       
   299      * Own. Iterator used in synchronisation. 
       
   300      * Indicates next suite name to be synchronised.
       
   301      */
       
   302     THashSetIter<HBufC*>* iSuiteSetIterator;
       
   303 
       
   304     /**
       
   305      * ETrue if suite files on the c: drive were updated during the
       
   306      * last synchronization. New suite files also count as updated.
       
   307      * EFalse if the last synchronization did not alter any files
       
   308      * on the c: drive.
       
   309      */
       
   310     TBool iSuiteFilesUpdated;
       
   311 
       
   312     };
   204     };
   313 #endif // C_HNMULMODELPROVIDER_H
   205 #endif // C_HNMULMODELPROVIDER_H