usbuis/usbindicatorplugin/inc/usbindicatorplugin.h
changeset 38 218231f2b3b3
child 56 f45583a69686
equal deleted inserted replaced
35:9d8b04ca6939 38:218231f2b3b3
       
     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: USB Indicator Plugin Class
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef USBINDICATORPLUGIN_H
       
    19 #define USBINDICATORPLUGIN_H
       
    20 
       
    21 
       
    22 #include <hbindicatorplugininterface.h>
       
    23 #include <hbindicatorinterface.h>
       
    24 #include <QTranslator>
       
    25 
       
    26 const QString ConnectedIndicator = ("com.nokia.hb.indicator.usb.device.connected/1.0");
       
    27 const QString AddressedIndicator = ("com.nokia.hb.indicator.usb.device.inprogress/1.0" );
       
    28 
       
    29 _LIT(KUSBExe, "USBSettingsApp.exe");
       
    30 const TInt KUSBUIUid = 0x2002E70C;
       
    31 
       
    32 /*!
       
    33    USB indicator plugin class. 
       
    34    Main class of USB indicator plugin. 
       
    35  */
       
    36 class UsbIndicatorPlugin : public QObject, public HbIndicatorPluginInterface
       
    37 {
       
    38     Q_OBJECT
       
    39     Q_INTERFACES(HbIndicatorPluginInterface)
       
    40 
       
    41 public:
       
    42     /*!
       
    43        Constructor
       
    44      */
       
    45     UsbIndicatorPlugin();
       
    46      
       
    47      /*!
       
    48         Destructor
       
    49       */
       
    50     ~UsbIndicatorPlugin();
       
    51     
       
    52     /*!
       
    53        @see HbIndicatorPluginInterface
       
    54      */
       
    55     QStringList indicatorTypes() const;
       
    56     
       
    57     /*!
       
    58        @see HbIndicatorPluginInterface
       
    59      */
       
    60     inline bool accessAllowed(const QString &indicatorType,
       
    61             const QVariantMap &securityInfo) const;   
       
    62     /*!
       
    63        @see HbIndicatorPluginInterface
       
    64      */
       
    65     HbIndicatorInterface* createIndicator(const QString &indicatorType);
       
    66     
       
    67     /*!
       
    68        @see HbIndicatorPluginInterface
       
    69      */
       
    70     inline int error() const;
       
    71     
       
    72 private:
       
    73     Q_DISABLE_COPY(UsbIndicatorPlugin)
       
    74     
       
    75     /*!
       
    76        Error value
       
    77      */
       
    78     int mError;
       
    79     
       
    80     /*!
       
    81        Indicator types 
       
    82        supported indicator types. 
       
    83      */
       
    84     QStringList mIndicatorTypes;
       
    85     
       
    86     bool mTranslatorLoaded;
       
    87     
       
    88     QTranslator mTranslator;
       
    89 };
       
    90 
       
    91 // ----------------------------------------------------------------------------
       
    92 // UsbIndicatorPlugin::accessAllowed
       
    93 // ----------------------------------------------------------------------------
       
    94 bool UsbIndicatorPlugin::accessAllowed(const QString &indicatorType,
       
    95     const QVariantMap &securityInfo) const
       
    96 {
       
    97     Q_UNUSED(indicatorType)
       
    98     Q_UNUSED(securityInfo)
       
    99 
       
   100     // This plugin doesn't perform operations that may compromise security.
       
   101     // All clients are allowed to use.
       
   102     return true;
       
   103 }
       
   104 
       
   105 // ----------------------------------------------------------------------------
       
   106 // UsbIndicatorPlugin::error
       
   107 // ----------------------------------------------------------------------------
       
   108 inline int UsbIndicatorPlugin::error() const
       
   109 {
       
   110     return mError;
       
   111 }
       
   112 
       
   113 
       
   114 #endif /* USBIndicatorPlugin_H */