securitysettings/qtconfigutils/eapqtconfiginterface/src/eapqtconfiginterface_p.cpp
changeset 39 fe6b6762fccd
parent 33 938269283a16
child 42 53085837e73a
equal deleted inserted replaced
38:7a0216d033ac 39:fe6b6762fccd
     1 /*
     1 /*
     2  * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
     2  * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3  * All rights reserved.
     3  * All rights reserved.
     4  * This component and the accompanying materials are made available
     4  * This component and the accompanying materials are made available
     5  * under the terms of the License "Eclipse Public License v1.0"
     5  * under the terms of "Eclipse Public License v1.0"
     6  * which accompanies this distribution, and is available
     6  * which accompanies this distribution, and is available
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8  *
     8  *
     9  * Initial Contributors:
     9  * Initial Contributors:
    10  * Nokia Corporation - initial contribution.
    10  * Nokia Corporation - initial contribution.
    15  *   EAP method configuration QT interface
    15  *   EAP method configuration QT interface
    16  *
    16  *
    17  */
    17  */
    18 
    18 
    19 /*
    19 /*
    20  * %version: 41 %
    20  * %version: 49 %
    21  */
    21  */
    22 
    22 
       
    23 // System includes
    23 #include <QDir>
    24 #include <QDir>
    24 #include <QList>
    25 #include <QList>
    25 #include <QVariant>
    26 #include <QVariant>
    26 #include <QPluginLoader>
    27 #include <QPluginLoader>
    27 #include <HbTranslator>
    28 #include <HbTranslator>
    28 #include <QLocale>
    29 #include <QLocale>
    29 #include <QCoreApplication>
    30 #include <QCoreApplication>
    30 #include <QDebug>
    31 #include <QDebug>
    31 
       
    32 #include <cmmanager.h>
    32 #include <cmmanager.h>
    33 #include <cmpluginwlandef.h>
    33 #include <cmpluginwlandef.h>
    34 #include <EapGeneralSettings.h>
    34 #include <EapGeneralSettings.h>
    35 
       
    36 #include <eapqtplugininfo.h>
    35 #include <eapqtplugininfo.h>
    37 #include <eapqtcertificateinfo.h>
    36 #include <eapqtcertificateinfo.h>
    38 
    37 
       
    38 // User includes
    39 #include "cpeapplugininterface.h"
    39 #include "cpeapplugininterface.h"
    40 #include "eapqtconfiginterface_p.h"
    40 #include "eapqtconfiginterface_p.h"
    41 
       
    42 // validators
       
    43 #include "eapqtvalidatorpassword.h"
    41 #include "eapqtvalidatorpassword.h"
    44 #include "eapqtvalidatorusername.h"
    42 #include "eapqtvalidatorusername.h"
    45 #include "eapqtvalidatorrealm.h"
    43 #include "eapqtvalidatorrealm.h"
    46 
    44 #include "eapqtvalidatorpacstorepassword.h"
    47 static const QString eapPluginDir("\\resource\\qt\\plugins\\controlpanel\\eapsecurity");
    45 #include "eapqtvalidatorpacstorepasswordconfirm.h"
       
    46 
       
    47 /*!
       
    48  *  \class EapQtConfigInterfacePrivate
       
    49  *  \brief Private implementation of EAP QT configuration interface
       
    50  */
       
    51 
       
    52 // External function prototypes
       
    53 
       
    54 // Local constants
    48 static const QString eapTranslationFile("cpeapuiplugins");
    55 static const QString eapTranslationFile("cpeapuiplugins");
       
    56 
       
    57 // ======== LOCAL FUNCTIONS ========
       
    58 
       
    59 // ======== MEMBER FUNCTIONS ========
    49 
    60 
    50 EapQtConfigInterfacePrivate::EapQtConfigInterfacePrivate() :
    61 EapQtConfigInterfacePrivate::EapQtConfigInterfacePrivate() :
    51   mValidatorInstance(true),
    62   mValidatorInstance(true),
    52   mLastOuterHandle(EapQtPluginHandle::PluginUndefined),
    63   mLastOuterHandle(EapQtPluginHandle::PluginUndefined),
    53   mTranslator(NULL),
    64   mTranslator(NULL),
    57   mEapBearer(ELan),
    68   mEapBearer(ELan),
    58   mEapDbIndex(EapQtConfigInterface::IapIdUndefined),
    69   mEapDbIndex(EapQtConfigInterface::IapIdUndefined),
    59   mEapDbIndexValid(false)
    70   mEapDbIndexValid(false)
    60 {
    71 {
    61     qDebug("EapQtConfigInterfacePrivate() - created validator instance, this = 0x%08x", this);
    72     qDebug("EapQtConfigInterfacePrivate() - created validator instance, this = 0x%08x", this);
    62 
    73 }
    63 }
    74 
    64 
    75 EapQtConfigInterfacePrivate::EapQtConfigInterfacePrivate(
    65 EapQtConfigInterfacePrivate::EapQtConfigInterfacePrivate(/* EapQtConfigInterface *configIf, */
       
    66     const EapQtConfigInterface::EapBearerType bearerType, const int iapId) :  
    76     const EapQtConfigInterface::EapBearerType bearerType, const int iapId) :  
    67   mValidatorInstance(false),
    77   mValidatorInstance(false),
    68   mLastOuterHandle(EapQtPluginHandle::PluginUndefined),
    78   mLastOuterHandle(EapQtPluginHandle::PluginUndefined),
    69   mTranslator(NULL), 
    79   mTranslator(NULL), 
    70   mEapGsIf(NULL), 
    80   mEapGsIf(NULL), 
    74   mEapDbIndex(EapQtConfigInterface::IapIdUndefined),
    84   mEapDbIndex(EapQtConfigInterface::IapIdUndefined),
    75   mEapDbIndexValid(false)
    85   mEapDbIndexValid(false)
    76 {
    86 {
    77     qDebug("EapQtConfigInterfacePrivate() - creating non-validator instance, this = 0x%08x", this);
    87     qDebug("EapQtConfigInterfacePrivate() - creating non-validator instance, this = 0x%08x", this);
    78 
    88 
    79 
       
    80     switch (bearerType) {
    89     switch (bearerType) {
    81     case EapQtConfigInterface::EapBearerTypeVpn:
    90     case EapQtConfigInterface::EapBearerTypeVpn:
    82         mEapBearer = EVpn;
    91         mEapBearer = EVpn;
    83         break;
    92         break;
    84     default:
    93     default:
   109 }
   118 }
   110 
   119 
   111 void EapQtConfigInterfacePrivate::shutdown()
   120 void EapQtConfigInterfacePrivate::shutdown()
   112 {
   121 {
   113     qDebug("EapQtConfigInterfacePrivate::shutdown(), this = 0x%08x", this);
   122     qDebug("EapQtConfigInterfacePrivate::shutdown(), this = 0x%08x", this);
   114 
       
   115 
   123 
   116     mOuterEapsOn.Close();
   124     mOuterEapsOn.Close();
   117     mOuterEapsOff.Close();
   125     mOuterEapsOff.Close();
   118 
   126 
   119     // cleanup Ecom
   127     // cleanup Ecom
   225 
   233 
   226 bool EapQtConfigInterfacePrivate::setEapWlanDbIndex(const int iapId)
   234 bool EapQtConfigInterfacePrivate::setEapWlanDbIndex(const int iapId)
   227 {
   235 {
   228     qDebug("EapQtConfigInterfacePrivate::setEapWlanDbIndex - requested id: %d, this = 0x%08x", iapId, this);
   236     qDebug("EapQtConfigInterfacePrivate::setEapWlanDbIndex - requested id: %d, this = 0x%08x", iapId, this);
   229 
   237 
   230 
       
   231     RCmManager cmm;
   238     RCmManager cmm;
   232     TRAPD(err, cmm.OpenL());
   239     TRAPD(err, cmm.OpenL());
   233     if (err != KErrNone) {
   240     if (err != KErrNone) {
   234         qDebug("ERROR: EapQtConfigInterfacePrivate::setEapWlanDbIndex - cmm.OpenL() failed",
   241         qDebug("ERROR: EapQtConfigInterfacePrivate::setEapWlanDbIndex - cmm.OpenL() failed",
   235             mEapBearer, iapId);
   242             mEapBearer, iapId);
   272 void EapQtConfigInterfacePrivate::appendEapTypes(const RArray<TEapExpandedType>* const eapTypes,
   279 void EapQtConfigInterfacePrivate::appendEapTypes(const RArray<TEapExpandedType>* const eapTypes,
   273     QList<QByteArray>* const eapList)
   280     QList<QByteArray>* const eapList)
   274 {
   281 {
   275     qDebug("EapQtConfigInterfacePrivate::appendEapTypes(), this = 0x%08x", this);
   282     qDebug("EapQtConfigInterfacePrivate::appendEapTypes(), this = 0x%08x", this);
   276 
   283 
   277 
       
   278     Q_ASSERT(eapTypes);
   284     Q_ASSERT(eapTypes);
   279     Q_ASSERT(eapList);
   285     Q_ASSERT(eapList);
   280 
   286 
   281     qDebug("EapQtConfigInterfacePrivate - appendEapTypes, EAP count = %d", eapTypes->Count());
   287     qDebug("EapQtConfigInterfacePrivate - appendEapTypes, EAP count = %d", eapTypes->Count());
   282 
   288 
   291 }
   297 }
   292 
   298 
   293 QList<EapQtPluginInfo> EapQtConfigInterfacePrivate::supportedOuterTypes()
   299 QList<EapQtPluginInfo> EapQtConfigInterfacePrivate::supportedOuterTypes()
   294 {
   300 {
   295     qDebug("EapQtConfigInterfacePrivate::supportedOuterTypes(), this = 0x%08x", this);
   301     qDebug("EapQtConfigInterfacePrivate::supportedOuterTypes(), this = 0x%08x", this);
   296 
       
   297 
   302 
   298     checkInstanceThrowing();
   303     checkInstanceThrowing();
   299 
   304 
   300     if (mEapGsIf.isNull()) {
   305     if (mEapGsIf.isNull()) {
   301         qDebug("ERROR: EapQtConfigInterfacePrivate::supportedOuterTypes() - mEapGsIf is NULL");
   306         qDebug("ERROR: EapQtConfigInterfacePrivate::supportedOuterTypes() - mEapGsIf is NULL");
   357             qDebug() << "EapQtConfigInterfacePrivate - supportedOuterTypes: appended EAP: "
   362             qDebug() << "EapQtConfigInterfacePrivate - supportedOuterTypes: appended EAP: "
   358                 << tmpEap.toHex();
   363                 << tmpEap.toHex();
   359         }
   364         }
   360     }
   365     }
   361 
   366 
       
   367     // sort the list
       
   368     qSort(mSupportedOuterTypes.begin(), mSupportedOuterTypes.end(),
       
   369         EapQtConfigInterfacePrivate::pluginLessThan);
       
   370 
   362     qDebug("EapQtConfigInterfacePrivate - supportedOuterTypes: supported EAP count: %d",
   371     qDebug("EapQtConfigInterfacePrivate - supportedOuterTypes: supported EAP count: %d",
   363         mSupportedOuterTypes.count());
   372         mSupportedOuterTypes.count());
   364 
   373 
   365     return mSupportedOuterTypes;
   374     return mSupportedOuterTypes;
   366 }
   375 }
   383     }
   392     }
   384     return ret;
   393     return ret;
   385 }
   394 }
   386 
   395 
   387 QList<EapQtPluginInfo> EapQtConfigInterfacePrivate::supportedInnerTypes(
   396 QList<EapQtPluginInfo> EapQtConfigInterfacePrivate::supportedInnerTypes(
   388     const EapQtPluginHandle& outer)
   397     const EapQtPluginHandle &outer)
   389 {
   398 {
   390     qDebug("EapQtConfigInterfacePrivate::supportedInnerTypes(), this = 0x%08x", this);
   399     qDebug("EapQtConfigInterfacePrivate::supportedInnerTypes(), this = 0x%08x", this);
   391 
       
   392 
   400 
   393     checkInstanceThrowing();
   401     checkInstanceThrowing();
   394 
   402 
   395     // check if we already have up-to-date data
   403     // check if we already have up-to-date data
   396     if (mLastOuterHandle == outer) {
   404     if (mLastOuterHandle == outer) {
   451         }
   459         }
   452     }
   460     }
   453 
   461 
   454     mLastOuterHandle = outer;
   462     mLastOuterHandle = outer;
   455 
   463 
       
   464     // sort the list
       
   465     qSort(mSupportedInnerTypes.begin(), mSupportedInnerTypes.end(),
       
   466         EapQtConfigInterfacePrivate::pluginLessThan);
       
   467 
       
   468     qDebug("EapQtConfigInterfacePrivate - supportedInnerTypes: supported EAP count: %d",
       
   469         mSupportedInnerTypes.count());
       
   470 
   456     return mSupportedInnerTypes;
   471     return mSupportedInnerTypes;
   457 }
   472 }
   458 
   473 
   459 void EapQtConfigInterfacePrivate::copyCertificateInfo(
   474 void EapQtConfigInterfacePrivate::copyCertificateInfo(
   460     const RPointerArray<EapCertificateEntry>* const certEntries,
   475     const RPointerArray<EapCertificateEntry>* const certEntries,
   461     QList<EapQtCertificateInfo>* const certInfos)
   476     QList<EapQtCertificateInfo>* const certInfos)
   462 {
   477 {
   463     qDebug("EapQtConfigInterfacePrivate::copyCertificateInfo(), this = 0x%08x", this);
   478     qDebug("EapQtConfigInterfacePrivate::copyCertificateInfo(), this = 0x%08x", this);
   464 
       
   465 
   479 
   466     Q_ASSERT(certEntries);
   480     Q_ASSERT(certEntries);
   467     Q_ASSERT(certInfos);
   481     Q_ASSERT(certInfos);
   468 
   482 
   469     certInfos->clear();
   483     certInfos->clear();
   473     const TDes* text = 0;
   487     const TDes* text = 0;
   474     int ind = 0;
   488     int ind = 0;
   475 
   489 
   476     for (ind = 0; ind < certEntries->Count(); ind++) {
   490     for (ind = 0; ind < certEntries->Count(); ind++) {
   477 
   491 
       
   492         // cleanup cert
       
   493         cert.clear();
       
   494 
   478         EapCertificateEntry* certPtr = (*certEntries)[ind];
   495         EapCertificateEntry* certPtr = (*certEntries)[ind];
   479 
   496 
   480         qDebug() << "EapQtConfigInterfacePrivate - copyCertificateInfo *** certificate starts *** ";
   497         qDebug() << "EapQtConfigInterfacePrivate - copyCertificateInfo *** certificate starts *** ";
   481 
   498 
   482         if (certPtr->GetSubjectNamePresent() != EFalse) {
   499         if (certPtr->GetSubjectNamePresent() != EFalse) {
   545 bool EapQtConfigInterfacePrivate::fetchCertificates(QList<EapQtCertificateInfo>* const caInfos,
   562 bool EapQtConfigInterfacePrivate::fetchCertificates(QList<EapQtCertificateInfo>* const caInfos,
   546     QList<EapQtCertificateInfo>* const clientInfos)
   563     QList<EapQtCertificateInfo>* const clientInfos)
   547 {
   564 {
   548     qDebug("EapQtConfigInterfacePrivate::fetchCertificates(), this = 0x%08x", this);
   565     qDebug("EapQtConfigInterfacePrivate::fetchCertificates(), this = 0x%08x", this);
   549 
   566 
   550 
   567     Q_ASSERT(caInfos != NULL || clientInfos != NULL);
   551     Q_ASSERT(caInfos != NULL || clientInfos != NULL || !mEapGsIf.isNull());
   568     Q_ASSERT(!mEapGsIf.isNull());
   552 
   569 
   553     TInt err(KErrNone);
   570     TInt err(KErrNone);
   554     RPointerArray<EapCertificateEntry> clientCerts;
   571     RPointerArray<EapCertificateEntry> clientCerts;
   555     RPointerArray<EapCertificateEntry> caCerts;
   572     RPointerArray<EapCertificateEntry> caCerts;
   556 
   573 
   557     // lists are always queried again as the user might have installed new certificates
       
   558     // during the life time of the object
       
   559     err = mEapGsIf->GetCertificateLists(clientCerts, caCerts);
   574     err = mEapGsIf->GetCertificateLists(clientCerts, caCerts);
   560     if (err != KErrNone) {
   575     if (err != KErrNone) {
   561         qDebug("EapQtConfigInterfacePrivate - fetchCertificates failed: %d", err);
   576         qDebug("EapQtConfigInterfacePrivate - fetchCertificates failed: %d", err);
   562         caCerts.ResetAndDestroy();
   577         caCerts.ResetAndDestroy();
   563         clientCerts.ResetAndDestroy();
   578         clientCerts.ResetAndDestroy();
   576     caCerts.ResetAndDestroy();
   591     caCerts.ResetAndDestroy();
   577     clientCerts.ResetAndDestroy();
   592     clientCerts.ResetAndDestroy();
   578     return true;
   593     return true;
   579 }
   594 }
   580 
   595 
       
   596 bool EapQtConfigInterfacePrivate::updateCertificates() {
       
   597 
       
   598     qDebug("EapQtConfigInterfacePrivate::updateCertificates(), this = 0x%08x", this);
       
   599 
       
   600     checkInstanceThrowing();
       
   601 
       
   602     // empty current state
       
   603     mCaCertificates.clear();
       
   604     mUserCertificates.clear();
       
   605 
       
   606     return fetchCertificates(&mCaCertificates, &mUserCertificates);
       
   607 }
       
   608 
   581 QList<EapQtCertificateInfo> EapQtConfigInterfacePrivate::certificateAuthorityCertificates()
   609 QList<EapQtCertificateInfo> EapQtConfigInterfacePrivate::certificateAuthorityCertificates()
   582 {
   610 {
   583     qDebug("EapQtConfigInterfacePrivate::certificateAuthorityCertificates(), this = 0x%08x", this);
   611     qDebug("EapQtConfigInterfacePrivate::certificateAuthorityCertificates(), this = 0x%08x", this);
   584 
   612 
   585 
       
   586     checkInstanceThrowing();
   613     checkInstanceThrowing();
   587 
   614 
   588     QList<EapQtCertificateInfo> list;
   615     // update only if the list is empty
   589     if (!fetchCertificates(&list, 0)) {
   616     if(mCaCertificates.length() == 0) {
   590         // query failed
   617         qDebug() << "EapQtConfigInterfacePrivate::certificateAuthorityCertificates() - updates certificate lists";
   591         list.clear();
   618         updateCertificates();
   592     }
   619     }
   593     return list;
   620 
       
   621     return mCaCertificates;
   594 }
   622 }
   595 
   623 
   596 QList<EapQtCertificateInfo> EapQtConfigInterfacePrivate::userCertificates()
   624 QList<EapQtCertificateInfo> EapQtConfigInterfacePrivate::userCertificates()
   597 {
   625 {
   598     qDebug("EapQtConfigInterfacePrivate::userCertificates(), this = 0x%08x", this);
   626     qDebug("EapQtConfigInterfacePrivate::userCertificates(), this = 0x%08x", this);
   599 
   627 
   600 
   628     // use the CA certificates method, it will update both the lists
   601     checkInstanceThrowing();
   629     // if CA list is empty
   602 
   630     (void) certificateAuthorityCertificates();
   603     QList<EapQtCertificateInfo> list;
   631     return mUserCertificates;
   604     if (!fetchCertificates(0, &list)) {
   632 }
   605         // query failed
   633 
   606         list.clear();
   634 void EapQtConfigInterfacePrivate::getEapTypeIf(const EapQtPluginHandle &pluginHandle)
   607     }
       
   608     return list;
       
   609 }
       
   610 
       
   611 void EapQtConfigInterfacePrivate::getEapTypeIf(const EapQtPluginHandle& pluginHandle)
       
   612 {
   635 {
   613     qDebug("EapQtConfigInterfacePrivate::getEapTypeIf(), this = 0x%08x", this);
   636     qDebug("EapQtConfigInterfacePrivate::getEapTypeIf(), this = 0x%08x", this);
   614 
       
   615 
   637 
   616     // dig up the EAP type in TEapExpandedType format
   638     // dig up the EAP type in TEapExpandedType format
   617     TEapExpandedType eapServerType;
   639     TEapExpandedType eapServerType;
   618     QByteArray eapType = pluginHandle.type().eapExpandedData();
   640     QByteArray eapType = pluginHandle.type().eapExpandedData();
   619     TInt err(KErrNone);
   641     TInt err(KErrNone);
   657 // in config:
   679 // in config:
   658 // if OuterType is defined, the configuration for pluginHandle is set inside this OuterType
   680 // if OuterType is defined, the configuration for pluginHandle is set inside this OuterType
   659 // if OuterType is not defined, pluginHandle is for an outer type
   681 // if OuterType is not defined, pluginHandle is for an outer type
   660 // if InnerType is defined, the defined inner types in config are activated for pluginHandle
   682 // if InnerType is defined, the defined inner types in config are activated for pluginHandle
   661 // if InnerType is not defined, the pluginHandle does not activate any inner type (or they do not exist)
   683 // if InnerType is not defined, the pluginHandle does not activate any inner type (or they do not exist)
   662 bool EapQtConfigInterfacePrivate::saveConfiguration(const EapQtPluginHandle& pluginHandle,
   684 bool EapQtConfigInterfacePrivate::saveConfiguration(const EapQtPluginHandle &pluginHandle,
   663     EapQtConfig& config)
   685     const EapQtConfig &config)
   664 {
   686 {
   665     qDebug("EapQtConfigInterfacePrivate::saveConfiguration(), this = 0x%08x", this);
   687     qDebug("EapQtConfigInterfacePrivate::saveConfiguration(), this = 0x%08x", this);
   666 
       
   667 
   688 
   668     checkInstanceThrowing();
   689     checkInstanceThrowing();
   669 
   690 
   670     if (!mEapDbIndexValid) {
   691     if (!mEapDbIndexValid) {
   671         qDebug() << "ERROR: Database reference not valid, call setConfigurationReference first!";
   692         qDebug() << "ERROR: Database reference not valid, call setConfigurationReference first!";
   672         return false;
   693         return false;
   673     }
   694     }
   674 
   695 
   675     // only check if EAP ui is supported here,
   696     // set tunneling type & check if the requested EAP is supported
   676     // getEapTypeIf checks the EAP server support
   697     // if we are configuring outer type, OuterType == QVariant::Invalid or
   677     int dummy = 0;
   698     // EapQtPluginHandle::PluginUndefined
   678     if (!isUiSupported(pluginHandle.type().eapExpandedData(), dummy)) {
   699 
   679         qDebug(
   700     EapQtPluginHandle tmpOuterHandle;
   680             "ERROR: EapQtConfigInterfacePrivate::saveConfiguration() - UI not supported for the requested EAP");
   701     QVariant varValue = config.value(EapQtConfig::OuterType);
   681         return false;
   702     if (varValue != QVariant::Invalid && !(varValue.value<EapQtPluginHandle> () == EapQtPluginHandle::PluginUndefined)) {
       
   703         tmpOuterHandle = varValue.value<EapQtPluginHandle> ();
       
   704         // check if supported
       
   705         if(!isSupportedInnerType(tmpOuterHandle, pluginHandle)) {
       
   706             qDebug("ERROR: EapQtConfigInterfacePrivate::saveConfiguration() - not supported outer/inner type combination");
       
   707             return false;
       
   708         }
       
   709     }
       
   710     else {
       
   711         tmpOuterHandle = EapQtPluginHandle::PluginUndefined;
       
   712         // check if supported
       
   713         if(!isSupportedOuterType(pluginHandle)) {
       
   714             qDebug("ERROR: EapQtConfigInterfacePrivate::saveConfiguration() - not supported outer type");
       
   715             return false;
       
   716         }
   682     }
   717     }
   683 
   718 
   684     getEapTypeIf(pluginHandle);
   719     getEapTypeIf(pluginHandle);
   685     if (mEapTypeIf.isNull()) {
   720     if (mEapTypeIf.isNull()) {
   686         qDebug("ERROR: EapQtConfigInterfacePrivate::saveConfiguration() - getEapTypeIf failed");
   721         qDebug("ERROR: EapQtConfigInterfacePrivate::saveConfiguration() - getEapTypeIf failed");
   687         return false;
   722         return false;
   688     }
       
   689 
       
   690     // set tunneling type
       
   691     // if we are configuring outer type, OuterType == Invalid or EapQtPluginHandle::PluginUndefined
       
   692 
       
   693     EapQtPluginHandle tmpOuterHandle;
       
   694     QVariant varValue = config.value(EapQtConfig::OuterType);
       
   695     if (varValue != QVariant::Invalid) {
       
   696         tmpOuterHandle = varValue.value<EapQtPluginHandle> ();
       
   697     }
       
   698     else {
       
   699         tmpOuterHandle = EapQtPluginHandle::PluginUndefined;
       
   700     }
   723     }
   701 
   724 
   702     TEapExpandedType tmpOuterEap;
   725     TEapExpandedType tmpOuterEap;
   703     tmpOuterEap.SetValue(tmpOuterHandle.type().eapExpandedData().data(),
   726     tmpOuterEap.SetValue(tmpOuterHandle.type().eapExpandedData().data(),
   704         tmpOuterHandle.type().eapExpandedData().length());
   727         tmpOuterHandle.type().eapExpandedData().length());
   731 
   754 
   732     return true;
   755     return true;
   733 }
   756 }
   734 
   757 
   735 // config must be empty when calling
   758 // config must be empty when calling
   736 bool EapQtConfigInterfacePrivate::readConfiguration(const EapQtPluginHandle& outerHandle,
   759 bool EapQtConfigInterfacePrivate::readConfiguration(const EapQtPluginHandle &outerHandle,
   737     const EapQtPluginHandle& pluginHandle, EapQtConfig& config)
   760     const EapQtPluginHandle &pluginHandle, EapQtConfig &config)
   738 {
   761 {
   739     qDebug("EapQtConfigInterfacePrivate::readConfiguration(), this = 0x%08x", this);
   762     qDebug("EapQtConfigInterfacePrivate::readConfiguration(), this = 0x%08x", this);
   740 
   763 
   741     // clear input
   764     // clear input
   742     config.clear();
   765     config.clear();
   746     if (!mEapDbIndexValid) {
   769     if (!mEapDbIndexValid) {
   747         qDebug() << "ERROR: Database reference not valid, call setConfigurationReference first!";
   770         qDebug() << "ERROR: Database reference not valid, call setConfigurationReference first!";
   748         return false;
   771         return false;
   749     }
   772     }
   750 
   773 
   751     // only check if UI is supported for pluginHandle here,
   774     // check EAP type support
   752     // getEapTypeIf checks the EAP server support
   775     if(!(outerHandle == EapQtPluginHandle::PluginUndefined)) {
   753     int dummy = 0;
   776         if(!isSupportedInnerType(outerHandle, pluginHandle)) {
   754     if (!isUiSupported(pluginHandle.type().eapExpandedData(), dummy)) {
   777             qDebug("ERROR: EapQtConfigInterfacePrivate::readConfiguration() - not supported outer/inner type combination");
   755         qDebug(
   778             return false;
   756             "ERROR: EapQtConfigInterfacePrivate::readConfiguration - UI not supported for the requested EAP");
   779         }
   757         return false;
   780     } else {
       
   781         if(!isSupportedOuterType(pluginHandle)) {
       
   782             qDebug("ERROR: EapQtConfigInterfacePrivate::readConfiguration() - not supported outer type");
       
   783             return false;
       
   784         }
   758     }
   785     }
   759 
   786 
   760     getEapTypeIf(pluginHandle);
   787     getEapTypeIf(pluginHandle);
   761     if (mEapTypeIf.isNull()) {
   788     if (mEapTypeIf.isNull()) {
   762         qDebug("ERROR: EapQtConfigInterfacePrivate::readConfiguration - getEapTypeIf failed");
   789         qDebug("ERROR: EapQtConfigInterfacePrivate::readConfiguration - getEapTypeIf failed");
   806 TBool EapQtConfigInterfacePrivate::convertToTbool(bool value)
   833 TBool EapQtConfigInterfacePrivate::convertToTbool(bool value)
   807 {
   834 {
   808     return (value ? ETrue : EFalse);
   835     return (value ? ETrue : EFalse);
   809 }
   836 }
   810 
   837 
   811 void EapQtConfigInterfacePrivate::copyToEapSettings(EapQtConfig& config, EAPSettings& eapSettings)
   838 void EapQtConfigInterfacePrivate::copyToEapSettings(const EapQtConfig &config, EAPSettings &eapSettings)
   812 {
   839 {
   813 
       
   814     qDebug("EapQtConfigInterfacePrivate::copyToEapSettings(), this = 0x%08x", this);
   840     qDebug("EapQtConfigInterfacePrivate::copyToEapSettings(), this = 0x%08x", this);
   815 
       
   816 
   841 
   817     int ind = 0;
   842     int ind = 0;
   818 
   843 
   819     QVariant varValue = config.value(EapQtConfig::UsernameAutomatic);
   844     QVariant varValue = config.value(EapQtConfig::UsernameAutomatic);
   820     if (varValue.type() == QVariant::Bool) {
   845     if (varValue.type() == QVariant::Bool) {
   924     if (varValue.type() == QVariant::Bool) {
   949     if (varValue.type() == QVariant::Bool) {
   925         eapSettings.iPEAPVersionsPresent = ETrue;
   950         eapSettings.iPEAPVersionsPresent = ETrue;
   926         eapSettings.iPEAPv0Allowed = convertToTbool(varValue.toBool());
   951         eapSettings.iPEAPv0Allowed = convertToTbool(varValue.toBool());
   927         qDebug() << "EapQtConfigInterfacePrivate - copyToEapSettings PeapVersion0Allowed: "
   952         qDebug() << "EapQtConfigInterfacePrivate - copyToEapSettings PeapVersion0Allowed: "
   928             << varValue.toBool();
   953             << varValue.toBool();
       
   954     } else {
       
   955         // in any other case disable PEAP version;
       
   956         // no need to set eapSettings.iPEAPVersionsPresent,
       
   957         // it will be set if one of the other PEAP versions is enabled,
       
   958         // otherwise this setting is redundant and can be ignored
       
   959         eapSettings.iPEAPv0Allowed = EFalse;
   929     }
   960     }
   930 
   961 
   931     varValue = config.value(EapQtConfig::PeapVersion1Allowed);
   962     varValue = config.value(EapQtConfig::PeapVersion1Allowed);
   932     if (varValue.type() == QVariant::Bool) {
   963     if (varValue.type() == QVariant::Bool) {
   933         eapSettings.iPEAPVersionsPresent = ETrue;
   964         eapSettings.iPEAPVersionsPresent = ETrue;
   934         eapSettings.iPEAPv1Allowed = convertToTbool(varValue.toBool());
   965         eapSettings.iPEAPv1Allowed = convertToTbool(varValue.toBool());
   935         qDebug() << "EapQtConfigInterfacePrivate - copyToEapSettings PeapVersion1Allowed: "
   966         qDebug() << "EapQtConfigInterfacePrivate - copyToEapSettings PeapVersion1Allowed: "
   936             << varValue.toBool();
   967             << varValue.toBool();
       
   968     } else {
       
   969         // in any other case disable PEAP version;
       
   970         // no need to set eapSettings.iPEAPVersionsPresent,
       
   971         // it will be set if one of the other PEAP versions is enabled,
       
   972         // otherwise this setting is redundant and can be ignored
       
   973         eapSettings.iPEAPv1Allowed = EFalse;
   937     }
   974     }
   938 
   975 
   939     varValue = config.value(EapQtConfig::PeapVersion2Allowed);
   976     varValue = config.value(EapQtConfig::PeapVersion2Allowed);
   940     if (varValue.type() == QVariant::Bool) {
   977     if (varValue.type() == QVariant::Bool) {
   941         eapSettings.iPEAPVersionsPresent = ETrue;
   978         eapSettings.iPEAPVersionsPresent = ETrue;
   942         eapSettings.iPEAPv2Allowed = convertToTbool(varValue.toBool());
   979         eapSettings.iPEAPv2Allowed = convertToTbool(varValue.toBool());
   943         qDebug() << "EapQtConfigInterfacePrivate - copyToEapSettings PeapVersion2Allowed: "
   980         qDebug() << "EapQtConfigInterfacePrivate - copyToEapSettings PeapVersion2Allowed: "
   944             << varValue.toBool();
   981             << varValue.toBool();
       
   982     } else {
       
   983         // in any other case disable PEAP version;
       
   984         // no need to set eapSettings.iPEAPVersionsPresent,
       
   985         // it will be set if one of the other PEAP versions is enabled,
       
   986         // otherwise this setting is redundant and can be ignored
       
   987         eapSettings.iPEAPv2Allowed = EFalse;
   945     }
   988     }
   946 
   989 
   947     varValue = config.value(EapQtConfig::ProvisioningModeAuthenticated);
   990     varValue = config.value(EapQtConfig::ProvisioningModeAuthenticated);
   948     if (varValue.type() == QVariant::Bool) {
   991     if (varValue.type() == QVariant::Bool) {
   949         eapSettings.iAuthProvModeAllowedPresent = ETrue;
   992         eapSettings.iAuthProvModeAllowedPresent = ETrue;
   963     }
  1006     }
   964 
  1007 
   965     varValue = config.value(EapQtConfig::PACGroupReference);
  1008     varValue = config.value(EapQtConfig::PACGroupReference);
   966     // do not copy if too large string
  1009     // do not copy if too large string
   967     if (varValue.type() == QVariant::String && varValue.toString().count() <= StringMaxLength) {
  1010     if (varValue.type() == QVariant::String && varValue.toString().count() <= StringMaxLength) {
   968         // not supported
  1011         eapSettings.iPACGroupReference.Copy(varValue.toString().utf16());
       
  1012         eapSettings.iPACGroupReferencePresent = ETrue;
   969         qDebug() << "EapQtConfigInterfacePrivate - copyToEapSettings PACGroupReference: "
  1013         qDebug() << "EapQtConfigInterfacePrivate - copyToEapSettings PACGroupReference: "
   970             << varValue.toString();
  1014             << varValue.toString();
   971     }
  1015     }
   972 
  1016 
   973     varValue = config.value(EapQtConfig::WarnADHPNoPAC);
  1017     varValue = config.value(EapQtConfig::WarnADHPNoPAC);
  1035     if (varValue.type() == QVariant::List) {
  1079     if (varValue.type() == QVariant::List) {
  1036 
  1080 
  1037         qDebug() << "EapQtConfigInterfacePrivate::copyToEapSettings() - CipherSuites present";
  1081         qDebug() << "EapQtConfigInterfacePrivate::copyToEapSettings() - CipherSuites present";
  1038         QList<QVariant> varCiphers = varValue.toList();
  1082         QList<QVariant> varCiphers = varValue.toList();
  1039 
  1083 
       
  1084         // clears the ciphersuite configuration if the provided list is empty
       
  1085         eapSettings.iCipherSuitesPresent = ETrue;
       
  1086 
  1040         for (ind = 0; ind < varCiphers.count(); ind++) {
  1087         for (ind = 0; ind < varCiphers.count(); ind++) {
  1041             // check that the item is of correct type (int also accepted to not be too strict)
  1088             // check that the item is of correct type (int also accepted to not be too strict)
  1042             if (varCiphers[ind].type() == QVariant::UInt || varCiphers[ind].type() == QVariant::Int) {
  1089             if (varCiphers[ind].type() == QVariant::UInt || varCiphers[ind].type() == QVariant::Int) {
  1043                 // set to true only if at least item cipher is ok
       
  1044                 eapSettings.iCipherSuitesPresent = ETrue;
       
  1045                 eapSettings.iCipherSuites.Append(varCiphers[ind].toUInt());
  1090                 eapSettings.iCipherSuites.Append(varCiphers[ind].toUInt());
  1046                 qDebug(
  1091                 qDebug(
  1047                     "EapQtConfigInterfacePrivate::copyToEapSettings() - CipherSuites at %d: 0x%08x",
  1092                     "EapQtConfigInterfacePrivate::copyToEapSettings() - CipherSuites at %d: 0x%08x",
  1048                     ind, varCiphers[ind].toUInt());
  1093                     ind, varCiphers[ind].toUInt());
  1049             }
  1094             }
  1050         }
  1095         }
  1051     }
  1096     }
  1052 
  1097 
       
  1098     // set always to true to support clearing previously configured CA/user certificates
       
  1099     // if the EAP method in question does not use certificates,
       
  1100     // EAP server will ignore the setting;
       
  1101     // CA/user certificates get cleared if EapQtConfig::Authority/UserCertificate is QVariant::Invalid or
       
  1102     // the provided lists are empty
       
  1103     eapSettings.iCertificatesPresent = ETrue;
       
  1104 
  1053     varValue = config.value(EapQtConfig::AuthorityCertificate);
  1105     varValue = config.value(EapQtConfig::AuthorityCertificate);
  1054     if (varValue.type() == QVariant::List) {
  1106     if (varValue.type() == QVariant::List) {
  1055 
  1107 
  1056         qDebug()
  1108         qDebug()
  1057             << "EapQtConfigInterfacePrivate::copyToEapSettings() - AuthorityCertificate present";
  1109             << "EapQtConfigInterfacePrivate::copyToEapSettings() - AuthorityCertificate present";
  1058 
  1110 
  1059         QList<QVariant> varCerts = varValue.toList();
  1111         QList<QVariant> varCerts = varValue.toList();
  1060         for (ind = 0; ind < varCerts.count(); ind++) {
  1112         for (ind = 0; ind < varCerts.count(); ind++) {
  1061             // check that the item is of correct type
  1113             // check that the item is of correct type
  1062             if (varCerts[ind].canConvert<EapQtCertificateInfo> ()) {
  1114             if (varCerts[ind].canConvert<EapQtCertificateInfo> ()) {
  1063                 // set to true only if at least one item is ok
       
  1064                 eapSettings.iCertificatesPresent = ETrue;
       
  1065                 appendCertificateInfo(true, varCerts[ind].value<EapQtCertificateInfo> (),
  1115                 appendCertificateInfo(true, varCerts[ind].value<EapQtCertificateInfo> (),
  1066                     &(eapSettings.iCertificates));
  1116                     &(eapSettings.iCertificates));
  1067                 qDebug()
  1117                 qDebug()
  1068                     << "EapQtConfigInterfacePrivate::copyToEapSettings() - AuthorityCertificate appended";
  1118                     << "EapQtConfigInterfacePrivate::copyToEapSettings() - AuthorityCertificate appended";
  1069             }
  1119             }
  1077 
  1127 
  1078         QList<QVariant> varCerts = varValue.toList();
  1128         QList<QVariant> varCerts = varValue.toList();
  1079         for (ind = 0; ind < varCerts.count(); ind++) {
  1129         for (ind = 0; ind < varCerts.count(); ind++) {
  1080             // check that the item is of correct type
  1130             // check that the item is of correct type
  1081             if (varCerts[ind].canConvert<EapQtCertificateInfo> ()) {
  1131             if (varCerts[ind].canConvert<EapQtCertificateInfo> ()) {
  1082                 // set to true only if at least one item is ok
       
  1083                 eapSettings.iCertificatesPresent = ETrue;
       
  1084                 appendCertificateInfo(false, varCerts[ind].value<EapQtCertificateInfo> (),
  1132                 appendCertificateInfo(false, varCerts[ind].value<EapQtCertificateInfo> (),
  1085                     &(eapSettings.iCertificates));
  1133                     &(eapSettings.iCertificates));
  1086                 qDebug()
  1134                 qDebug()
  1087                     << "EapQtConfigInterfacePrivate::copyToEapSettings() - AuthorityCertificate appended";
  1135                     << "EapQtConfigInterfacePrivate::copyToEapSettings() - AuthorityCertificate appended";
  1088             }
  1136             }
  1094 // caller takes care of deallocating resulting data in certList
  1142 // caller takes care of deallocating resulting data in certList
  1095 void EapQtConfigInterfacePrivate::appendCertificateInfo(bool isCaCertificate,
  1143 void EapQtConfigInterfacePrivate::appendCertificateInfo(bool isCaCertificate,
  1096     const EapQtCertificateInfo& certInfo, RPointerArray<EapCertificateEntry>* const certList)
  1144     const EapQtCertificateInfo& certInfo, RPointerArray<EapCertificateEntry>* const certList)
  1097 {
  1145 {
  1098     qDebug("EapQtConfigInterfacePrivate::appendCertificateInfo(), this = 0x%08x", this);
  1146     qDebug("EapQtConfigInterfacePrivate::appendCertificateInfo(), this = 0x%08x", this);
  1099 
       
  1100 
  1147 
  1101     Q_ASSERT(certList);
  1148     Q_ASSERT(certList);
  1102 
  1149 
  1103     // use scoped pointer to make sure memory is not leaked in failures
  1150     // use scoped pointer to make sure memory is not leaked in failures
  1104     QScopedPointer<EapCertificateEntry> certEntry(new EapCertificateEntry);
  1151     QScopedPointer<EapCertificateEntry> certEntry(new EapCertificateEntry);
  1198 
  1245 
  1199     // all ok, remove the ownerhsip from scoped pointer
  1246     // all ok, remove the ownerhsip from scoped pointer
  1200     (void) certEntry.take();
  1247     (void) certEntry.take();
  1201 }
  1248 }
  1202 
  1249 
  1203 void EapQtConfigInterfacePrivate::copyFromEapSettings(EAPSettings& eapSettings, EapQtConfig& config)
  1250 void EapQtConfigInterfacePrivate::copyFromEapSettings(EAPSettings &eapSettings, EapQtConfig &config)
  1204 {
  1251 {
  1205     qDebug("EapQtConfigInterfacePrivate::copyFromEapSettings(), this = 0x%08x", this);
  1252     qDebug("EapQtConfigInterfacePrivate::copyFromEapSettings(), this = 0x%08x", this);
  1206 
  1253 
  1207     int ind = 0;
  1254     int ind = 0;
  1208 
  1255 
  1481 
  1528 
  1482 QList<EapQtPluginHandle> EapQtConfigInterfacePrivate::selectedOuterTypes()
  1529 QList<EapQtPluginHandle> EapQtConfigInterfacePrivate::selectedOuterTypes()
  1483 {
  1530 {
  1484     qDebug("EapQtConfigInterfacePrivate::selectedOuterTypes(), this = 0x%08x", this);
  1531     qDebug("EapQtConfigInterfacePrivate::selectedOuterTypes(), this = 0x%08x", this);
  1485 
  1532 
  1486 
       
  1487     checkInstanceThrowing();
  1533     checkInstanceThrowing();
  1488 
  1534 
  1489     if (!mEapDbIndexValid) {
  1535     if (!mEapDbIndexValid) {
  1490         qDebug() << "ERROR: Database reference not valid, call setConfigurationReference first!";
  1536         qDebug() << "ERROR: Database reference not valid, call setConfigurationReference first!";
  1491         return QList<EapQtPluginHandle> ();
  1537         return QList<EapQtPluginHandle> ();
  1510         selectedOuterTypes.count());
  1556         selectedOuterTypes.count());
  1511 
  1557 
  1512     return selectedOuterTypes;
  1558     return selectedOuterTypes;
  1513 }
  1559 }
  1514 
  1560 
  1515 bool EapQtConfigInterfacePrivate::isSupportedOuterType(const EapQtPluginHandle& handle)
  1561 bool EapQtConfigInterfacePrivate::isSupportedOuterType(const EapQtPluginHandle &handle)
  1516 {
  1562 {
  1517     qDebug("EapQtConfigInterfacePrivate::isSupportedOuterType(), this = 0x%08x", this);
  1563     qDebug("EapQtConfigInterfacePrivate::isSupportedOuterType(), this = 0x%08x", this);
  1518 
       
  1519 
  1564 
  1520     checkInstanceThrowing();
  1565     checkInstanceThrowing();
  1521 
  1566 
  1522     // check if mSupportedOuterTypes is up-to-date
  1567     // check if mSupportedOuterTypes is up-to-date
  1523     if (mSupportedOuterTypes.count() <= 0) {
  1568     if (mSupportedOuterTypes.count() <= 0) {
  1533     }
  1578     }
  1534     return ret;
  1579     return ret;
  1535 }
  1580 }
  1536 
  1581 
  1537 bool EapQtConfigInterfacePrivate::setSelectedOuterTypes(
  1582 bool EapQtConfigInterfacePrivate::setSelectedOuterTypes(
  1538     const QList<EapQtPluginHandle>& outerHandles)
  1583     const QList<EapQtPluginHandle> &outerHandles)
  1539 {
  1584 {
  1540     qDebug("EapQtConfigInterfacePrivate::setSelectedOuterTypes()");
  1585     qDebug("EapQtConfigInterfacePrivate::setSelectedOuterTypes()");
  1541 
       
  1542 
  1586 
  1543     checkInstanceThrowing();
  1587     checkInstanceThrowing();
  1544 
  1588 
  1545     if (!mEapDbIndexValid || mEapGsIf.isNull()) {
  1589     if (!mEapDbIndexValid || mEapGsIf.isNull()) {
  1546         qDebug()
  1590         qDebug()
  1589         ret = false;
  1633         ret = false;
  1590     }
  1634     }
  1591     return ret;
  1635     return ret;
  1592 }
  1636 }
  1593 
  1637 
  1594 bool EapQtConfigInterfacePrivate::isSupportedInnerType(const EapQtPluginHandle& outerHandle,
  1638 bool EapQtConfigInterfacePrivate::isSupportedInnerType(const EapQtPluginHandle &outerHandle,
  1595     const EapQtPluginHandle& innerHandle)
  1639     const EapQtPluginHandle &innerHandle)
  1596 {
  1640 {
  1597     qDebug("EapQtConfigInterfacePrivate::isSupportedInnerType(), this = 0x%08x", this);
  1641     qDebug("EapQtConfigInterfacePrivate::isSupportedInnerType(), this = 0x%08x", this);
  1598 
       
  1599 
  1642 
  1600     checkInstanceThrowing();
  1643     checkInstanceThrowing();
  1601 
  1644 
  1602     // update mSupportedInnerTypes
  1645     // update mSupportedInnerTypes
  1603     (void) supportedInnerTypes(outerHandle);
  1646     (void) supportedInnerTypes(outerHandle);
  1611 }
  1654 }
  1612 
  1655 
  1613 bool EapQtConfigInterfacePrivate::deleteConfiguration()
  1656 bool EapQtConfigInterfacePrivate::deleteConfiguration()
  1614 {
  1657 {
  1615     qDebug("EapQtConfigInterfacePrivate::deleteConfiguration(), this = 0x%08x", this);
  1658     qDebug("EapQtConfigInterfacePrivate::deleteConfiguration(), this = 0x%08x", this);
  1616 
       
  1617 
  1659 
  1618     checkInstanceThrowing();
  1660     checkInstanceThrowing();
  1619 
  1661 
  1620     if (!mEapDbIndexValid || mEapGsIf.isNull()) {
  1662     if (!mEapDbIndexValid || mEapGsIf.isNull()) {
  1621         qDebug()
  1663         qDebug()
  1635 {
  1677 {
  1636     qDebug("EapQtConfigInterfacePrivate::loadPlugins(), this = 0x%08x", this);
  1678     qDebug("EapQtConfigInterfacePrivate::loadPlugins(), this = 0x%08x", this);
  1637 
  1679 
  1638     checkInstanceThrowing();
  1680     checkInstanceThrowing();
  1639 
  1681 
  1640     QDir pluginsDir(eapPluginDir);
  1682     // plugin directory defined in cpeapplugininterface.h
       
  1683     QDir pluginsDir(CpEapPluginInterfacePluginDirectory);
  1641     foreach( QString fileName, pluginsDir.entryList(QDir::Files) )
  1684     foreach( QString fileName, pluginsDir.entryList(QDir::Files) )
  1642         {
  1685         {
  1643             QPluginLoader loader(pluginsDir.absoluteFilePath(fileName));
  1686             QPluginLoader loader(pluginsDir.absoluteFilePath(fileName));
  1644             QObject *tmp = loader.instance();
  1687             QObject *tmp = loader.instance();
  1645             if (tmp) {
  1688             if (tmp) {
  1653     // collect UI plugin infos
  1696     // collect UI plugin infos
  1654     QList<CpEapPluginInterface*>::iterator iter;
  1697     QList<CpEapPluginInterface*>::iterator iter;
  1655     for (iter = mPlugins.begin(); iter != mPlugins.end(); ++iter) {
  1698     for (iter = mPlugins.begin(); iter != mPlugins.end(); ++iter) {
  1656         mPluginInfos.append((*iter)->pluginInfo());
  1699         mPluginInfos.append((*iter)->pluginInfo());
  1657     }
  1700     }
  1658 }
  1701 
  1659 
  1702     // sort the UI plugins according to their order number
  1660 CpBaseSettingView *EapQtConfigInterfacePrivate::uiInstance(const EapQtPluginHandle& outerHandle,
  1703     qSort(mPluginInfos.begin(), mPluginInfos.end(), EapQtConfigInterfacePrivate::pluginLessThan);
  1661     const EapQtPluginHandle& pluginHandle)
  1704 
       
  1705     qDebug("EapQtConfigInterfacePrivate - loadPlugins: supported EAP plugin count: %d",
       
  1706         mPluginInfos.count());
       
  1707 }
       
  1708 
       
  1709 bool EapQtConfigInterfacePrivate::pluginLessThan(
       
  1710     const EapQtPluginInfo &plugin1,
       
  1711     const EapQtPluginInfo &plugin2)
       
  1712 {
       
  1713     return plugin1.orderNumber() < plugin2.orderNumber();
       
  1714 }
       
  1715 
       
  1716 CpBaseSettingView *EapQtConfigInterfacePrivate::uiInstance(const EapQtPluginHandle &outerHandle,
       
  1717     const EapQtPluginHandle &pluginHandle)
  1662 {
  1718 {
  1663     qDebug("EapQtConfigInterfacePrivate::uiInstance(), this = 0x%08x", this);
  1719     qDebug("EapQtConfigInterfacePrivate::uiInstance(), this = 0x%08x", this);
  1664 
       
  1665 
  1720 
  1666     checkInstanceThrowing();
  1721     checkInstanceThrowing();
  1667 
  1722 
  1668     // if outer type UI is requested, outerHandle must be undefined and pluginHandle
  1723     // if outer type UI is requested, outerHandle must be undefined and pluginHandle
  1669     // must be supported as outer type
  1724     // must be supported as outer type
  1723         break;
  1778         break;
  1724     }
  1779     }
  1725     return ret;
  1780     return ret;
  1726 }
  1781 }
  1727 
  1782 
  1728 EapQtValidator *EapQtConfigInterfacePrivate::validatorEap(EapQtExpandedEapType type,
  1783 EapQtValidator *EapQtConfigInterfacePrivate::validatorEap(const EapQtExpandedEapType &type,
  1729     EapQtConfig::SettingsId id)
  1784     const EapQtConfig::SettingsId id)
  1730 {
  1785 {
  1731     qDebug("EapQtConfigInterfacePrivate::validatorEap(), this = 0x%08x", this);
  1786     qDebug("EapQtConfigInterfacePrivate::validatorEap(), this = 0x%08x", this);
  1732 
  1787 
       
  1788     qDebug() << "EapQtConfigInterfacePrivate::validatorEap() - requested EAP: "
       
  1789         << type.eapExpandedData().toHex();
       
  1790     qDebug() << "EapQtConfigInterfacePrivate::validatorEap() - setting: " << id;
  1733 
  1791 
  1734     EapQtValidator *ret = NULL;
  1792     EapQtValidator *ret = NULL;
  1735 
  1793 
  1736     switch (id) {
  1794     switch (id) {
  1737 
  1795 
  1787     default:
  1845     default:
  1788         ret = NULL;
  1846         ret = NULL;
  1789 
  1847 
  1790     }
  1848     }
  1791 
  1849 
       
  1850     qDebug() << "EapQtConfigInterfacePrivate::validatorEap() - is returning NULL: " << (ret == NULL);
       
  1851 
  1792     return ret;
  1852     return ret;
  1793 }
  1853 }
       
  1854 
       
  1855 bool EapQtConfigInterfacePrivate::readPacStoreConfiguration(EapQtPacStoreConfig& /* config */)
       
  1856 {
       
  1857     // not supported
       
  1858     return false;
       
  1859 }
       
  1860 
       
  1861 bool EapQtConfigInterfacePrivate::savePacStoreConfiguration(const EapQtPacStoreConfig& /* config */)
       
  1862 {
       
  1863     // not supported
       
  1864     return false;
       
  1865 }
       
  1866 
       
  1867 EapQtValidator *EapQtConfigInterfacePrivate::validatorPacStore(
       
  1868     const EapQtPacStoreConfig::PacStoreSettings id)
       
  1869 {
       
  1870     qDebug("EapQtConfigInterfacePrivate::validatorPacStore(), this = 0x%08x", this);
       
  1871 
       
  1872     EapQtValidator *ret = NULL;
       
  1873 
       
  1874     switch (id) {
       
  1875     case EapQtPacStoreConfig::PacStorePassword:
       
  1876         ret = new EapQtValidatorPacStorePassword();
       
  1877         break;
       
  1878     case EapQtPacStoreConfig::PacStorePasswordConfirmation:
       
  1879         ret = new EapQtValidatorPacStorePasswordConfirm();
       
  1880         break;
       
  1881     default:
       
  1882         ret = NULL;
       
  1883     }
       
  1884 
       
  1885     return ret;
       
  1886 }