securitysettings/cpeapuiplugins/cpeapuserpasswordui/src/cpeapuserpasswordplugin.cpp
branchRCL_3
changeset 46 c74b3d9f6b9e
parent 45 bad0cc58d154
child 55 9c2aa05919d9
equal deleted inserted replaced
45:bad0cc58d154 46:c74b3d9f6b9e
     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 "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: 11 %
       
    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 Q_EXPORT_PLUGIN2(CpEapUserPasswordPlugin, CpEapUserPasswordPlugin);
       
    40 
       
    41 // ======== LOCAL FUNCTIONS ========
       
    42 
       
    43 // ======== MEMBER FUNCTIONS ========
       
    44 
       
    45 /*!
       
    46  * Constructor.
       
    47  */
       
    48 CpEapUserPasswordPlugin::CpEapUserPasswordPlugin() :
       
    49     mBearer(EapQtConfigInterface::EapBearerTypeWlan),
       
    50     mIapId(EapQtConfigInterface::IapIdUndefined)
       
    51 {
       
    52     // Nothing to be done
       
    53 
       
    54     qDebug("CpEapUserPasswordPlugin created");
       
    55 }
       
    56 
       
    57 /*!
       
    58  * Destructor.
       
    59  */
       
    60 CpEapUserPasswordPlugin::~CpEapUserPasswordPlugin()
       
    61 {
       
    62     // Nothing to be done
       
    63     // UI instances are owned and deallocated by CP framework
       
    64 
       
    65     qDebug("CpEapUserPasswordPlugin destroyed");
       
    66 }
       
    67 
       
    68 /*!
       
    69  * See CpEapPluginInterface::setSettingsReference()
       
    70  * 
       
    71  * @param bearer Bearer of the accessed settings
       
    72  * @param iapId ID of the accessed IAP
       
    73  */
       
    74 void CpEapUserPasswordPlugin::setSettingsReference(
       
    75     const EapQtConfigInterface::EapBearerType bearer, const int iapId)
       
    76 {
       
    77     mBearer = bearer;
       
    78     mIapId = iapId;
       
    79 }
       
    80 
       
    81 /*!
       
    82  * See CpEapPluginInterface::pluginInfo()
       
    83  * 
       
    84  * @return Plugin info
       
    85  */
       
    86 QList<EapQtPluginInfo> CpEapUserPasswordPlugin::pluginInfo()
       
    87 {
       
    88     qDebug("CpEapUserPasswordPlugin: provide plugin info");
       
    89     QList<EapQtPluginInfo> ret;
       
    90 
       
    91     ret.append(EapQtPluginInfo(
       
    92         EapQtPluginHandle::PluginEapMschapv2,
       
    93         EapQtUiConstants::StringEapMschapv2,
       
    94         EapQtUiConstants::OrderEapMschapv2));
       
    95 
       
    96     ret.append(EapQtPluginInfo(
       
    97         EapQtPluginHandle::PluginPap,
       
    98         EapQtUiConstants::StringPap,
       
    99         EapQtUiConstants::OrderPap));
       
   100 
       
   101     ret.append(EapQtPluginInfo(
       
   102         EapQtPluginHandle::PluginPlainMschapv2,
       
   103         EapQtUiConstants::StringMschapv2,
       
   104         EapQtUiConstants::OrderMschapv2));
       
   105 
       
   106     ret.append(EapQtPluginInfo(
       
   107         EapQtPluginHandle::PluginEapGtc,
       
   108         EapQtUiConstants::StringEapGtc,
       
   109         EapQtUiConstants::OrderEapGtc));
       
   110 
       
   111     ret.append(EapQtPluginInfo(
       
   112         EapQtPluginHandle::PluginLeap,
       
   113         EapQtUiConstants::StringLeap,
       
   114         EapQtUiConstants::OrderLeap));
       
   115 
       
   116     return ret;
       
   117 }
       
   118 
       
   119 /*!
       
   120  * See CpEapPluginInterface::uiInstance()
       
   121  * 
       
   122  * Creates UI instance
       
   123  * 
       
   124  * @param outerHandle Plugin handle to outer EAP type.
       
   125  * @param plugin Plugin info
       
   126  * 
       
   127  * @return username-password UI instance
       
   128  */
       
   129 CpBaseSettingView* CpEapUserPasswordPlugin::uiInstance(const EapQtPluginHandle& outerHandle,
       
   130     const EapQtPluginInfo &plugin)
       
   131 {
       
   132     qDebug("CpEapUserPasswordPlugin: create UI instance");
       
   133 
       
   134     Q_ASSERT(mIapId != EapQtConfigInterface::IapIdUndefined);
       
   135 
       
   136     // instance is owned and deallocated by CP framework
       
   137     return new CpEapUserPasswordUi(mBearer, mIapId, plugin, outerHandle);
       
   138 }