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