wvuing/wvvariant/AlternatorSrc/CAlternatorImp.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2003-2005 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:  Header of concrete implementation class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CALTERNATORIMP_H
       
    21 #define CALTERNATORIMP_H
       
    22 
       
    23 //  INCLUDES
       
    24 
       
    25 #include "CAlternator.h"
       
    26 #include "AlternatorGlobals.h"
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CEikonEnv;
       
    30 class RWriteStream;
       
    31 class RReadStream;
       
    32 class CCABrandInstallerImp;
       
    33 // CLASS DECLARATION
       
    34 
       
    35 /**
       
    36 *  Concrete implementation of CAlternator.h See CAlternator.h.
       
    37 *  @lib alternator.lib
       
    38 *  @since 1.2s
       
    39 */
       
    40 class CAlternatorImp : public CAlternator
       
    41     {
       
    42     public:  // Constructors and destructor
       
    43 
       
    44 
       
    45         /**
       
    46         * Constructor
       
    47         */
       
    48         static CAlternatorImp* NewL( const TDesC& aBrandRoot );
       
    49 
       
    50         /**
       
    51         * Destructor.
       
    52         */
       
    53         virtual ~CAlternatorImp();
       
    54 
       
    55     public: // Functions from base classes
       
    56 
       
    57 
       
    58         /**
       
    59         * From CAlternator
       
    60         */
       
    61         const TDesC& CurrentBitmapFileL( const TDesC& aModuleId,
       
    62                                          const TDesC& aAlternative,
       
    63                                          const TDesC& aBitmapFileName );
       
    64 
       
    65         TInt ChangeResourceL( const TDesC& aModuleId,
       
    66                               const TDesC& aAlternative,
       
    67                               const TDesC& aResFileName,
       
    68                               TInt& aResOffset );
       
    69 
       
    70         TInt ChangeBitmapFileL( const TDesC& aModuleId,
       
    71                                 const TDesC& aAlternative,
       
    72                                 const TDesC& aBitmapFileName );
       
    73 
       
    74         void GetCurrentResourceFileL( const TDesC& aModuleId,
       
    75                                       const TDesC& aAlternative,
       
    76                                       const TDesC& aResFileName,
       
    77                                       TDes& aFullPath );
       
    78 
       
    79     public: //New Functions
       
    80 
       
    81         /**
       
    82         * Changes root path of op branding files
       
    83         * @since 3.0
       
    84         * @param aBrandRoot, new root path
       
    85         */
       
    86         void SetBrandRoot( const TDesC& aBrandRoot );
       
    87 
       
    88     private:
       
    89 
       
    90         /**
       
    91         * Changes the resource file.
       
    92         * @since 1.2s
       
    93         * @param aModuleId, dll's (or app) id. For example "IM".
       
    94         * @param aAlternative, id for alternative
       
    95         *                      (for example operator "Oper1" ) files.
       
    96         * @param aResFileName,resource file's name.
       
    97         * @param aResOffSet,reference to resource offset
       
    98         * @return Returns error code if something went wrong.
       
    99         *         Leaves on OOM situations.
       
   100         */
       
   101         TInt LoadResourceFileL( const TDesC& aModuleId, const
       
   102                                 TDesC& aAlternative,
       
   103                                 const TDesC& aResFileName,
       
   104                                 TInt& aResOffSet );
       
   105 
       
   106 
       
   107         /**
       
   108         * Checks if the path&file exists.
       
   109         * @param aCheckThis, path to be checked.
       
   110         * @since 1.2s
       
   111         */
       
   112         TBool IsPathOk( const TDesC& aCheckThis ) const;
       
   113 
       
   114         /**
       
   115         * Constructs complete path from parts and checks for correctness.
       
   116         * @param aResult, the complete path.
       
   117         * @param aModuleId, dll's (or app) id. For example "IM".
       
   118         * @param aAlternative, id for alternative
       
   119         *                     (for example operator "Oper1" ) files.
       
   120         * @param aFileName, filename of the complete path
       
   121         * @return KErrNone if path was found from C or MMC card,
       
   122         *         otherwise error is returned
       
   123         * @since 1.2s
       
   124         */
       
   125         TInt ConstructCompletePathAndCheck( TDes& aResult,
       
   126                                             const TDesC& aModuleId,
       
   127                                             const TDesC& aAlternative,
       
   128                                             const TDesC& aFileName );
       
   129 
       
   130     private:
       
   131 
       
   132         /**
       
   133         * C++ default constructor.
       
   134         */
       
   135         CAlternatorImp();
       
   136 
       
   137         /**
       
   138         * By default Symbian 2nd phase constructor is private.
       
   139         */
       
   140         void ConstructL( const TDesC& aBrandRoot );
       
   141 
       
   142 
       
   143     private:    // Data
       
   144 
       
   145         // Pointer to eikon environment
       
   146         CEikonEnv* iEikEnv;
       
   147         // Current bitmap path
       
   148         TFileName iCurrentBitmap;
       
   149 
       
   150         // Root for branding files like: c:\system\data\branding\
       
   151         // owned
       
   152         HBufC* iBrandRoot;
       
   153 
       
   154         CCABrandInstallerImp* iBrandInstaller;
       
   155 
       
   156     };
       
   157 
       
   158 #endif      // CALTERNATORIMP_H
       
   159 
       
   160 // End of File