securitysettings/eapqtdialogs/src/eapdialogplugin.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 "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: Prompt Dialog plugin implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <hbdevicedialoginterface.h>
       
    20 #include <QVariantMap>
       
    21 #include "eapdialogplugin.h"
       
    22 #include "eapusernamepwddialog.h"
       
    23 #include "OstTraceDefinitions.h"
       
    24 #ifdef OST_TRACE_COMPILER_IN_USE
       
    25 #endif
       
    26 
       
    27 
       
    28 Q_EXPORT_PLUGIN2(eapdialogplugin, EapDialogPlugin)
       
    29 
       
    30 
       
    31 // This plugin implements one device dialog type
       
    32 static const struct {
       
    33     const char *mTypeString;
       
    34 } dialogInfos[] = {
       
    35     {"com.nokia.eap.usernamepassworddialog/1.0"},
       
    36     {"com.nokia.eap.querydialog/1.0"},
       
    37     {"com.nokia.eap.passwordquerydialog/1.0"},
       
    38     {"com.nokia.eap.fastinstallpacquerydialog/1.0"},
       
    39     {"com.nokia.eap.fastpacstorepwquerydialog/1.0"},
       
    40     {"com.nokia.eap.fastcreatemasterkeyquerydialog/1.0"},
       
    41     {"com.nokia.eap.fastpacfilepwquerydialog/1.0"},
       
    42     {"com.nokia.eap.fastprovwaitnotedialog/1.0"},
       
    43     {"com.nokia.eap.mschapv2passwordexpirednotedialog/1.0"},
       
    44     {"com.nokia.eap.mschapv2oldpassworddialog/1.0"},
       
    45     {"com.nokia.eap.mschapv2newpassworddialog/1.0"},
       
    46     {"com.nokia.eap.fastshowprovnotsuccessnotedialog/1.0"}
       
    47 };
       
    48 
       
    49 /**
       
    50  * Constructor
       
    51  */ 
       
    52 EapDialogPlugin::EapDialogPlugin()
       
    53 {
       
    54     OstTraceFunctionEntry0( EAPDIALOGPLUGIN_EAPDIALOGPLUGIN_ENTRY );
       
    55     qDebug("EapDialogPlugin::EapDialogPlugin");
       
    56         
       
    57     OstTraceFunctionExit0( EAPDIALOGPLUGIN_EAPDIALOGPLUGIN_EXIT );
       
    58 }
       
    59 
       
    60 /**
       
    61  * Destructor
       
    62  */ 
       
    63 EapDialogPlugin::~EapDialogPlugin()
       
    64 {
       
    65     OstTraceFunctionEntry0( DUP1_EAPDIALOGPLUGIN_DEAPDIALOGPLUGIN_ENTRY );
       
    66       
       
    67     OstTraceFunctionExit0( EAPDIALOGPLUGIN_DEAPDIALOGPLUGIN_EXIT );
       
    68 }
       
    69 
       
    70 /**
       
    71  * Create device dialog widget
       
    72  */ 
       
    73 HbDeviceDialogInterface *EapDialogPlugin::createDeviceDialog(
       
    74     const QString &deviceDialogType,
       
    75     const QVariantMap &parameters)
       
    76 {  
       
    77     OstTraceFunctionEntry0( EAPDIALOGPLUGIN_CREATEDEVICEDIALOG_ENTRY );
       
    78     qDebug("EapDialogPlugin::createDeviceDialog ENTER");
       
    79         
       
    80     if ( deviceDialogType.compare("com.nokia.eap.usernamepassworddialog/1.0") == 0 ) 
       
    81         {
       
    82         qDebug("EapDialogPlugin::createDeviceDialog: new EapUsernamePwdDialog");
       
    83         return ( new EapUsernamePwdDialog(parameters) );
       
    84         }
       
    85     else 
       
    86         {
       
    87         qDebug("EapDialogPlugin::createDeviceDialog: ELSE --> ERRORISMO");
       
    88         }       
       
    89     OstTraceFunctionExit0( EAPDIALOGPLUGIN_CREATEDEVICEDIALOG_EXIT );
       
    90     qDebug("EapDialogPlugin::createDeviceDialog EXIT");
       
    91     
       
    92     return NULL;
       
    93 }
       
    94 
       
    95 /**
       
    96  * Check if client is allowed to use device dialog widget
       
    97  */
       
    98 bool EapDialogPlugin::accessAllowed(const QString &deviceDialogType,
       
    99     const QVariantMap &parameters, const QVariantMap &securityInfo) const
       
   100 {
       
   101     OstTraceFunctionEntry0( EAPDIALOGPLUGIN_ACCESSALLOWED_ENTRY );
       
   102     
       
   103     Q_UNUSED(deviceDialogType)
       
   104     Q_UNUSED(parameters)
       
   105     Q_UNUSED(securityInfo)
       
   106 
       
   107     // This plugin doesn't perform operations that may compromise security.
       
   108     // All clients are allowed to use.
       
   109     return true;
       
   110 }
       
   111 
       
   112 /**
       
   113  * Return information of device dialog the plugin creates
       
   114  */ 
       
   115 bool EapDialogPlugin::deviceDialogInfo(const QString &deviceDialogType,
       
   116     const QVariantMap &parameters, DeviceDialogInfo *info) const
       
   117 {
       
   118     OstTraceFunctionEntry0( EAPDIALOGPLUGIN_DEVICEDIALOGINFO_ENTRY );
       
   119     qDebug("EapDialogPlugin::deviceDialogInfo");
       
   120     
       
   121     Q_UNUSED(parameters)
       
   122     Q_UNUSED(deviceDialogType)
       
   123     
       
   124     info->group = GenericDeviceDialogGroup;
       
   125     info->flags = NoDeviceDialogFlags;
       
   126     info->priority = DefaultPriority;
       
   127     
       
   128     OstTraceFunctionExit0( EAPDIALOGPLUGIN_DEVICEDIALOGINFO_EXIT );
       
   129     qDebug("EapDialogPlugin::deviceDialogInfo EXIT");
       
   130     return true;
       
   131 }
       
   132 
       
   133 /**
       
   134  * Return device dialog types this plugin implements
       
   135  */ 
       
   136 QStringList EapDialogPlugin::deviceDialogTypes() const
       
   137 {
       
   138     OstTraceFunctionEntry0( EAPDIALOGPLUGIN_DEVICEDIALOGTYPES_ENTRY );
       
   139     qDebug("EapDialogPlugin::deviceDialogTypes");
       
   140     
       
   141     QStringList types;
       
   142     const int numTypes = sizeof(dialogInfos) / sizeof(dialogInfos[0]);
       
   143     for(int i = 0; i < numTypes; i++) {
       
   144         types.append(dialogInfos[i].mTypeString);
       
   145     }
       
   146     
       
   147     OstTraceFunctionExit0( EAPDIALOGPLUGIN_DEVICEDIALOGTYPES_EXIT );
       
   148     return types;
       
   149 }
       
   150 
       
   151 /**
       
   152  * Return plugin flags
       
   153  */ 
       
   154 EapDialogPlugin::PluginFlags EapDialogPlugin::pluginFlags() const
       
   155 {
       
   156     OstTraceFunctionEntry0( EAPDIALOGPLUGIN_PLUGINFLAGS_ENTRY );   
       
   157     OstTraceFunctionExit0( EAPDIALOGPLUGIN_PLUGINFLAGS_EXIT );
       
   158     return NoPluginFlags;
       
   159 }
       
   160 
       
   161 /**
       
   162  * The last error is not stored, not supported
       
   163  */ 
       
   164 int EapDialogPlugin::error() const
       
   165 {
       
   166     OstTraceFunctionEntry0( EAPDIALOGPLUGIN_ERROR_ENTRY );
       
   167     OstTraceFunctionExit0( EAPDIALOGPLUGIN_ERROR_EXIT );
       
   168     return 0;
       
   169 }
       
   170