phoneplugins/phoneindicatorplugin/src/phoneindicatorinterface.cpp
branchGCC_SURGE
changeset 51 f39ed5e045e0
parent 30 ebdbd102c78a
parent 46 bc5a64e5bc3c
equal deleted inserted replaced
40:bab96b7ed1a4 51:f39ed5e045e0
     9  * Initial Contributors:
     9  * Initial Contributors:
    10  * Nokia Corporation - initial contribution.
    10  * Nokia Corporation - initial contribution.
    11  *
    11  *
    12  * Contributors:
    12  * Contributors:
    13  *
    13  *
    14  * Description:  
    14  * Description:
    15  *
    15  *
    16  */
    16  */
    17 
    17 
    18 #include "Phoneindicatorinterface.h"
    18 #include "phoneindicatorinterface.h"
       
    19 #include "phoneindicatorservicesendertask.h"
    19 #include "phoneindicators.h"
    20 #include "phoneindicators.h"
    20 
    21 
    21 #include <QTime>
    22 #include <QTime>
    22 #include <QStringList> 
    23 #include <QStringList>
    23 #ifdef Q_OS_SYMBIAN
    24 #include <QThreadPool>
    24 #include <logsservices.h>
       
    25 #include <xqservicerequest.h>
       
    26 #include <eikenv.h>
       
    27 #include <apgtask.h>
       
    28 
       
    29 #endif
       
    30 
    25 
    31 PhoneIndicatorInterface::PhoneIndicatorInterface(
    26 PhoneIndicatorInterface::PhoneIndicatorInterface(
    32                 const QString &indicatorType,
    27                 const QString &indicatorType,
    33                 int typeIndex,
    28                 int typeIndex,
    34                 Interaction interaction) :
    29                 Interaction interaction) :
    37         m_typeIndex(typeIndex),
    32         m_typeIndex(typeIndex),
    38         m_interaction(interaction),
    33         m_interaction(interaction),
    39         m_primaryText(IndicatorInfos[typeIndex].primaryText),
    34         m_primaryText(IndicatorInfos[typeIndex].primaryText),
    40         m_secondaryText(IndicatorInfos[typeIndex].secondaryText),
    35         m_secondaryText(IndicatorInfos[typeIndex].secondaryText),
    41         m_icon(IndicatorInfos[typeIndex].icon)
    36         m_icon(IndicatorInfos[typeIndex].icon)
    42 
       
    43 {
    37 {
    44 }
       
    45 
       
    46 PhoneIndicatorInterface::~PhoneIndicatorInterface()
       
    47 {
       
    48 
       
    49 }
    38 }
    50 
    39 
    51 bool PhoneIndicatorInterface::handleInteraction(InteractionType type)
    40 bool PhoneIndicatorInterface::handleInteraction(InteractionType type)
    52 {
    41 {
    53     if (type == InteractionActivated) {
    42     if (type == InteractionActivated) {
    54         switch (m_interaction) {
    43         switch (m_interaction) {
    55             
    44         case OpenMissedCallView:    //fallthrough
    56         case OpenMissedCallView: {
    45         case OpenCallUi:      //fallthrough
    57 #ifdef Q_OS_SYMBIAN
    46         case OpenDiverSettingsView:
    58             XQServiceRequest snd("com.nokia.services.logsservices.starter",
    47             QThreadPool::globalInstance()->start(new PhoneIndicatorServiceSenderTask(m_interaction));
    59                                  "start(int,bool)", false);
       
    60             snd << (int)LogsServices::ViewMissed;
       
    61             snd << false;
       
    62             int retValue;
       
    63             snd.send(retValue);
       
    64 
       
    65 //            LogsServices::start( LogsServices::ViewMissed, false );
       
    66 #endif
       
    67             }
       
    68             break;
       
    69         case SwitchBackToCall: {
       
    70 #ifdef Q_OS_SYMBIAN
       
    71             RWsSession& wsSession = CEikonEnv::Static()->WsSession();
       
    72             TApaTaskList taskList( wsSession );
       
    73             const TUid KUidPhoneApp = { 0x100058B3 };   // Phone application
       
    74             TApaTask task = taskList.FindApp(KUidPhoneApp);
       
    75             task.BringToForeground();
       
    76 #endif
       
    77             }
       
    78             break;
    48             break;
    79         case Deactivate:
    49         case Deactivate:
    80             emit deactivate();
    50             emit deactivate();
    81             break;
    51             break;
    82         default:
    52         default:
    88 }
    58 }
    89 
    59 
    90 QVariant PhoneIndicatorInterface::indicatorData(int role) const
    60 QVariant PhoneIndicatorInterface::indicatorData(int role) const
    91 {
    61 {
    92     QVariantMap map = m_parameter.value<QVariantMap>();
    62     QVariantMap map = m_parameter.value<QVariantMap>();
    93     
    63 
    94     if (role == PrimaryTextRole) {
    64     if (role == PrimaryTextRole) {
    95         return map.value( (QVariant(PrimaryTextRole)).toString()).toString();
    65         return map.value( (QVariant(PrimaryTextRole)).toString()).toString();
    96     } else if (role == SecondaryTextRole ) {
    66     } else if (role == SecondaryTextRole ) {
    97         return map.value( (QVariant(SecondaryTextRole)).toString()).toString();
    67         return map.value( (QVariant(SecondaryTextRole)).toString()).toString();
    98     } else if (role == MonoDecorationNameRole) {
    68     } else if (role == MonoDecorationNameRole) {
   105 
    75 
   106 bool PhoneIndicatorInterface::handleClientRequest(RequestType type, const QVariant &parameter)
    76 bool PhoneIndicatorInterface::handleClientRequest(RequestType type, const QVariant &parameter)
   107 {
    77 {
   108     bool handled(false);
    78     bool handled(false);
   109     switch (type) {
    79     switch (type) {
   110         
       
   111     case RequestActivate:
    80     case RequestActivate:
   112         if (m_parameter != parameter) {
    81         if (m_parameter != parameter) {
   113             m_parameter = parameter;
    82             m_parameter = parameter;
   114             emit dataChanged();
    83             emit dataChanged();
   115         }
    84         }
   116         handled =  true;
    85         handled =  true;
   117         break;
    86         break;
   118     default:
    87     default:
   119         m_parameter.clear();
    88         m_parameter.clear();
   120     }
    89     }
   121 
       
   122     return handled;
    90     return handled;
   123 }
    91 }
       
    92