securitysettings/eapqtdialogs/src/eapdialogplugin.cpp
author hgs
Fri, 09 Jul 2010 10:14:51 +0300
changeset 36 c98682f98478
parent 34 ad1f037f1ac2
child 44 22d80358905b
permissions -rw-r--r--
201027
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
34
hgs
parents: 26
diff changeset
    14
* Description: Eap Dialog Plugin implementation
26
hgs
parents:
diff changeset
    15
*
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
34
hgs
parents: 26
diff changeset
    18
/*
36
hgs
parents: 34
diff changeset
    19
* %version: 9 %
34
hgs
parents: 26
diff changeset
    20
*/
26
hgs
parents:
diff changeset
    21
36
hgs
parents: 34
diff changeset
    22
// System includes
26
hgs
parents:
diff changeset
    23
#include <hbdevicedialoginterface.h>
hgs
parents:
diff changeset
    24
#include <QVariantMap>
36
hgs
parents: 34
diff changeset
    25
hgs
parents: 34
diff changeset
    26
// User includes
26
hgs
parents:
diff changeset
    27
#include "eapdialogplugin.h"
hgs
parents:
diff changeset
    28
#include "eapusernamepwddialog.h"
34
hgs
parents: 26
diff changeset
    29
#include "eapquerydialog.h"
hgs
parents: 26
diff changeset
    30
#include "eappasswordquerydialog.h"
hgs
parents: 26
diff changeset
    31
#include "eapfastinstallpacquerydialog.h"
hgs
parents: 26
diff changeset
    32
#include "eapfastpacstorepwquerydialog.h"
hgs
parents: 26
diff changeset
    33
#include "eapfastpacfilepwquerydialog.h"
hgs
parents: 26
diff changeset
    34
#include "eapfastcreatemasterkeyquerydialog.h"
hgs
parents: 26
diff changeset
    35
#include "eapfastprovwaitnotedialog.h"
hgs
parents: 26
diff changeset
    36
#include "eapmschapv2pwdexpirednotedialog.h"
hgs
parents: 26
diff changeset
    37
#include "eapmschapv2oldpwddialog.h"
hgs
parents: 26
diff changeset
    38
#include "eapmschapv2newpwddialog.h"
hgs
parents: 26
diff changeset
    39
#include "eapfastprovnotsuccessnotedialog.h"
26
hgs
parents:
diff changeset
    40
#include "OstTraceDefinitions.h"
hgs
parents:
diff changeset
    41
#ifdef OST_TRACE_COMPILER_IN_USE
hgs
parents:
diff changeset
    42
#endif
hgs
parents:
diff changeset
    43
36
hgs
parents: 34
diff changeset
    44
/*!
hgs
parents: 34
diff changeset
    45
 * \class EapDialogPlugin
hgs
parents: 34
diff changeset
    46
 * \brief Implements Eap Dialog Plugin. 
hgs
parents: 34
diff changeset
    47
 */
hgs
parents: 34
diff changeset
    48
hgs
parents: 34
diff changeset
    49
// External function prototypes
26
hgs
parents:
diff changeset
    50
hgs
parents:
diff changeset
    51
Q_EXPORT_PLUGIN2(eapdialogplugin, EapDialogPlugin)
hgs
parents:
diff changeset
    52
36
hgs
parents: 34
diff changeset
    53
// Local constants
26
hgs
parents:
diff changeset
    54
36
hgs
parents: 34
diff changeset
    55
//! This plugin implements several device dialog types
26
hgs
parents:
diff changeset
    56
static const struct {
hgs
parents:
diff changeset
    57
    const char *mTypeString;
hgs
parents:
diff changeset
    58
} dialogInfos[] = {
hgs
parents:
diff changeset
    59
    {"com.nokia.eap.usernamepassworddialog/1.0"},
hgs
parents:
diff changeset
    60
    {"com.nokia.eap.querydialog/1.0"},
hgs
parents:
diff changeset
    61
    {"com.nokia.eap.passwordquerydialog/1.0"},
hgs
parents:
diff changeset
    62
    {"com.nokia.eap.fastinstallpacquerydialog/1.0"},
hgs
parents:
diff changeset
    63
    {"com.nokia.eap.fastpacstorepwquerydialog/1.0"},
hgs
parents:
diff changeset
    64
    {"com.nokia.eap.fastcreatemasterkeyquerydialog/1.0"},
hgs
parents:
diff changeset
    65
    {"com.nokia.eap.fastpacfilepwquerydialog/1.0"},
hgs
parents:
diff changeset
    66
    {"com.nokia.eap.fastprovwaitnotedialog/1.0"},
hgs
parents:
diff changeset
    67
    {"com.nokia.eap.mschapv2passwordexpirednotedialog/1.0"},
hgs
parents:
diff changeset
    68
    {"com.nokia.eap.mschapv2oldpassworddialog/1.0"},
hgs
parents:
diff changeset
    69
    {"com.nokia.eap.mschapv2newpassworddialog/1.0"},
hgs
parents:
diff changeset
    70
    {"com.nokia.eap.fastshowprovnotsuccessnotedialog/1.0"}
hgs
parents:
diff changeset
    71
};
hgs
parents:
diff changeset
    72
36
hgs
parents: 34
diff changeset
    73
// ======== LOCAL FUNCTIONS ========
hgs
parents: 34
diff changeset
    74
hgs
parents: 34
diff changeset
    75
// ======== MEMBER FUNCTIONS ========
hgs
parents: 34
diff changeset
    76
hgs
parents: 34
diff changeset
    77
/*!
hgs
parents: 34
diff changeset
    78
 * Constructor.
hgs
parents: 34
diff changeset
    79
 */
26
hgs
parents:
diff changeset
    80
EapDialogPlugin::EapDialogPlugin()
hgs
parents:
diff changeset
    81
{
hgs
parents:
diff changeset
    82
    OstTraceFunctionEntry0( EAPDIALOGPLUGIN_EAPDIALOGPLUGIN_ENTRY );
hgs
parents:
diff changeset
    83
    qDebug("EapDialogPlugin::EapDialogPlugin");
hgs
parents:
diff changeset
    84
        
hgs
parents:
diff changeset
    85
    OstTraceFunctionExit0( EAPDIALOGPLUGIN_EAPDIALOGPLUGIN_EXIT );
hgs
parents:
diff changeset
    86
}
hgs
parents:
diff changeset
    87
36
hgs
parents: 34
diff changeset
    88
/*!
26
hgs
parents:
diff changeset
    89
 * Destructor
hgs
parents:
diff changeset
    90
 */ 
hgs
parents:
diff changeset
    91
EapDialogPlugin::~EapDialogPlugin()
hgs
parents:
diff changeset
    92
{
hgs
parents:
diff changeset
    93
    OstTraceFunctionEntry0( DUP1_EAPDIALOGPLUGIN_DEAPDIALOGPLUGIN_ENTRY );
hgs
parents:
diff changeset
    94
      
hgs
parents:
diff changeset
    95
    OstTraceFunctionExit0( EAPDIALOGPLUGIN_DEAPDIALOGPLUGIN_EXIT );
hgs
parents:
diff changeset
    96
}
hgs
parents:
diff changeset
    97
36
hgs
parents: 34
diff changeset
    98
/*!
26
hgs
parents:
diff changeset
    99
 * Create device dialog widget
36
hgs
parents: 34
diff changeset
   100
 *
hgs
parents: 34
diff changeset
   101
 * @param [in]  deviceDialogType Tells which Dialog to create
hgs
parents: 34
diff changeset
   102
 * @param [in]  parameters Parameters for the Construction of the dialog.
hgs
parents: 34
diff changeset
   103
 * @return  created dialog widget
26
hgs
parents:
diff changeset
   104
 */ 
hgs
parents:
diff changeset
   105
HbDeviceDialogInterface *EapDialogPlugin::createDeviceDialog(
hgs
parents:
diff changeset
   106
    const QString &deviceDialogType,
hgs
parents:
diff changeset
   107
    const QVariantMap &parameters)
hgs
parents:
diff changeset
   108
{  
hgs
parents:
diff changeset
   109
    OstTraceFunctionEntry0( EAPDIALOGPLUGIN_CREATEDEVICEDIALOG_ENTRY );
hgs
parents:
diff changeset
   110
    qDebug("EapDialogPlugin::createDeviceDialog ENTER");
36
hgs
parents: 34
diff changeset
   111
    
hgs
parents: 34
diff changeset
   112
    HbDeviceDialogInterface* dialog = NULL; 
26
hgs
parents:
diff changeset
   113
        
36
hgs
parents: 34
diff changeset
   114
    if ( deviceDialogType.compare(dialogInfos[0].mTypeString) == 0 ) 
26
hgs
parents:
diff changeset
   115
        {
hgs
parents:
diff changeset
   116
        qDebug("EapDialogPlugin::createDeviceDialog: new EapUsernamePwdDialog");
36
hgs
parents: 34
diff changeset
   117
        dialog = new EapUsernamePwdDialog(parameters);
26
hgs
parents:
diff changeset
   118
        }
36
hgs
parents: 34
diff changeset
   119
    else if ( deviceDialogType.compare(dialogInfos[1].mTypeString) == 0 ) 
34
hgs
parents: 26
diff changeset
   120
        { 
hgs
parents: 26
diff changeset
   121
        qDebug("EapDialogPlugin::createDeviceDialog: new EapQueryDialog");
36
hgs
parents: 34
diff changeset
   122
        dialog = new EapQueryDialog(parameters);   
34
hgs
parents: 26
diff changeset
   123
        }
36
hgs
parents: 34
diff changeset
   124
    else if ( deviceDialogType.compare(dialogInfos[2].mTypeString) == 0 ) 
34
hgs
parents: 26
diff changeset
   125
        { 
hgs
parents: 26
diff changeset
   126
        qDebug("EapDialogPlugin::createDeviceDialog: new EapPasswordQueryDialog");
36
hgs
parents: 34
diff changeset
   127
        dialog = new EapPasswordQueryDialog(parameters);
34
hgs
parents: 26
diff changeset
   128
        }
36
hgs
parents: 34
diff changeset
   129
    else if ( deviceDialogType.compare(dialogInfos[3].mTypeString) == 0 )
34
hgs
parents: 26
diff changeset
   130
        {
hgs
parents: 26
diff changeset
   131
        qDebug("EapDialogPlugin::createDeviceDialog: new EapFastInstallPacQueryDialog");
36
hgs
parents: 34
diff changeset
   132
        dialog = new EapFastInstallPacQueryDialog(parameters);
34
hgs
parents: 26
diff changeset
   133
        }
36
hgs
parents: 34
diff changeset
   134
    else if ( deviceDialogType.compare(dialogInfos[4].mTypeString) == 0 )
34
hgs
parents: 26
diff changeset
   135
        {
hgs
parents: 26
diff changeset
   136
        qDebug("EapDialogPlugin::createDeviceDialog: new EapFastPacStorePwQueryDialog");
36
hgs
parents: 34
diff changeset
   137
        dialog = new EapFastPacStorePwQueryDialog(parameters);
34
hgs
parents: 26
diff changeset
   138
        }   
36
hgs
parents: 34
diff changeset
   139
    else if ( deviceDialogType.compare(dialogInfos[5].mTypeString) == 0 )
34
hgs
parents: 26
diff changeset
   140
        {
hgs
parents: 26
diff changeset
   141
        qDebug("EapDialogPlugin::createDeviceDialog: new EapFastCreateMasterKeyQueryDialog");
36
hgs
parents: 34
diff changeset
   142
        dialog = new EapFastCreateMasterKeyQueryDialog(parameters);
34
hgs
parents: 26
diff changeset
   143
        }  
36
hgs
parents: 34
diff changeset
   144
    else if ( deviceDialogType.compare(dialogInfos[6].mTypeString) == 0 )
26
hgs
parents:
diff changeset
   145
        {
34
hgs
parents: 26
diff changeset
   146
        qDebug("EapDialogPlugin::createDeviceDialog: new EapFastPacFilePwQueryDialog");
36
hgs
parents: 34
diff changeset
   147
        dialog = new EapFastPacFilePwQueryDialog(parameters);
34
hgs
parents: 26
diff changeset
   148
        }
36
hgs
parents: 34
diff changeset
   149
    else if ( deviceDialogType.compare(dialogInfos[7].mTypeString) == 0 )
34
hgs
parents: 26
diff changeset
   150
        {
hgs
parents: 26
diff changeset
   151
        qDebug("EapDialogPlugin::createDeviceDialog: new EapFastProvWaitNoteDialog");
36
hgs
parents: 34
diff changeset
   152
        dialog = new EapFastProvWaitNoteDialog(parameters);
34
hgs
parents: 26
diff changeset
   153
        }  
36
hgs
parents: 34
diff changeset
   154
    else if ( deviceDialogType.compare(dialogInfos[8].mTypeString) == 0 )
34
hgs
parents: 26
diff changeset
   155
        {
hgs
parents: 26
diff changeset
   156
        qDebug("EapDialogPlugin::createDeviceDialog: new EapMschapv2PwdExpNoteDialog");
36
hgs
parents: 34
diff changeset
   157
        dialog = new EapMschapv2PwdExpNoteDialog(parameters);
34
hgs
parents: 26
diff changeset
   158
        }  
36
hgs
parents: 34
diff changeset
   159
    else if ( deviceDialogType.compare(dialogInfos[9].mTypeString) == 0 )
34
hgs
parents: 26
diff changeset
   160
        {
hgs
parents: 26
diff changeset
   161
        qDebug("EapDialogPlugin::createDeviceDialog: new EapMschapv2OldPwdDialog");
36
hgs
parents: 34
diff changeset
   162
        dialog = new EapMschapv2OldPwdDialog(parameters);
34
hgs
parents: 26
diff changeset
   163
        }  
36
hgs
parents: 34
diff changeset
   164
    else if ( deviceDialogType.compare(dialogInfos[10].mTypeString) == 0 )
34
hgs
parents: 26
diff changeset
   165
        {
hgs
parents: 26
diff changeset
   166
        qDebug("EapDialogPlugin::createDeviceDialog: new EapMschapv2NewPwdDialog");
36
hgs
parents: 34
diff changeset
   167
        dialog = new EapMschapv2NewPwdDialog(parameters);
34
hgs
parents: 26
diff changeset
   168
        }  
36
hgs
parents: 34
diff changeset
   169
    else if ( deviceDialogType.compare(dialogInfos[11].mTypeString) == 0 )
34
hgs
parents: 26
diff changeset
   170
        {
hgs
parents: 26
diff changeset
   171
        qDebug("EapDialogPlugin::createDeviceDialog: new EapFastProvNotSuccessNoteDialog");
36
hgs
parents: 34
diff changeset
   172
        dialog = new EapFastProvNotSuccessNoteDialog(parameters);
34
hgs
parents: 26
diff changeset
   173
        }   
26
hgs
parents:
diff changeset
   174
    OstTraceFunctionExit0( EAPDIALOGPLUGIN_CREATEDEVICEDIALOG_EXIT );
hgs
parents:
diff changeset
   175
    qDebug("EapDialogPlugin::createDeviceDialog EXIT");
hgs
parents:
diff changeset
   176
    
36
hgs
parents: 34
diff changeset
   177
    return dialog;
26
hgs
parents:
diff changeset
   178
}
hgs
parents:
diff changeset
   179
36
hgs
parents: 34
diff changeset
   180
/*!
hgs
parents: 34
diff changeset
   181
 * Check if client is allowed to use device dialog widget. For the meantime
hgs
parents: 34
diff changeset
   182
 * this plugin doesn't perform operations that may compromise security.
hgs
parents: 34
diff changeset
   183
 * All clients are allowed to use.
hgs
parents: 34
diff changeset
   184
 *
hgs
parents: 34
diff changeset
   185
 * @param [in]  deviceDialogType Tells which Dialog type
hgs
parents: 34
diff changeset
   186
 * @param [in]  parameters Device dialog parameters
hgs
parents: 34
diff changeset
   187
 * @param [in]  securityInfo Information for Security check
hgs
parents: 34
diff changeset
   188
 * @return  returns always true
hgs
parents: 34
diff changeset
   189
 */ 
26
hgs
parents:
diff changeset
   190
bool EapDialogPlugin::accessAllowed(const QString &deviceDialogType,
hgs
parents:
diff changeset
   191
    const QVariantMap &parameters, const QVariantMap &securityInfo) const
hgs
parents:
diff changeset
   192
{
hgs
parents:
diff changeset
   193
    OstTraceFunctionEntry0( EAPDIALOGPLUGIN_ACCESSALLOWED_ENTRY );
hgs
parents:
diff changeset
   194
    
hgs
parents:
diff changeset
   195
    Q_UNUSED(deviceDialogType)
hgs
parents:
diff changeset
   196
    Q_UNUSED(parameters)
hgs
parents:
diff changeset
   197
    Q_UNUSED(securityInfo)
hgs
parents:
diff changeset
   198
hgs
parents:
diff changeset
   199
    return true;
hgs
parents:
diff changeset
   200
}
hgs
parents:
diff changeset
   201
36
hgs
parents: 34
diff changeset
   202
/*!
26
hgs
parents:
diff changeset
   203
 * Return information of device dialog the plugin creates
36
hgs
parents: 34
diff changeset
   204
 *
hgs
parents: 34
diff changeset
   205
 * @param [in]  deviceDialogType Tells which Dialog type
hgs
parents: 34
diff changeset
   206
 * @param [in]  parameters Device dialog parameters
hgs
parents: 34
diff changeset
   207
 * @param [in,out]  info Structure the plugin fills with an information 
hgs
parents: 34
diff changeset
   208
 * @return  returns always true
26
hgs
parents:
diff changeset
   209
 */ 
hgs
parents:
diff changeset
   210
bool EapDialogPlugin::deviceDialogInfo(const QString &deviceDialogType,
hgs
parents:
diff changeset
   211
    const QVariantMap &parameters, DeviceDialogInfo *info) const
hgs
parents:
diff changeset
   212
{
hgs
parents:
diff changeset
   213
    OstTraceFunctionEntry0( EAPDIALOGPLUGIN_DEVICEDIALOGINFO_ENTRY );
hgs
parents:
diff changeset
   214
    qDebug("EapDialogPlugin::deviceDialogInfo");
hgs
parents:
diff changeset
   215
    
hgs
parents:
diff changeset
   216
    Q_UNUSED(parameters)
hgs
parents:
diff changeset
   217
    Q_UNUSED(deviceDialogType)
hgs
parents:
diff changeset
   218
    
hgs
parents:
diff changeset
   219
    info->group = GenericDeviceDialogGroup;
hgs
parents:
diff changeset
   220
    info->flags = NoDeviceDialogFlags;
hgs
parents:
diff changeset
   221
    info->priority = DefaultPriority;
hgs
parents:
diff changeset
   222
    
hgs
parents:
diff changeset
   223
    OstTraceFunctionExit0( EAPDIALOGPLUGIN_DEVICEDIALOGINFO_EXIT );
hgs
parents:
diff changeset
   224
    qDebug("EapDialogPlugin::deviceDialogInfo EXIT");
hgs
parents:
diff changeset
   225
    return true;
hgs
parents:
diff changeset
   226
}
hgs
parents:
diff changeset
   227
36
hgs
parents: 34
diff changeset
   228
/*!
hgs
parents: 34
diff changeset
   229
 * Returns a list of device dialog types the plugin implements. 
hgs
parents: 34
diff changeset
   230
 *
hgs
parents: 34
diff changeset
   231
 * @return returns device dialog types this plugin implements
26
hgs
parents:
diff changeset
   232
 */ 
hgs
parents:
diff changeset
   233
QStringList EapDialogPlugin::deviceDialogTypes() const
hgs
parents:
diff changeset
   234
{
hgs
parents:
diff changeset
   235
    OstTraceFunctionEntry0( EAPDIALOGPLUGIN_DEVICEDIALOGTYPES_ENTRY );
hgs
parents:
diff changeset
   236
    qDebug("EapDialogPlugin::deviceDialogTypes");
hgs
parents:
diff changeset
   237
    
hgs
parents:
diff changeset
   238
    QStringList types;
hgs
parents:
diff changeset
   239
    const int numTypes = sizeof(dialogInfos) / sizeof(dialogInfos[0]);
hgs
parents:
diff changeset
   240
    for(int i = 0; i < numTypes; i++) {
hgs
parents:
diff changeset
   241
        types.append(dialogInfos[i].mTypeString);
hgs
parents:
diff changeset
   242
    }
hgs
parents:
diff changeset
   243
    
hgs
parents:
diff changeset
   244
    OstTraceFunctionExit0( EAPDIALOGPLUGIN_DEVICEDIALOGTYPES_EXIT );
hgs
parents:
diff changeset
   245
    return types;
hgs
parents:
diff changeset
   246
}
hgs
parents:
diff changeset
   247
36
hgs
parents: 34
diff changeset
   248
/*!
26
hgs
parents:
diff changeset
   249
 * Return plugin flags
36
hgs
parents: 34
diff changeset
   250
 *
hgs
parents: 34
diff changeset
   251
 * @return returns plugin flags
26
hgs
parents:
diff changeset
   252
 */ 
hgs
parents:
diff changeset
   253
EapDialogPlugin::PluginFlags EapDialogPlugin::pluginFlags() const
hgs
parents:
diff changeset
   254
{
hgs
parents:
diff changeset
   255
    OstTraceFunctionEntry0( EAPDIALOGPLUGIN_PLUGINFLAGS_ENTRY );   
hgs
parents:
diff changeset
   256
    OstTraceFunctionExit0( EAPDIALOGPLUGIN_PLUGINFLAGS_EXIT );
hgs
parents:
diff changeset
   257
    return NoPluginFlags;
hgs
parents:
diff changeset
   258
}
hgs
parents:
diff changeset
   259
36
hgs
parents: 34
diff changeset
   260
/*!
26
hgs
parents:
diff changeset
   261
 * The last error is not stored, not supported
36
hgs
parents: 34
diff changeset
   262
 *
hgs
parents: 34
diff changeset
   263
 * @return returns always 0
26
hgs
parents:
diff changeset
   264
 */ 
hgs
parents:
diff changeset
   265
int EapDialogPlugin::error() const
hgs
parents:
diff changeset
   266
{
hgs
parents:
diff changeset
   267
    OstTraceFunctionEntry0( EAPDIALOGPLUGIN_ERROR_ENTRY );
hgs
parents:
diff changeset
   268
    OstTraceFunctionExit0( EAPDIALOGPLUGIN_ERROR_EXIT );
hgs
parents:
diff changeset
   269
    return 0;
hgs
parents:
diff changeset
   270
}
hgs
parents:
diff changeset
   271