securitysettings/cpeapuiplugins/cpeapuserpasswordui/src/cpeapuserpasswordplugin.cpp
changeset 26 9abfd4f00d37
child 34 ad1f037f1ac2
equal deleted inserted replaced
25:e03a3db4489e 26:9abfd4f00d37
       
     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  *   Control Panel QT plugin for username-password based 
       
    16  *   EAP method configuration
       
    17  *
       
    18  */
       
    19 
       
    20 /*
       
    21  * %version: 9 %
       
    22  */
       
    23 
       
    24 // System includes
       
    25 // User includes
       
    26 #include "cpeapuserpasswordplugin.h"
       
    27 #include "cpeapuserpasswordui.h"
       
    28 #include "eapuidefs.h"
       
    29 
       
    30 /*!
       
    31  * \class CpEapUserPasswordPlugin
       
    32  * \brief Control Panel QT plugin for username-password based EAP method configuration. 
       
    33  */
       
    34 
       
    35 // External function prototypes
       
    36 
       
    37 // Local constants
       
    38 
       
    39 // Order numbers
       
    40 static const int order_eapmschapv2(10);
       
    41 static const int order_pap(20);
       
    42 static const int order_plainmschapv2(30);
       
    43 static const int order_eapgtc(40);
       
    44 static const int order_leap(50);
       
    45 
       
    46 Q_EXPORT_PLUGIN2(CpEapUserPasswordPlugin, CpEapUserPasswordPlugin)
       
    47 ;
       
    48 
       
    49 // ======== LOCAL FUNCTIONS ========
       
    50 
       
    51 // ======== MEMBER FUNCTIONS ========
       
    52 
       
    53 /*!
       
    54  * Constructor.
       
    55  */
       
    56 CpEapUserPasswordPlugin::CpEapUserPasswordPlugin() :
       
    57     mBearer(EapQtConfigInterface::EapBearerTypeWlan),
       
    58     mIapId(EapQtConfigInterface::IapIdUndefined)
       
    59 {
       
    60     // Nothing to be done
       
    61 
       
    62     qDebug("CpEapUserPasswordPlugin created");
       
    63 }
       
    64 
       
    65 /*!
       
    66  * Destructor.
       
    67  */
       
    68 CpEapUserPasswordPlugin::~CpEapUserPasswordPlugin()
       
    69 {
       
    70     // Nothing to be done
       
    71     // UI instances are owned and deallocated by CP framework
       
    72 
       
    73     qDebug("CpEapUserPasswordPlugin destroyed");
       
    74 }
       
    75 
       
    76 /*!
       
    77  * See CpEapPluginInterface::setSettingsReference()
       
    78  * 
       
    79  * @param bearer Bearer of the accessed settings
       
    80  * @param iapId ID of the accessed IAP
       
    81  */
       
    82 void CpEapUserPasswordPlugin::setSettingsReference(
       
    83     const EapQtConfigInterface::EapBearerType bearer, const int iapId)
       
    84 {
       
    85     mBearer = bearer;
       
    86     mIapId = iapId;
       
    87 }
       
    88 
       
    89 /*!
       
    90  * See CpEapPluginInterface::pluginInfo()
       
    91  * 
       
    92  * @return Plugin info
       
    93  */
       
    94 QList<EapQtPluginInfo> CpEapUserPasswordPlugin::pluginInfo()
       
    95 {
       
    96     qDebug("CpEapUserPasswordPlugin: provide plugin info");
       
    97     QList<EapQtPluginInfo> ret;
       
    98 
       
    99     ret.append(EapQtPluginInfo(EapQtPluginHandle::PluginEapMschapv2,  
       
   100         EapUiStrings::EapMschapv2, order_eapmschapv2) );
       
   101     
       
   102     ret.append(EapQtPluginInfo(EapQtPluginHandle::PluginPap, 
       
   103         EapUiStrings::Pap, order_pap) );
       
   104 
       
   105     ret.append(EapQtPluginInfo(EapQtPluginHandle::PluginPlainMschapv2,
       
   106         EapUiStrings::Mschapv2, order_plainmschapv2) );
       
   107 
       
   108     ret.append(EapQtPluginInfo(EapQtPluginHandle::PluginEapGtc, 
       
   109         EapUiStrings::EapGtc, order_eapgtc) );
       
   110 
       
   111     ret.append(EapQtPluginInfo(EapQtPluginHandle::PluginLeap, 
       
   112         EapUiStrings::Leap, order_leap) );
       
   113 
       
   114     return ret;
       
   115 }
       
   116 
       
   117 /*!
       
   118  * See CpEapPluginInterface::uiInstance()
       
   119  * 
       
   120  * Creates UI instance
       
   121  * 
       
   122  * @param outerHandle Plugin handle to outer EAP type.
       
   123  * @param plugin Plugin info
       
   124  * 
       
   125  * @return username-password UI instance
       
   126  */
       
   127 CpBaseSettingView* CpEapUserPasswordPlugin::uiInstance(const EapQtPluginHandle& outerHandle,
       
   128     const EapQtPluginInfo &plugin)
       
   129 {
       
   130     qDebug("CpEapUserPasswordPlugin: create UI instance");
       
   131 
       
   132     Q_ASSERT(mIapId != EapQtConfigInterface::IapIdUndefined);
       
   133 
       
   134     // instance is owned and deallocated by CP framework
       
   135     return new CpEapUserPasswordUi(mBearer, mIapId, plugin, outerHandle);
       
   136 }