contentstorage/casrv/cawidgetscanner/inc/cawidgetscannerparser.h
changeset 103 b99b84bcd2d1
parent 73 4bc7b118b3df
child 104 9b022b1f357c
equal deleted inserted replaced
83:156f692b1687 103:b99b84bcd2d1
    19 #ifndef C_WIDGETSCANNERPARSER_H
    19 #ifndef C_WIDGETSCANNERPARSER_H
    20 #define C_WIDGETSCANNERPARSER_H
    20 #define C_WIDGETSCANNERPARSER_H
    21 
    21 
    22 //  INCLUDES
    22 //  INCLUDES
    23 #include <e32base.h>
    23 #include <e32base.h>
    24 #include <xmlengdomimplementation.h>
    24 #include <xml/dom/xmlengdomimplementation.h>
    25 #include <xmlengelement.h>
       
    26 #include <badesca.h>
    25 #include <badesca.h>
    27 #include <f32file.h>
    26 #include <f32file.h>
    28 #include "cawidgetdescription.h"
    27 #include "cawidgetdescription.h"
       
    28 #include "castorage_global.h"
    29 
    29 
    30 // CONSTANTS
    30 // CONSTANTS
    31 
    31 
    32 // FORWARD DECLARATIONS
    32 // FORWARD DECLARATIONS
       
    33 
    33 class CDir;
    34 class CDir;
    34 
    35 CA_STORAGE_TEST_CLASS( T_CaWidgetScanner )
       
    36 class TXmlEngElement;
    35 /**
    37 /**
    36  *  Widget Parser
    38  *  Widget Parser
    37  *
    39  *
    38  *  @since Series Series60 5.x
    40  *  @since Series Series60 5.x
    39  */
    41  */
    56 
    58 
    57     /**
    59     /**
    58      * WidgetsL
    60      * WidgetsL
    59      * @return array containing widgets description
    61      * @return array containing widgets description
    60      */
    62      */
    61     RWidgetArray& WidgetsScanL( );
    63     RWidgetArray& WidgetsScanL( const RWidgetArray& aWidgets  );
    62 
    64     
    63 private:
    65 private:
    64 
    66 
    65     /**
    67     /**
       
    68      * C++ default constructor.
       
    69      */
       
    70     CCaWidgetScannerParser( RFs& aFs );
       
    71 
       
    72     /**
       
    73      * By default Symbian 2nd phase constructor is private.
       
    74      */
       
    75     void ConstructL( );
       
    76 
       
    77 
       
    78     /**
    66      * Looks for manifests on a drive
    79      * Looks for manifests on a drive
    67      * @param aDriveLetter drive letter
    80      * @param aDrive drive to use
    68      */
    81      */
    69     void ScanOnDriveL( );
    82     void ScanOnDriveL( TChar& aDrive );
    70 
    83 
    71     /**
    84     /**
    72      * Parses all manifest files in a directory
    85      * Parses all manifest files in a directory
    73      * @param aDriveLetter drive letter
       
    74      * @param aDirectoryName directory name
    86      * @param aDirectoryName directory name
    75      */
    87      * @param aDrive drive to use
    76     void ParseDirectoryL( const TDesC& aDirectoryName );
    88      */
       
    89     void ParseDirectoryL( const TDesC& aDirectoryName, TChar& aDrive );
    77 
    90 
    78     /**
    91     /**
    79     * Parse manifest file
    92     * Parse manifest file
    80     * @param aFilePath full file path to manifest file
    93     * @param aFilePath full file path to manifest file
    81     * @param aPackageUid descriptor containing package uid
    94     * @param aPackageUid descriptor containing package uid
       
    95     * @param aDrive drive to use
    82     */
    96     */
    83     void ParseManifestFileL( const TDesC& aFilePath,
    97     void ParseManifestFileL( const TDesC& aFilePath,
    84         const TDesC& aPackageUid);
    98         const TDesC& aPackageUid, TChar& aDrive );
    85 
    99 
    86     /**
   100     /**
    87     * Parse a widget, store parsed object in an internal array
   101     * Parse a widget, store parsed object in an internal array
    88     * @param aFilePath full file path to manifest file
   102     * @param aFilePath full file path to manifest file
    89     * @param aElement widget element
   103     * @param aElement widget element
    90     * @param aPackageUid descriptor containing package uid
   104     * @param aPackageUid descriptor containing package uid
       
   105     * @param aDrive drive to use
    91     */
   106     */
    92     void ParseWidgetL( const TDesC& aFilePath,
   107     void ParseWidgetL( const TDesC& aFilePath,
    93             TXmlEngElement aElement, const TDesC& aPackageUid );
   108             TXmlEngElement& aElement, const TDesC& aPackageUid,
       
   109             TChar& aDrive );
    94 
   110 
    95     /**
   111     /**
    96      * Gets all directories from import folder
   112      * Gets all directories from import folder
    97      * @param aDriveLetter drive letter
   113      * @param aDriveLetter drive letter
    98      * @return directories
   114      * @return directories
    99      */
   115      */
   100     CDir* GetDirectoriesLC( );
   116     CDir* GetDirectoriesLC( TChar& aDrive );
   101 
   117 
   102     /**
   118     /**
   103      * Returns import path
   119      * Returns import path
   104      * @param aDriveLetter drive letter
   120      * @param aDriveLetter drive letter
   105      * @return import path
   121      * @return import path
   106      */
   122      */
   107     HBufC* FullPathLC( );
   123     HBufC* FullPathLC( TChar& aDrive ) const;
   108 
   124 
   109     /**
   125     /**
   110      * Returns manifest directory path
   126      * Returns manifest directory path
   111      * @param aDriveLetter drive letter
   127      * @param aDriveLetter drive letter
   112      * @param aDirectoryName directory name
   128      * @param aDirectoryName directory name
       
   129      * @param aDrive drive to use
   113      * @return manifest directory path
   130      * @return manifest directory path
   114      */
   131      */
   115     HBufC* GetManifestDirectoryPathLC( const TDesC& aDirectoryName );
   132     HBufC* GetManifestDirectoryPathLC( const TDesC& aDirectoryName, TChar& aDrive ) const;
   116 
   133 
   117     /**
   134     /**
   118      * Sets widgets URI
   135      * Sets widgets URI
   119      * @param aElement xml element
   136      * @param aElement xml element
   120      * @param aWidget widget to set value
   137      * @param aWidget widget to set value
   121      */
   138      */
   122     void SetUriL( TXmlEngElement & aElement, CCaWidgetDescription * aWidget );
   139     void SetUriL( TXmlEngElement& aElement, CCaWidgetDescription* aWidget );
   123 
   140 
   124     /**
   141     /**
   125      * Sets widgets library and path created from library
   142      * Sets widgets library and path created from library
   126      * @param aElement xml element
   143      * @param aElement xml element
   127      * @param aPackageUid package uid
   144      * @param aPackageUid package uid
   128      * @param aWidget widget to set value
   145      * @param aWidget widget to set value
   129      */
   146      */
   130     void SetLibraryL( TXmlEngElement & aElement, const TDesC & aPackageUid,
   147     void SetLibraryL( TXmlEngElement& aElement, const TDesC& aPackageUid,
   131             CCaWidgetDescription * aWidget );
   148             CCaWidgetDescription* aWidget, TChar& aDrive );
   132 
   149 
   133     /**
   150     /**
   134      * Sets widgets title
   151      * Sets widgets title
   135      * @param aElement xml element
   152      * @param aElement xml element
   136      * @param aWidget widget to set value
   153      * @param aWidget widget to set value
   137      */
   154      */
   138     void SetTitleL( TXmlEngElement & aElement, 
   155     void SetTitleL( TXmlEngElement& aElement, 
   139             CCaWidgetDescription * aWidget );
   156             CCaWidgetDescription* aWidget );
   140 
   157 
   141     /**
   158     /**
   142      * Sets widgets description
   159      * Sets widgets description
   143      * @param aElement xml element
   160      * @param aElement xml element
   144      * @param aWidget widget to set value
   161      * @param aWidget widget to set value
   145      */
   162      */
   146     void SetDescriptionL( TXmlEngElement & aElement,
   163     void SetDescriptionL( TXmlEngElement& aElement,
   147             CCaWidgetDescription * aWidget );
   164             CCaWidgetDescription* aWidget );
   148 
   165 
   149     /**
   166     /**
   150      * Sets widgets visibility
   167      * Sets widgets visibility
   151      * @param aElement xml element
   168      * @param aElement xml element
   152      * @param aWidget widget to set value
   169      * @param aWidget widget to set value
   153      */
   170      */
   154     void SetVisibilityL( TXmlEngElement & aElement,
   171     void SetVisibilityL( TXmlEngElement& aElement,
   155             CCaWidgetDescription * aWidget );
   172             CCaWidgetDescription* aWidget );
   156 
   173 
   157     /**
   174     /**
   158      * Sets icons URI
   175      * Sets icons URI
   159      * @param aElement xml element
   176      * @param aElement xml element
   160      * @param aPackageUid package uid
   177      * @param aPackageUid package uid
   161      * @param aWidget widget to set value
   178      * @param aWidget widget to set value
   162      */
   179      */
   163     void SetIconUriL( TXmlEngElement & aElement, const TDesC & aPackageUid,
   180     void SetIconUriL( TXmlEngElement& aElement, const TDesC& aPackageUid,
   164             CCaWidgetDescription * aWidget );
   181             CCaWidgetDescription* aWidget, TChar& aDrive );
   165 
   182 
   166     /**
   183     /**
   167      * Sets widgets mmc id
   184      * Sets widgets mmc id
   168      * @param aWidget widget to set value
   185      * @param aWidget widget to set value
   169      */
   186      */
   170     void SetMmcIdL( CCaWidgetDescription * aWidget );
   187     void SetMmcIdL( CCaWidgetDescription* aWidget, TChar& aDrive );
   171     
   188     
   172     void ParseUriL(TXmlEngElement & aElement);
   189     void ParseUriL( TXmlEngElement& aElement,
   173     void ParseTitleL(TXmlEngElement & aElement);
   190             CCaWidgetDescription* aWidgetDescriptor );
   174     void ParseIconL(TXmlEngElement & aElement,  const TDesC & aPackageUid);
   191     void ParseTitleL( TXmlEngElement& aElement,
   175     void ParseDescriptionL(TXmlEngElement & aElement);
   192             CCaWidgetDescription* aWidgetDescriptor );
   176     void ParseHiddenL(TXmlEngElement & aElement);
   193     void ParseIconL( TXmlEngElement& aElement,  const TDesC& aPackageUid,
   177     void ParseServiceXmlL(TXmlEngElement & aElement);
   194             CCaWidgetDescription* aWidgetDescriptor, TChar& aDrive );
       
   195     void ParseDescriptionL( TXmlEngElement& aElement,
       
   196             CCaWidgetDescription* aWidgetDescriptor );
       
   197     void ParseHiddenL( TXmlEngElement& aElement,
       
   198             CCaWidgetDescription* aWidgetDescriptor );
       
   199     void ParseServiceXmlL(TXmlEngElement & aElement,
       
   200             CCaWidgetDescription* aWidgetDescriptor );
       
   201     void SetModificationTimeL( const TDesC& aFilePath,
       
   202             CCaWidgetDescription* aWidgetDescriptor );
       
   203     
       
   204     void ParsePreviewImageNameL( TXmlEngElement& aElement, 
       
   205         const TDesC& aPackageUid,
       
   206         CCaWidgetDescription* aWidgetDescriptor,
       
   207         TChar& aDrive );
       
   208 
       
   209     /**
       
   210      * @param aElement xml document element.
       
   211      * @return created descriptor with element's text value. Ownership
       
   212      * of the descriptor is passed to the caller.
       
   213      */
       
   214     HBufC *CCaWidgetScannerParser::GetElementTextLC( 
       
   215         const TXmlEngElement& aElement ) const;
       
   216     
       
   217     /**
       
   218      * Parses graphics name value and if the name has a file extension
       
   219      * adds widget root directory path to it.
       
   220      * @param aElement xml document element.
       
   221      * @return created descriptor with graphics name value. Ownership
       
   222      * of the descriptor is passed to the caller.
       
   223      */
       
   224     HBufC* GetThemableGraphicsNameLC(
       
   225             const TXmlEngElement & aElement,
       
   226             const TDesC & aPackageUid,
       
   227             TChar& aDrive ) const;
       
   228 
       
   229 
   178 
   230 
   179 private:
   231 private:
   180 
   232     // Data  
   181     /**
       
   182      * C++ default constructor.
       
   183      */
       
   184     CCaWidgetScannerParser( RFs& aFs );
       
   185 
       
   186     /**
       
   187      * By default Symbian 2nd phase constructor is private.
       
   188      */
       
   189     void ConstructL( );
       
   190 
       
   191 private:
       
   192     // Data
       
   193 
       
   194     /*
       
   195      * Stores current drive letter
       
   196      */
       
   197     TChar iCurrentDriveLetter;
       
   198 
   233 
   199     /*
   234     /*
   200      * File server session.Not Own
   235      * File server session.Not Own
   201      */
   236      */
   202     RFs iFs;
   237     RFs iFs;
   208 
   243 
   209     /*
   244     /*
   210      * Widgets. Own.
   245      * Widgets. Own.
   211      */
   246      */
   212     RWidgetArray iWidgets;
   247     RWidgetArray iWidgets;
       
   248     
       
   249     /*
       
   250      * Widgets. Not own.
       
   251      */
       
   252     RWidgetArray iFetchedWidgets; 
   213     /*
   253     /*
   214      * Own.
   254      * Own.
   215      */
   255      */
   216     RXmlEngDOMImplementation iDomImpl;
   256     RXmlEngDOMImplementation iDomImpl;
   217     
   257     
   218     CCaWidgetDescription* iWidgetDescriptor;
   258     
   219 
   259     CA_STORAGE_TEST_FRIEND_CLASS( T_CaWidgetScanner )
       
   260     
   220     };
   261     };
   221 
   262 
   222 #endif      // C_WIDGETSCANNERPARSER_H
   263 #endif      // C_WIDGETSCANNERPARSER_H
   223 // End of File
   264 // End of File