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