email/imum/Utils/Inc/ImumInSettingsDataValidator.h
branchRCL_3
changeset 60 7fdbb852d323
parent 0 72b543305e3a
equal deleted inserted replaced
57:ebe688cedc25 60:7fdbb852d323
       
     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 "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:  ImumInSettingsDataValidator.h
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CIMUMINSETTINGSDATAVALIDATOR_H
       
    20 #define CIMUMINSETTINGSDATAVALIDATOR_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 
       
    25 // CONSTANTS
       
    26 // MACROS
       
    27 // DATA TYPES
       
    28 // FUNCTION PROTOTYPES
       
    29 // FORWARD DECLARATIONS
       
    30 class CImumInternalApiImpl;
       
    31 class CImumInSettingsDataImpl;
       
    32 class MImumInSettingsDataCollection;
       
    33 class CMsvCommDbUtilities;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38  *  Class to analyze and correct settings data objects.
       
    39  *
       
    40  *  @lib ImumUtils.lib
       
    41  *  @since S60 v3.2
       
    42  */
       
    43 class CImumInSettingsDataValidator : public CBase
       
    44     {
       
    45     public:  // Constructors and destructor
       
    46 
       
    47         /**
       
    48         * Creates object from CImumInSettingsDataValidator and leaves it to cleanup stack
       
    49         * @since S60 v3.2
       
    50         * @return, Constructed object
       
    51         */
       
    52         static CImumInSettingsDataValidator* NewLC(
       
    53             CImumInternalApiImpl& aInternalApi );
       
    54 
       
    55         /**
       
    56         * Create object from CImumInSettingsDataValidator
       
    57         * @since S60 v3.2
       
    58         * @return, Constructed object
       
    59         */
       
    60         static CImumInSettingsDataValidator* NewL(
       
    61             CImumInternalApiImpl& aInternalApi );
       
    62 
       
    63         /**
       
    64         * Destructor
       
    65         * @since S60 v3.2
       
    66         */
       
    67         virtual ~CImumInSettingsDataValidator();
       
    68 
       
    69     public: // New functions
       
    70 
       
    71         /**
       
    72          *
       
    73          *
       
    74          * @since S60 v3.2
       
    75          * @param
       
    76          * @return
       
    77          */
       
    78         TInt Validate(
       
    79             CImumInSettingsDataImpl& aSettings );
       
    80 
       
    81         /**
       
    82          *
       
    83          *
       
    84          * @since S60 v3.2
       
    85          * @param
       
    86          * @return
       
    87          */
       
    88         TInt Validate(
       
    89             MImumInSettingsDataCollection& aConnectionSettings );
       
    90 
       
    91         /**
       
    92          *
       
    93          *
       
    94          * @since S60 v3.2
       
    95          * @param
       
    96          * @leave
       
    97          */
       
    98         void ValidateL(
       
    99             CImumInSettingsDataImpl& aSettings );
       
   100 
       
   101         /**
       
   102          *
       
   103          *
       
   104          * @since S60 v3.2
       
   105          * @param
       
   106          * @leave
       
   107          */
       
   108         void ValidateL(
       
   109             MImumInSettingsDataCollection& aConnectionSettings );
       
   110 
       
   111     public: // Functions from base classes
       
   112 
       
   113     protected:  // Constructors
       
   114 
       
   115         /**
       
   116         * Default constructor for classCImumInSettingsDataValidator
       
   117         * @since S60 v3.2
       
   118         * @return, Constructed object
       
   119         */
       
   120         CImumInSettingsDataValidator(
       
   121             CImumInternalApiImpl& aInternalApi );
       
   122 
       
   123         /**
       
   124         * Symbian 2-phase constructor
       
   125         * @since S60 v3.2
       
   126         */
       
   127         void ConstructL();
       
   128 
       
   129     protected:  // New virtual functions
       
   130     protected:  // New functions
       
   131     protected:  // Functions from base classes
       
   132 
       
   133     private:  // New virtual functions
       
   134     private:  // New functions
       
   135 
       
   136         /**
       
   137          *
       
   138          *
       
   139          * @since S60 v3.2
       
   140          * @param
       
   141          */
       
   142         void CheckProtocolsL(
       
   143             CImumInSettingsDataImpl& aSettings );
       
   144 
       
   145         /**
       
   146          * Makes sure that access point has working values set
       
   147          *
       
   148          * @since S60 v3.2
       
   149          * @param
       
   150          * @return
       
   151          */
       
   152         void ValidateAccessPointL(
       
   153             MImumInSettingsDataCollection& aConnectionSettings );
       
   154 
       
   155         /**
       
   156          *
       
   157          *
       
   158          * @since S60 v3.2
       
   159          */
       
   160         void CheckEmailAddressL(
       
   161             const CImumInSettingsDataImpl& aSettings );
       
   162 
       
   163         /**
       
   164          *
       
   165          *
       
   166          * @since S60 v3.2
       
   167          */
       
   168         void CheckServerAddressL(
       
   169             const MImumInSettingsDataCollection& aSettings );
       
   170 
       
   171         /**
       
   172          *
       
   173          *
       
   174          * @since S60 v3.2
       
   175          * @param
       
   176          */
       
   177         void CheckMailboxNameL(
       
   178             const CImumInSettingsDataImpl& aSettings );
       
   179 
       
   180         /**
       
   181          * Check and validate security settings
       
   182          *
       
   183          * @since S60 v3.2
       
   184          * @param
       
   185          */
       
   186         void ValidateSecurityL(
       
   187             MImumInSettingsDataCollection& aConnectionSettings );
       
   188 
       
   189         /**
       
   190          * Returns default port of security setting for the protocol.
       
   191          *
       
   192          * @since S60 v3.2
       
   193          * @param aSecurity Selected security setting
       
   194          * @param aProtocol Current protocol
       
   195          * @return Default port based on the protocol and security setting
       
   196          */
       
   197         TInt GetDefaultSecurityPortL(
       
   198             const TInt aSecurity,
       
   199             const TInt aProtocol );
       
   200 
       
   201         /**
       
   202          * This method verifies that the key contains valid information
       
   203          *
       
   204          * @since S60 v3.2
       
   205          * @param aSettings Either API's SettingsData or ConnectionSettings
       
   206          * @param aAttributeKey Unique id of the key.
       
   207          * @param aMinValue Minimum possible value for the setting
       
   208          * @param aMaxValue Maximum possible value for the setting
       
   209          * @param aErrorCode
       
   210          * @return Verified value of the attribute
       
   211          * @leave aErrorCode, when setting doesn't fulfill the requirements
       
   212          */
       
   213         template<class TType, class TSettings>
       
   214         inline TType VerifyKeyL(
       
   215             TSettings& aSettings,
       
   216             const TUint aAttributeKey,
       
   217             const TInt aMinValue,
       
   218             const TInt aMaxValue,
       
   219             const TInt aErrorCode ) const;
       
   220 
       
   221         /**
       
   222          * This method validates that the key contains valid information
       
   223          *
       
   224          * @since S60 v3.2
       
   225          * @param aSettings Either API's SettingsData or ConnectionSettings
       
   226          * @param aAttributeKey Unique id of the key.
       
   227          * @param aMinValue Minimum possible value for the setting
       
   228          * @param aMaxValue Maximum possible value for the setting
       
   229          * @return Validated value of the attribute.
       
   230          * @rtype Type of the value.
       
   231          */
       
   232         template<class TType, class TSettings>
       
   233         inline TType ValidateKey(
       
   234             TSettings& aSettings,
       
   235             const TUint aAttributeKey,
       
   236             const TInt aMinValue,
       
   237             const TInt aMaxValue );
       
   238 
       
   239     private:  // Functions from base classes
       
   240 
       
   241     public:     // Data
       
   242     protected:  // Data
       
   243     private:    // Data
       
   244 
       
   245         /** Control flags */
       
   246         enum TFlags
       
   247             {
       
   248             // Validating has caused settings to be changed
       
   249             ESettingsHaveChanged = 0
       
   250             };
       
   251 
       
   252         //
       
   253         CImumInternalApiImpl&   iInternalApi;
       
   254         // Owned: For access point validation
       
   255         CMsvCommDbUtilities*    iCommDbUtils;
       
   256         // Flags to control the behaviour
       
   257         TMuiuFlags              iFlags;
       
   258     };
       
   259 
       
   260 #include "ImumInSettingsDataValidator.inl"
       
   261 
       
   262 #endif //  CIMUMINSETTINGSDATAVALIDATOR_H
       
   263 
       
   264 // End of File
       
   265