cellular/psuinotes/src/psuiwaitingnotehandler.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 <hbdevicenotificationdialog.h>
       
    19 #include <psetcallwaitingwrapper.h>
       
    20 #include "psuinotes.h"
       
    21 #include "psuiwaitingnotehandler.h"
       
    22 #include "psuiutils.h"
       
    23 #include "psuilogging.h"
       
    24 
       
    25 /*!
       
    26   PsUiWaitingNoteHandler::PsUiWaitingNoteHandler
       
    27  */
       
    28 PsUiWaitingNoteHandler::PsUiWaitingNoteHandler(PSetCallWaitingWrapper& callWaitingWrapper) :
       
    29     m_callWaitingWrapper(callWaitingWrapper)
       
    30 {
       
    31     DPRINT << ": IN";
       
    32     
       
    33     m_settingsWrapper = new PsUiSettingsWrapper();
       
    34     
       
    35     QObject::connect(
       
    36         &m_callWaitingWrapper, 
       
    37         SIGNAL(handleCallWaitingGetStatus(
       
    38            PSetCallWaitingWrapper::PsCallWaitingStatus, const QList<unsigned char> &)),
       
    39         this, 
       
    40         SLOT(handleCallWaitingGetStatus(
       
    41            PSetCallWaitingWrapper::PsCallWaitingStatus, const QList<unsigned char> &)));
       
    42     QObject::connect(
       
    43         &m_callWaitingWrapper, 
       
    44         SIGNAL(handleCallWaitingChanged(PSetCallWaitingWrapper::PsCallWaitingCommand, int)),
       
    45         this, 
       
    46         SLOT(handleCallWaitingChanged(PSetCallWaitingWrapper::PsCallWaitingCommand, int)));
       
    47     QObject::connect(
       
    48         &m_callWaitingWrapper, 
       
    49         SIGNAL(handleCallWaitingRequesting( bool, bool )),
       
    50         this, 
       
    51         SLOT(handleCallWaitingRequesting( bool, bool )));
       
    52     QObject::connect(
       
    53         &m_callWaitingWrapper, 
       
    54         SIGNAL(handleCallWaitingError( int )),
       
    55         this, 
       
    56         SLOT(handleCallWaitingError( int )));
       
    57 
       
    58     DPRINT << ": OUT";
       
    59 }
       
    60 
       
    61 /*!
       
    62   PsUiWaitingNoteHandler::~PsUiWaitingNoteHandler
       
    63  */
       
    64 PsUiWaitingNoteHandler::~PsUiWaitingNoteHandler()
       
    65 {
       
    66     DPRINT << ": IN";
       
    67     delete m_settingsWrapper;
       
    68     DPRINT << ": OUT";
       
    69 }
       
    70 
       
    71 /*!
       
    72   PsUiWaitingNoteHandler::handleCallWaitingGetStatus
       
    73  */
       
    74 void PsUiWaitingNoteHandler::handleCallWaitingGetStatus( 
       
    75     PSetCallWaitingWrapper::PsCallWaitingStatus status,
       
    76     const QList<unsigned char> &basicServiceGroupIds)
       
    77 {
       
    78     DPRINT << ": IN";
       
    79     DPRINT << ": IN status: " << status;
       
    80     Q_UNUSED(basicServiceGroupIds);
       
    81 
       
    82     PsUiNotes::instance()->cancelNote(m_activeNoteId);
       
    83     
       
    84     if (PSetCallWaitingWrapper::StatusNotProvisioned == status && 
       
    85         m_settingsWrapper->isFeatureCallWaitingDistiquishNotProvisionedEnabled()) {
       
    86         DPRINT << ": not provisioned";
       
    87         PsUiNotes::instance()->showGlobalNotificationDialog(hbTrId("txt_phone_info_request_not_completed"));
       
    88     }
       
    89     
       
    90     else if (PSetCallWaitingWrapper::StatusActive == status) {
       
    91         DPRINT << ": status active";
       
    92         PsUiNotes::instance()->showGlobalNotificationDialog(
       
    93             hbTrId("Call waiting active")); //txt_phone_dpopinfo_call_waiting_active 
       
    94     }
       
    95     else {
       
    96         DPRINT << ": status not active";
       
    97         PsUiNotes::instance()->showGlobalNotificationDialog(
       
    98             hbTrId("Call waiting not active")); //txt_phone_dpopinfo_call_waiting_not_active      
       
    99     }
       
   100 
       
   101     DPRINT << ": OUT";   
       
   102 }
       
   103 
       
   104 /*!
       
   105   PsUiWaitingNoteHandler::handleCallWaitingChanged
       
   106  */
       
   107 void PsUiWaitingNoteHandler::handleCallWaitingChanged( 
       
   108     PSetCallWaitingWrapper::PsCallWaitingCommand setting,
       
   109     int result )
       
   110 {
       
   111     DPRINT << ": IN";
       
   112     PsUiNotes::instance()->cancelNote(m_activeNoteId);
       
   113     if (result) {
       
   114         PsUiNotes::instance()->showGlobalNote(m_activeNoteId,
       
   115         hbTrId("txt_phone_info_request_not_confirmed"), 
       
   116             HbMessageBox::MessageTypeWarning);
       
   117     } else {
       
   118         switch (setting){
       
   119             case PSetCallWaitingWrapper::ActivateCallWaiting:
       
   120                  PsUiNotes::instance()->showGlobalNotificationDialog(
       
   121                  hbTrId("txt_phone_info_call_waiting_activated"));
       
   122              break;
       
   123             case PSetCallWaitingWrapper::DeactivateCallWaiting:
       
   124                  PsUiNotes::instance()->showGlobalNotificationDialog(
       
   125                  hbTrId("txt_phone_info_call_waiting_deactivated")); 
       
   126              break;
       
   127             default: 
       
   128                  PsUiNotes::instance()->showGlobalNotificationDialog(
       
   129                  hbTrId("txt_phone_info_result_unknown"));
       
   130              break;
       
   131         }
       
   132       }
       
   133         
       
   134     DPRINT << ": OUT";
       
   135 }
       
   136 
       
   137 /*!
       
   138   PsUiWaitingNoteHandler::handleCallWaitingRequesting
       
   139  */
       
   140 void PsUiWaitingNoteHandler::handleCallWaitingRequesting( bool ongoing, bool interrupted )
       
   141 {
       
   142     DPRINT << ": IN";
       
   143     DPRINT << "ongoing:" << ongoing << ", interrupted:" << interrupted;
       
   144    
       
   145     if (ongoing) {
       
   146         PsUiNotes::instance()->showGlobalProgressNote(m_activeNoteId, hbTrId("txt_common_info_requesting"));
       
   147     }
       
   148       
       
   149     if (interrupted) {
       
   150         PsUiNotes::instance()->cancelNote(m_activeNoteId);
       
   151     }
       
   152     
       
   153      
       
   154     DPRINT << ": OUT";
       
   155 }
       
   156 
       
   157 /*!
       
   158   PsUiWaitingNoteHandler::handleCallWaitingError
       
   159  */
       
   160 void PsUiWaitingNoteHandler::handleCallWaitingError( int error )
       
   161 {
       
   162     DPRINT << ": IN";
       
   163     DPRINT << "errorCode:" << error;
       
   164     PsUiNotes::instance()->cancelNote(m_activeNoteId);     
       
   165     PsUiNotes::instance()->showGlobalErrorNote(m_activeNoteId, error);
       
   166 
       
   167     DPRINT << ": OUT";
       
   168 }