accesssec_plat/eap_qt_configuration_api/inc/eapqtvalidator.h
changeset 26 9abfd4f00d37
child 27 9660a5eb236f
equal deleted inserted replaced
25:e03a3db4489e 26:9abfd4f00d37
       
     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 the License "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: 1 %
       
    21  */
       
    22 
       
    23 #ifndef EAPQTVALIDATOR_H
       
    24 #define EAPQTVALIDATOR_H
       
    25 
       
    26 #include <QVariant>
       
    27 
       
    28 /*!
       
    29  * @addtogroup group_eap_config_api
       
    30  * @{
       
    31  */
       
    32 
       
    33 #ifdef BUILD_EAP_QT_CONFIG_INTERFACE_DLL
       
    34 #define EAP_QT_CONFIG_INTERFACE_EXPORT Q_DECL_EXPORT
       
    35 #else
       
    36 #define EAP_QT_CONFIG_INTERFACE_EXPORT Q_DECL_IMPORT
       
    37 #endif
       
    38 
       
    39 class HbLineEdit;
       
    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  * Another important method of this class is the validate() method. With
       
    48  * that method you can check that the content and format is valid for 
       
    49  * given configuration compination.
       
    50  * 
       
    51  * An instance of validator can be created with 
       
    52  * EapQtConfigInterface::validatorEap() method.
       
    53  */
       
    54 
       
    55 class EAP_QT_CONFIG_INTERFACE_EXPORT EapQtValidator
       
    56 {
       
    57 public:
       
    58 
       
    59     /*!
       
    60      * Validation status.
       
    61      */
       
    62     enum Status {
       
    63         /// Ok
       
    64         StatusOk,
       
    65         /// Content is invalid
       
    66         StatusInvalid,
       
    67         /// The length is not valid
       
    68         StatusInvalidLength,
       
    69         /// Invalid characters detected
       
    70         StatusInvalidCharacters,
       
    71         /// Input is too short
       
    72         StatusTooShort, 
       
    73         /// Input is too long
       
    74         StatusTooLong,  
       
    75     };
       
    76     
       
    77 public:
       
    78 
       
    79     EapQtValidator() {};
       
    80     virtual ~EapQtValidator() {};
       
    81 
       
    82     /*!
       
    83      * Processes validation to the given input \a value.
       
    84      *
       
    85      * @param value Value to be validated
       
    86      * 
       
    87      * @return Status code.
       
    88      * 
       
    89      * - EapQtConfig::Username: All values 
       
    90      * - EapQtConfig::Password: All values
       
    91      * - EapQtConfig::Realm: All values
       
    92      * - EapQtConfig::ServerName: All values
       
    93      * - EapQtConfig::PacStorePassword: All values  
       
    94      * - EapQtConfig::PacStorePasswordConfirmation: StatusOk and StatusInvalid
       
    95      */
       
    96     virtual Status validate(QVariant value) = 0;
       
    97    
       
    98     /*!
       
    99      * Sets required configurations to the lineedit such as:
       
   100      * - Constraints
       
   101      * - HbInputFilter
       
   102      * - HbValidator
       
   103      * - inputMethodsHints
       
   104      * - maximum length
       
   105      * - predictive input mode
       
   106      * - number/text mode
       
   107      * 
       
   108      * Configurations depends on the Expanded EAP type and the configuration id
       
   109      * which were used to instantiate the validator.
       
   110      * 
       
   111      * @param edit LineEdit to be updated.
       
   112      */
       
   113     virtual void updateEditor(HbLineEdit* edit) = 0;
       
   114     
       
   115 private:
       
   116 
       
   117     Q_DISABLE_COPY(EapQtValidator)
       
   118 };
       
   119 
       
   120 /*! @} */
       
   121 
       
   122 #endif