accesssec_plat/eap_qt_configuration_api/inc/eapqtvalidator.h
branchRCL_3
changeset 46 c74b3d9f6b9e
parent 45 bad0cc58d154
child 55 9c2aa05919d9
equal deleted inserted replaced
45:bad0cc58d154 46:c74b3d9f6b9e
     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  *   EAP QT configuration validator interface
       
    16  *
       
    17  */
       
    18 
       
    19 /*
       
    20  * %version: 6 %
       
    21  */
       
    22 
       
    23 #ifndef EAPQTVALIDATOR_H
       
    24 #define EAPQTVALIDATOR_H
       
    25 
       
    26 // System includes
       
    27 #include <qglobal.h>
       
    28 
       
    29 // User includes
       
    30 
       
    31 // Forward declarations
       
    32 class QVariant;
       
    33 class HbLineEdit;
       
    34 
       
    35 // External data types
       
    36 
       
    37 // Constants
       
    38 
       
    39 // Class declaration
       
    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 #endif