securitysettings/cpeapuiplugins/cpeapuserpasswordui/src/cpeapuserpasswordui.cpp
changeset 27 9660a5eb236f
parent 26 9abfd4f00d37
child 34 ad1f037f1ac2
equal deleted inserted replaced
26:9abfd4f00d37 27:9660a5eb236f
    15  *   Control Panel QT UI for username-password based EAP method configuration
    15  *   Control Panel QT UI for username-password based EAP method configuration
    16  *
    16  *
    17  */
    17  */
    18 
    18 
    19 /*
    19 /*
    20  * %version: 23 %
    20  * %version: 24 %
    21  */
    21  */
    22 
    22 
    23 // System includes
    23 // System includes
    24 #include <HbDataForm>
    24 #include <HbDataForm>
    25 #include <HbDataFormModel>
    25 #include <HbDataFormModel>
    98  */
    98  */
    99 CpEapUserPasswordUi::~CpEapUserPasswordUi()
    99 CpEapUserPasswordUi::~CpEapUserPasswordUi()
   100 {
   100 {
   101     qDebug("CpEapUserPasswordUi::~CpEapUserPasswordUi");
   101     qDebug("CpEapUserPasswordUi::~CpEapUserPasswordUi");
   102 
   102 
   103     delete mValidatorUsername;
   103     // mValidatorUsername, mValidatorPassword
   104     delete mValidatorPassword;
       
   105 
       
   106     // mConfigIf: scoped pointer deleted automatically
   104     // mConfigIf: scoped pointer deleted automatically
   107 }
   105 }
   108 
   106 
   109 /*!
   107 /*!
   110  * Initializes the password-username ui and initializes objects based on configuration
   108  * Initializes the password-username ui and initializes objects based on configuration
   195         (mForm->itemByIndex(modelIndex));
   193         (mForm->itemByIndex(modelIndex));
   196     HbDataFormModelItem *modelItem = mModel->itemFromIndex(modelIndex);
   194     HbDataFormModelItem *modelItem = mModel->itemFromIndex(modelIndex);
   197     
   195     
   198     if (modelItem == mUsername) {
   196     if (modelItem == mUsername) {
   199         // When username lineEdit is activated (shown) first time, validator is added
   197         // When username lineEdit is activated (shown) first time, validator is added
   200         if (NULL == mValidatorUsername) {
   198         mValidatorUsername.reset(mConfigIf->validatorEap(mPluginInfo.pluginHandle().type(),
   201             mValidatorUsername = mConfigIf->validatorEap(mPluginInfo.pluginHandle().type(),
   199             EapQtConfig::Username));
   202                 EapQtConfig::Username);
       
   203         }
       
   204         HbLineEdit *usernameEdit = qobject_cast<HbLineEdit *> (viewItem->dataItemContentWidget());
   200         HbLineEdit *usernameEdit = qobject_cast<HbLineEdit *> (viewItem->dataItemContentWidget());
   205         mValidatorUsername->updateEditor(usernameEdit);
   201         mValidatorUsername->updateEditor(usernameEdit);
   206     }
   202     }
   207     else if (modelItem == mPassword) {
   203     else if (modelItem == mPassword) {
   208         // When password lineEdit is activated (shown) first time, validator is added
   204         // When password lineEdit is activated (shown) first time, validator is added
   209         if (NULL == mValidatorPassword){
   205         mValidatorPassword.reset(mConfigIf->validatorEap(mPluginInfo.pluginHandle().type(),
   210             mValidatorPassword = mConfigIf->validatorEap(mPluginInfo.pluginHandle().type(),
   206             EapQtConfig::Password));
   211                 EapQtConfig::Password);            
       
   212         }
       
   213         mPasswordEdit = qobject_cast<HbLineEdit *> (viewItem->dataItemContentWidget());
   207         mPasswordEdit = qobject_cast<HbLineEdit *> (viewItem->dataItemContentWidget());
   214         mValidatorPassword->updateEditor(mPasswordEdit);
   208         mValidatorPassword->updateEditor(mPasswordEdit);
   215         // Install event filter to clear dummy password, when password is started to edit.
   209         // Install event filter to clear dummy password, when password is started to edit.
   216         mPasswordEdit->installEventFilter(this);
   210         mPasswordEdit->installEventFilter(this);
   217     }
   211     }