diff -r 1505405bc645 -r b01c07dfcf84 systemsettings/accindicatorplugin/tsrc/utaccindicatorplugin/CTCHTML/indexD1.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemsettings/accindicatorplugin/tsrc/utaccindicatorplugin/CTCHTML/indexD1.html Thu Oct 07 06:25:45 2010 +0300 @@ -0,0 +1,295 @@ + + +CTC++ Coverage Report - Execution Profile - accindicator.cpp + + + + + + + + +CTC++ Coverage Report - +Execution Profile +   #1/4

+Directory Summary | Files Summary | Functions Summary | Execution Profile
+To files: First | Previous | Next | Last | Index | No Index


+File: W:\sf\mw\appsupport\systemsettings\accindicatorplugin\src\accindicator.cpp
+Instrumentation mode: function-decision
+TER: 41 % ( 31/ 75)

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Start/ End/    
True False - Line Source

  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 #include "accindicator.h"
  18 
  19 #include <QtPlugin>
  20 #include <QProcess>
  21 #include <accpolgenericiddefinitions.h>
  22 
Top
- 23 Q_EXPORT_PLUGIN(AccIndicatorPlugin)
 - 23 return qt_plugin_verification_data
Top
- 23 FUNCTION qt_plugin_instance()
- 23 if (! _instance)
 - 23 return _instance
  24 const static char IndicatorType[] = "com.nokia.accessory.indicatorplugin/1.0";
  25 QString KAccMode = "AccMode";
  26 QString KAccType = "AccType";
  27 
Top
  28 AccIndicatorPlugin::AccIndicatorPlugin() :
  29 HbIndicatorInterface(IndicatorType,
  30         HbIndicatorInterface::SettingCategory,
  31         InteractionActivated)
  32     {
  33     mIndicatorTypes << "com.nokia.accessory.indicatorplugin/1.0";
  34     }
  35 
Top
- 36 AccIndicatorPlugin::~AccIndicatorPlugin()
  37     {
  38     }
  39 
  40 // ----------------------------------------------------------------------------
  41 // AccIndicatorPlugin::indicatorTypes
  42 // returns the indicator types handled by this plugin
  43 // ----------------------------------------------------------------------------
  44 
Top
  45 QStringList AccIndicatorPlugin::indicatorTypes() const
  46     {
   47     return mIndicatorTypes;
  48     }
  49 
  50 // ----------------------------------------------------------------------------
  51 // AccIndicatorPlugin::createIndicator
  52 // creates an indicator.
  53 // ----------------------------------------------------------------------------
  54 
Top
  55 HbIndicatorInterface* AccIndicatorPlugin::createIndicator(
  56         const QString &indicatorType)
  57     {
  58     Q_UNUSED(indicatorType)
   59     return this;
  60     }
  61 
  62 // ----------------------------------------------------------------------------
  63 // AccIndicatorPlugin::error
  64 // returns the error code.
  65 // ----------------------------------------------------------------------------
  66 
Top
- 67 int AccIndicatorPlugin::error() const
  68     {
 - 69     return mError;
  70     }
  71 
  72 // ----------------------------------------------------------------------------
  73 // AccIndicatorPlugin::accessAllowed
  74 // check for the access rights of the client. As there are no restrictions for 
  75 // this plugin it always returns true.
  76 // ----------------------------------------------------------------------------
  77 
Top
  78 bool AccIndicatorPlugin::accessAllowed(const QString &indicatorType,const QVariantMap &securityInfo) const
  79     {
  80     Q_UNUSED(indicatorType)
  81     Q_UNUSED(securityInfo)
  82 
   83     return true;
  84     }
  85 
  86 // ----------------------------------------------------------------------------
  87 // AccIndicator::handleInteraction
  88 // called when the user interacts with the indicator.Enable the interaction only
  89 // for headset,tty and tv-out for user to change the settings.
  90 // ----------------------------------------------------------------------------
Top
  91 bool AccIndicatorPlugin::handleInteraction(InteractionType type)
  92     {
  93     bool handled = false;
  94     if (type == InteractionActivated) 
  95         {
  96         // If it is 3-pole ( i.e., HeadSet or TTY ) and TV-Out enable the handleInteraction() to change the settings.
- 97         if(mAccMode == EAccModeWiredHeadset || mAccMode == EAccModeWirelessHeadset || mAccMode == EAccModeTextDevice || mAccMode == EAccModeTVOut )
  98             {
  99             QObject::connect( &mProcess, SIGNAL(error(QProcess::ProcessError)),                       
  100                               this, SLOT(processError(QProcess::ProcessError)));
  101 
  102             QVariant mode,type;
  103             mode.setValue((int)mAccMode); 
  104             type.setValue((int)mAccType);
  105             mArgs.append(mode.toString());
  106             mArgs.append(type.toString());
  107             
  108             // Launch the process to show the view.
  109             mProcess.start("accindicatorsettings" , mArgs);
  110             handled = true;
  111             }
  112         }
   113     return handled;
  114     }
  115 
  116 // ----------------------------------------------------------------------------
  117 // AccIndicator::indicatorData
  118 // returns the name and icon to be displayed in the universal indicator menu.
  119 // ----------------------------------------------------------------------------
Top
  120 QVariant AccIndicatorPlugin::indicatorData(int role) const
  121     {
    122     switch(role)
  123         {
  124         //for displaying the string in indicator.
   125         case PrimaryTextRole: 
  126             {
  127             QString type(mDisplayName);
   128             return type;
  129             }
  130         //for displaying the icon in indicator.
   131         case MonoDecorationNameRole:
  132             {
  133             QString iconName;
- 134             if(mAccType == KPCWired || mAccType == KPCUSB)
  135                 {
  136                 iconName = QString("z:/resource/accindicator/wired_accessory.svg");
  137                 }
- 138             else if (mAccType == KPCBluetooth || mAccType == KPCInfraRed)
  139                 {
  140                 iconName = QString("z:/resource/accindicator/wireless_accessory.svg");
  141                 }
   142             return iconName;
  143             }
 - 144         default: 
 - 145             return QVariant();      
  146         }
  147     }
  148 
  149 // ----------------------------------------------------------------------------
  150 // AccIndicatorPlugin::handleClientRequest
  151 // this function gets called when client activates plugin
  152 // ----------------------------------------------------------------------------
Top
  153 bool AccIndicatorPlugin::handleClientRequest( RequestType type, 
  154         const QVariant &parameter)
  155     {    
  156     bool handled(false);
    157     switch (type) {
   158         case RequestActivate:
  159             {
  160             // Get the params(acctype and mode) from the hbindicator.activate() which is called from sysap.
  161             
  162             QVariantMap mapValues = parameter.toMap();
- 163             if(mapValues.contains(KAccMode))
  164                 {
  165                 mAccMode = static_cast<TAccMode>(mapValues.value(KAccMode).toInt());
  166                 }
- 167             if(mapValues.contains(KAccType))
  168                 {
  169                 mAccType = mapValues.value(KAccType).toInt();
  170                 }
  171 
  172             // prepare the name to be displayed in the universal indicator menu.
  173             prepareDisplayName();
  174             emit dataChanged();
  175             handled =  true;
  176             }
   177             break;
   178         case RequestDeactivate:
  179             {
  180             // reset data 
  181             mDisplayName = QString();
  182             emit deactivate();
  183             }
   184             break;
 - 185         default:
 - 186             break;
  187     }
   188     return handled;
  189     }
  190 
  191 // ----------------------------------------------------------------------------
  192 // AccIndicator::prepareDisplayName
  193 // prepare the name to be displayed in the indicator menu.
  194 // ----------------------------------------------------------------------------
Top
  195 void AccIndicatorPlugin::prepareDisplayName()
  196     {
  197     mDisplayName.clear();
    198     switch(mAccMode)
  199         {
   200         case EAccModeWiredHeadset:
  201             mDisplayName.append(QString("Wired Headset"));
   202             break;
 - 203         case EAccModeWirelessHeadset:
  204             mDisplayName.append(QString("Wireless Headset"));
 - 205             break;
 - 206         case EAccModeWiredCarKit:
  207             mDisplayName.append(QString("Wired CarKit"));
 - 208             break;
 - 209         case EAccModeWirelessCarKit:
  210             mDisplayName.append(QString("Wireless Carkit"));
 - 211             break;
 - 212         case EAccModeTextDevice:
  213             mDisplayName.append(QString("TTY"));
 - 214             break;
 - 215         case EAccModeLoopset:
  216             mDisplayName.append(QString("LoopSet"));
 - 217             break;
 - 218         case EAccModeMusicStand:
  219             mDisplayName.append(QString("Music Stand"));
 - 220             break;
   221         case EAccModeTVOut:
  222             mDisplayName.append(QString("TV Out"));
   223             break;
 - 224         case EAccModeHeadphones:
  225             mDisplayName.append(QString("Head Phones"));
 - 226             break;
 - 227         default :
  228             mDisplayName.append(QString("Unknown"));
  229         }
  230     }
  231 
  232 // ----------------------------------------------------------------------------
  233 // AccIndicator::processError
  234 // handle the error conditions reurned by the QProcess.
  235 // ----------------------------------------------------------------------------
  236 
Top
- 237 void AccIndicatorPlugin::processError(QProcess::ProcessError err)
  238     {
    239     switch (err) {   
 - 240         case QProcess::FailedToStart: 
 - 241         case QProcess::Crashed: 
 - 242         case QProcess::Timedout: 
 - 243         case QProcess::ReadError: 
 - 244         case QProcess::WriteError: 
 - 245         case QProcess::UnknownError:
 - 246              break;  
 - 247         default:
 - 248             break;
  249         }
  250     }
***TER 41% (31/75) of SOURCE FILE accindicator.cpp

+Directory Summary | Files Summary | Functions Summary | Execution Profile
+To files: First | Previous | Next | Last | Top | Index | No Index


+