securitysettings/eapqtdialogs/src/eapdialogplugin.cpp
author hgs
Thu, 24 Jun 2010 11:23:08 +0300
changeset 34 ad1f037f1ac2
parent 26 9abfd4f00d37
child 36 c98682f98478
permissions -rw-r--r--
201025
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
/*
hgs
parents: 26
diff changeset
    19
* %version: 8 %
hgs
parents: 26
diff changeset
    20
*/
26
hgs
parents:
diff changeset
    21
hgs
parents:
diff changeset
    22
#include <hbdevicedialoginterface.h>
hgs
parents:
diff changeset
    23
#include <QVariantMap>
hgs
parents:
diff changeset
    24
#include "eapdialogplugin.h"
hgs
parents:
diff changeset
    25
#include "eapusernamepwddialog.h"
34
hgs
parents: 26
diff changeset
    26
#include "eapquerydialog.h"
hgs
parents: 26
diff changeset
    27
#include "eappasswordquerydialog.h"
hgs
parents: 26
diff changeset
    28
#include "eapfastinstallpacquerydialog.h"
hgs
parents: 26
diff changeset
    29
#include "eapfastpacstorepwquerydialog.h"
hgs
parents: 26
diff changeset
    30
#include "eapfastpacfilepwquerydialog.h"
hgs
parents: 26
diff changeset
    31
#include "eapfastcreatemasterkeyquerydialog.h"
hgs
parents: 26
diff changeset
    32
#include "eapfastprovwaitnotedialog.h"
hgs
parents: 26
diff changeset
    33
#include "eapmschapv2pwdexpirednotedialog.h"
hgs
parents: 26
diff changeset
    34
#include "eapmschapv2oldpwddialog.h"
hgs
parents: 26
diff changeset
    35
#include "eapmschapv2newpwddialog.h"
hgs
parents: 26
diff changeset
    36
#include "eapfastprovnotsuccessnotedialog.h"
26
hgs
parents:
diff changeset
    37
#include "OstTraceDefinitions.h"
hgs
parents:
diff changeset
    38
#ifdef OST_TRACE_COMPILER_IN_USE
hgs
parents:
diff changeset
    39
#endif
hgs
parents:
diff changeset
    40
hgs
parents:
diff changeset
    41
hgs
parents:
diff changeset
    42
Q_EXPORT_PLUGIN2(eapdialogplugin, EapDialogPlugin)
hgs
parents:
diff changeset
    43
hgs
parents:
diff changeset
    44
hgs
parents:
diff changeset
    45
// This plugin implements one device dialog type
hgs
parents:
diff changeset
    46
static const struct {
hgs
parents:
diff changeset
    47
    const char *mTypeString;
hgs
parents:
diff changeset
    48
} dialogInfos[] = {
hgs
parents:
diff changeset
    49
    {"com.nokia.eap.usernamepassworddialog/1.0"},
hgs
parents:
diff changeset
    50
    {"com.nokia.eap.querydialog/1.0"},
hgs
parents:
diff changeset
    51
    {"com.nokia.eap.passwordquerydialog/1.0"},
hgs
parents:
diff changeset
    52
    {"com.nokia.eap.fastinstallpacquerydialog/1.0"},
hgs
parents:
diff changeset
    53
    {"com.nokia.eap.fastpacstorepwquerydialog/1.0"},
hgs
parents:
diff changeset
    54
    {"com.nokia.eap.fastcreatemasterkeyquerydialog/1.0"},
hgs
parents:
diff changeset
    55
    {"com.nokia.eap.fastpacfilepwquerydialog/1.0"},
hgs
parents:
diff changeset
    56
    {"com.nokia.eap.fastprovwaitnotedialog/1.0"},
hgs
parents:
diff changeset
    57
    {"com.nokia.eap.mschapv2passwordexpirednotedialog/1.0"},
hgs
parents:
diff changeset
    58
    {"com.nokia.eap.mschapv2oldpassworddialog/1.0"},
hgs
parents:
diff changeset
    59
    {"com.nokia.eap.mschapv2newpassworddialog/1.0"},
hgs
parents:
diff changeset
    60
    {"com.nokia.eap.fastshowprovnotsuccessnotedialog/1.0"}
hgs
parents:
diff changeset
    61
};
hgs
parents:
diff changeset
    62
hgs
parents:
diff changeset
    63
/**
hgs
parents:
diff changeset
    64
 * Constructor
hgs
parents:
diff changeset
    65
 */ 
hgs
parents:
diff changeset
    66
EapDialogPlugin::EapDialogPlugin()
hgs
parents:
diff changeset
    67
{
hgs
parents:
diff changeset
    68
    OstTraceFunctionEntry0( EAPDIALOGPLUGIN_EAPDIALOGPLUGIN_ENTRY );
hgs
parents:
diff changeset
    69
    qDebug("EapDialogPlugin::EapDialogPlugin");
hgs
parents:
diff changeset
    70
        
hgs
parents:
diff changeset
    71
    OstTraceFunctionExit0( EAPDIALOGPLUGIN_EAPDIALOGPLUGIN_EXIT );
hgs
parents:
diff changeset
    72
}
hgs
parents:
diff changeset
    73
hgs
parents:
diff changeset
    74
/**
hgs
parents:
diff changeset
    75
 * Destructor
hgs
parents:
diff changeset
    76
 */ 
hgs
parents:
diff changeset
    77
EapDialogPlugin::~EapDialogPlugin()
hgs
parents:
diff changeset
    78
{
hgs
parents:
diff changeset
    79
    OstTraceFunctionEntry0( DUP1_EAPDIALOGPLUGIN_DEAPDIALOGPLUGIN_ENTRY );
hgs
parents:
diff changeset
    80
      
hgs
parents:
diff changeset
    81
    OstTraceFunctionExit0( EAPDIALOGPLUGIN_DEAPDIALOGPLUGIN_EXIT );
hgs
parents:
diff changeset
    82
}
hgs
parents:
diff changeset
    83
hgs
parents:
diff changeset
    84
/**
hgs
parents:
diff changeset
    85
 * Create device dialog widget
hgs
parents:
diff changeset
    86
 */ 
hgs
parents:
diff changeset
    87
HbDeviceDialogInterface *EapDialogPlugin::createDeviceDialog(
hgs
parents:
diff changeset
    88
    const QString &deviceDialogType,
hgs
parents:
diff changeset
    89
    const QVariantMap &parameters)
hgs
parents:
diff changeset
    90
{  
hgs
parents:
diff changeset
    91
    OstTraceFunctionEntry0( EAPDIALOGPLUGIN_CREATEDEVICEDIALOG_ENTRY );
hgs
parents:
diff changeset
    92
    qDebug("EapDialogPlugin::createDeviceDialog ENTER");
hgs
parents:
diff changeset
    93
        
hgs
parents:
diff changeset
    94
    if ( deviceDialogType.compare("com.nokia.eap.usernamepassworddialog/1.0") == 0 ) 
hgs
parents:
diff changeset
    95
        {
hgs
parents:
diff changeset
    96
        qDebug("EapDialogPlugin::createDeviceDialog: new EapUsernamePwdDialog");
hgs
parents:
diff changeset
    97
        return ( new EapUsernamePwdDialog(parameters) );
hgs
parents:
diff changeset
    98
        }
34
hgs
parents: 26
diff changeset
    99
    else if ( deviceDialogType.compare("com.nokia.eap.querydialog/1.0") == 0 ) 
hgs
parents: 26
diff changeset
   100
        { 
hgs
parents: 26
diff changeset
   101
        qDebug("EapDialogPlugin::createDeviceDialog: new EapQueryDialog");
hgs
parents: 26
diff changeset
   102
        return ( new EapQueryDialog(parameters) );
hgs
parents: 26
diff changeset
   103
        }
hgs
parents: 26
diff changeset
   104
    else if ( deviceDialogType.compare("com.nokia.eap.passwordquerydialog/1.0") == 0 ) 
hgs
parents: 26
diff changeset
   105
        { 
hgs
parents: 26
diff changeset
   106
        qDebug("EapDialogPlugin::createDeviceDialog: new EapPasswordQueryDialog");
hgs
parents: 26
diff changeset
   107
        return ( new EapPasswordQueryDialog(parameters) );
hgs
parents: 26
diff changeset
   108
        }
hgs
parents: 26
diff changeset
   109
    else if ( deviceDialogType.compare("com.nokia.eap.fastinstallpacquerydialog/1.0") == 0 )
hgs
parents: 26
diff changeset
   110
        {
hgs
parents: 26
diff changeset
   111
        qDebug("EapDialogPlugin::createDeviceDialog: new EapFastInstallPacQueryDialog");
hgs
parents: 26
diff changeset
   112
        return ( new EapFastInstallPacQueryDialog(parameters) );
hgs
parents: 26
diff changeset
   113
        }
hgs
parents: 26
diff changeset
   114
    else if ( deviceDialogType.compare("com.nokia.eap.fastpacstorepwquerydialog/1.0") == 0 )
hgs
parents: 26
diff changeset
   115
        {
hgs
parents: 26
diff changeset
   116
        qDebug("EapDialogPlugin::createDeviceDialog: new EapFastPacStorePwQueryDialog");
hgs
parents: 26
diff changeset
   117
        return ( new EapFastPacStorePwQueryDialog(parameters));
hgs
parents: 26
diff changeset
   118
        }   
hgs
parents: 26
diff changeset
   119
    else if ( deviceDialogType.compare("com.nokia.eap.fastcreatemasterkeyquerydialog/1.0") == 0 )
hgs
parents: 26
diff changeset
   120
        {
hgs
parents: 26
diff changeset
   121
        qDebug("EapDialogPlugin::createDeviceDialog: new EapFastCreateMasterKeyQueryDialog");
hgs
parents: 26
diff changeset
   122
        return ( new EapFastCreateMasterKeyQueryDialog(parameters) );
hgs
parents: 26
diff changeset
   123
        }  
hgs
parents: 26
diff changeset
   124
    else if ( deviceDialogType.compare("com.nokia.eap.fastpacfilepwquerydialog/1.0") == 0 )
26
hgs
parents:
diff changeset
   125
        {
34
hgs
parents: 26
diff changeset
   126
        qDebug("EapDialogPlugin::createDeviceDialog: new EapFastPacFilePwQueryDialog");
hgs
parents: 26
diff changeset
   127
        return ( new EapFastPacFilePwQueryDialog(parameters) );
hgs
parents: 26
diff changeset
   128
        }
hgs
parents: 26
diff changeset
   129
    else if ( deviceDialogType.compare("com.nokia.eap.fastprovwaitnotedialog/1.0") == 0 )
hgs
parents: 26
diff changeset
   130
        {
hgs
parents: 26
diff changeset
   131
        qDebug("EapDialogPlugin::createDeviceDialog: new EapFastProvWaitNoteDialog");
hgs
parents: 26
diff changeset
   132
        return ( new EapFastProvWaitNoteDialog(parameters) );
hgs
parents: 26
diff changeset
   133
        }  
hgs
parents: 26
diff changeset
   134
    else if ( deviceDialogType.compare("com.nokia.eap.mschapv2passwordexpirednotedialog/1.0") == 0 )
hgs
parents: 26
diff changeset
   135
        {
hgs
parents: 26
diff changeset
   136
        qDebug("EapDialogPlugin::createDeviceDialog: new EapMschapv2PwdExpNoteDialog");
hgs
parents: 26
diff changeset
   137
        return ( new EapMschapv2PwdExpNoteDialog(parameters) );
hgs
parents: 26
diff changeset
   138
        }  
hgs
parents: 26
diff changeset
   139
    else if ( deviceDialogType.compare("com.nokia.eap.mschapv2oldpassworddialog/1.0") == 0 )
hgs
parents: 26
diff changeset
   140
        {
hgs
parents: 26
diff changeset
   141
        qDebug("EapDialogPlugin::createDeviceDialog: new EapMschapv2OldPwdDialog");
hgs
parents: 26
diff changeset
   142
        return ( new EapMschapv2OldPwdDialog(parameters) );
hgs
parents: 26
diff changeset
   143
        }  
hgs
parents: 26
diff changeset
   144
    else if ( deviceDialogType.compare("com.nokia.eap.mschapv2newpassworddialog/1.0") == 0 )
hgs
parents: 26
diff changeset
   145
        {
hgs
parents: 26
diff changeset
   146
        qDebug("EapDialogPlugin::createDeviceDialog: new EapMschapv2NewPwdDialog");
hgs
parents: 26
diff changeset
   147
        return ( new EapMschapv2NewPwdDialog(parameters) );
hgs
parents: 26
diff changeset
   148
        }  
hgs
parents: 26
diff changeset
   149
    else if ( deviceDialogType.compare("com.nokia.eap.fastshowprovnotsuccessnotedialog/1.0") == 0 )
hgs
parents: 26
diff changeset
   150
        {
hgs
parents: 26
diff changeset
   151
        qDebug("EapDialogPlugin::createDeviceDialog: new EapFastProvNotSuccessNoteDialog");
hgs
parents: 26
diff changeset
   152
        return ( new EapFastProvNotSuccessNoteDialog(parameters) );
hgs
parents: 26
diff changeset
   153
        }   
26
hgs
parents:
diff changeset
   154
    OstTraceFunctionExit0( EAPDIALOGPLUGIN_CREATEDEVICEDIALOG_EXIT );
hgs
parents:
diff changeset
   155
    qDebug("EapDialogPlugin::createDeviceDialog EXIT");
hgs
parents:
diff changeset
   156
    
hgs
parents:
diff changeset
   157
    return NULL;
hgs
parents:
diff changeset
   158
}
hgs
parents:
diff changeset
   159
hgs
parents:
diff changeset
   160
/**
hgs
parents:
diff changeset
   161
 * Check if client is allowed to use device dialog widget
hgs
parents:
diff changeset
   162
 */
hgs
parents:
diff changeset
   163
bool EapDialogPlugin::accessAllowed(const QString &deviceDialogType,
hgs
parents:
diff changeset
   164
    const QVariantMap &parameters, const QVariantMap &securityInfo) const
hgs
parents:
diff changeset
   165
{
hgs
parents:
diff changeset
   166
    OstTraceFunctionEntry0( EAPDIALOGPLUGIN_ACCESSALLOWED_ENTRY );
hgs
parents:
diff changeset
   167
    
hgs
parents:
diff changeset
   168
    Q_UNUSED(deviceDialogType)
hgs
parents:
diff changeset
   169
    Q_UNUSED(parameters)
hgs
parents:
diff changeset
   170
    Q_UNUSED(securityInfo)
hgs
parents:
diff changeset
   171
hgs
parents:
diff changeset
   172
    // This plugin doesn't perform operations that may compromise security.
hgs
parents:
diff changeset
   173
    // All clients are allowed to use.
hgs
parents:
diff changeset
   174
    return true;
hgs
parents:
diff changeset
   175
}
hgs
parents:
diff changeset
   176
hgs
parents:
diff changeset
   177
/**
hgs
parents:
diff changeset
   178
 * Return information of device dialog the plugin creates
hgs
parents:
diff changeset
   179
 */ 
hgs
parents:
diff changeset
   180
bool EapDialogPlugin::deviceDialogInfo(const QString &deviceDialogType,
hgs
parents:
diff changeset
   181
    const QVariantMap &parameters, DeviceDialogInfo *info) const
hgs
parents:
diff changeset
   182
{
hgs
parents:
diff changeset
   183
    OstTraceFunctionEntry0( EAPDIALOGPLUGIN_DEVICEDIALOGINFO_ENTRY );
hgs
parents:
diff changeset
   184
    qDebug("EapDialogPlugin::deviceDialogInfo");
hgs
parents:
diff changeset
   185
    
hgs
parents:
diff changeset
   186
    Q_UNUSED(parameters)
hgs
parents:
diff changeset
   187
    Q_UNUSED(deviceDialogType)
hgs
parents:
diff changeset
   188
    
hgs
parents:
diff changeset
   189
    info->group = GenericDeviceDialogGroup;
hgs
parents:
diff changeset
   190
    info->flags = NoDeviceDialogFlags;
hgs
parents:
diff changeset
   191
    info->priority = DefaultPriority;
hgs
parents:
diff changeset
   192
    
hgs
parents:
diff changeset
   193
    OstTraceFunctionExit0( EAPDIALOGPLUGIN_DEVICEDIALOGINFO_EXIT );
hgs
parents:
diff changeset
   194
    qDebug("EapDialogPlugin::deviceDialogInfo EXIT");
hgs
parents:
diff changeset
   195
    return true;
hgs
parents:
diff changeset
   196
}
hgs
parents:
diff changeset
   197
hgs
parents:
diff changeset
   198
/**
hgs
parents:
diff changeset
   199
 * Return device dialog types this plugin implements
hgs
parents:
diff changeset
   200
 */ 
hgs
parents:
diff changeset
   201
QStringList EapDialogPlugin::deviceDialogTypes() const
hgs
parents:
diff changeset
   202
{
hgs
parents:
diff changeset
   203
    OstTraceFunctionEntry0( EAPDIALOGPLUGIN_DEVICEDIALOGTYPES_ENTRY );
hgs
parents:
diff changeset
   204
    qDebug("EapDialogPlugin::deviceDialogTypes");
hgs
parents:
diff changeset
   205
    
hgs
parents:
diff changeset
   206
    QStringList types;
hgs
parents:
diff changeset
   207
    const int numTypes = sizeof(dialogInfos) / sizeof(dialogInfos[0]);
hgs
parents:
diff changeset
   208
    for(int i = 0; i < numTypes; i++) {
hgs
parents:
diff changeset
   209
        types.append(dialogInfos[i].mTypeString);
hgs
parents:
diff changeset
   210
    }
hgs
parents:
diff changeset
   211
    
hgs
parents:
diff changeset
   212
    OstTraceFunctionExit0( EAPDIALOGPLUGIN_DEVICEDIALOGTYPES_EXIT );
hgs
parents:
diff changeset
   213
    return types;
hgs
parents:
diff changeset
   214
}
hgs
parents:
diff changeset
   215
hgs
parents:
diff changeset
   216
/**
hgs
parents:
diff changeset
   217
 * Return plugin flags
hgs
parents:
diff changeset
   218
 */ 
hgs
parents:
diff changeset
   219
EapDialogPlugin::PluginFlags EapDialogPlugin::pluginFlags() const
hgs
parents:
diff changeset
   220
{
hgs
parents:
diff changeset
   221
    OstTraceFunctionEntry0( EAPDIALOGPLUGIN_PLUGINFLAGS_ENTRY );   
hgs
parents:
diff changeset
   222
    OstTraceFunctionExit0( EAPDIALOGPLUGIN_PLUGINFLAGS_EXIT );
hgs
parents:
diff changeset
   223
    return NoPluginFlags;
hgs
parents:
diff changeset
   224
}
hgs
parents:
diff changeset
   225
hgs
parents:
diff changeset
   226
/**
hgs
parents:
diff changeset
   227
 * The last error is not stored, not supported
hgs
parents:
diff changeset
   228
 */ 
hgs
parents:
diff changeset
   229
int EapDialogPlugin::error() const
hgs
parents:
diff changeset
   230
{
hgs
parents:
diff changeset
   231
    OstTraceFunctionEntry0( EAPDIALOGPLUGIN_ERROR_ENTRY );
hgs
parents:
diff changeset
   232
    OstTraceFunctionExit0( EAPDIALOGPLUGIN_ERROR_EXIT );
hgs
parents:
diff changeset
   233
    return 0;
hgs
parents:
diff changeset
   234
}
hgs
parents:
diff changeset
   235