cellular/psuinotes/src/psuidivertnotehandler.cpp
branchRCL_3
changeset 20 987c9837762f
parent 19 7d48bed6ce0c
child 21 0a6dd2dc9970
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
     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:
       
    15  *
       
    16  */
       
    17 
       
    18 #include <psetcalldivertingwrapper.h>
       
    19 #include "psuinotes.h"
       
    20 #include "psuidivertnotehandler.h"
       
    21 #include "psuilogging.h"
       
    22 
       
    23 /*!
       
    24   PsUiDivertNoteHandler::PsUiDivertNoteHandler 
       
    25  */
       
    26 PsUiDivertNoteHandler::PsUiDivertNoteHandler(PSetCallDivertingWrapper& callDivertingWrapper) :
       
    27     m_callDivertingWrapper(callDivertingWrapper)
       
    28 {
       
    29     DPRINT << ": IN";
       
    30    
       
    31     QObject::connect(
       
    32         &m_callDivertingWrapper, 
       
    33         SIGNAL(handleDivertingChanged(const PSCallDivertingCommand&,bool)),
       
    34         this, 
       
    35         SLOT(handleDivertingChanged(const PSCallDivertingCommand&,bool)));
       
    36     QObject::connect(
       
    37         &m_callDivertingWrapper, 
       
    38         SIGNAL(handleDivertingStatus(QList<PSCallDivertingStatus*>&, bool)),
       
    39         this, 
       
    40         SLOT(handleDivertingStatus(QList<PSCallDivertingStatus*>&, bool)));
       
    41     QObject::connect(
       
    42         &m_callDivertingWrapper, 
       
    43         SIGNAL(handleDivertingError(int)),
       
    44         this, 
       
    45         SLOT(handleDivertingError(int))); 
       
    46     QObject::connect(
       
    47         &m_callDivertingWrapper, 
       
    48         SIGNAL(handleCFRequesting(bool,bool)),
       
    49         this,
       
    50         SLOT(handleCFRequesting(bool,bool)));
       
    51     DPRINT << ": OUT";
       
    52 }
       
    53 
       
    54 /*!
       
    55   PsUiDivertNoteHandler::~PsUiDivertNoteHandler
       
    56  */
       
    57 PsUiDivertNoteHandler::~PsUiDivertNoteHandler()
       
    58 {  
       
    59 }
       
    60 
       
    61 /*!
       
    62   PsUiDivertNoteHandler::handleDivertingChanged
       
    63  */
       
    64 void PsUiDivertNoteHandler::handleDivertingChanged(
       
    65     const PSCallDivertingCommand& aSetting, 
       
    66     bool aPlural)
       
    67 {  
       
    68     DPRINT << ": IN";
       
    69     switch ( aSetting.iStatus ) {
       
    70         case DivertingStatusActive:
       
    71             if (aPlural) {   
       
    72                 PsUiNotes::instance()->showGlobalNotificationDialog(
       
    73                     hbTrId("txt_phone_info_diverts_activated"));
       
    74             } else {       
       
    75                 PsUiNotes::instance()->showGlobalNotificationDialog(
       
    76                     hbTrId("txt_phone_info_divert_activated"));
       
    77             }
       
    78             break;
       
    79         case DivertingStatusNotRegistered:  
       
    80         case DivertingStatusInactive:
       
    81             if (aPlural) {
       
    82                 PsUiNotes::instance()->showGlobalNotificationDialog(
       
    83                     hbTrId("txt_phone_info_diverts_deactivated"));
       
    84             } else {
       
    85                 PsUiNotes::instance()->showGlobalNotificationDialog(
       
    86                     hbTrId("txt_phone_info_divert_deactivated"));
       
    87             }
       
    88             break;
       
    89         case DivertingStatusNotProvisioned:
       
    90         case DivertingStatusUnknown:
       
    91         default:
       
    92             PsUiNotes::instance()->showGlobalNotificationDialog(
       
    93                 hbTrId("txt_phone_info_request_not_completed"));
       
    94     }
       
    95     DPRINT << ": OUT";
       
    96 }
       
    97    
       
    98 /*!
       
    99   PsUiDivertNoteHandler::handleDivertingStatus
       
   100  */
       
   101 void PsUiDivertNoteHandler::handleDivertingStatus(
       
   102     QList<PSCallDivertingStatus*>& divertList, 
       
   103     bool plural)
       
   104 {
       
   105     DPRINT << ": IN";   
       
   106     Q_UNUSED(plural);
       
   107 
       
   108     PsUiNotes::instance()->showCallDivertDetails(divertList);
       
   109     DPRINT << ": OUT";
       
   110 }
       
   111    
       
   112 /*!
       
   113   PsUiDivertNoteHandler::handleDivertingError
       
   114  */
       
   115 void PsUiDivertNoteHandler::handleDivertingError(int aReason)
       
   116 {
       
   117     DPRINT << ": IN";
       
   118     // Cancel previous note
       
   119     PsUiNotes::instance()->cancelNote(m_activeNoteId);
       
   120     // Show error note
       
   121     PsUiNotes::instance()->showGlobalErrorNote(m_activeNoteId, aReason);    
       
   122     DPRINT << ": OUT";
       
   123 }
       
   124 
       
   125 /*!
       
   126   PsUiDivertNoteHandler::handleCFRequesting
       
   127  */
       
   128 void PsUiDivertNoteHandler::handleCFRequesting(bool ongoing, bool interrupted)
       
   129 {
       
   130     DPRINT << ": IN";
       
   131     if (interrupted) {
       
   132        PsUiNotes::instance()->cancelNote(m_activeProgressNoteId);
       
   133        PsUiNotes::instance()->cancelNote(m_activeNoteId);
       
   134     } else {
       
   135        if (ongoing) {
       
   136            PsUiNotes::instance()->showGlobalProgressNote(
       
   137                m_activeProgressNoteId, hbTrId("txt_phone_info_requesting"));
       
   138        } else {
       
   139            PsUiNotes::instance()->cancelNote(m_activeProgressNoteId);
       
   140        }
       
   141     }       
       
   142     DPRINT << ": OUT";
       
   143 }