phoneapp/phoneuiqtviewadapter/src/phoneuiqtviewadapter.cpp
changeset 27 2f8f8080a020
parent 22 6bb1b21d2484
child 30 ebdbd102c78a
equal deleted inserted replaced
22:6bb1b21d2484 27:2f8f8080a020
    37 #include "phoneconstants.h"
    37 #include "phoneconstants.h"
    38 #include "phonenotecontroller.h"
    38 #include "phonenotecontroller.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 "qtphonelog.h"
    43 #include "qtphonelog.h"
    43 #include <UikonInternalPSKeys.h>
    44 #include <UikonInternalPSKeys.h>
    44 #include <bubblemanagerif.h>
    45 #include <bubblemanagerif.h>
    45 #include <hbaction.h>
    46 #include <hbaction.h>
    46 #include <pevirtualengine.h>
    47 #include <pevirtualengine.h>
    53 #include <hbi18ndef.h>
    54 #include <hbi18ndef.h>
    54 #include <eikenv.h>
    55 #include <eikenv.h>
    55 #include <w32std.h>
    56 #include <w32std.h>
    56 #include <apgtask.h>
    57 #include <apgtask.h>
    57 #include <hbstringutil.h>
    58 #include <hbstringutil.h>
       
    59 #include <telinformationpskeys.h>
       
    60 #include <AknSgcc.h>
       
    61 #include <AknCapServerClient.h>
       
    62 
    58 
    63 
    59 //CONSTANTS
    64 //CONSTANTS
    60 static const int PHONE_CALL_NOT_FOUND = -1;
    65 static const int PHONE_CALL_NOT_FOUND = -1;
    61 
    66 
    62 PhoneUIQtViewAdapter::PhoneUIQtViewAdapter (PhoneUIQtViewIF &view, QObject *parent) :
    67 PhoneUIQtViewAdapter::PhoneUIQtViewAdapter (PhoneUIQtViewIF &view, QObject *parent) :
    63     QObject (parent), m_view (view), m_idleUid(-1),
    68     QObject (parent), m_view (view), m_idleUid(-1),
    64     m_dialpadAboutToClose(false), m_homeScreenToForeground(false)
    69     m_dialpadAboutToClose(false), m_homeScreenToForeground(false),
       
    70     m_carModeEnabled(false)
    65 {
    71 {
    66     m_bubbleWrapper = new PhoneBubbleWrapper(m_view.bubbleManager (), this);
    72     m_bubbleWrapper = new PhoneBubbleWrapper(m_view.bubbleManager (), this);
    67     m_noteController = new PhoneNoteController(this);
    73     m_noteController = new PhoneNoteController(this);
    68     m_uiCommandController = new PhoneUiCommandController(view, this);
    74     m_uiCommandController = new PhoneUiCommandController(view, this);
    69     m_messageController = new PhoneMessageController(this);
    75     m_messageController = new PhoneMessageController(this);
    76     TPhoneCmdParamInteger intParam;
    82     TPhoneCmdParamInteger intParam;
    77     intParam.SetInteger(m_resourceAdapter->defaultToolbarResourceId());
    83     intParam.SetInteger(m_resourceAdapter->defaultToolbarResourceId());
    78     setToolbarButtons(&intParam);
    84     setToolbarButtons(&intParam);
    79 
    85 
    80     m_telephonyService = new TelephonyService (this, this);
    86     m_telephonyService = new TelephonyService (this, this);
       
    87 	m_indicatorController = new PhoneIndicatorController(this);
       
    88 
       
    89     // Define car mode pub sub key
       
    90     int err = RProperty::Define(
       
    91         KPSUidTelCarMode,
       
    92         KTelCarMode,
       
    93         RProperty::EInt,
       
    94         KPhoneReadPolicy,
       
    95         KPhoneWritePolicy);
       
    96     
       
    97     // Start listening to car mode changes
       
    98     if(err == KErrNone) {
       
    99         CPhonePubSubProxy::Instance()->NotifyChangeL(KPSUidTelCarMode,
       
   100             KTelCarMode, this);
       
   101     }
    81 }
   102 }
    82 
   103 
    83 PhoneUIQtViewAdapter::~PhoneUIQtViewAdapter ()
   104 PhoneUIQtViewAdapter::~PhoneUIQtViewAdapter ()
    84 {
   105 {
    85     delete m_ringingtonecontroller;
   106     delete m_ringingtonecontroller;
   110         m_ringingtonecontroller->StopPlaying();
   131         m_ringingtonecontroller->StopPlaying();
   111         break;
   132         break;
   112 
   133 
   113     case EPhoneViewMuteRingTone:
   134     case EPhoneViewMuteRingTone:
   114         m_ringingtonecontroller->MuteRingingTone();
   135         m_ringingtonecontroller->MuteRingingTone();
   115         break;
       
   116 
       
   117     case EPhoneViewBeginUpdate:
       
   118         m_bubbleWrapper->bubbleManager ().startChanges ();
       
   119         break;
       
   120 
       
   121     case EPhoneViewEndUpdate:
       
   122         m_bubbleWrapper->bubbleManager ().endChanges ();
       
   123         break;
   136         break;
   124 
   137 
   125     case EPhoneViewHideNaviPaneAudioVolume:
   138     case EPhoneViewHideNaviPaneAudioVolume:
   126         m_view.removeVolumeSlider ();
   139         m_view.removeVolumeSlider ();
   127         break;
   140         break;
   174         break;
   187         break;
   175     case EPhoneViewRemoveGlobalNote:
   188     case EPhoneViewRemoveGlobalNote:
   176     case EPhoneViewRemoveGlobalWaitNote:
   189     case EPhoneViewRemoveGlobalWaitNote:
   177         m_noteController->removeGlobalWaitNote();
   190         m_noteController->removeGlobalWaitNote();
   178         break;
   191         break;
   179 
   192     case EPhoneViewUpdateFSW:
       
   193         setHidden(true);
       
   194         break;
   180     default:
   195     default:
   181         break;
   196         break;
   182     }
   197     }
   183  CPhoneMediatorFactory::Instance()->Sender()->SendEvent( aCmdId );
   198  CPhoneMediatorFactory::Instance()->Sender()->SendEvent( aCmdId );
   184 }
   199 }
   307     case EPhoneViewUpdateCallHeaderCallDuration:
   322     case EPhoneViewUpdateCallHeaderCallDuration:
   308     {
   323     {
   309         TPhoneCmdParamInteger *time = static_cast<TPhoneCmdParamInteger *>(aCommandParam);
   324         TPhoneCmdParamInteger *time = static_cast<TPhoneCmdParamInteger *>(aCommandParam);
   310         QString duration = convertDuration(time->Integer());
   325         QString duration = convertDuration(time->Integer());
   311         PHONE_DEBUG2("call duration:", duration);
   326         PHONE_DEBUG2("call duration:", duration);
   312         m_bubbleWrapper->bubbleManager ().updateCallTime (m_bubbleWrapper->bubbleId (aCallId), duration);
   327         int bubbleId = m_bubbleWrapper->bubbleId(aCallId);
       
   328         
       
   329         if (-1 != bubbleId) {
       
   330             m_bubbleWrapper->bubbleManager().updateCallTime(bubbleId, duration);
       
   331         }
   313         break;
   332         break;
   314     }
   333     }
   315 
   334 
   316     case EPhoneViewCipheringInfoChange:
   335     case EPhoneViewCipheringInfoChange:
   317     {
   336     {
   394     case EPhoneSetConferenceExpanded:
   413     case EPhoneSetConferenceExpanded:
   395         m_bubbleWrapper->bubbleManager ().startChanges ();
   414         m_bubbleWrapper->bubbleManager ().startChanges ();
   396         m_bubbleWrapper->bubbleManager().setExpandedConferenceCallHeader(
   415         m_bubbleWrapper->bubbleManager().setExpandedConferenceCallHeader(
   397                 m_bubbleWrapper->conferenceCallList().size());
   416                 m_bubbleWrapper->conferenceCallList().size());
   398         m_bubbleWrapper->bubbleManager ().endChanges ();
   417         m_bubbleWrapper->bubbleManager ().endChanges ();
       
   418         break;
       
   419     case EPhoneViewBeginUpdate:
       
   420         m_bubbleWrapper->bubbleManager ().startChanges ();
       
   421         break;
       
   422     case EPhoneViewEndUpdate:
       
   423         m_bubbleWrapper->bubbleManager ().endChanges ();
       
   424         break;
       
   425     case EPhoneViewOpenContacts:
       
   426         openContacts();
   399         break;
   427         break;
   400     default:
   428     default:
   401         break;
   429         break;
   402     }
   430     }
   403 }
   431 }
   514         m_bubbleWrapper->bubbleManager().setCallObjectImage(bubble,imagePath);
   542         m_bubbleWrapper->bubbleManager().setCallObjectImage(bubble,imagePath);
   515     } else {
   543     } else {
   516         m_bubbleWrapper->bubbleManager().setCallObjectFromTheme(bubble);
   544         m_bubbleWrapper->bubbleManager().setCallObjectFromTheme(bubble);
   517     }
   545     }
   518     m_bubbleWrapper->bubbleManager ().endChanges ();
   546     m_bubbleWrapper->bubbleManager ().endChanges ();
       
   547     
       
   548     if (1 == m_bubbleWrapper->bubbles().keys().count()) {
       
   549         setHidden(false);
       
   550     }
   519 }
   551 }
   520 
   552 
   521 void PhoneUIQtViewAdapter::createEmergencyCallHeader(
   553 void PhoneUIQtViewAdapter::createEmergencyCallHeader(
   522     int callId,
   554     int callId,
   523     TPhoneCommandParam *commandParam)
   555     TPhoneCommandParam *commandParam)
   597 
   629 
   598 void PhoneUIQtViewAdapter::handleCipheringInfoChange(int callId, TPhoneCommandParam *commandParam)
   630 void PhoneUIQtViewAdapter::handleCipheringInfoChange(int callId, TPhoneCommandParam *commandParam)
   599 {
   631 {
   600     TPhoneCmdParamCallHeaderData *param =
   632     TPhoneCmdParamCallHeaderData *param =
   601         static_cast<TPhoneCmdParamCallHeaderData*>(commandParam);
   633         static_cast<TPhoneCmdParamCallHeaderData*>(commandParam);
   602     m_bubbleWrapper->bubbleManager().startChanges();
   634 
   603     m_bubbleWrapper->setCiphering(m_bubbleWrapper->bubbleId(callId),
   635     int bubble = m_bubbleWrapper->bubbleId(callId);        
   604                                   param->CipheringIndicatorAllowed(),
   636     if ( -1 != bubble ) {        
   605                                   param->Ciphering());
   637         m_bubbleWrapper->bubbleManager().startChanges();
   606     m_bubbleWrapper->bubbleManager().endChanges();
   638         m_bubbleWrapper->setCiphering(m_bubbleWrapper->bubbleId(callId),
       
   639                                       param->CipheringIndicatorAllowed(),
       
   640                                       param->Ciphering());
       
   641         m_bubbleWrapper->bubbleManager().endChanges();
       
   642     }
   607 }
   643 }
   608 
   644 
   609 TPhoneViewResponseId PhoneUIQtViewAdapter::callIdByState (TPhoneCommandParam *commandParam)
   645 TPhoneViewResponseId PhoneUIQtViewAdapter::callIdByState (TPhoneCommandParam *commandParam)
   610 {
   646 {
   611     Q_ASSERT (commandParam->ParamId () == TPhoneCommandParam::EPhoneParamIdCallStateData);
   647     Q_ASSERT (commandParam->ParamId () == TPhoneCommandParam::EPhoneParamIdCallStateData);
   945             (KConferenceCallId == callId));
   981             (KConferenceCallId == callId));
   946 }
   982 }
   947 
   983 
   948 void PhoneUIQtViewAdapter::bringToForeground()
   984 void PhoneUIQtViewAdapter::bringToForeground()
   949 {
   985 {
   950     m_view.bringToForeground();
   986     if(!m_carModeEnabled) {
       
   987         m_view.bringToForeground();
       
   988     }
   951 }
   989 }
   952 
   990 
   953 void PhoneUIQtViewAdapter::showGlobalNote(
   991 void PhoneUIQtViewAdapter::showGlobalNote(
   954         TPhoneCommandParam *commandParam)
   992         TPhoneCommandParam *commandParam)
   955 {
   993 {
  1076                               values().contains(EPEStateConnecting));
  1114                               values().contains(EPEStateConnecting));
  1077 
  1115 
  1078     m_bubbleWrapper->bubbleManager().setBubbleSelectionDisabled(selectionFlag);
  1116     m_bubbleWrapper->bubbleManager().setBubbleSelectionDisabled(selectionFlag);
  1079 }
  1117 }
  1080 
  1118 
       
  1119 void PhoneUIQtViewAdapter::HandlePropertyChangedL(const TUid& aCategory, 
       
  1120     const TUint aKey, const TInt aValue)
       
  1121 {
       
  1122     if((aCategory == KPSUidTelCarMode) && (aKey == KTelCarMode)) {
       
  1123         if(aValue == EPSCarModeOff) {
       
  1124             m_carModeEnabled = false;
       
  1125         } else if(aValue == EPSCarModeOn) {
       
  1126             m_carModeEnabled = true;
       
  1127         } else {
       
  1128             Q_ASSERT(false);
       
  1129         }
       
  1130     }
       
  1131 }
       
  1132 
       
  1133 void PhoneUIQtViewAdapter::setHidden(bool hidden)
       
  1134 {
       
  1135     TRAP_IGNORE(SetHiddenL(hidden));
       
  1136 }
       
  1137 
       
  1138 void PhoneUIQtViewAdapter::SetHiddenL(bool hidden)
       
  1139 {
       
  1140     CEikonEnv* env = CEikonEnv::Static();
       
  1141     
       
  1142     if (env) {
       
  1143         CApaWindowGroupName* windowGroupName =
       
  1144             CApaWindowGroupName::NewLC(
       
  1145                     env->WsSession(),
       
  1146                     env->RootWin().Identifier() );
       
  1147         
       
  1148         windowGroupName->SetHidden( hidden );
       
  1149         User::LeaveIfError(
       
  1150                 windowGroupName->SetWindowGroupName(
       
  1151                         env->RootWin() ) );
       
  1152         
       
  1153         CleanupStack::PopAndDestroy( windowGroupName );
       
  1154 
       
  1155         CAknSgcClient::AknSrv()->UpdateTaskList();
       
  1156     }
       
  1157 }
       
  1158 
       
  1159 void PhoneUIQtViewAdapter::openContacts()
       
  1160 {
       
  1161     XQServiceRequest snd("com.nokia.services.phonebookappservices.Launch","launch()", false);
       
  1162     int retValue;
       
  1163     snd.send(retValue);
       
  1164 }
       
  1165 
       
  1166