securitysettings/cpeapuiplugins/cpeapsimakaui/src/cpeapsimakaui.cpp
changeset 27 9660a5eb236f
parent 26 9abfd4f00d37
child 34 ad1f037f1ac2
equal deleted inserted replaced
26:9abfd4f00d37 27:9660a5eb236f
    15  *   Control Panel QT UI for EAP-SIM and EAP-AKA method configuration
    15  *   Control Panel QT UI for EAP-SIM and EAP-AKA method configuration
    16  *
    16  *
    17  */
    17  */
    18 
    18 
    19 /*
    19 /*
    20  * %version:  15 %
    20  * %version:  16 %
    21  */
    21  */
    22 
    22 
    23 // System includes
    23 // System includes
    24 #include <HbDataForm>
    24 #include <HbDataForm>
    25 #include <HbDataFormModel>
    25 #include <HbDataFormModel>
    90  */
    90  */
    91 CpEapSimAkaUi::~CpEapSimAkaUi()
    91 CpEapSimAkaUi::~CpEapSimAkaUi()
    92 {
    92 {
    93     qDebug("CpEapSimAkaUi::~CpEapSimAkaUi");
    93     qDebug("CpEapSimAkaUi::~CpEapSimAkaUi");
    94 
    94 
    95     delete mValidatorRealm;
    95     // mValidatorRealm, mValidatorUsername
    96     delete mValidatorUsername;
       
    97 
       
    98     // mConfigIf: scoped pointer deleted automatically
    96     // mConfigIf: scoped pointer deleted automatically
    99 }
    97 }
   100 
    98 
   101 /*!
    99 /*!
   102  * Initializes the sim-aka ui and initializes objects based on configuration
   100  * Initializes the sim-aka 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 *edit = qobject_cast<HbLineEdit *> (viewItem->dataItemContentWidget());
   200         HbLineEdit *edit = qobject_cast<HbLineEdit *> (viewItem->dataItemContentWidget());
   205         mValidatorUsername->updateEditor(edit);
   201         mValidatorUsername->updateEditor(edit);
   206     }
   202     }
   207     else if (modelItem == mRealm) {
   203     else if (modelItem == mRealm) {
   208         // When realm lineEdit is activated (shown) first time, validator is added
   204         // When realm lineEdit is activated (shown) first time, validator is added
   209         if (NULL == mValidatorRealm) {
   205         mValidatorRealm.reset(mConfigIf->validatorEap(mPluginInfo.pluginHandle().type(),
   210             mValidatorRealm = mConfigIf->validatorEap(mPluginInfo.pluginHandle().type(),
   206                 EapQtConfig::Realm));
   211                 EapQtConfig::Realm);           
       
   212         }
       
   213         HbLineEdit *edit = qobject_cast<HbLineEdit *> (viewItem->dataItemContentWidget());
   207         HbLineEdit *edit = qobject_cast<HbLineEdit *> (viewItem->dataItemContentWidget());
   214         mValidatorRealm->updateEditor(edit);
   208         mValidatorRealm->updateEditor(edit);
   215     }
   209     }
   216 }
   210 }
   217 
   211 
   308  */
   302  */
   309 bool CpEapSimAkaUi::validate()
   303 bool CpEapSimAkaUi::validate()
   310 {
   304 {
   311     bool valid = false;
   305     bool valid = false;
   312 
   306 
   313     if (validateGroup(mUsername, mUsernameAutomatic, mValidatorUsername) && validateGroup(mRealm,
   307     if (validateGroup(mUsername, mUsernameAutomatic, mValidatorUsername.data()) 
   314         mRealmAutomatic, mValidatorRealm)) {
   308         && validateGroup(mRealm, mRealmAutomatic, mValidatorRealm.data())) {
   315         valid = true;
   309         valid = true;
   316     }
   310     }
   317 
   311 
   318     return valid;
   312     return valid;
   319 }
   313 }