bluetoothengine/btindicator/src/btindicatorplugin.cpp
branchRCL_3
changeset 23 9386f31cc85b
parent 22 613943a21004
child 24 269724087bed
equal deleted inserted replaced
22:613943a21004 23:9386f31cc85b
     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:
       
    15  *
       
    16  */
       
    17 
       
    18 #include "btindicatorplugin.h"
       
    19 #include "btindicator.h"
       
    20 #include <hbtranslator.h>
       
    21 
       
    22 const char* BTINDICATOR_TRANSLATION = "btindimenu";
       
    23 
       
    24 Q_EXPORT_PLUGIN(BTIndicatorPlugin)
       
    25 
       
    26 // ----------------------------------------------------------------------------
       
    27 // BTIndicatorPlugin::BTIndicatorPlugin
       
    28 // ----------------------------------------------------------------------------
       
    29 BTIndicatorPlugin::BTIndicatorPlugin() : mError(0),mIndicatorTranslator(0)
       
    30 {
       
    31 }
       
    32 
       
    33 // ----------------------------------------------------------------------------
       
    34 // BTIndicatorPlugin::~BTIndicatorPlugin
       
    35 // ----------------------------------------------------------------------------
       
    36 BTIndicatorPlugin::~BTIndicatorPlugin()
       
    37 {
       
    38     delete mIndicatorTranslator;
       
    39 }
       
    40 
       
    41 // ----------------------------------------------------------------------------
       
    42 // BTIndicatorPlugin::indicatorTypes
       
    43 // Return notification types this plugin implements
       
    44 // ----------------------------------------------------------------------------
       
    45 QStringList BTIndicatorPlugin::indicatorTypes() const
       
    46 {
       
    47   QStringList types; 
       
    48   types << "com.nokia.bluetooth.indicatorplugin/1.0";
       
    49   return types;
       
    50 }
       
    51 
       
    52 // ----------------------------------------------------------------------------
       
    53 // BTIndicatorPlugin::accessAllowed
       
    54 // ----------------------------------------------------------------------------
       
    55 bool BTIndicatorPlugin::accessAllowed(const QString &indicatorType,
       
    56         const QVariantMap &securityInfo) const
       
    57 {
       
    58     Q_UNUSED(indicatorType)
       
    59     Q_UNUSED(securityInfo)
       
    60 
       
    61     // This plugin doesn't perform operations that may compromise security.
       
    62     // All clients are allowed to use.
       
    63     return true;
       
    64 }
       
    65 
       
    66 
       
    67 // ----------------------------------------------------------------------------
       
    68 // BTIndicatorPlugin::createIndicator
       
    69 // Creates and returns the HbIndicatorInterface
       
    70 // ----------------------------------------------------------------------------
       
    71 HbIndicatorInterface* BTIndicatorPlugin::createIndicator(const QString &indicatorType)
       
    72 {
       
    73     if(!mIndicatorTranslator) {
       
    74         mIndicatorTranslator = new HbTranslator(BTINDICATOR_TRANSLATION);
       
    75     }
       
    76     HbIndicatorInterface *indicator = new BTIndicator(indicatorType);
       
    77     return indicator;
       
    78 }
       
    79 
       
    80 // ----------------------------------------------------------------------------
       
    81 // BTIndicatorPlugin::error
       
    82 // ----------------------------------------------------------------------------
       
    83 int BTIndicatorPlugin::error() const
       
    84 {
       
    85     return mError;
       
    86 }
       
    87