pkiutilities/untrustedcertificatedialog/src/untrustedcertificateplugin.cpp
branchRCL_3
changeset 22 03674e5abf46
parent 21 09b1ac925e3f
child 23 94da73d93b58
equal deleted inserted replaced
21:09b1ac925e3f 22:03674e5abf46
     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:  Device dialog plugin that shows untrusted certificate
       
    15 *               dialog for TLS server authentication failure errors.
       
    16 *
       
    17 */
       
    18 
       
    19 #include "untrustedcertificateplugin.h"
       
    20 #include "untrustedcertificatedialog.h"
       
    21 #include "untrustedcertificatedefinitions.h"
       
    22 
       
    23 
       
    24 // ----------------------------------------------------------------------------
       
    25 // UntrustedCertificatePlugin::UntrustedCertificatePlugin()
       
    26 // ----------------------------------------------------------------------------
       
    27 //
       
    28 UntrustedCertificatePlugin::UntrustedCertificatePlugin() : mError(KErrNone)
       
    29 {
       
    30 }
       
    31 
       
    32 // ----------------------------------------------------------------------------
       
    33 // UntrustedCertificatePlugin::~UntrustedCertificatePlugin()
       
    34 // ----------------------------------------------------------------------------
       
    35 //
       
    36 UntrustedCertificatePlugin::~UntrustedCertificatePlugin()
       
    37 {
       
    38 }
       
    39 
       
    40 // ----------------------------------------------------------------------------
       
    41 // UntrustedCertificatePlugin::accessAllowed()
       
    42 // ----------------------------------------------------------------------------
       
    43 //
       
    44 bool UntrustedCertificatePlugin::accessAllowed(const QString &deviceDialogType,
       
    45     const QVariantMap &parameters, const QVariantMap &securityInfo) const
       
    46 {
       
    47     Q_UNUSED(deviceDialogType)
       
    48     Q_UNUSED(parameters)
       
    49     Q_UNUSED(securityInfo)
       
    50 
       
    51     // All clients are allowed to use.
       
    52     // TODO: should access be limited to certain clients?
       
    53     return true;
       
    54 }
       
    55 
       
    56 // ----------------------------------------------------------------------------
       
    57 // UntrustedCertificatePlugin::createDeviceDialog()
       
    58 // ----------------------------------------------------------------------------
       
    59 //
       
    60 HbDeviceDialogInterface *UntrustedCertificatePlugin::createDeviceDialog(
       
    61     const QString &deviceDialogType, const QVariantMap &parameters)
       
    62 {
       
    63     Q_UNUSED(deviceDialogType)
       
    64 
       
    65     UntrustedCertificateDialog *deviceDialog = new UntrustedCertificateDialog(parameters);
       
    66     mError = deviceDialog->deviceDialogError();
       
    67     if (mError != KErrNone) {
       
    68         delete deviceDialog;
       
    69         deviceDialog = 0;
       
    70     }
       
    71 
       
    72     return deviceDialog;
       
    73 }
       
    74 
       
    75 // ----------------------------------------------------------------------------
       
    76 // UntrustedCertificatePlugin::deviceDialogInfo()
       
    77 // ----------------------------------------------------------------------------
       
    78 //
       
    79 bool UntrustedCertificatePlugin::deviceDialogInfo( const QString &deviceDialogType,
       
    80         const QVariantMap &parameters, DeviceDialogInfo *info) const
       
    81 {
       
    82     Q_UNUSED(deviceDialogType);
       
    83     Q_UNUSED(parameters);
       
    84 
       
    85     info->group = GenericDeviceDialogGroup;
       
    86     info->flags = NoDeviceDialogFlags;
       
    87     info->priority = DefaultPriority;
       
    88 
       
    89     return true;
       
    90 }
       
    91 
       
    92 // ----------------------------------------------------------------------------
       
    93 // UntrustedCertificatePlugin::deviceDialogTypes()
       
    94 // ----------------------------------------------------------------------------
       
    95 //
       
    96 QStringList UntrustedCertificatePlugin::deviceDialogTypes() const
       
    97 {
       
    98     QStringList types;
       
    99     types << KUntrustedCertificateDialog;
       
   100     return types;
       
   101 }
       
   102 
       
   103 // ----------------------------------------------------------------------------
       
   104 // UntrustedCertificatePlugin::pluginFlags()
       
   105 // ----------------------------------------------------------------------------
       
   106 //
       
   107 HbDeviceDialogPlugin::PluginFlags UntrustedCertificatePlugin::pluginFlags() const
       
   108 {
       
   109     return NoPluginFlags;
       
   110 }
       
   111 
       
   112 // ----------------------------------------------------------------------------
       
   113 // UntrustedCertificatePlugin::error()
       
   114 // ----------------------------------------------------------------------------
       
   115 //
       
   116 int UntrustedCertificatePlugin::error() const
       
   117 {
       
   118     return mError;
       
   119 }
       
   120 
       
   121 Q_EXPORT_PLUGIN2(untrustedcertdialog,UntrustedCertificatePlugin)
       
   122