menufw/hierarchynavigator/hnmetadatamodel/inc/hnxmlsuitefilesreg.h
branchRCL_3
changeset 26 1b758917cafc
parent 25 137ebc85284b
child 28 d721605b30d0
equal deleted inserted replaced
25:137ebc85284b 26:1b758917cafc
     1 /*
       
     2 * Copyright (c) 2007-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 *  Version     : %version:  2 % << Don't touch! Updated by Synergy at check-out.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef C_HNXMLSUITEFILESREG_H
       
    22 #define C_HNXMLSUITEFILESREG_H
       
    23 
       
    24 #include <bautils.h>
       
    25 #include <e32hashtab.h>
       
    26 
       
    27 /**
       
    28  * Structure binding file information together.
       
    29  * All of this information is essential when synchronising suite files.
       
    30  */
       
    31 NONSHARABLE_STRUCT(THnFileInfo)
       
    32 	{
       
    33 	TBuf< KMaxFileName > iFileName;
       
    34 	TBuf< KMaxPath > iFilePath;
       
    35 	TTime iLastModified;
       
    36 	TInt iSize;
       
    37 	};
       
    38 
       
    39 /**
       
    40  * Registry of suite definition files.
       
    41  * 
       
    42  * Keeps track of the suite files' sync. 
       
    43  *
       
    44  * @lib hnmetadatamodel
       
    45  * @since S60 5.0
       
    46  * @ingroup group_hnmetadatamodel
       
    47  */
       
    48 NONSHARABLE_CLASS(CHnXmlSuiteFilesReg) : public CBase
       
    49     {
       
    50 public:
       
    51     /**
       
    52      * Standard factory method.
       
    53      *
       
    54      * @since S60 v5.0
       
    55      * @return Fully constructed object.
       
    56      */
       
    57     static TBool SynchronizeL( RFs & aFs, const TDesC &aSuiteName );
       
    58  
       
    59     /**
       
    60      * Standard virtual destructor.
       
    61      */
       
    62     virtual ~CHnXmlSuiteFilesReg();
       
    63    
       
    64 private:
       
    65 	
       
    66     /**
       
    67      * Standard C++ constructor.
       
    68      */     
       
    69 	CHnXmlSuiteFilesReg( RFs & aFs );
       
    70 
       
    71     /**
       
    72      * Standard symbian 2nd phase constructor.
       
    73      */     
       
    74     void ConstructL( const TDesC &aSuiteName );
       
    75     
       
    76     /**
       
    77      * Destroys suite file maps.
       
    78      */
       
    79     void DestroySuiteFilesMaps();
       
    80 
       
    81     /**
       
    82      * Returns the valid suite import dir.
       
    83      *
       
    84      * @param aDriveNumber Number of the drive for which to create path.
       
    85      * @return Path.
       
    86      */	
       
    87     HBufC* GetSuiteImportDirL( TInt aDriveNumber ) const;
       
    88 
       
    89     /**
       
    90      * Searches all the drives for import files for this particular suite.
       
    91      */	
       
    92     void SearchDrivesForSuiteFilesL();
       
    93 
       
    94     /**
       
    95      * Processes suite import dir.
       
    96      *
       
    97      * @param aSuitePath Path of the suite import.
       
    98      */	
       
    99     void SearchDirForSuiteFilesL( const TDesC& aSuitePath );
       
   100 
       
   101     /**
       
   102      * Adds a file to the suite map. The logics in the methods always prefers
       
   103      * the newer files over the older. If a file by the same name already exists 
       
   104      * with a newer date file will not be added.
       
   105      *
       
   106      * @param aDir Directory of the new file.
       
   107      * @param aFile New file entry.
       
   108      */	
       
   109     void AddSuiteFileToMapL( const TDesC& aDir, const TEntry& aFile );
       
   110 
       
   111     /**
       
   112      * Calculates the current size of the dir in the installation.\
       
   113      *
       
   114      * @return Size in bytes.
       
   115      */
       
   116     TInt CalculateCurrentSuiteSizeL();
       
   117 
       
   118     /**
       
   119      * Calculates the size of the data to be synchronised.
       
   120      *
       
   121      * @return Size in bytes.
       
   122      */
       
   123     TInt CalculateSynchronizationSuiteSize();
       
   124 	
       
   125     /**
       
   126      * Synchronizes the suite files.
       
   127      */
       
   128     TBool SynchronizeSuiteFilesL();
       
   129 
       
   130     /**
       
   131      * Constructs the valid installation path.
       
   132      *
       
   133      * @return The installation path.
       
   134      */
       
   135     HBufC* GetSuiteInstallPathL();
       
   136 	
       
   137 private:
       
   138 	
       
   139    /**
       
   140     * Name of the suite (suite folder).
       
   141     */
       
   142     RBuf iSuiteName;
       
   143 	
       
   144     /**
       
   145      * File server session reference
       
   146      */
       
   147     RFs &iFs;
       
   148     
       
   149     /**
       
   150      * File manager
       
   151      */
       
   152     CFileMan* iFileMan;  
       
   153         
       
   154     /**
       
   155      * Hashmap containing paths to the suite files.
       
   156      */
       
   157     RHashMap< const TDesC*, THnFileInfo* > iSuiteFiles;
       
   158 
       
   159     };
       
   160 #endif // C_HNXMLSUITEFILESREG_H