accesssec_plat/eap_qt_configuration_api/inc/eapqtvalidator.h
changeset 33 938269283a16
child 39 fe6b6762fccd
equal deleted inserted replaced
22:093cf0757204 33:938269283a16
       
     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: 2 %
       
    21  */
       
    22 
       
    23 #ifndef EAPQTVALIDATOR_H
       
    24 #define EAPQTVALIDATOR_H
       
    25 
       
    26 #include <QVariant>
       
    27 #include <eapqtconfigdefs.h>
       
    28 
       
    29 /*!
       
    30  * @addtogroup group_eap_config_api
       
    31  * @{
       
    32  */
       
    33 
       
    34 class HbLineEdit;
       
    35 
       
    36 /*!
       
    37  * Eap Qt Validator interface. This interface provides a method to configure
       
    38  * the editor to use required constraints, hints, editor classes and so one
       
    39  * depending on the EAP type and the configuration identifier.
       
    40  * See updateEditor() method for further details.
       
    41  * 
       
    42  * Another important method of this class is the validate() method. With
       
    43  * that method you can check that the content and format is valid for 
       
    44  * given configuration compination.
       
    45  * 
       
    46  * An instance of validator can be created with 
       
    47  * EapQtConfigInterface::validatorEap() method.
       
    48  */
       
    49 
       
    50 class EAP_QT_CONFIG_INTERFACE_EXPORT EapQtValidator
       
    51 {
       
    52 public:
       
    53 
       
    54     /*!
       
    55      * Validation status.
       
    56      */
       
    57     enum Status {
       
    58         /// Ok
       
    59         StatusOk,
       
    60         /// Content is invalid
       
    61         StatusInvalid,
       
    62         /// The length is not valid
       
    63         StatusInvalidLength,
       
    64         /// Invalid characters detected
       
    65         StatusInvalidCharacters,
       
    66         /// Input is too short
       
    67         StatusTooShort, 
       
    68         /// Input is too long
       
    69         StatusTooLong,  
       
    70     };
       
    71     
       
    72 public:
       
    73 
       
    74     EapQtValidator() {};
       
    75     virtual ~EapQtValidator() {};
       
    76 
       
    77     /*!
       
    78      * Processes validation to the given input \a value.
       
    79      *
       
    80      * @param value Value to be validated
       
    81      * 
       
    82      * @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      */
       
    91     virtual Status validate(QVariant value) = 0;
       
    92    
       
    93     /*!
       
    94      * Sets required configurations to the lineedit such as:
       
    95      * - Constraints
       
    96      * - HbInputFilter
       
    97      * - HbValidator
       
    98      * - inputMethodsHints
       
    99      * - maximum length
       
   100      * - predictive input mode
       
   101      * - number/text mode
       
   102      * 
       
   103      * Configurations depends on the Expanded EAP type and the configuration id
       
   104      * which were used to instantiate the validator.
       
   105      * 
       
   106      * @param edit LineEdit to be updated.
       
   107      */
       
   108     virtual void updateEditor(HbLineEdit* edit) = 0;
       
   109     
       
   110 private:
       
   111 
       
   112     Q_DISABLE_COPY(EapQtValidator)
       
   113 };
       
   114 
       
   115 /*! @} */
       
   116 
       
   117 #endif