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