wlanutilities/wlanwizard/tsrc/stubs/eapqtvalidator.h
branchRCL_3
changeset 24 63be7eb3fc78
equal deleted inserted replaced
23:b852595f5cbe 24:63be7eb3fc78
       
     1 /*
       
     2 * Copyright (c) 2010 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 * Stub for EAP WIZARD testing: EAP QT configuration validator interface.
       
    16 */
       
    17 
       
    18 #ifndef EAPQTVALIDATOR_H
       
    19 #define EAPQTVALIDATOR_H
       
    20 
       
    21 // System includes
       
    22 #include <QVariant>
       
    23 
       
    24 // User includes
       
    25 
       
    26 // Forward declarations
       
    27 
       
    28 class HbLineEdit;
       
    29 
       
    30 // External data types
       
    31 
       
    32 // Constants
       
    33 
       
    34 // Class declaration
       
    35 
       
    36 /*!
       
    37  * @addtogroup group_eap_config_api
       
    38  * @{
       
    39  */
       
    40 
       
    41 /*
       
    42  * Eap Qt Validator interface. This interface provides a method to configure
       
    43  * the editor to use required constraints, hints, editor classes and so one
       
    44  * depending on the EAP type and the configuration identifier.
       
    45  * See updateEditor() method for further details.
       
    46  * 
       
    47  * validate() method checks that the content and format are valid for
       
    48  * given configuration parameter.
       
    49  * 
       
    50  * An instance of a validator is created with
       
    51  * EapQtConfigInterface::validatorEap() method.
       
    52  */
       
    53 
       
    54 class EapQtValidator
       
    55 {
       
    56     
       
    57 public:
       
    58 
       
    59     // Data types
       
    60 
       
    61     /*
       
    62      * Validation status. Can be extended.
       
    63      */
       
    64     enum Status {
       
    65         /// Ok
       
    66         StatusOk = 0,
       
    67         /// Content is invalid
       
    68         StatusInvalid,
       
    69         /// The length is not valid
       
    70         StatusInvalidLength,
       
    71         /// Invalid characters detected
       
    72         StatusInvalidCharacters,
       
    73         /// Input is too short
       
    74         StatusTooShort, 
       
    75         /// Input is too long
       
    76         StatusTooLong,  
       
    77     };
       
    78 
       
    79     EapQtValidator() {};
       
    80     virtual ~EapQtValidator() {};
       
    81 
       
    82     /*!
       
    83      * Validates the given input \a value.
       
    84      *
       
    85      * @param value Value to be validated
       
    86      * 
       
    87      * @return Status code.
       
    88      */
       
    89     virtual Status validate(const QVariant &value) = 0;
       
    90    
       
    91     /*!
       
    92      * Sets required configurations to the line edit.
       
    93      * 
       
    94      * Configurations depend on given EAP type and the configuration
       
    95      * identifire which was used to instantiate the validator.
       
    96      * 
       
    97      * @param edit LineEdit to be updated.
       
    98      */
       
    99     virtual void updateEditor(HbLineEdit* const edit) = 0;
       
   100     
       
   101 private:
       
   102 
       
   103     Q_DISABLE_COPY(EapQtValidator)
       
   104 };
       
   105 
       
   106 /*! @} */
       
   107 
       
   108 #endif