phoneapp/phoneuiqtviewadapter/src/phoneresourceadapter.cpp
changeset 37 ba76fc04e6c2
child 45 6b911d05207e
equal deleted inserted replaced
36:2eacb6118286 37:ba76fc04e6c2
       
     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:  Converts Symbian resources to PhoneAction objects.
       
    15 */
       
    16 
       
    17 #include "phoneresourceadapter.h"
       
    18 #include "phoneresourceids.h"
       
    19 #include "phoneui.hrh"
       
    20 #include "phoneuiqtbuttonscontroller.h"
       
    21 #include <phoneappvoipcommands.hrh>
       
    22 #include <QApplication>
       
    23 #include <QLocale>
       
    24 #include <QTranslator>
       
    25 #include <QtDebug>
       
    26 #include <QVariant>
       
    27 #include <hbaction.h>
       
    28 
       
    29 PhoneResourceAdapter *pinstance = 0;// initialize pointer
       
    30 
       
    31 PhoneResourceAdapter* PhoneResourceAdapter::Instance (QObject *parent) 
       
    32 {
       
    33     if (pinstance == 0)  // is it the first call?
       
    34     {  
       
    35         pinstance = new PhoneResourceAdapter (parent); // create sole instance
       
    36     }
       
    37     return pinstance; // address of sole instance
       
    38 }
       
    39   
       
    40 PhoneResourceAdapter::PhoneResourceAdapter (QObject *parent) : QObject (parent)
       
    41 {
       
    42     m_buttonsCtrl = new PhoneUIQtButtonsController();
       
    43     
       
    44 }
       
    45 
       
    46 PhoneResourceAdapter::~PhoneResourceAdapter ()
       
    47 {
       
    48     delete m_buttonsCtrl;
       
    49 }
       
    50 
       
    51 PhoneUIQtButtonsController* PhoneResourceAdapter::buttonsController ()
       
    52 {
       
    53     PhoneUIQtButtonsController* retValue = 0;
       
    54     
       
    55     if (m_buttonsCtrl) 
       
    56         {
       
    57         retValue = m_buttonsCtrl;
       
    58         }
       
    59     
       
    60     return retValue;
       
    61 }
       
    62 
       
    63 QMap<PhoneAction::ActionType, PhoneAction *> PhoneResourceAdapter::convert (int symbianResourceId, ...)
       
    64 {
       
    65     QMap<PhoneAction::ActionType, PhoneAction *> translatedActions;
       
    66     
       
    67     switch (symbianResourceId) {
       
    68     
       
    69     case R_PHONEUI_CALLHANDLING_INCOMINGCALL_CBA:
       
    70         {
       
    71         PhoneAction *leftButton = new PhoneAction;
       
    72         leftButton->setIcon (HbIcon("qtg_mono_send"));
       
    73         leftButton->setCommand(EPhoneCallComingCmdSoftReject);
       
    74         translatedActions [PhoneAction::ToolbarButton1] = leftButton;       
       
    75         
       
    76         PhoneAction *rightButton = new PhoneAction;
       
    77         rightButton->setIcon (HbIcon("qtg_mono_speaker_off"));
       
    78         rightButton->setCommand (EPhoneCallComingCmdSilent);
       
    79         translatedActions [PhoneAction::ToolbarButton2] = rightButton;            
       
    80         }
       
    81         break;
       
    82 
       
    83     case R_PHONEUI_CALLHANDLING_INCOMINGCALL_REJECT_CBA:
       
    84         {
       
    85         PhoneAction *leftButton = new PhoneAction;
       
    86         leftButton->setIcon (HbIcon("qtg_mono_send"));
       
    87         leftButton->setCommand(EPhoneCallComingCmdSoftReject);
       
    88         translatedActions [PhoneAction::ToolbarButton1] = leftButton;
       
    89                
       
    90         PhoneAction *rightButton = new PhoneAction;
       
    91         rightButton->setIcon (HbIcon("qtg_mono_reject_call"));
       
    92         rightButton->setCommand (EPhoneCallComingCmdReject);
       
    93         translatedActions [PhoneAction::ToolbarButton2] = rightButton;      
       
    94         }
       
    95         break;
       
    96         
       
    97     case R_PHONEUI_CALLHANDLING_INCOMINGCALL_SOFT_REJECT_CBA:
       
    98         {
       
    99         PhoneAction *leftButton = new PhoneAction;
       
   100         leftButton->setIcon (HbIcon("qtg_mono_send"));
       
   101         leftButton->setCommand(EPhoneCallComingCmdSoftReject);
       
   102         translatedActions [PhoneAction::ToolbarButton1] = leftButton;    
       
   103         
       
   104         PhoneAction *rightButton = new PhoneAction;
       
   105         rightButton->setIcon (HbIcon("qtg_mono_speaker_off"));
       
   106         rightButton->setDisabled(true);
       
   107         translatedActions [PhoneAction::ToolbarButton2] = rightButton;        
       
   108         }
       
   109         break;
       
   110         
       
   111     case R_PHONEUI_CALLHANDLING_CALLWAITING_CBA:        
       
   112         {
       
   113         PhoneAction *leftButton = new PhoneAction;
       
   114         leftButton->setIcon (HbIcon("qtg_mono_send"));
       
   115         leftButton->setCommand(EPhoneCallComingCmdSoftReject);
       
   116         translatedActions [PhoneAction::ToolbarButton1] = leftButton;       
       
   117         
       
   118         PhoneAction *rightButton = new PhoneAction;
       
   119         rightButton->setIcon (HbIcon("qtg_mono_join_call"));
       
   120         rightButton->setCommand (EPhoneInCallCmdJoin);
       
   121         rightButton->setDisabled(true);
       
   122         translatedActions [PhoneAction::ToolbarButton2] = rightButton;            
       
   123         }
       
   124         break;        
       
   125         
       
   126     case R_PHONEUI_DIALER_CBA:
       
   127     case R_PHONEUI_INCALL_DIALER_CBA:
       
   128     case R_PHONEUI_CALLHANDLING_CALLSETUP_EMPTY_DTMFDIALER_CBA:
       
   129     case R_PHONEUI_CALLHANDLING_INCALL_UNHOLD_CBA:
       
   130         {
       
   131         PhoneAction *leftButton = new PhoneAction;
       
   132         leftButton->setIcon (HbIcon("qtg_mono_dialer"));
       
   133         leftButton->setCommand(EPhoneInCallCmdDialer);
       
   134         translatedActions [PhoneAction::ToolbarButton1] = leftButton;
       
   135         
       
   136         PhoneAction *centerButton = new PhoneAction;
       
   137         centerButton->setIcon (HbIcon("qtg_mono_mic_mute"));
       
   138         centerButton->setCommand (EPhoneInCallCmdMute);
       
   139         translatedActions [PhoneAction::ToolbarButton2] = centerButton;        
       
   140 
       
   141         PhoneAction *centerButton2 = new PhoneAction;
       
   142         if (!m_buttonsCtrl->getButtonFlags(PhoneUIQtButtonsController::Ihf))
       
   143             {
       
   144             centerButton2->setIcon (HbIcon("qtg_mono_speaker"));
       
   145             centerButton2->setCommand (EPhoneInCallCmdActivateIhf);
       
   146             }
       
   147         else
       
   148             {
       
   149             centerButton2->setIcon (HbIcon("qtg_mono_mobile"));
       
   150             centerButton2->setCommand (EPhoneInCallCmdDeactivateIhf);
       
   151             }
       
   152         translatedActions [PhoneAction::ToolbarButton3] = centerButton2; 
       
   153         
       
   154         PhoneAction *rightButton = new PhoneAction;
       
   155         rightButton->setIcon(HbIcon("qtg_mono_contacts"));
       
   156         rightButton->setDisabled( 
       
   157                 (symbianResourceId==
       
   158                  R_PHONEUI_CALLHANDLING_CALLSETUP_EMPTY_DTMFDIALER_CBA));        
       
   159         rightButton->setCommand(EPhoneInCallCmdContacts);
       
   160         
       
   161         translatedActions[PhoneAction::ToolbarButton4] = rightButton;
       
   162         }
       
   163         break;
       
   164         
       
   165     case R_PHONEUI_CALLHANDLING_EMERGENCY_CBA:
       
   166         {
       
   167         PhoneAction *leftButton = new PhoneAction;
       
   168         leftButton->setIcon (HbIcon("qtg_mono_dialer"));
       
   169         leftButton->setCommand(EPhoneInCallCmdDialer);
       
   170         translatedActions [PhoneAction::ToolbarButton1] = leftButton;
       
   171         
       
   172         PhoneAction *rightButton = new PhoneAction;
       
   173         if (!m_buttonsCtrl->getButtonFlags(PhoneUIQtButtonsController::Ihf))
       
   174             {
       
   175             rightButton->setIcon (HbIcon("qtg_mono_speaker"));
       
   176             rightButton->setCommand (EPhoneInCallCmdActivateIhf);
       
   177             }
       
   178         else
       
   179             {
       
   180             rightButton->setIcon (HbIcon("qtg_mono_mobile"));
       
   181             rightButton->setCommand (EPhoneInCallCmdDeactivateIhf);
       
   182             }
       
   183         translatedActions [PhoneAction::ToolbarButton2] = rightButton;                    
       
   184         }
       
   185         break;
       
   186         
       
   187     case R_PHONEUI_CALLHANDLING_INCALL_UNMUTE_CBA:
       
   188         {
       
   189         PhoneAction *leftButton = new PhoneAction;
       
   190         leftButton->setIcon (HbIcon("qtg_mono_dialer"));
       
   191         leftButton->setCommand(EPhoneInCallCmdDialer);
       
   192         translatedActions [PhoneAction::ToolbarButton1] = leftButton;
       
   193         
       
   194         PhoneAction *centerButton = new PhoneAction;
       
   195         centerButton->setIcon (HbIcon("qtg_mono_mic_unmute"));
       
   196         centerButton->setCommand (EPhoneInCallCmdUnmute);
       
   197         translatedActions [PhoneAction::ToolbarButton2] = centerButton;        
       
   198 
       
   199         PhoneAction *centerButton2 = new PhoneAction;
       
   200         if (!m_buttonsCtrl->getButtonFlags(PhoneUIQtButtonsController::Ihf))
       
   201             {
       
   202             centerButton2->setIcon (HbIcon("qtg_mono_speaker"));
       
   203             centerButton2->setCommand (EPhoneInCallCmdActivateIhf);
       
   204             }
       
   205         else
       
   206             {
       
   207             centerButton2->setIcon (HbIcon("qtg_mono_mobile"));
       
   208             centerButton2->setCommand (EPhoneInCallCmdDeactivateIhf);
       
   209             }
       
   210         translatedActions [PhoneAction::ToolbarButton3] = centerButton2;     
       
   211         
       
   212         PhoneAction *rightButton = new PhoneAction;
       
   213         rightButton->setIcon(HbIcon("qtg_mono_contacts"));
       
   214         rightButton->setCommand(EPhoneInCallCmdContacts);
       
   215         translatedActions[PhoneAction::ToolbarButton4] = rightButton;   
       
   216         }
       
   217         break;
       
   218         
       
   219     case R_PHONEUI_CALLHANDLING_INCALL_HANDSET_CBA:
       
   220         {
       
   221         PhoneAction *leftButton = new PhoneAction;
       
   222         leftButton->setIcon (HbIcon("qtg_mono_dialer"));
       
   223         leftButton->setCommand(EPhoneInCallCmdDialer);
       
   224         translatedActions [PhoneAction::ToolbarButton1] = leftButton;
       
   225         
       
   226         PhoneAction *centerButton1 = new PhoneAction;
       
   227         if (!m_buttonsCtrl->getButtonFlags(PhoneUIQtButtonsController::Hold))
       
   228             {
       
   229             centerButton1->setIcon (HbIcon("qtg_mono_mic_mute"));
       
   230             centerButton1->setCommand (EPhoneInCallCmdMute);
       
   231             }
       
   232         else
       
   233             {
       
   234             centerButton1->setIcon (HbIcon("qtg_mono_mic_unmute"));
       
   235             centerButton1->setCommand (EPhoneInCallCmdUnmute);
       
   236             }
       
   237         translatedActions [PhoneAction::ToolbarButton2] = centerButton1;
       
   238 
       
   239         PhoneAction *centerButton2 = new PhoneAction;
       
   240         centerButton2->setIcon (HbIcon("qtg_mono_mobile"));
       
   241         centerButton2->setCommand (EPhoneInCallCmdDeactivateIhf);
       
   242         translatedActions [PhoneAction::ToolbarButton3] = centerButton2;
       
   243         
       
   244         PhoneAction *rightButton = new PhoneAction;
       
   245         rightButton->setIcon(HbIcon("qtg_mono_contacts"));
       
   246         rightButton->setCommand(EPhoneInCallCmdContacts);
       
   247         translatedActions[PhoneAction::ToolbarButton4] = rightButton;
       
   248         }
       
   249         break;
       
   250 
       
   251     case R_PHONEUI_MTCAL_INCOMING_CALL:
       
   252         {
       
   253         PhoneAction *text = new PhoneAction;
       
   254         text->setText (hbTrId("txt_phone_other_incoming_call"));
       
   255         translatedActions [PhoneAction::Text] = text;
       
   256         }
       
   257         break;
       
   258         
       
   259     case R_PHONEUI_INCALL_CALL_DISCONNECTED:
       
   260         {
       
   261         PhoneAction *text = new PhoneAction;
       
   262         text->setText (hbTrId("txt_phone_other_disconnected"));
       
   263         translatedActions [PhoneAction::Text] = text;
       
   264         }
       
   265         break;      
       
   266         
       
   267     case R_PHONEUI_INCALL_CALL_HELD:
       
   268         {
       
   269         PhoneAction *text = new PhoneAction;
       
   270         text->setText (hbTrId("txt_phone_other_on_hold"));
       
   271         translatedActions [PhoneAction::Text] = text;    
       
   272         break;
       
   273         }
       
   274 
       
   275     case R_PHONEUI_MULTC_WAITING:
       
   276         {
       
   277         PhoneAction *text = new PhoneAction;
       
   278         text->setText (hbTrId("txt_phone_other_waiting"));
       
   279         translatedActions [PhoneAction::Text] = text;
       
   280         }
       
   281         break; 
       
   282 
       
   283     case R_PHONEUI_INCALL_CALL_NUMBER:
       
   284         {
       
   285         PhoneAction *text = new PhoneAction;
       
   286         VA_LIST list;
       
   287         VA_START (list, symbianResourceId);
       
   288         int intValue = VA_ARG (list, int);
       
   289         text->setText(hbTrId("txt_phone_other_call_ln").arg(intValue));
       
   290         translatedActions [PhoneAction::Text] = text;
       
   291         VA_END (list);
       
   292         }
       
   293         break;
       
   294         
       
   295     case R_PHONEUI_TIME_DURAT_LONG_WITH_ZERO:
       
   296         {
       
   297         PhoneAction *text = new PhoneAction;
       
   298         // Symbian modifier used here: %:0%H%:1%T%:2%S%:3
       
   299         // This is because this text is used by Symbian localization
       
   300         // for formatting later on.
       
   301         text->setText ("%:0%H%:1%T%:2%S%:3");
       
   302         translatedActions [PhoneAction::Text] = text;
       
   303         break;
       
   304         }
       
   305         
       
   306     case R_PHONEUI_OUT_GOING_CALL:
       
   307         {
       
   308         PhoneAction *text = new PhoneAction;
       
   309         text->setText (hbTrId("txt_phone_other_calling"));
       
   310         translatedActions [PhoneAction::Text] = text;
       
   311         break;
       
   312         }
       
   313         
       
   314     case R_PHONEUI_MTCAL_CLI_WITHHELD:
       
   315         {
       
   316         PhoneAction *text = new PhoneAction;
       
   317         text->setText (hbTrId("txt_phone_other_private_number"));
       
   318         translatedActions [PhoneAction::Text] = text;
       
   319         break;
       
   320         }
       
   321     case R_PHONEUI_MTCAL_CALL:
       
   322         {
       
   323         PhoneAction *text = new PhoneAction;
       
   324         text->setText (hbTrId("txt_common_button_call")); //Call
       
   325         translatedActions [PhoneAction::Text] = text;
       
   326         break;
       
   327         }
       
   328 
       
   329     case R_PHONEUI_EMERGENCY_CALL_HEADER:
       
   330         {
       
   331         PhoneAction *text = new PhoneAction;
       
   332         text->setText (hbTrId("txt_phone_other_emergency_call"));
       
   333         translatedActions [PhoneAction::Text] = text;            
       
   334         break;            
       
   335         }
       
   336         
       
   337     case R_PHONEUI_EMERGENCY_CALL_BUTTONS:
       
   338         {
       
   339         PhoneAction *button = new PhoneAction;
       
   340         button->setText (hbTrId("txt_phone_button_end_call"));
       
   341         button->setIcon (HbIcon("qtg_mono_end_call"));
       
   342         button->setCommand (EPhoneCmdEnd);
       
   343         translatedActions [PhoneAction::LeftButton] = button;
       
   344         }
       
   345         break;
       
   346         
       
   347     case R_PHONEUI_ATTEMPTING_EMERGENCY_CALL_TEXT:
       
   348         {
       
   349         PhoneAction *text = new PhoneAction;
       
   350         text->setText (hbTrId("txt_phone_other_attempting"));
       
   351         translatedActions [PhoneAction::Text] = text;            
       
   352         }
       
   353         break;
       
   354 
       
   355     case R_PHONEUI_CONFERENCE_CALL:
       
   356         {
       
   357         PhoneAction *text = new PhoneAction;
       
   358         text->setText (hbTrId("txt_phone_other_conference_call"));
       
   359         translatedActions [PhoneAction::Text] = text; 
       
   360         }
       
   361         break;
       
   362     case R_PHONEUI_SENDING_DTMF_WAIT_NOTE_TEXT:
       
   363         {
       
   364         PhoneAction *text = new PhoneAction;
       
   365         VA_LIST list;
       
   366         VA_START (list, symbianResourceId);
       
   367         const TDesC *string = (TDesC*)VA_ARG(list, TDesC*);
       
   368         text->setText (hbTrId("txt_phone_info_sending").arg(QString::fromUtf16(string->Ptr(), 
       
   369                 string->Length())));
       
   370         translatedActions [PhoneAction::Text] = text;
       
   371         VA_END (list);
       
   372         }
       
   373         break;
       
   374     case R_PHONEUI_DTMF_WAIT_CHARACTER_CONFIRMATION_QUERY_TEXT:
       
   375         {
       
   376         PhoneAction *text = new PhoneAction;
       
   377         VA_LIST list;
       
   378         VA_START (list, symbianResourceId);
       
   379         const TDesC *string = (TDesC*)VA_ARG(list, TDesC*);
       
   380         text->setText (hbTrId("txt_phone_info_send_string").arg(QString::fromUtf16(string->Ptr(), 
       
   381                 string->Length())));
       
   382         translatedActions [PhoneAction::Text] = text;
       
   383         VA_END (list);
       
   384         }
       
   385         break;
       
   386     case R_PHONE_IMEI_STRING:
       
   387         {
       
   388         QScopedPointer<PhoneAction> text(new PhoneAction);
       
   389         VA_LIST list;
       
   390         VA_START(list, symbianResourceId);
       
   391         const TDesC *string = static_cast<TDesC*>(VA_ARG(list, TDesC*));
       
   392         QString serialNumber = 
       
   393             QString::fromUtf16(string->Ptr(), string->Length());
       
   394         text->setText(hbTrId("txt_phone_info_serial_no").arg(serialNumber));
       
   395         translatedActions[PhoneAction::Text] = text.take();
       
   396         VA_END(list);
       
   397         }
       
   398         break;
       
   399     case R_PHONEUI_LIFE_TIMER_STRING:
       
   400         {
       
   401         QScopedPointer<PhoneAction> text(new PhoneAction);
       
   402         VA_LIST list;
       
   403         VA_START(list, symbianResourceId);
       
   404         const TDesC *string = static_cast<TDesC*>(VA_ARG(list, TDesC*));
       
   405         QString lifeTimerText =
       
   406             QString::fromUtf16(string->Ptr(), string->Length());
       
   407         text->setText(hbTrId("txt_phone_info_life_timer").arg(lifeTimerText));
       
   408         translatedActions[PhoneAction::Text] = text.take();
       
   409         VA_END(list);
       
   410         }
       
   411         break;
       
   412     default:
       
   413         break;
       
   414     }
       
   415     
       
   416     return translatedActions;
       
   417 }
       
   418 
       
   419 QString PhoneResourceAdapter::convertToString(int symbianResourceId) const
       
   420 {
       
   421     QString ret;
       
   422     
       
   423     switch (symbianResourceId) {
       
   424         case R_PHONE_ERROR_CALL_NOT_ALLOWED:
       
   425             {
       
   426             ret = hbTrId("txt_phone_dpopinfo_not_allowed");      
       
   427             }
       
   428             break;
       
   429             
       
   430         case R_ERROR_NOTE_NOT_ALLOWED:
       
   431             {
       
   432             ret =  hbTrId("txt_phone_dpopinfo_not_allowed");  
       
   433             }
       
   434             break;
       
   435             
       
   436         case R_NOTETEXT_INVALID_PHONENUMBER:
       
   437             {
       
   438             ret = hbTrId("txt_phone_info_invalid_phone_number"); 
       
   439             }
       
   440             break;
       
   441             
       
   442         case R_NOTETEXT_NO_ANSWER:
       
   443             {
       
   444             ret = hbTrId("txt_phone_info_no_answer"); 
       
   445             }
       
   446             break;
       
   447         
       
   448         case R_PHONE_ERROR_NUMBER_BUSY:
       
   449             {
       
   450             ret = hbTrId("txt_phone_info_number_busy"); 
       
   451             }
       
   452             break;
       
   453             
       
   454         case R_PHONE_SS_NOTIFICATION_MOCAL_WAITING_TEXT:
       
   455             {
       
   456             ret = hbTrId("txt_phone_other_waiting");
       
   457             }
       
   458             break;
       
   459             
       
   460         case R_PHONE_SS_NOTIFICATION_INCAL_INFO_HOLD_TEXT:
       
   461             {
       
   462             ret = hbTrId("txt_phone_other_on_hold");
       
   463             }
       
   464             break;
       
   465             
       
   466         case R_INCAL_INFO_HOLD_TEXT:
       
   467             {
       
   468             ret = hbTrId("txt_phone_other_on_hold");
       
   469             }
       
   470             break;
       
   471             
       
   472         case R_INCAL_REMOTE_ACTIVE_TEXT:
       
   473             {
       
   474             ret = hbTrId("txt_phone_info_connected");
       
   475             }
       
   476             break;
       
   477             
       
   478         case R_INCAL_INFO_CONF_HOLD_TEXT:
       
   479             {
       
   480             ret = hbTrId("Conference on hold");
       
   481             }
       
   482             break;
       
   483         case R_PHONE_INCALL_INFO_NO_NETWORK_SUPPORT:
       
   484             {
       
   485             ret = hbTrId("txt_phone_info_no_network_support_for_video_call");
       
   486             }
       
   487             break;
       
   488         case R_PHONE_ERROR_EMERGENCY_CALLS_ONLY:
       
   489             {
       
   490             ret = hbTrId("txt_phone_info_emergency_calls_only");         
       
   491             }
       
   492             break;
       
   493         case R_NOTETEXT_NUMBER_NOT_IN_USE:
       
   494             {
       
   495             ret = hbTrId("txt_phone_info_number_not_in_use");         
       
   496             }
       
   497             break;
       
   498         case R_NOTETEXT_NETWORK_BUSY:
       
   499             {
       
   500             ret = hbTrId("txt_phone_info_network_busy");         
       
   501             }
       
   502             break;
       
   503         case R_NOTETEXT_ERROR_IN_CONNECTION:
       
   504             {
       
   505             ret = hbTrId("txt_phone_info_error_in_connection");         
       
   506             }
       
   507             break;
       
   508         case R_PHONEUI_ERROR_EMERGENCY_ATTEMPT_FAILED:
       
   509             {
       
   510             ret = hbTrId("txt_phone_info_emergency_call_failed");         
       
   511             }
       
   512             break;
       
   513         case R_PHONE_SS_NOTIFICATION_INCAL_TRANSFERRED_TEXT:
       
   514             {
       
   515             ret = hbTrId("txt_phone_info_transferred");         
       
   516             }
       
   517             break;
       
   518         case R_PHONE_ERROR_NO_SERVICE:
       
   519             {
       
   520             ret = hbTrId("txt_phone_dpopinfo_no_network_coverage");         
       
   521             }
       
   522             break;
       
   523         default:
       
   524             break;
       
   525     }
       
   526 
       
   527     return ret;
       
   528 }
       
   529 
       
   530 QString PhoneResourceAdapter::convertToString(
       
   531         int symbianResourceId, const QString &text) const
       
   532 {
       
   533     QString ret;
       
   534     
       
   535     switch (symbianResourceId) {
       
   536 
       
   537         case R_PHONE_TEXT_COLP_CONNECTED:
       
   538             {
       
   539             ret = hbTrId("txt_phone_info_connected_to_1").arg(text);
       
   540             }
       
   541             break;
       
   542         default:
       
   543             break;
       
   544     }
       
   545 
       
   546     return ret;
       
   547 }
       
   548 
       
   549 int PhoneResourceAdapter::defaultToolbarResourceId() const
       
   550 {
       
   551     return R_PHONEUI_INCALL_DIALER_CBA; //R_PHONEUI_CALLHANDLING_INCOMINGCALL_CBA;
       
   552 }
       
   553 
       
   554 QString PhoneResourceAdapter::convertCommandToString(
       
   555         int symbianCommandId ) const
       
   556 {
       
   557     QString ret;
       
   558     
       
   559     switch(symbianCommandId) {
       
   560     case EPhoneInCallCmdEndAllCalls:
       
   561         ret = hbTrId("txt_phone_opt_end_all_calls");
       
   562         break;     
       
   563     case EPhoneInCallCmdTransfer:
       
   564         ret = hbTrId("txt_phone_opt_transfer");
       
   565         break;    
       
   566     case EPhoneInCallCmdSwitchToVideo:
       
   567         ret = hbTrId("Call back with video call");
       
   568         break;  
       
   569     case EPhoneCmdHandoverToWlan:
       
   570         ret = hbTrId("Handover to WLAN");
       
   571         break;  
       
   572     case EPhoneCmdHandoverToGsm:
       
   573         ret = hbTrId("Handover to GSM");
       
   574         break;  
       
   575         
       
   576     // TODO
       
   577     default:
       
   578         break;
       
   579     }
       
   580 
       
   581     return ret;
       
   582 }
       
   583 
       
   584 QList<HbAction*> PhoneResourceAdapter::convertToHbActions(
       
   585         int symbianResourceId ) const
       
   586 {
       
   587     QList<HbAction*> ret;
       
   588     
       
   589     switch(symbianResourceId) {
       
   590         case R_PHONEUI_DTMF_WAIT_CHARACTER_CONFIRMATION_QUERY:
       
   591             {
       
   592             HbAction *leftButton = new HbAction(hbTrId("txt_common_button_send"));
       
   593             leftButton->setData(QVariant(EPhoneInCallCmdContinueSendingDtmfString));
       
   594             ret.append(leftButton);
       
   595     
       
   596             HbAction *rightButton = new HbAction(hbTrId("txt_common_button_cancel"));
       
   597             rightButton->setData(QVariant(EPhoneInCallCmdCancelSendingDtmfString));
       
   598             ret.append(rightButton);
       
   599             }
       
   600             break;
       
   601         case R_PHONEUI_SENDING_DTMF_WAIT_NOTE:
       
   602             {     
       
   603             HbAction *button = new HbAction(hbTrId("txt_common_button_cancel"));
       
   604             button->setData(QVariant(EPhoneInCallCmdCancelSendingDtmfString));
       
   605             ret.append(button); 
       
   606             }
       
   607             break;
       
   608         default:
       
   609             break;
       
   610     }
       
   611 
       
   612     return ret;
       
   613 }
       
   614