securitysettings/eapqtdialogs/src/eapmschapv2newpwddialog.cpp
changeset 36 c98682f98478
parent 34 ad1f037f1ac2
child 44 22d80358905b
equal deleted inserted replaced
34:ad1f037f1ac2 36:c98682f98478
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description: EAP-MSCHAPv2 New Password Input Dialog implementation
    14 * Description: 
       
    15 *   EAP-MSCHAPv2 New Password Input Dialog implementation
    15 *
    16 *
    16 */
    17 */
    17 
    18 
    18 /*
    19 /*
    19 * %version: 4 %
    20 * %version: 5 %
    20 */
    21 */
    21 
    22 
       
    23 // System includes
    22 #include <HbAction>
    24 #include <HbAction>
    23 #include <HbLineEdit>
    25 #include <HbLineEdit>
    24 #include <HbTranslator>
    26 #include <HbTranslator>
    25 #include <HbMessageBox>
    27 #include <HbMessageBox>
    26 #include <eapqtvalidator.h>
    28 #include <eapqtvalidator.h>
    27 #include <eapqtexpandedeaptype.h>
    29 #include <eapqtexpandedeaptype.h>
    28 #include <eapqtconfiginterface.h>
    30 #include <eapqtconfiginterface.h>
    29 #include <eapqtconfig.h>
    31 #include <eapqtconfig.h>
       
    32 
       
    33 // User includes
    30 #include "eapmschapv2newpwddialog.h"
    34 #include "eapmschapv2newpwddialog.h"
    31 #include "OstTraceDefinitions.h"
    35 #include "OstTraceDefinitions.h"
    32 #ifdef OST_TRACE_COMPILER_IN_USE
    36 #ifdef OST_TRACE_COMPILER_IN_USE
    33 #endif
    37 #endif
    34 
    38 
    35 
    39 /*!
    36 /**
    40  * \class EapMschapv2NewPwdDialog
    37  * The constructor
    41  * \brief Implements EAP-MSCHAPv2 New Password Input Dialog. 
       
    42  */
       
    43 
       
    44 // External function prototypes
       
    45 
       
    46 // Local constants
       
    47  
       
    48 // ======== LOCAL FUNCTIONS ========
       
    49 
       
    50 // ======== MEMBER FUNCTIONS ========
       
    51 
       
    52 /*!
       
    53  * Constructor.
       
    54  * 
       
    55  * @param [in]  parameters Parameters for the Constructor.
    38  */
    56  */
    39 EapMschapv2NewPwdDialog::EapMschapv2NewPwdDialog(const QVariantMap &parameters) 
    57 EapMschapv2NewPwdDialog::EapMschapv2NewPwdDialog(const QVariantMap &parameters) 
    40  :mEdit1(NULL), 
    58  :mEdit1(NULL), 
    41  mEdit2(NULL), 
    59  mEdit2(NULL), 
    42  mPwdValidator(NULL),
    60  mPwdValidator(NULL),
    51     
    69     
    52     OstTraceFunctionExit0( EAPMSCHAPV2NEWPWDDIALOG_EAPMSCHAPV2NEWPWDDIALOG_EXIT );
    70     OstTraceFunctionExit0( EAPMSCHAPV2NEWPWDDIALOG_EAPMSCHAPV2NEWPWDDIALOG_EXIT );
    53     qDebug("EapMschapv2NewPwdDialog::EapMschapv2NewPwdDialog EXIT");
    71     qDebug("EapMschapv2NewPwdDialog::EapMschapv2NewPwdDialog EXIT");
    54 }
    72 }
    55     
    73     
    56 /**
    74 /*!
    57  * The construction of the dialog
    75  * The construction of the dialog
       
    76  *
       
    77  * @param [in] parameters Parameters for the Construction of the dialog.
    58  */ 
    78  */ 
    59 void EapMschapv2NewPwdDialog::createDialog(const QVariantMap &parameters )
    79 void EapMschapv2NewPwdDialog::createDialog(const QVariantMap &parameters )
    60 {
    80 {
    61     OstTraceFunctionEntry0( EAPMSCHAPV2NEWPWDDIALOG_CREATEDIALOG_ENTRY );
    81     OstTraceFunctionEntry0( EAPMSCHAPV2NEWPWDDIALOG_CREATEDIALOG_ENTRY );
    62     qDebug("EapMschapv2NewPwdDialog::createDialog ENTER");
    82     qDebug("EapMschapv2NewPwdDialog::createDialog ENTER");
    71     this->setModal(true);
    91     this->setModal(true);
    72     this->setTimeout(HbPopup::NoTimeout);
    92     this->setTimeout(HbPopup::NoTimeout);
    73     this->setDismissPolicy(HbPopup::NoDismiss);    
    93     this->setDismissPolicy(HbPopup::NoDismiss);    
    74     this->setAdditionalRowVisible(true);
    94     this->setAdditionalRowVisible(true);
    75     
    95     
       
    96     //Set the first Line Edit to be on the screen
    76     this->setPromptText(labelText1, 0);   
    97     this->setPromptText(labelText1, 0);   
    77     mEdit1 = this->lineEdit(0);
    98     mEdit1 = this->lineEdit(0);
    78     mEdit1->setEchoMode(HbLineEdit::Password);
    99     mEdit1->setEchoMode(HbLineEdit::Password);
    79     
   100     
       
   101     //Set the second Line Edit to be on the screen also
    80     this->setPromptText(labelText2, 1);   
   102     this->setPromptText(labelText2, 1);   
    81     mEdit2 = this->lineEdit(1);        
   103     mEdit2 = this->lineEdit(1);        
    82     mEdit2->setEchoMode(HbLineEdit::Password);
   104     mEdit2->setEchoMode(HbLineEdit::Password);
    83     
   105     
    84     EapQtConfigInterface eap_config_if;
   106     EapQtConfigInterface eapConfigIf;
    85     
   107     
    86     mPwdValidator.reset( eap_config_if.validatorEap(EapQtExpandedEapType::TypeEapMschapv2,
   108     mPwdValidator.reset( eapConfigIf.validatorEap(EapQtExpandedEapType::TypeEapMschapv2,
    87                 EapQtConfig::Password ) );  
   109                 EapQtConfig::Password ) );  
    88     Q_ASSERT( mPwdValidator.isNull() == false );                
   110     Q_ASSERT( mPwdValidator.isNull() == false );                
    89                    
   111                    
    90     mPwdValidator->updateEditor(mEdit1);
   112     mPwdValidator->updateEditor(mEdit1);
    91     
   113     
   124    
   146    
   125     OstTraceFunctionExit0( DUP1_EAPMSCHAPV2NEWPWDDIALOG_CREATEDIALOG_EXIT );
   147     OstTraceFunctionExit0( DUP1_EAPMSCHAPV2NEWPWDDIALOG_CREATEDIALOG_EXIT );
   126     qDebug("EapMschapv2NewPwdDialog::createDialog EXIT");
   148     qDebug("EapMschapv2NewPwdDialog::createDialog EXIT");
   127 }
   149 }
   128 
   150 
   129 /**
   151 /*!
   130  * Destructor
   152  * Destructor.
   131  */
   153  */
   132 EapMschapv2NewPwdDialog::~EapMschapv2NewPwdDialog()
   154 EapMschapv2NewPwdDialog::~EapMschapv2NewPwdDialog()
   133 {
   155 {
   134     OstTraceFunctionEntry0( EAPMSCHAPV2NEWPWDDIALOG_DEAPMSCHAPV2NEWPWDDIALOG_ENTRY );
   156     OstTraceFunctionEntry0( EAPMSCHAPV2NEWPWDDIALOG_DEAPMSCHAPV2NEWPWDDIALOG_ENTRY );
   135     qDebug("EapMschapv2NewPwdDialog::~EapMschapv2NewPwdDialog");
   157     qDebug("EapMschapv2NewPwdDialog::~EapMschapv2NewPwdDialog");
   138     //mPwdValidator:   scoped pointer deleted automatically
   160     //mPwdValidator:   scoped pointer deleted automatically
   139     
   161     
   140     OstTraceFunctionExit0( EAPMSCHAPV2NEWPWDDIALOG_DEAPMSCHAPV2NEWPWDDIALOG_EXIT );
   162     OstTraceFunctionExit0( EAPMSCHAPV2NEWPWDDIALOG_DEAPMSCHAPV2NEWPWDDIALOG_EXIT );
   141 }
   163 }
   142 
   164 
   143 /**
   165 /*!
   144  * Line edit validator
   166  * Line edit validator
       
   167  *
       
   168  * @return true if content is valid.
   145  */
   169  */
   146 bool EapMschapv2NewPwdDialog::validate() const
   170 bool EapMschapv2NewPwdDialog::validate() const
   147 {
   171 {
   148     qDebug("EapMschapv2NewPwdDialog::validate ENTER");
   172     qDebug("EapMschapv2NewPwdDialog::validate ENTER");
   149     
   173     
   150     bool valid = false;
   174     bool valid = false;
   151     
   175      
   152     EapQtValidator::Status test_status = mPwdValidator->validate(mEdit1->text());
       
   153     
       
   154     if ( mPwdValidator->validate(mEdit1->text())== EapQtValidator::StatusOk &&
   176     if ( mPwdValidator->validate(mEdit1->text())== EapQtValidator::StatusOk &&
   155         mEdit1->text() == mEdit2->text()) {
   177         mEdit1->text() == mEdit2->text()) {
   156         qDebug("EapMschapv2NewPwdDialog::validate: ret val: TRUE");
   178         qDebug("EapMschapv2NewPwdDialog::validate: ret val: TRUE");
   157         valid = true;
   179         valid = true;
   158     }
   180     }
   159     qDebug("EapPasswordQueryDialog::validate EXIT");
   181     qDebug("EapPasswordQueryDialog::validate EXIT");
   160     return valid;
   182     return valid;
   161 }
   183 }
   162 
   184 
   163 /**
   185 /*!
   164  * Function is called when the Ok Action button is pressed
   186  * Function is called when the Ok Action button is pressed
   165  */
   187  */
   166 void EapMschapv2NewPwdDialog::okPressed()
   188 void EapMschapv2NewPwdDialog::okPressed()
   167 {
   189 {
   168     OstTraceFunctionEntry0( EAPMSCHAPV2NEWPWDDIALOG_OKPRESSED_ENTRY );
   190     OstTraceFunctionEntry0( EAPMSCHAPV2NEWPWDDIALOG_OKPRESSED_ENTRY );
   188         }
   210         }
   189     OstTraceFunctionExit0( EAPMSCHAPV2NEWPWDDIALOG_OKPRESSED_EXIT );
   211     OstTraceFunctionExit0( EAPMSCHAPV2NEWPWDDIALOG_OKPRESSED_EXIT );
   190     qDebug("EapMschapv2NewPwdDialog::okPressed EXIT");
   212     qDebug("EapMschapv2NewPwdDialog::okPressed EXIT");
   191 }
   213 }
   192 
   214 
   193 /**
   215 /*!
   194  * Function is called when the Cancel Action button is pressed
   216  * Function is called when the Cancel Action button is pressed
   195  */
   217  */
   196 void EapMschapv2NewPwdDialog::cancelPressed()
   218 void EapMschapv2NewPwdDialog::cancelPressed()
   197 {
   219 {
   198     OstTraceFunctionEntry0( EAPMSCHAPV2NEWPWDDIALOG_CANCELPRESSED_ENTRY );
   220     OstTraceFunctionEntry0( EAPMSCHAPV2NEWPWDDIALOG_CANCELPRESSED_ENTRY );
   204     }   
   226     }   
   205     qDebug("EapMschapv2NewPwdDialog::cancelPressed EXIT");
   227     qDebug("EapMschapv2NewPwdDialog::cancelPressed EXIT");
   206     OstTraceFunctionExit0( EAPMSCHAPV2NEWPWDDIALOG_CANCELPRESSED_EXIT );
   228     OstTraceFunctionExit0( EAPMSCHAPV2NEWPWDDIALOG_CANCELPRESSED_EXIT );
   207 }
   229 }
   208 
   230 
   209 /**
   231 /*!
   210  * Function is called when the dialog is about to close
   232  * Function is called when the dialog is about to close
   211  * 
       
   212  */
   233  */
   213 void EapMschapv2NewPwdDialog::closingDialog()
   234 void EapMschapv2NewPwdDialog::closingDialog()
   214 {
   235 {
   215     OstTraceFunctionEntry0( EAPMSCHAPV2NEWPWDDIALOG_CLOSINGDIALOG_ENTRY );
   236     OstTraceFunctionEntry0( EAPMSCHAPV2NEWPWDDIALOG_CLOSINGDIALOG_ENTRY );
   216     qDebug("EapMschapv2NewPwdDialog::closingDialog ENTER");
   237     qDebug("EapMschapv2NewPwdDialog::closingDialog ENTER");
   217  
   238  
   218     qDebug("EapMschapv2NewPwdDialog::closingDialog EXIT");
   239     qDebug("EapMschapv2NewPwdDialog::closingDialog EXIT");
   219     OstTraceFunctionExit0( EAPMSCHAPV2NEWPWDDIALOG_CLOSINGDIALOG_EXIT );
   240     OstTraceFunctionExit0( EAPMSCHAPV2NEWPWDDIALOG_CLOSINGDIALOG_EXIT );
   220 }
   241 }
   221 
   242 
   222 /**
   243 /*!
   223  * Updating the dialog during its showing is not allowed.
   244  * Device dialog parameters to be set while dialog is displayed.
   224  */ 
   245  * Not supported. 
       
   246  *
       
   247  * @param [in] parameters NOT USED
       
   248  * @return true always.
       
   249  */  
   225 bool EapMschapv2NewPwdDialog::setDeviceDialogParameters
   250 bool EapMschapv2NewPwdDialog::setDeviceDialogParameters
   226                 (const QVariantMap &parameters)
   251                 (const QVariantMap &parameters)
   227 {
   252 {
   228     OstTraceFunctionEntry0( EAPMSCHAPV2NEWPWDDIALOG_SETDEVICEDIALOGPARAMETERS_ENTRY );
   253     OstTraceFunctionEntry0( EAPMSCHAPV2NEWPWDDIALOG_SETDEVICEDIALOGPARAMETERS_ENTRY );
   229     
   254     
   232     
   257     
   233     OstTraceFunctionExit0( EAPMSCHAPV2NEWPWDDIALOG_SETDEVICEDIALOGPARAMETERS_EXIT );
   258     OstTraceFunctionExit0( EAPMSCHAPV2NEWPWDDIALOG_SETDEVICEDIALOGPARAMETERS_EXIT );
   234     return true;
   259     return true;
   235 }
   260 }
   236 
   261 
   237 /**
   262 /*!
   238  * Not supported, 0 always returned
   263  * Not supported
       
   264  *
       
   265  * @return 0 always returned.
   239  */
   266  */
   240 int EapMschapv2NewPwdDialog::deviceDialogError() const
   267 int EapMschapv2NewPwdDialog::deviceDialogError() const
   241 {
   268 {
   242     OstTraceFunctionEntry0( EAPMSCHAPV2NEWPWDDIALOG_DEVICEDIALOGERROR_ENTRY );
   269     OstTraceFunctionEntry0( EAPMSCHAPV2NEWPWDDIALOG_DEVICEDIALOGERROR_ENTRY );
   243     OstTraceFunctionExit0( EAPMSCHAPV2NEWPWDDIALOG_DEVICEDIALOGERROR_EXIT);
   270     OstTraceFunctionExit0( EAPMSCHAPV2NEWPWDDIALOG_DEVICEDIALOGERROR_EXIT);
   244     return 0;
   271     return 0;
   245 }
   272 }
   246 
   273 
   247 /**
   274 /*!
   248  * Dialog is closed and the signal about closing is emitted
   275  * Dialog is closed and the signal about closing is emitted
       
   276  *
       
   277  * @param [in] byClient indicates when the user closes the dialog
   249  */
   278  */
   250 void EapMschapv2NewPwdDialog::closeDeviceDialog(bool byClient)
   279 void EapMschapv2NewPwdDialog::closeDeviceDialog(bool byClient)
   251 {   
   280 {   
   252     OstTraceFunctionEntry0( EAPMSCHAPV2NEWPWDDIALOG_CLOSEDEVICEDIALOG_ENTRY );
   281     OstTraceFunctionEntry0( EAPMSCHAPV2NEWPWDDIALOG_CLOSEDEVICEDIALOG_ENTRY );
   253     qDebug("EapMschapv2NewPwdDialog::closeDeviceDialog ENTER");
   282     qDebug("EapMschapv2NewPwdDialog::closeDeviceDialog ENTER");
   260     
   289     
   261     qDebug("EapMschapv2NewPwdDialog::closeDeviceDialog EXIT");
   290     qDebug("EapMschapv2NewPwdDialog::closeDeviceDialog EXIT");
   262     OstTraceFunctionExit0( EAPMSCHAPV2NEWPWDDIALOG_CLOSEDEVICEDIALOG_EXIT );
   291     OstTraceFunctionExit0( EAPMSCHAPV2NEWPWDDIALOG_CLOSEDEVICEDIALOG_EXIT );
   263 }
   292 }
   264 
   293 
   265 /**
   294 /*!
   266  * This dialog widget is returned to the caller
   295  * This dialog widget is returned to the caller
       
   296  *
       
   297  * @return this dialog widget
   267  */
   298  */
   268 HbPopup *EapMschapv2NewPwdDialog::deviceDialogWidget() const
   299 HbPopup *EapMschapv2NewPwdDialog::deviceDialogWidget() const
   269 {
   300 {
   270     OstTraceFunctionEntry0( EAPMSCHAPV2NEWPWDDIALOG_DEVICEDIALOGWIDGET_ENTRY );
   301     OstTraceFunctionEntry0( EAPMSCHAPV2NEWPWDDIALOG_DEVICEDIALOGWIDGET_ENTRY );
   271     OstTraceFunctionExit0( EAPMSCHAPV2NEWPWDDIALOG_DEVICEDIALOGWIDGET_EXIT );
   302     OstTraceFunctionExit0( EAPMSCHAPV2NEWPWDDIALOG_DEVICEDIALOGWIDGET_EXIT );