phoneapp/phoneuiqtviewadapter/src/phoneuiqtviewadapter.cpp
branchGCC_SURGE
changeset 51 f39ed5e045e0
parent 30 ebdbd102c78a
parent 46 bc5a64e5bc3c
equal deleted inserted replaced
40:bab96b7ed1a4 51:f39ed5e045e0
    24 #include "tphonecmdparamaudiooutput.h"
    24 #include "tphonecmdparamaudiooutput.h"
    25 #include "tphonecmdparamcallstatedata.h"
    25 #include "tphonecmdparamcallstatedata.h"
    26 #include "tphonecmdparamcallheaderdata.h"
    26 #include "tphonecmdparamcallheaderdata.h"
    27 #include "tphonecmdparamemergencycallheaderdata.h"
    27 #include "tphonecmdparamemergencycallheaderdata.h"
    28 #include "tphonecmdparamstring.h"
    28 #include "tphonecmdparamstring.h"
       
    29 #include "tphonecmdparamkeycapture.h"
    29 #include "cphonepubsubproxy.h"
    30 #include "cphonepubsubproxy.h"
    30 #include "pevirtualengine.h"
    31 #include "pevirtualengine.h"
    31 #include "cphonepubsubproxy.h"
       
    32 #include "cphoneringingtonecontroller.h"
    32 #include "cphoneringingtonecontroller.h"
    33 #include "phoneresourceadapter.h"
    33 #include "phoneresourceadapter.h"
    34 #include "phoneui.hrh"
    34 #include "phoneui.hrh"
    35 #include "cphonemediatorfactory.h"
    35 #include "cphonemediatorfactory.h"
    36 #include "phoneuiqtbuttonscontroller.h"
    36 #include "phoneuiqtbuttonscontroller.h"
    39 #include "telephonyservice.h"
    39 #include "telephonyservice.h"
    40 #include "phoneuicommandcontroller.h"
    40 #include "phoneuicommandcontroller.h"
    41 #include "phonemessagecontroller.h"
    41 #include "phonemessagecontroller.h"
    42 #include "phoneindicatorcontroller.h"
    42 #include "phoneindicatorcontroller.h"
    43 #include "qtphonelog.h"
    43 #include "qtphonelog.h"
       
    44 #include "phonevisibilityhandler.h"
       
    45 #include "phoneapplauncher.h"
       
    46 #include "cphonecenrepproxy.h"
       
    47 
    44 #include <UikonInternalPSKeys.h>
    48 #include <UikonInternalPSKeys.h>
    45 #include <bubblemanagerif.h>
    49 #include <bubblemanagerif.h>
    46 #include <hbaction.h>
    50 #include <hbaction.h>
    47 #include <pevirtualengine.h>
    51 #include <pevirtualengine.h>
    48 #include <xqservicerequest.h>
       
    49 #include <QtGlobal>
    52 #include <QtGlobal>
    50 #include <xqserviceutil.h>
    53 #include <xqserviceutil.h>
    51 #include <hbinstance.h>
    54 #include <hbinstance.h>
    52 #include <QKeyEvent>
    55 #include <QKeyEvent>
    53 #include <hbextendedlocale.h>
    56 #include <hbextendedlocale.h>
    54 #include <hbi18ndef.h>
    57 #include <hbi18ndef.h>
    55 #include <eikenv.h>
    58 #include <eikenv.h>
    56 #include <w32std.h>
    59 #include <w32std.h>
    57 #include <apgtask.h>
       
    58 #include <hbstringutil.h>
    60 #include <hbstringutil.h>
    59 #include <telinformationpskeys.h>
       
    60 #include <AknSgcc.h>
    61 #include <AknSgcc.h>
    61 #include <AknCapServerClient.h>
    62 #include <AknCapServerClient.h>
       
    63 #include <logsservices.h>
       
    64 
    62 
    65 
    63 
    66 
    64 //CONSTANTS
    67 //CONSTANTS
    65 static const int PHONE_CALL_NOT_FOUND = -1;
    68 static const int PHONE_CALL_NOT_FOUND = -1;
    66 
    69 
       
    70 const TUid KCRUidTelTouchButtons = {0x2001B2E6};
       
    71 const TUint32 KTelIncallTouchButtons   = 0x00000001;
       
    72 
       
    73 
    67 PhoneUIQtViewAdapter::PhoneUIQtViewAdapter (PhoneUIQtViewIF &view, QObject *parent) :
    74 PhoneUIQtViewAdapter::PhoneUIQtViewAdapter (PhoneUIQtViewIF &view, QObject *parent) :
    68     QObject (parent), m_view (view), m_idleUid(-1),
    75     QObject (parent),
    69     m_dialpadAboutToClose(false), m_homeScreenToForeground(false),
    76     m_view (view),
    70     m_carModeEnabled(false)
    77     m_idleUid(-1),
       
    78     m_bubbleWrapper(0),
       
    79     m_ringingtonecontroller(0),
       
    80     m_resourceAdapter(0),
       
    81     m_noteController(0),
       
    82     m_telephonyService(0),
       
    83     m_uiCommandController(0),
       
    84     m_messageController(0),
       
    85     m_indicatorController(0),
       
    86     m_dialpadAboutToClose(false),
       
    87     m_homeScreenToForeground(false),
       
    88     m_visibilityHandler(0),
       
    89     m_appLauncher(0),
       
    90     m_clearDialpadOnClose(true),
       
    91     m_speakerAsDefaultButton(false)
    71 {
    92 {
    72     m_bubbleWrapper = new PhoneBubbleWrapper(m_view.bubbleManager (), this);
    93     m_bubbleWrapper = new PhoneBubbleWrapper(m_view.bubbleManager (), this);
    73     m_noteController = new PhoneNoteController(this);
    94     m_noteController = new PhoneNoteController(this);
    74     m_uiCommandController = new PhoneUiCommandController(view, this);
    95     m_uiCommandController = new PhoneUiCommandController(view, this);
    75     m_messageController = new PhoneMessageController(this);
       
    76 
    96 
    77     TRAPD( error, m_ringingtonecontroller = CPhoneRingingToneController::NewL () );
    97     TRAPD( error, m_ringingtonecontroller = CPhoneRingingToneController::NewL () );
    78     qt_symbian_throwIfError(error);
    98     qt_symbian_throwIfError(error);
    79     m_resourceAdapter = PhoneResourceAdapter::Instance(this);
    99     m_resourceAdapter = PhoneResourceAdapter::Instance(this);
    80 
   100 
    83     intParam.SetInteger(m_resourceAdapter->defaultToolbarResourceId());
   103     intParam.SetInteger(m_resourceAdapter->defaultToolbarResourceId());
    84     setToolbarButtons(&intParam);
   104     setToolbarButtons(&intParam);
    85 
   105 
    86     m_telephonyService = new TelephonyService (this, this);
   106     m_telephonyService = new TelephonyService (this, this);
    87 	m_indicatorController = new PhoneIndicatorController(this);
   107 	m_indicatorController = new PhoneIndicatorController(this);
    88 
   108     m_visibilityHandler = new PhoneVisibilityHandler(view, this);
    89     // Define car mode pub sub key
   109     m_appLauncher = new PhoneAppLauncher(this);
    90     int err = RProperty::Define(
   110     m_messageController = new PhoneMessageController(*m_appLauncher, this);
    91         KPSUidTelCarMode,
   111     
    92         KTelCarMode,
   112     int touchButton(-1);
    93         RProperty::EInt,
   113     if ( KErrNone == CPhoneCenRepProxy::Instance()->GetInt(
    94         KPhoneReadPolicy,
   114             KCRUidTelTouchButtons,
    95         KPhoneWritePolicy);
   115             KTelIncallTouchButtons,
    96     
   116             touchButton ) ) {
    97     // Start listening to car mode changes
   117         if ( touchButton == 2 ) {
    98     if(err == KErrNone) {
   118             m_speakerAsDefaultButton = true;
    99         CPhonePubSubProxy::Instance()->NotifyChangeL(KPSUidTelCarMode,
   119         }    
   100             KTelCarMode, this);
   120     }
   101     }
   121 
   102 }
   122 }
   103 
   123 
   104 PhoneUIQtViewAdapter::~PhoneUIQtViewAdapter ()
   124 PhoneUIQtViewAdapter::~PhoneUIQtViewAdapter ()
   105 {
   125 {
   106     delete m_ringingtonecontroller;
   126     delete m_ringingtonecontroller;
   147         removeConferenceBubble();
   167         removeConferenceBubble();
   148         break;
   168         break;
   149 
   169 
   150     case EPhoneViewSendToBackground:
   170     case EPhoneViewSendToBackground:
   151     case EPhoneViewBringIdleToForeground:
   171     case EPhoneViewBringIdleToForeground:
   152         if (m_homeScreenToForeground) {
   172         m_visibilityHandler->sendToBackground(m_homeScreenToForeground);
   153             RWsSession& wsSession = CEikonEnv::Static()->WsSession();
       
   154 
       
   155             TApaTaskList taskList( wsSession );
       
   156             _LIT(KPhoneHsAppName,"hsapplication");
       
   157             TApaTask task = taskList.FindApp(KPhoneHsAppName);
       
   158             task.BringToForeground();
       
   159         } else {
       
   160             XQServiceUtil::toBackground(true);
       
   161         }
       
   162 
       
   163         m_homeScreenToForeground = false;
   173         m_homeScreenToForeground = false;
   164         break;
   174         break;
   165     case EPhoneViewRemoveAllCallHeaders:
   175     case EPhoneViewRemoveAllCallHeaders:
   166         removeAllCallHeaders();
   176         removeAllCallHeaders();
   167         break;
   177         break;
   207         int bubble = m_bubbleWrapper->bubbles().value(aCallId);
   217         int bubble = m_bubbleWrapper->bubbles().value(aCallId);
   208         m_view.clearBubbleCommands(bubble);
   218         m_view.clearBubbleCommands(bubble);
   209         m_view.removeExpandAction(bubble);
   219         m_view.removeExpandAction(bubble);
   210         m_bubbleWrapper->removeCallHeader (aCallId);
   220         m_bubbleWrapper->removeCallHeader (aCallId);
   211         m_bubbleWrapper->bubbleManager().endChanges();
   221         m_bubbleWrapper->bubbleManager().endChanges();
   212         m_indicatorController->clearActiveCallData();
   222         
       
   223         if (!m_bubbleWrapper->bubbles().count()) {
       
   224             m_indicatorController->clearActiveCallData();
       
   225         }
   213         }
   226         }
   214         break;
   227         break;
   215     case EPhoneViewRemoveFromConference:
   228     case EPhoneViewRemoveFromConference:
   216         removeCallFromConference(aCallId);
   229         removeCallFromConference(aCallId);
   217         break;
   230         break;
   284         break;
   297         break;
   285     case EPhoneViewShowQuery:
   298     case EPhoneViewShowQuery:
   286         m_noteController->showQuery(aCommandParam);
   299         m_noteController->showQuery(aCommandParam);
   287         break;
   300         break;
   288     case EPhoneViewOpenSoftRejectEditor:
   301     case EPhoneViewOpenSoftRejectEditor:
       
   302         m_visibilityHandler->hideDeviceDialogs(false);
   289         m_messageController->openSoftRejectMessageEditor(aCommandParam);
   303         m_messageController->openSoftRejectMessageEditor(aCommandParam);
       
   304         break;
       
   305     case EPhoneViewSetGlobalNotifiersDisabled:
       
   306         hideDeviceDialogs(aCommandParam);
       
   307         break;
       
   308     case EPhoneViewLaunchLogs: 
       
   309         openLogs(aCommandParam);
   290         break;
   310         break;
   291     default:
   311     default:
   292         break;
   312         break;
   293     }
   313     }
   294     CPhoneMediatorFactory::Instance()->Sender()->SendEvent( aCmdId, *aCommandParam );
   314     CPhoneMediatorFactory::Instance()->Sender()->SendEvent( aCmdId, *aCommandParam );
   454     case EPhoneViewHsToForegroundAfterCall: {
   474     case EPhoneViewHsToForegroundAfterCall: {
   455         TPhoneCmdParamBoolean *param = static_cast<TPhoneCmdParamBoolean *>(aCommandParam);
   475         TPhoneCmdParamBoolean *param = static_cast<TPhoneCmdParamBoolean *>(aCommandParam);
   456         m_homeScreenToForeground = param->Boolean();
   476         m_homeScreenToForeground = param->Boolean();
   457         }
   477         }
   458         break;
   478         break;
       
   479     case EPhoneViewSetIhfFlag: {
       
   480         TPhoneCmdParamBoolean *param = static_cast<TPhoneCmdParamBoolean *>(aCommandParam);
       
   481 
       
   482         PhoneResourceAdapter::Instance()->buttonsController()->
       
   483                 setButtonFlags(PhoneUIQtButtonsController::Ihf, 
       
   484                                param->Boolean());
       
   485         }
       
   486         break;
       
   487     case EPhoneViewSetMuteFlag: {
       
   488         TPhoneCmdParamBoolean *param = static_cast<TPhoneCmdParamBoolean *>(aCommandParam);
       
   489 
       
   490         PhoneResourceAdapter::Instance()->buttonsController()->
       
   491                 setButtonFlags(PhoneUIQtButtonsController::Mute, 
       
   492                                param->Boolean());
       
   493         }
       
   494         break;
       
   495     case EPhoneViewSetBlueToothFlag: {
       
   496         TPhoneCmdParamBoolean *param = static_cast<TPhoneCmdParamBoolean *>(aCommandParam);
       
   497 
       
   498         PhoneResourceAdapter::Instance()->buttonsController()->
       
   499                 setButtonFlags(PhoneUIQtButtonsController::Btaa, 
       
   500                                param->Boolean());
       
   501         }
       
   502         break;
       
   503     case EPhoneViewSetBluetoothAvailableFlag: {
       
   504         TPhoneCmdParamBoolean *param = static_cast<TPhoneCmdParamBoolean *>(aCommandParam);
       
   505     
       
   506         PhoneResourceAdapter::Instance()->buttonsController()->
       
   507                 setButtonFlags(PhoneUIQtButtonsController::BluetoothAvailable, 
       
   508                                param->Boolean());
       
   509         }
       
   510         break;
       
   511     case EPhoneViewStartCapturingKey: {
       
   512         TPhoneCmdParamKeyCapture *captureParam = 
       
   513                 static_cast<TPhoneCmdParamKeyCapture *>(aCommandParam);        
       
   514         Qt::Key qtKey;
       
   515         
       
   516         if (convertKey(captureParam->KeyCode(), qtKey)) {
       
   517             m_view.captureKey(qtKey, true);
       
   518         }
       
   519     }
       
   520     break;
       
   521     case EPhoneViewStopCapturingKey: {
       
   522         TPhoneCmdParamKeyCapture *captureParam = 
       
   523                 static_cast<TPhoneCmdParamKeyCapture *>(aCommandParam);        
       
   524         Qt::Key qtKey;
       
   525         
       
   526         if (convertKey(captureParam->KeyCode(), qtKey)) {
       
   527             m_view.captureKey(qtKey, false);
       
   528         }
       
   529     }
       
   530     break;
   459     default:
   531     default:
   460         break;
   532         break;
   461     }
   533     }
   462 }
   534 }
   463 
   535 
   466     return KNullDesC;
   538     return KNullDesC;
   467 }
   539 }
   468 
   540 
   469 void PhoneUIQtViewAdapter::dialpadClosed()
   541 void PhoneUIQtViewAdapter::dialpadClosed()
   470 {
   542 {
       
   543     if (m_clearDialpadOnClose) {
       
   544         m_view.clearDialpad();
       
   545     }
   471     m_dialpadAboutToClose = true;
   546     m_dialpadAboutToClose = true;
       
   547     m_clearDialpadOnClose = true;
   472     setCallMenu();
   548     setCallMenu();
   473 }
   549 }
   474 
   550 
   475 PhoneNoteController* PhoneUIQtViewAdapter::noteController() const
   551 PhoneNoteController* PhoneUIQtViewAdapter::noteController() const
   476 {
   552 {
   557     m_bubbleWrapper->bubbleManager ().endChanges ();
   633     m_bubbleWrapper->bubbleManager ().endChanges ();
   558     
   634     
   559     if (1 == m_bubbleWrapper->bubbles().keys().count()) {
   635     if (1 == m_bubbleWrapper->bubbles().keys().count()) {
   560         setHidden(false);
   636         setHidden(false);
   561     }
   637     }
   562     m_indicatorController->setActiveCallData( data.CLIText(), KNullDesC );
   638     m_indicatorController->setActiveCallData();
   563 }
   639 }
   564 
   640 
   565 void PhoneUIQtViewAdapter::createEmergencyCallHeader(
   641 void PhoneUIQtViewAdapter::createEmergencyCallHeader(
   566     int callId,
   642     int callId,
   567     TPhoneCommandParam *commandParam)
   643     TPhoneCommandParam *commandParam)
   576     int bubble = m_bubbleWrapper->createCallHeader (callId);
   652     int bubble = m_bubbleWrapper->createCallHeader (callId);
   577     m_bubbleWrapper->setLabel (bubble, data.LabelText ());
   653     m_bubbleWrapper->setLabel (bubble, data.LabelText ());
   578     m_bubbleWrapper->setCli (bubble, data.HeaderText ());
   654     m_bubbleWrapper->setCli (bubble, data.HeaderText ());
   579     m_bubbleWrapper->setCiphering(bubble, data.CipheringIndicatorAllowed(), data.Ciphering());
   655     m_bubbleWrapper->setCiphering(bubble, data.CipheringIndicatorAllowed(), data.Ciphering());
   580     m_bubbleWrapper->bubbleManager ().endChanges ();
   656     m_bubbleWrapper->bubbleManager ().endChanges ();
       
   657     
       
   658     m_indicatorController->setActiveCallData();
   581 }
   659 }
   582 
   660 
   583 void PhoneUIQtViewAdapter::updateCallHeaderState (
   661 void PhoneUIQtViewAdapter::updateCallHeaderState (
   584     int callId,
   662     int callId,
   585     TPhoneCommandParam *commandParam)
   663     TPhoneCommandParam *commandParam)
   615          m_bubbleWrapper->setCli (bubble, data.CLIText ());
   693          m_bubbleWrapper->setCli (bubble, data.CLIText ());
   616          m_bubbleWrapper->setSecondaryCli (bubble, data.CNAPText ());
   694          m_bubbleWrapper->setSecondaryCli (bubble, data.CNAPText ());
   617          m_bubbleWrapper->setDivert (bubble, data.Diverted ());
   695          m_bubbleWrapper->setDivert (bubble, data.Diverted ());
   618          m_bubbleWrapper->bubbleManager ().endChanges ();
   696          m_bubbleWrapper->bubbleManager ().endChanges ();
   619      }
   697      }
       
   698      m_indicatorController->setActiveCallData();
   620 
   699 
   621 }
   700 }
   622 
   701 
   623 void PhoneUIQtViewAdapter::updateCallHeaderRemoteInfoAndLabel (int callId, TPhoneCommandParam *commandParam)
   702 void PhoneUIQtViewAdapter::updateCallHeaderRemoteInfoAndLabel (int callId, TPhoneCommandParam *commandParam)
   624 {
   703 {
   672     TPhoneCmdParamBoolean &param =
   751     TPhoneCmdParamBoolean &param =
   673         static_cast<TPhoneCmdParamBoolean &>(*commandParam);
   752         static_cast<TPhoneCmdParamBoolean &>(*commandParam);
   674     bool emergencyCall = param.Boolean();
   753     bool emergencyCall = param.Boolean();
   675 
   754 
   676     m_bubbleWrapper->bubbleManager ().startChanges ();
   755     m_bubbleWrapper->bubbleManager ().startChanges ();
   677     m_view.clearParticipantListActions();
       
   678 
   756 
   679     QList<int> bubbles = m_bubbleWrapper->bubbles().keys();
   757     QList<int> bubbles = m_bubbleWrapper->bubbles().keys();
   680 
   758 
   681     m_resourceAdapter->buttonsController()->setButtonFlags(
   759     m_resourceAdapter->buttonsController()->setButtonFlags(
   682             PhoneUIQtButtonsController::DisableJoin,
   760             PhoneUIQtButtonsController::DisableJoin,
   683             (5 <= m_bubbleWrapper->conferenceCallList().count()));
   761             (5 <= m_bubbleWrapper->conferenceCallList().count()));
       
   762     
       
   763     setCommonButtonFlags();
   684 
   764 
   685     for (int j = 0; j < bubbles.size(); ++j){
   765     for (int j = 0; j < bubbles.size(); ++j){
   686         int callId = bubbles.at(j);
   766         int callId = bubbles.at(j);
   687         // Clear bubble
   767         // Clear bubble
   688         m_view.clearBubbleCommands(m_bubbleWrapper->bubbles().value(callId));
   768         m_view.clearBubbleCommands(m_bubbleWrapper->bubbles().value(callId));
   704                                     *action);
   784                                     *action);
   705             delete action;
   785             delete action;
   706         }
   786         }
   707     }
   787     }
   708 
   788 
   709     setParticipantListActions();
       
   710     setExpandedConferenceCallHeader();
   789     setExpandedConferenceCallHeader();
   711     setBubbleSelectionFlag();
   790     setBubbleSelectionFlag();
   712     setMenu();
   791     setMenu();
   713 
   792 
   714     m_bubbleWrapper->bubbleManager ().endChanges ();
   793     m_bubbleWrapper->bubbleManager ().endChanges ();
   719     Q_ASSERT (commandParam->ParamId () == TPhoneCommandParam::EPhoneParamIdInteger);
   798     Q_ASSERT (commandParam->ParamId () == TPhoneCommandParam::EPhoneParamIdInteger);
   720 
   799 
   721     TPhoneCmdParamInteger &intParam =
   800     TPhoneCmdParamInteger &intParam =
   722         static_cast<TPhoneCmdParamInteger &>(*commandParam);
   801         static_cast<TPhoneCmdParamInteger &>(*commandParam);
   723 
   802 
   724     m_resourceAdapter->buttonsController()->setButtonFlags(
   803     setCommonButtonFlags();
   725             PhoneUIQtButtonsController::DisableJoin,
   804     
   726             (5 <= m_bubbleWrapper->conferenceCallList().count()));
   805     int callId(-1);
   727 
   806     int serviceId(-1);
   728     QMap<PhoneAction::ActionType, PhoneAction *> actions = m_resourceAdapter->convert (intParam.Integer ());
   807     if ( 0<m_bubbleWrapper->callStates().keys().size() ) {
   729     QList<PhoneAction*> values = actions.values();
   808         int bubbleId = m_bubbleWrapper->bubbleManager().expandedBubble();
   730 
   809         callId = m_bubbleWrapper->callIdByBubbleId(bubbleId);
       
   810         serviceId = m_bubbleWrapper->serviceIdByCallId(callId);
       
   811     }
       
   812     
       
   813     QList<PhoneAction*> actions = m_uiCommandController->toolBarActions(
       
   814                                         intParam.Integer(),
       
   815                                         m_bubbleWrapper->callStates(),
       
   816                                         m_bubbleWrapper->serviceIds(),
       
   817                                         serviceId,
       
   818                                         callId );
       
   819     
   731     if (actions.count()) {
   820     if (actions.count()) {
   732         m_view.setToolbarActions(values);
   821         m_view.setToolbarActions(actions);
   733     }
   822     }
   734 
   823 
   735     qDeleteAll(actions);
   824     qDeleteAll(actions);
   736 }
   825 }
   737 
   826 
   843     int bubble = m_bubbleWrapper->createConferenceBubble(
   932     int bubble = m_bubbleWrapper->createConferenceBubble(
   844             callId, data.CallState(), data.LabelText(), data.CLIText());
   933             callId, data.CallState(), data.LabelText(), data.CLIText());
   845 
   934 
   846     m_bubbleWrapper->setServiceId(callId,data.ServiceId());
   935     m_bubbleWrapper->setServiceId(callId,data.ServiceId());
   847     m_bubbleWrapper->setCiphering(bubble, data.CipheringIndicatorAllowed(), data.Ciphering());
   936     m_bubbleWrapper->setCiphering(bubble, data.CipheringIndicatorAllowed(), data.Ciphering());
       
   937     
       
   938     setParticipantListActions();
   848 }
   939 }
   849 
   940 
   850 void PhoneUIQtViewAdapter::conferenceCallId(int callId, TPhoneCommandParam *commandParam)
   941 void PhoneUIQtViewAdapter::conferenceCallId(int callId, TPhoneCommandParam *commandParam)
   851 {
   942 {
   852     PHONE_DEBUG("PhoneUIQtViewAdapter::conferenceCallId");
   943     PHONE_DEBUG("PhoneUIQtViewAdapter::conferenceCallId");
   861 
   952 
   862 void PhoneUIQtViewAdapter::removeConferenceBubble()
   953 void PhoneUIQtViewAdapter::removeConferenceBubble()
   863 {
   954 {
   864     m_bubbleWrapper->bubbleManager().startChanges();
   955     m_bubbleWrapper->bubbleManager().startChanges();
   865     m_view.removeExpandAction(m_bubbleWrapper->bubbleId(KConferenceCallId));
   956     m_view.removeExpandAction(m_bubbleWrapper->bubbleId(KConferenceCallId));
       
   957     m_view.clearParticipantListActions();
   866     m_bubbleWrapper->removeConferenceBubble();
   958     m_bubbleWrapper->removeConferenceBubble();
   867     m_bubbleWrapper->bubbleManager().endChanges();
   959     m_bubbleWrapper->bubbleManager().endChanges();
       
   960     if (!m_bubbleWrapper->bubbles().count()) {
       
   961         m_indicatorController->clearActiveCallData();
       
   962     }
       
   963 
   868 }
   964 }
   869 
   965 
   870 void PhoneUIQtViewAdapter::isConference(TPhoneCommandParam *commandParam)
   966 void PhoneUIQtViewAdapter::isConference(TPhoneCommandParam *commandParam)
   871 {
   967 {
   872     Q_ASSERT (commandParam->ParamId () == TPhoneCommandParam::EPhoneParamIdBoolean);
   968     Q_ASSERT (commandParam->ParamId () == TPhoneCommandParam::EPhoneParamIdBoolean);
   993             (KConferenceCallId == callId));
  1089             (KConferenceCallId == callId));
   994 }
  1090 }
   995 
  1091 
   996 void PhoneUIQtViewAdapter::bringToForeground()
  1092 void PhoneUIQtViewAdapter::bringToForeground()
   997 {
  1093 {
   998     if(!m_carModeEnabled) {
  1094     m_visibilityHandler->bringToForeground();
   999         m_view.bringToForeground();
  1095 }
  1000     }
  1096 
       
  1097 void PhoneUIQtViewAdapter::hideDeviceDialogs(TPhoneCommandParam *commandParam)
       
  1098 {
       
  1099     Q_ASSERT (commandParam->ParamId () == TPhoneCommandParam::EPhoneParamIdBoolean);
       
  1100     TPhoneCmdParamBoolean* booleanParam =
       
  1101         static_cast<TPhoneCmdParamBoolean*>(commandParam);
       
  1102     m_visibilityHandler->hideDeviceDialogs(booleanParam->Boolean());
  1001 }
  1103 }
  1002 
  1104 
  1003 void PhoneUIQtViewAdapter::showGlobalNote(
  1105 void PhoneUIQtViewAdapter::showGlobalNote(
  1004         TPhoneCommandParam *commandParam)
  1106         TPhoneCommandParam *commandParam)
  1005 {
  1107 {
  1015 
  1117 
  1016     if (booleanParam->Boolean()) {
  1118     if (booleanParam->Boolean()) {
  1017         m_dialpadAboutToClose = false;
  1119         m_dialpadAboutToClose = false;
  1018         m_view.showDialpad();
  1120         m_view.showDialpad();
  1019     } else {
  1121     } else {
       
  1122         m_clearDialpadOnClose = false;
  1020         m_view.hideDialpad();
  1123         m_view.hideDialpad();
  1021     }
  1124     }
  1022 }
  1125 }
  1023 
  1126 
  1024 void PhoneUIQtViewAdapter::removeAllCallHeaders()
  1127 void PhoneUIQtViewAdapter::removeAllCallHeaders()
  1038             m_view.removeExpandAction(bubble);
  1141             m_view.removeExpandAction(bubble);
  1039             m_bubbleWrapper->removeCallHeader (callId);
  1142             m_bubbleWrapper->removeCallHeader (callId);
  1040             m_bubbleWrapper->bubbleManager().endChanges();
  1143             m_bubbleWrapper->bubbleManager().endChanges();
  1041         }
  1144         }
  1042     }
  1145     }
  1043     m_indicatorController->clearActiveCallData();
  1146     if (!m_bubbleWrapper->bubbles().count()) {
       
  1147         m_indicatorController->clearActiveCallData();
       
  1148     }
       
  1149 
  1044 }
  1150 }
  1045 
  1151 
  1046 void PhoneUIQtViewAdapter::getNumberFromDialpad(
  1152 void PhoneUIQtViewAdapter::getNumberFromDialpad(
  1047         TPhoneCommandParam *commandParam)
  1153         TPhoneCommandParam *commandParam)
  1048 {
  1154 {
  1127                               values().contains(EPEStateDialing) ||
  1233                               values().contains(EPEStateDialing) ||
  1128                           m_bubbleWrapper->callStates().
  1234                           m_bubbleWrapper->callStates().
  1129                               values().contains(EPEStateConnecting));
  1235                               values().contains(EPEStateConnecting));
  1130 
  1236 
  1131     m_bubbleWrapper->bubbleManager().setBubbleSelectionDisabled(selectionFlag);
  1237     m_bubbleWrapper->bubbleManager().setBubbleSelectionDisabled(selectionFlag);
  1132 }
       
  1133 
       
  1134 void PhoneUIQtViewAdapter::HandlePropertyChangedL(const TUid& aCategory, 
       
  1135     const TUint aKey, const TInt aValue)
       
  1136 {
       
  1137     if((aCategory == KPSUidTelCarMode) && (aKey == KTelCarMode)) {
       
  1138         if(aValue == EPSCarModeOff) {
       
  1139             m_carModeEnabled = false;
       
  1140         } else if(aValue == EPSCarModeOn) {
       
  1141             m_carModeEnabled = true;
       
  1142         } else {
       
  1143             Q_ASSERT(false);
       
  1144         }
       
  1145     }
       
  1146 }
  1238 }
  1147 
  1239 
  1148 void PhoneUIQtViewAdapter::setHidden(bool hidden)
  1240 void PhoneUIQtViewAdapter::setHidden(bool hidden)
  1149 {
  1241 {
  1150     TRAP_IGNORE(SetHiddenL(hidden));
  1242     TRAP_IGNORE(SetHiddenL(hidden));
  1168         CleanupStack::PopAndDestroy( windowGroupName );
  1260         CleanupStack::PopAndDestroy( windowGroupName );
  1169 
  1261 
  1170         CAknSgcClient::AknSrv()->UpdateTaskList();
  1262         CAknSgcClient::AknSrv()->UpdateTaskList();
  1171     }
  1263     }
  1172 }
  1264 }
  1173 
       
  1174 void PhoneUIQtViewAdapter::openContacts()
  1265 void PhoneUIQtViewAdapter::openContacts()
  1175 {
  1266 {
  1176     XQServiceRequest snd("com.nokia.services.phonebookappservices.Launch","launch()", false);
  1267     m_appLauncher->launchContacts();
  1177     int retValue;
  1268 }
  1178     snd.send(retValue);
  1269 
  1179 }
  1270 void PhoneUIQtViewAdapter::openLogs(TPhoneCommandParam *commandParam)
  1180 
  1271 {
  1181 
  1272     TPhoneCmdParamString* entryContent =
       
  1273             static_cast<TPhoneCmdParamString*>(commandParam);
       
  1274     
       
  1275     bool phoneVisible = m_visibilityHandler->phoneVisible();
       
  1276     
       
  1277     m_homeScreenToForeground = false;
       
  1278     m_visibilityHandler->sendToBackground(m_homeScreenToForeground);
       
  1279     
       
  1280     if (phoneVisible) { 
       
  1281         // Activate logs dialer only if telephone is on the top.
       
  1282         m_appLauncher->launchLogs(
       
  1283                 LogsServices::ViewAll,
       
  1284                 true,
       
  1285                 QString::fromUtf16(
       
  1286                     entryContent->String()->Ptr(),
       
  1287                     entryContent->String()->Length()));
       
  1288     } 
       
  1289 }
       
  1290 
       
  1291 void PhoneUIQtViewAdapter::setCommonButtonFlags()
       
  1292 {
       
  1293     m_resourceAdapter->buttonsController()->setButtonFlags(
       
  1294             PhoneUIQtButtonsController::FullConference,
       
  1295             (5 <= m_bubbleWrapper->conferenceCallList().count()));
       
  1296 
       
  1297     m_resourceAdapter->buttonsController()->setButtonFlags(
       
  1298             PhoneUIQtButtonsController::IhfAsPushButton,
       
  1299             m_speakerAsDefaultButton);
       
  1300 }
       
  1301 
       
  1302 bool PhoneUIQtViewAdapter::convertKey(
       
  1303         TKeyCode symbianKey, Qt::Key &qtKey)
       
  1304 {
       
  1305     bool ret = false;
       
  1306     
       
  1307     switch(symbianKey) {
       
  1308     case EKeyNo: {
       
  1309         qtKey = Qt::Key_No;
       
  1310         ret = true; 
       
  1311     }
       
  1312     break;
       
  1313     default:
       
  1314     break;
       
  1315     }
       
  1316     
       
  1317     return ret;
       
  1318 }
       
  1319 
       
  1320