webengine/widgetinstaller/Inc/WidgetConfigHandler.h
changeset 0 dd21522fd290
child 17 c8a366e56285
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 * Copyright (c) 2006 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 the License "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:  Widget installer info file parsing.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef WIDGETINFOPLISTCONFIGHANDLER_H
       
    20 #define WIDGETINFOPLISTCONFIGHANDLER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <libxml2_tree.h>
       
    24 #include <WidgetRegistryConstants.h>
       
    25 #include <WidgetPropertyValue.h>
       
    26 
       
    27 // FORWARD DECLARATION
       
    28 
       
    29 
       
    30 
       
    31     // CLASS DECLARATION
       
    32 
       
    33     /**
       
    34      *  Parse the widget info file for widget entry creation.
       
    35      *  @lib WidgetInstallerUI.lib
       
    36      *  @since 3.1
       
    37      */
       
    38 NONSHARABLE_CLASS(CWidgetConfigHandler): public CBase
       
    39         {
       
    40     public: // constuctors and destructor
       
    41 
       
    42         /**
       
    43          * Two-phased constructor.
       
    44          */
       
    45     static CWidgetConfigHandler* NewL();
       
    46 
       
    47         /**
       
    48          * Destructor.
       
    49          */
       
    50     virtual ~CWidgetConfigHandler();
       
    51 
       
    52     public:
       
    53 
       
    54         /**
       
    55          * Parse the widget info file and create CWidgetInfo and CWidgetData
       
    56          * check for required keys and values
       
    57          *
       
    58          * @param aBuffer The buffer contains widget info file content.
       
    59          * @param aPropertyValues output filled with parsed values from buf
       
    60          * @since 3.1
       
    61          * @return none.
       
    62          */
       
    63         void ParseValidateBundleMetadataL(
       
    64             TPtr8 aBuffer,
       
    65             RPointerArray<CWidgetPropertyValue>& aPropertyValues,
       
    66             RFs& aFileSession );
       
    67 
       
    68         /**
       
    69          * Parse the localized buffer from infoPlist.strings in format of
       
    70          * CFBundleDisplayName = "localized display name"
       
    71          * and update the widgetInfo's displayname
       
    72          *
       
    73          * @param aBuffer: the buffer holding data from infoPlist.strings file
       
    74          * @param aWidgetInfo: the widget info data which contains the widget display name
       
    75          * @since 3.1
       
    76          */
       
    77         void ParseInfoLocL( TPtrC8 aBuffer,
       
    78                             RFs& aFileSession,
       
    79                             CWidgetPropertyValue& aBundleDisplayName );
       
    80 
       
    81 
       
    82     protected:
       
    83 
       
    84         /**
       
    85          * C++ default constructor.
       
    86          */
       
    87         CWidgetConfigHandler();
       
    88 
       
    89         /**
       
    90          * Symbian 2nd phase constructor
       
    91          */
       
    92         void ConstructL();
       
    93 
       
    94         /**
       
    95          * Traverse to the next Node
       
    96          *
       
    97          * @param aNode: current node
       
    98          * @since 3.1
       
    99          * @return next node
       
   100          */
       
   101         xmlNode* TraverseNextNode( xmlNode* aNode );
       
   102 
       
   103         void ToUnicodeL( TInt aEncoding,
       
   104                          TInt aUnicodeSizeMultiplier,
       
   105                          TPtrC8 aInBuf, HBufC16** aOutBuf,
       
   106                          RFs& aFileSession );
       
   107 
       
   108         void GetContentL( RFs& aFileSession,
       
   109                           xmlDocPtr aDoc,
       
   110                           xmlNode* aNode,
       
   111                           HBufC** aContent );
       
   112 
       
   113         void ValidateL(
       
   114             RPointerArray<CWidgetPropertyValue>& aPropertyValues );
       
   115 
       
   116     private:
       
   117 
       
   118         enum DtdType
       
   119             {
       
   120             EDtdTypeUnknown,
       
   121             EDtdTypeApple,
       
   122             EDtdTypeNokia
       
   123             };
       
   124 
       
   125         // these index iProperties description table, not property
       
   126         // VALUES which are indexed by a TWidgetPropertyId
       
   127         enum TWidgetPropertyDescriptionId
       
   128             {
       
   129             EPropertyDescriptionAppleBundleIdentifier,     // required; string; example: com.apple.hello
       
   130             EPropertyDescriptionAppleBundleDisplayName,    // required; string; example: Hello World
       
   131             EPropertyDescriptionAppleBundleVersion,        // optional; string; example: 1.0
       
   132             EPropertyDescriptionAppleAllowFullAccess,      // optional; bool but int 0/1 internally
       
   133             // AppleAllowFullAccess is mapped to AllowNetworkAccess if that is missing, otherwise ignored
       
   134             EPropertyDescriptionNokiaIdentifier,           // required; string; example: com.nokia.hello
       
   135             EPropertyDescriptionNokiaDisplayName,          // required; string; example: Hello World
       
   136             EPropertyDescriptionNokiaVersion,              // optional; string; example: Hello World
       
   137             EPropertyDescriptionMainHTML,                  // required; string; example: HellowWorld.html
       
   138             EPropertyDescriptionAllowNetworkAccess,        // optional; bool but int 0/1 internally
       
   139             EPropertyDescriptionHeight,                    // optional; integer; example: 100
       
   140             EPropertyDescriptionWidth,                     // optional; integer; example: 100
       
   141             EPropertyDescriptionNokiaMiniViewEnable,       // optional; bool but int 0/1 internally
       
   142             EPropertyDescriptionNokiaPromptNeeded,       //optional; bool but int 0/1 internally
       
   143             // end property description list, begin special values
       
   144             EPropertyDescriptionIdCount,     // must be at end of properties
       
   145             EPropertyDescriptionIdInvalid    // must be after EPropertyDescriptionIdCount
       
   146             };
       
   147 
       
   148         TWidgetPropertyId GetPropertyId(
       
   149             const TDesC& aKeyName,
       
   150             DtdType aDtdType,
       
   151             TWidgetPropertyDescriptionId& aSpecialPropertyDescriptionId );
       
   152 
       
   153         class TWidgetProperty
       
   154             {
       
   155         public:
       
   156             TWidgetPropertyId id; // the registry value id for this name
       
   157             TPtrC name;
       
   158             TWidgetPropertyType type;
       
   159             TInt flags;
       
   160             };
       
   161 
       
   162         // Table describing properties from the bundle metadata.  Used by parser.
       
   163         TFixedArray<TWidgetProperty, EPropertyDescriptionIdCount> iProperties;
       
   164 
       
   165         DtdType iDtdType; // used by lproj processing after manifest parse
       
   166         };
       
   167 
       
   168 #endif
       
   169 
       
   170 // End of File