accesssec_plat/eap_qt_configuration_api/inc/eapqtvalidator.h
changeset 39 fe6b6762fccd
parent 33 938269283a16
equal deleted inserted replaced
38:7a0216d033ac 39:fe6b6762fccd
     1 /*
     1 /*
     2  * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
     2  * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3  * All rights reserved.
     3  * All rights reserved.
     4  * This component and the accompanying materials are made available
     4  * This component and the accompanying materials are made available
     5  * under the terms of the License "Eclipse Public License v1.0"
     5  * under the terms of "Eclipse Public License v1.0"
     6  * which accompanies this distribution, and is available
     6  * which accompanies this distribution, and is available
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8  *
     8  *
     9  * Initial Contributors:
     9  * Initial Contributors:
    10  * Nokia Corporation - initial contribution.
    10  * Nokia Corporation - initial contribution.
    15  *   EAP QT configuration validator interface
    15  *   EAP QT configuration validator interface
    16  *
    16  *
    17  */
    17  */
    18 
    18 
    19 /*
    19 /*
    20  * %version: 2 %
    20  * %version: 6 %
    21  */
    21  */
    22 
    22 
    23 #ifndef EAPQTVALIDATOR_H
    23 #ifndef EAPQTVALIDATOR_H
    24 #define EAPQTVALIDATOR_H
    24 #define EAPQTVALIDATOR_H
    25 
    25 
    26 #include <QVariant>
    26 // System includes
    27 #include <eapqtconfigdefs.h>
    27 #include <qglobal.h>
    28 
    28 
    29 /*!
    29 // User includes
    30  * @addtogroup group_eap_config_api
       
    31  * @{
       
    32  */
       
    33 
    30 
       
    31 // Forward declarations
       
    32 class QVariant;
    34 class HbLineEdit;
    33 class HbLineEdit;
    35 
    34 
    36 /*!
    35 // External data types
       
    36 
       
    37 // Constants
       
    38 
       
    39 // Class declaration
       
    40 
       
    41 /*
    37  * Eap Qt Validator interface. This interface provides a method to configure
    42  * Eap Qt Validator interface. This interface provides a method to configure
    38  * the editor to use required constraints, hints, editor classes and so one
    43  * the editor to use required constraints, hints, editor classes and so one
    39  * depending on the EAP type and the configuration identifier.
    44  * depending on the EAP type and the configuration identifier.
    40  * See updateEditor() method for further details.
    45  * See updateEditor() method for further details.
    41  * 
    46  * 
    42  * Another important method of this class is the validate() method. With
    47  * validate() method checks that the content and format are valid for
    43  * that method you can check that the content and format is valid for 
    48  * given configuration parameter.
    44  * given configuration compination.
       
    45  * 
    49  * 
    46  * An instance of validator can be created with 
    50  * An instance of a validator is created with
    47  * EapQtConfigInterface::validatorEap() method.
    51  * EapQtConfigInterface::validatorEap() method.
    48  */
    52  */
    49 
    53 
    50 class EAP_QT_CONFIG_INTERFACE_EXPORT EapQtValidator
    54 class EapQtValidator
    51 {
    55 {
       
    56 
    52 public:
    57 public:
    53 
    58 
    54     /*!
    59     // Data types
    55      * Validation status.
    60 
       
    61     /*
       
    62      * Validation status. Can be extended.
    56      */
    63      */
    57     enum Status {
    64     enum Status {
    58         /// Ok
    65         /// Ok
    59         StatusOk,
    66         StatusOk = 0,
    60         /// Content is invalid
    67         /// Content is invalid
    61         StatusInvalid,
    68         StatusInvalid,
    62         /// The length is not valid
    69         /// The length is not valid
    63         StatusInvalidLength,
    70         StatusInvalidLength,
    64         /// Invalid characters detected
    71         /// Invalid characters detected
    66         /// Input is too short
    73         /// Input is too short
    67         StatusTooShort, 
    74         StatusTooShort, 
    68         /// Input is too long
    75         /// Input is too long
    69         StatusTooLong,  
    76         StatusTooLong,  
    70     };
    77     };
    71     
       
    72 public:
       
    73 
    78 
    74     EapQtValidator() {};
    79     EapQtValidator() {};
    75     virtual ~EapQtValidator() {};
    80     virtual ~EapQtValidator() {};
    76 
    81 
    77     /*!
    82     /*!
    78      * Processes validation to the given input \a value.
    83      * Validates the given input \a value.
    79      *
    84      *
    80      * @param value Value to be validated
    85      * @param value Value to be validated
    81      * 
    86      * 
    82      * @return Status code.
    87      * @return Status code.
    83      * 
       
    84      * - EapQtConfig::Username: All values 
       
    85      * - EapQtConfig::Password: All values
       
    86      * - EapQtConfig::Realm: All values
       
    87      * - EapQtConfig::ServerName: All values
       
    88      * - EapQtConfig::PacStorePassword: All values  
       
    89      * - EapQtConfig::PacStorePasswordConfirmation: StatusOk and StatusInvalid
       
    90      */
    88      */
    91     virtual Status validate(QVariant value) = 0;
    89     virtual Status validate(const QVariant &value) = 0;
    92    
    90    
    93     /*!
    91     /*!
    94      * Sets required configurations to the lineedit such as:
    92      * Sets required configurations to the line edit.
    95      * - Constraints
       
    96      * - HbInputFilter
       
    97      * - HbValidator
       
    98      * - inputMethodsHints
       
    99      * - maximum length
       
   100      * - predictive input mode
       
   101      * - number/text mode
       
   102      * 
    93      * 
   103      * Configurations depends on the Expanded EAP type and the configuration id
    94      * Configurations depend on given EAP type and the configuration
   104      * which were used to instantiate the validator.
    95      * identifire which was used to instantiate the validator.
   105      * 
    96      * 
   106      * @param edit LineEdit to be updated.
    97      * @param edit LineEdit to be updated.
   107      */
    98      */
   108     virtual void updateEditor(HbLineEdit* edit) = 0;
    99     virtual void updateEditor(HbLineEdit* const edit) = 0;
   109     
   100     
   110 private:
   101 private:
   111 
   102 
   112     Q_DISABLE_COPY(EapQtValidator)
   103     Q_DISABLE_COPY(EapQtValidator)
   113 };
   104 };
   114 
   105 
   115 /*! @} */
       
   116 
       
   117 #endif
   106 #endif