appinstaller/AppinstUi/sifuidevicedialogplugin/src/sifuidevicedialogplugin.cpp
branchRCL_3
changeset 25 7333d7932ef7
equal deleted inserted replaced
24:5cc91383ab1e 25:7333d7932ef7
       
     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: Software install framework (SIF) device dialog plugin.
       
    15 *
       
    16 */
       
    17 
       
    18 #include "sifuidevicedialogplugin.h"
       
    19 #include "sifuidialogdefinitions.h"
       
    20 #include "sifuidialog.h"
       
    21 
       
    22 // This plugin implements one device dialog, SIF UI device dialog.
       
    23 static const char* KSifUiDeviceDialog = "com.nokia.sifui/1.0";
       
    24 static const struct {
       
    25     const char *mTypeString;
       
    26 } dialogInfos[] = {
       
    27     {KSifUiDeviceDialog}
       
    28 };
       
    29 
       
    30 
       
    31 // ======== MEMBER FUNCTIONS ========
       
    32 
       
    33 // ----------------------------------------------------------------------------
       
    34 // SifUiDeviceDialogPlugin::SifUiDeviceDialogPlugin()
       
    35 // ----------------------------------------------------------------------------
       
    36 //
       
    37 SifUiDeviceDialogPlugin::SifUiDeviceDialogPlugin() : mError(KErrNone)
       
    38 {
       
    39 }
       
    40 
       
    41 // ----------------------------------------------------------------------------
       
    42 // SifUiDeviceDialogPlugin::~SifUiDeviceDialogPlugin()
       
    43 // ----------------------------------------------------------------------------
       
    44 //
       
    45 SifUiDeviceDialogPlugin::~SifUiDeviceDialogPlugin()
       
    46 {
       
    47 }
       
    48 
       
    49 // ----------------------------------------------------------------------------
       
    50 // SifUiDeviceDialogPlugin::accessAllowed()
       
    51 // ----------------------------------------------------------------------------
       
    52 //
       
    53 bool SifUiDeviceDialogPlugin::accessAllowed(const QString &deviceDialogType,
       
    54     const QVariantMap &parameters, const QVariantMap &securityInfo) const
       
    55 {
       
    56     Q_UNUSED(deviceDialogType)
       
    57     Q_UNUSED(parameters)
       
    58     Q_UNUSED(securityInfo)
       
    59 
       
    60     // All clients are allowed to use.
       
    61     // TODO: should access be limited to certain clients?
       
    62     return true;
       
    63 }
       
    64 
       
    65 // ----------------------------------------------------------------------------
       
    66 // SifUiDeviceDialogPlugin::createDeviceDialog()
       
    67 // ----------------------------------------------------------------------------
       
    68 //
       
    69 HbDeviceDialogInterface *SifUiDeviceDialogPlugin::createDeviceDialog(
       
    70     const QString &deviceDialogType, const QVariantMap &parameters)
       
    71 {
       
    72     //  Create device dialog widget
       
    73     Q_UNUSED(deviceDialogType)
       
    74 
       
    75     SifUiDialog *deviceDialog = new SifUiDialog(parameters);
       
    76     mError = deviceDialog->deviceDialogError();
       
    77     if (mError != KErrNone) {
       
    78         delete deviceDialog;
       
    79         deviceDialog = 0;
       
    80     }
       
    81 
       
    82     return deviceDialog;
       
    83 }
       
    84 
       
    85 // ----------------------------------------------------------------------------
       
    86 // SifUiDeviceDialogPlugin::deviceDialogInfo()
       
    87 // ----------------------------------------------------------------------------
       
    88 //
       
    89 bool SifUiDeviceDialogPlugin::deviceDialogInfo( const QString &deviceDialogType,
       
    90         const QVariantMap &parameters, DeviceDialogInfo *info) const
       
    91 {
       
    92     // Return device dialog flags
       
    93     Q_UNUSED(deviceDialogType);
       
    94     Q_UNUSED(parameters);
       
    95 
       
    96     info->group = GenericDeviceDialogGroup;
       
    97     info->flags = NoDeviceDialogFlags;
       
    98     info->priority = DefaultPriority;
       
    99 
       
   100     return true;
       
   101 }
       
   102 
       
   103 // ----------------------------------------------------------------------------
       
   104 // SifUiDeviceDialogPlugin::deviceDialogTypes()
       
   105 // ----------------------------------------------------------------------------
       
   106 //
       
   107 QStringList SifUiDeviceDialogPlugin::deviceDialogTypes() const
       
   108 {
       
   109     // Return device dialog types this plugin implements
       
   110 
       
   111     QStringList types;
       
   112     const int numTypes = sizeof(dialogInfos) / sizeof(dialogInfos[0]);
       
   113     for(int i = 0; i < numTypes; ++i) {
       
   114         types.append(dialogInfos[i].mTypeString);
       
   115     }
       
   116 
       
   117     return types;
       
   118 }
       
   119 
       
   120 // ----------------------------------------------------------------------------
       
   121 // SifUiDeviceDialogPlugin::pluginFlags()
       
   122 // ----------------------------------------------------------------------------
       
   123 //
       
   124 HbDeviceDialogPlugin::PluginFlags SifUiDeviceDialogPlugin::pluginFlags() const
       
   125 {
       
   126     // Return plugin flags
       
   127     return NoPluginFlags;
       
   128 }
       
   129 
       
   130 // ----------------------------------------------------------------------------
       
   131 // SifUiDeviceDialogPlugin::error()
       
   132 // ----------------------------------------------------------------------------
       
   133 //
       
   134 int SifUiDeviceDialogPlugin::error() const
       
   135 {
       
   136     // Return last error
       
   137     return mError;
       
   138 }
       
   139 
       
   140 Q_EXPORT_PLUGIN2(SifUiDeviceDialogPlugin,SifUiDeviceDialogPlugin)
       
   141