devicemgmtindicatorsplugin/src/dmindicatorsplugin.cpp
changeset 47 d316aecb87fd
child 50 b7aa21d67399
equal deleted inserted replaced
46:b9b00b134b0d 47:d316aecb87fd
       
     1 /*
       
     2  * Copyright (c) 2009 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: DM indicators plugin implementation
       
    15  *
       
    16  */
       
    17 
       
    18 #include <QtPlugin>
       
    19 #include <QVariant>
       
    20 #include <dmindicatorconsts.h>
       
    21 
       
    22 #include "dmindicatorsplugin.h"
       
    23 #include "dmindicator.h" 
       
    24 #include "tarmtrustindicator.h"
       
    25 #include "dmpronoteindicators.h" 
       
    26 
       
    27 
       
    28 Q_EXPORT_PLUGIN(DMIndicatorsPlugin)
       
    29 
       
    30 // Secure Clients UIDs
       
    31 TUid PolicyManagmentSecUID =
       
    32     {
       
    33     0x10207815
       
    34     };
       
    35 
       
    36 TUid ScomoSecUID =
       
    37     {
       
    38     0x200267FB
       
    39     };
       
    40 
       
    41 TUid FotaSecUID =
       
    42     {
       
    43     0x2002FF68
       
    44     };
       
    45 
       
    46 
       
    47 // ----------------------------------------------------------------------------
       
    48 // DMIndicatorsPlugin::DMIndicatorsPlugin
       
    49 // @see DMIndicatorsPlugin.h
       
    50 // ----------------------------------------------------------------------------
       
    51 DMIndicatorsPlugin::DMIndicatorsPlugin() :
       
    52     mError(0)
       
    53     {
       
    54     mIndicatorTypes.append(KDMProgressIndicatorType);
       
    55     mIndicatorTypes.append(KDMNotificationIndicatorType);
       
    56     mIndicatorTypes.append(KDMSettingsIndicatorType);
       
    57     mIndicatorTypes.append(KScomoProgressIndicatorType);
       
    58     mIndicatorTypes.append(KScomoNotificationIndicatorType);
       
    59     mSecureClients.append(PolicyManagmentSecUID);
       
    60     mSecureClients.append(ScomoSecUID);
       
    61     mSecureClients.append(FotaSecUID);
       
    62     
       
    63     }
       
    64 
       
    65 // ----------------------------------------------------------------------------
       
    66 // DMIndicatorsPlugin::~DMIndicatorsPlugin
       
    67 // @see DMIndicatorsPlugin.h
       
    68 // ----------------------------------------------------------------------------
       
    69 DMIndicatorsPlugin::~DMIndicatorsPlugin()
       
    70     {
       
    71     }
       
    72 
       
    73 // ----------------------------------------------------------------------------
       
    74 // DMIndicatorsPlugin::indicatorTypes
       
    75 // Return notification types this plugin implements
       
    76 // @see DMIndicatorsPlugin.h
       
    77 // ----------------------------------------------------------------------------
       
    78 QStringList DMIndicatorsPlugin::indicatorTypes() const
       
    79     {
       
    80     qDebug("DMIndicatorsPlugin::indicatorTypes()");
       
    81     return mIndicatorTypes;
       
    82     }
       
    83 
       
    84 // ----------------------------------------------------------------------------
       
    85 // DMIndicatorsPlugin::accessAllowed
       
    86 // Check if client is allowed to use notification widget
       
    87 // @see DMIndicatorsPlugin.h
       
    88 // ----------------------------------------------------------------------------
       
    89 bool DMIndicatorsPlugin::accessAllowed(const QString &indicatorType,
       
    90         const QVariantMap &securityInfo) const
       
    91     {
       
    92     qDebug("DMIndicatorsPlugin::accessAllowed()");
       
    93     Q_UNUSED(indicatorType)
       
    94 
       
    95 #if defined(Q_OS_SYMBIAN)
       
    96 
       
    97     TUid SecUID = TUid::Uid(securityInfo.value("sym-secureId").toUInt());
       
    98 
       
    99     if (mSecureClients.contains(SecUID))
       
   100         {
       
   101         qDebug("DMIndicatorsPlugin::accessAllowed() SecUID is secure ");
       
   102         return true;
       
   103         }
       
   104     else
       
   105         {
       
   106         qDebug("DMIndicatorsPlugin::accessAllowed() SecUID is not secure ");
       
   107         return false;
       
   108         }
       
   109 #elif
       
   110     Q_UNUSED(securityInfo)
       
   111     qDebug("DMIndicatorsPlugin::accessAllowed() not Symbian ");
       
   112     return false;
       
   113     
       
   114 #endif
       
   115     }
       
   116 
       
   117 // ----------------------------------------------------------------------------
       
   118 // DMIndicatorsPlugin::createIndicator
       
   119 // @see DMIndicatorsPlugin.h
       
   120 // ----------------------------------------------------------------------------
       
   121 HbIndicatorInterface* DMIndicatorsPlugin::createIndicator(
       
   122         const QString &indicatorType)
       
   123     {
       
   124     qDebug("DMIndicatorsPlugin::createIndicator() Start");
       
   125     HbIndicatorInterface *indicator = 0;
       
   126 
       
   127     if (indicatorType == KDMProgressIndicatorType)
       
   128         {
       
   129         indicator = new DMProNoteIndicator(indicatorType,
       
   130                 HbIndicatorInterface::ProgressCategory,
       
   131                 HbIndicatorInterface::InteractionActivated);
       
   132         }
       
   133     else if (indicatorType == KDMNotificationIndicatorType)
       
   134         {
       
   135         indicator = new DMProNoteIndicator(indicatorType,
       
   136                 HbIndicatorInterface::NotificationCategory,
       
   137                 HbIndicatorInterface::InteractionActivated);
       
   138         }
       
   139 
       
   140     else if (indicatorType == KDMSettingsIndicatorType)
       
   141         {
       
   142         indicator = new TarmTrustIndicator(indicatorType,
       
   143                 HbIndicatorInterface::SettingCategory,
       
   144                 HbIndicatorInterface::NoInteraction);
       
   145         }
       
   146     else if (indicatorType == KScomoProgressIndicatorType)
       
   147         {
       
   148         indicator = new ScomoProNoteIndicator(indicatorType,
       
   149                 HbIndicatorInterface::ProgressCategory,
       
   150                 HbIndicatorInterface::InteractionActivated);
       
   151         }
       
   152     else if (indicatorType == KScomoNotificationIndicatorType)
       
   153         {
       
   154         indicator = new ScomoProNoteIndicator(indicatorType,
       
   155                 HbIndicatorInterface::NotificationCategory,
       
   156                 HbIndicatorInterface::InteractionActivated);
       
   157         }
       
   158     
       
   159     qDebug("DMIndicatorsPlugin::createIndicator() end");
       
   160     return indicator;
       
   161     }
       
   162 
       
   163 // ----------------------------------------------------------------------------
       
   164 // DMIndicatorsPlugin::error
       
   165 // @see DMIndicatorsPlugin.h
       
   166 // ----------------------------------------------------------------------------
       
   167 int DMIndicatorsPlugin::error() const
       
   168     {
       
   169     qDebug("DMIndicatorsPlugin::error()");
       
   170     return mError;
       
   171     }
       
   172