cellular/psuinotes/src/psuiclinotehandler.cpp
changeset 53 25b8d29b7c59
equal deleted inserted replaced
51:12bc758d6a02 53:25b8d29b7c59
       
     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 
       
    18 #include <hbdevicenotificationdialog.h>
       
    19 #include <psetcliwrapper.h>
       
    20 #include "psuinotes.h"
       
    21 #include "psuiclinotehandler.h"
       
    22 #include "psuiutils.h"
       
    23 #include "psuilogging.h"
       
    24 
       
    25 /*!
       
    26   PsUiCliNoteHandler::PsUiCliNoteHandler
       
    27  */
       
    28 PsUiCliNoteHandler::PsUiCliNoteHandler(PSetCliWrapper& cliWrapper) :
       
    29     m_cliWrapper(cliWrapper)
       
    30 {
       
    31     DPRINT << ": IN";
       
    32 
       
    33     QObject::connect(
       
    34         &m_cliWrapper, 
       
    35         SIGNAL(cliInformation( const PsCallLineIdentity& )),
       
    36         this, 
       
    37         SLOT(cliInformation( const PsCallLineIdentity& )));
       
    38     QObject::connect(
       
    39         &m_cliWrapper, 
       
    40         SIGNAL(handleCliRequesting( bool, bool )),
       
    41         this, 
       
    42         SLOT(handleCliRequesting( bool, bool )));
       
    43     QObject::connect(
       
    44         &m_cliWrapper, 
       
    45         SIGNAL(handleCliError( int )),
       
    46         this, 
       
    47         SLOT(handleCliError( int )));
       
    48     
       
    49     QObject::connect(
       
    50         &m_cliWrapper, 
       
    51         SIGNAL(handleCnapStatus( int )),
       
    52         this, 
       
    53         SLOT(handleCnapStatus( int )));
       
    54 
       
    55     DPRINT << ": OUT";
       
    56 }
       
    57 
       
    58 /*!
       
    59   PsUiCliNoteHandler::~PsUiCliNoteHandler
       
    60  */
       
    61 PsUiCliNoteHandler::~PsUiCliNoteHandler()
       
    62 {
       
    63     DPRINT << ": IN";
       
    64     DPRINT << ": OUT";
       
    65 }
       
    66 
       
    67 /*!
       
    68   PsUiCliNoteHandler::handleCliInformation
       
    69  */
       
    70 void PsUiCliNoteHandler::cliInformation( 
       
    71     const PsCallLineIdentity& type)
       
    72 {
       
    73     DPRINT << ": IN";
       
    74     PsUiNotes::instance()->cancelNote(m_activeNoteId);
       
    75 
       
    76     switch (type) {
       
    77         case ClirOn:
       
    78             PsUiNotes::instance()->showGlobalNotificationDialog(
       
    79                 hbTrId("txt_phone_dpopinfo_my_caller_id_not_sent_on_calling"));
       
    80             break;
       
    81         case ClirOff:
       
    82             PsUiNotes::instance()->showGlobalNotificationDialog(
       
    83                 hbTrId("txt_phone_dpopinfo_my_caller_id_sent_on_calling"));
       
    84             break;
       
    85         case ClipOn:
       
    86             PsUiNotes::instance()->showGlobalNotificationDialog(
       
    87                 hbTrId("txt_phone_dpopinfo_number_of_caller_is_shown"));
       
    88             break;
       
    89         case ClipOff:
       
    90             PsUiNotes::instance()->showGlobalNotificationDialog(
       
    91                 hbTrId("txt_phone_dpopinfo_number_of_caller_is_not_shown"));
       
    92             break;
       
    93         case ColrOn:
       
    94             PsUiNotes::instance()->showGlobalNotificationDialog(
       
    95                 hbTrId("txt_phone_dpopinfo_my_caller_id_not_sent_on_answer"));
       
    96             break;
       
    97         case ColrOff:
       
    98             PsUiNotes::instance()->showGlobalNotificationDialog(
       
    99                 hbTrId("txt_phone_dpopinfo_my_caller_id_sent_on_answering"));
       
   100             break;
       
   101         case ColpOn:
       
   102             PsUiNotes::instance()->showGlobalNotificationDialog(
       
   103                 hbTrId("txt_phone_dpopinfo_answering_number_is_shown"));
       
   104             break;
       
   105         case ColpOff:
       
   106             PsUiNotes::instance()->showGlobalNotificationDialog(
       
   107                 hbTrId("txt_phone_dpopinfo_answering_number_is_not_shown"));
       
   108             break;
       
   109         case CliUnknown:
       
   110         default:
       
   111             PsUiNotes::instance()->showGlobalNotificationDialog(
       
   112                 hbTrId("txt_phone_info_result_unknown"));
       
   113             break;
       
   114     }
       
   115    
       
   116     DPRINT << ": OUT";
       
   117 }
       
   118 
       
   119 /*!
       
   120   PsUiCliNoteHandler::handleCliRequesting
       
   121  */
       
   122 void PsUiCliNoteHandler::handleCliRequesting(bool ongoing,bool interrupted)
       
   123 {
       
   124     DPRINT << ": IN";
       
   125     DPRINT << "ongoing:" << ongoing << ", interrupted:" << interrupted;
       
   126     
       
   127     if (interrupted) {
       
   128         PsUiNotes::instance()->cancelNote(m_activeProgressNoteId);
       
   129         PsUiNotes::instance()->cancelNote(m_activeNoteId);
       
   130     } else {
       
   131         if (ongoing) {
       
   132           PsUiNotes::instance()->showGlobalProgressNote(
       
   133               m_activeProgressNoteId, hbTrId("txt_common_info_requesting"));
       
   134       } else {
       
   135           PsUiNotes::instance()->cancelNote(m_activeProgressNoteId);
       
   136       }
       
   137     }            
       
   138     DPRINT << ": OUT";
       
   139 }
       
   140 
       
   141 /*!
       
   142 PsUiCliNoteHandler::handleCnapStatus
       
   143  */
       
   144 void PsUiCliNoteHandler::handleCnapStatus(int status)
       
   145 {
       
   146     DPRINT << ": IN";   
       
   147     switch (status) {
       
   148         case PsUiUtils::ServiceActivePermanent:
       
   149         case PsUiUtils::ServiceActiveDefaultAllowed:
       
   150             PsUiNotes::instance()->showGlobalNotificationDialog(
       
   151                 hbTrId("txt_phone_dpopinfo_name_of_caller_is_shown"));
       
   152             break;
       
   153         case PsUiUtils::ServiceActiveDefaultRestricted:
       
   154         case PsUiUtils::ServiceNotProvisioned:
       
   155             PsUiNotes::instance()->showGlobalNotificationDialog(
       
   156                 hbTrId("txt_phone_dpopinfo_name_of_caller_is_not_shown"));
       
   157             break;
       
   158         case PsUiUtils::ServiceUnknown:
       
   159         default:
       
   160             PsUiNotes::instance()->showGlobalNotificationDialog(
       
   161                 hbTrId("txt_phone_info_request_not_completed"));
       
   162             break;
       
   163     }
       
   164     DPRINT << ": OUT";
       
   165 }
       
   166 
       
   167 /*!
       
   168   PsUiCliNoteHandler::handleCliError
       
   169  */
       
   170 void PsUiCliNoteHandler::handleCliError(int error)
       
   171 {
       
   172     DPRINT << ": IN";
       
   173     DPRINT << "errorCode:" << error;
       
   174     PsUiNotes::instance()->cancelNote(m_activeNoteId);
       
   175     PsUiNotes::instance()->showGlobalErrorNote(m_activeNoteId, error);
       
   176 
       
   177     DPRINT << ": OUT";
       
   178 }