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 "cphonepubsubproxy.h" |
29 #include "cphonepubsubproxy.h" |
30 #include "pevirtualengine.h" |
30 #include "pevirtualengine.h" |
31 #include "cphonepubsubproxy.h" |
|
32 #include "cphoneringingtonecontroller.h" |
31 #include "cphoneringingtonecontroller.h" |
33 #include "phoneresourceadapter.h" |
32 #include "phoneresourceadapter.h" |
34 #include "phoneui.hrh" |
33 #include "phoneui.hrh" |
35 #include "cphonemediatorfactory.h" |
34 #include "cphonemediatorfactory.h" |
36 #include "phoneuiqtbuttonscontroller.h" |
35 #include "phoneuiqtbuttonscontroller.h" |
39 #include "telephonyservice.h" |
38 #include "telephonyservice.h" |
40 #include "phoneuicommandcontroller.h" |
39 #include "phoneuicommandcontroller.h" |
41 #include "phonemessagecontroller.h" |
40 #include "phonemessagecontroller.h" |
42 #include "phoneindicatorcontroller.h" |
41 #include "phoneindicatorcontroller.h" |
43 #include "qtphonelog.h" |
42 #include "qtphonelog.h" |
|
43 #include "phonevisibilityhandler.h" |
|
44 |
44 #include <UikonInternalPSKeys.h> |
45 #include <UikonInternalPSKeys.h> |
45 #include <bubblemanagerif.h> |
46 #include <bubblemanagerif.h> |
46 #include <hbaction.h> |
47 #include <hbaction.h> |
47 #include <pevirtualengine.h> |
48 #include <pevirtualengine.h> |
48 #include <xqservicerequest.h> |
49 #include <xqservicerequest.h> |
52 #include <QKeyEvent> |
53 #include <QKeyEvent> |
53 #include <hbextendedlocale.h> |
54 #include <hbextendedlocale.h> |
54 #include <hbi18ndef.h> |
55 #include <hbi18ndef.h> |
55 #include <eikenv.h> |
56 #include <eikenv.h> |
56 #include <w32std.h> |
57 #include <w32std.h> |
57 #include <apgtask.h> |
|
58 #include <hbstringutil.h> |
58 #include <hbstringutil.h> |
59 #include <telinformationpskeys.h> |
|
60 #include <AknSgcc.h> |
59 #include <AknSgcc.h> |
61 #include <AknCapServerClient.h> |
60 #include <AknCapServerClient.h> |
|
61 #include <logsservices.h> |
62 |
62 |
63 |
63 |
64 //CONSTANTS |
64 //CONSTANTS |
65 static const int PHONE_CALL_NOT_FOUND = -1; |
65 static const int PHONE_CALL_NOT_FOUND = -1; |
66 |
66 |
67 PhoneUIQtViewAdapter::PhoneUIQtViewAdapter (PhoneUIQtViewIF &view, QObject *parent) : |
67 PhoneUIQtViewAdapter::PhoneUIQtViewAdapter (PhoneUIQtViewIF &view, QObject *parent) : |
68 QObject (parent), m_view (view), m_idleUid(-1), |
68 QObject (parent), |
69 m_dialpadAboutToClose(false), m_homeScreenToForeground(false), |
69 m_view (view), |
70 m_carModeEnabled(false) |
70 m_idleUid(-1), |
|
71 m_bubbleWrapper(0), |
|
72 m_ringingtonecontroller(0), |
|
73 m_resourceAdapter(0), |
|
74 m_noteController(0), |
|
75 m_telephonyService(0), |
|
76 m_uiCommandController(0), |
|
77 m_messageController(0), |
|
78 m_indicatorController(0), |
|
79 m_dialpadAboutToClose(false), |
|
80 m_homeScreenToForeground(false), |
|
81 m_visibilityHandler(0), |
|
82 m_clearDialpadOnClose(true) |
71 { |
83 { |
72 m_bubbleWrapper = new PhoneBubbleWrapper(m_view.bubbleManager (), this); |
84 m_bubbleWrapper = new PhoneBubbleWrapper(m_view.bubbleManager (), this); |
73 m_noteController = new PhoneNoteController(this); |
85 m_noteController = new PhoneNoteController(this); |
74 m_uiCommandController = new PhoneUiCommandController(view, this); |
86 m_uiCommandController = new PhoneUiCommandController(view, this); |
75 m_messageController = new PhoneMessageController(this); |
87 m_messageController = new PhoneMessageController(this); |
83 intParam.SetInteger(m_resourceAdapter->defaultToolbarResourceId()); |
95 intParam.SetInteger(m_resourceAdapter->defaultToolbarResourceId()); |
84 setToolbarButtons(&intParam); |
96 setToolbarButtons(&intParam); |
85 |
97 |
86 m_telephonyService = new TelephonyService (this, this); |
98 m_telephonyService = new TelephonyService (this, this); |
87 m_indicatorController = new PhoneIndicatorController(this); |
99 m_indicatorController = new PhoneIndicatorController(this); |
88 |
100 m_visibilityHandler = new PhoneVisibilityHandler(view, this); |
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 } |
|
102 } |
101 } |
103 |
102 |
104 PhoneUIQtViewAdapter::~PhoneUIQtViewAdapter () |
103 PhoneUIQtViewAdapter::~PhoneUIQtViewAdapter () |
105 { |
104 { |
106 delete m_ringingtonecontroller; |
105 delete m_ringingtonecontroller; |
147 removeConferenceBubble(); |
146 removeConferenceBubble(); |
148 break; |
147 break; |
149 |
148 |
150 case EPhoneViewSendToBackground: |
149 case EPhoneViewSendToBackground: |
151 case EPhoneViewBringIdleToForeground: |
150 case EPhoneViewBringIdleToForeground: |
152 if (m_homeScreenToForeground) { |
151 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; |
152 m_homeScreenToForeground = false; |
164 break; |
153 break; |
165 case EPhoneViewRemoveAllCallHeaders: |
154 case EPhoneViewRemoveAllCallHeaders: |
166 removeAllCallHeaders(); |
155 removeAllCallHeaders(); |
167 break; |
156 break; |
285 case EPhoneViewShowQuery: |
274 case EPhoneViewShowQuery: |
286 m_noteController->showQuery(aCommandParam); |
275 m_noteController->showQuery(aCommandParam); |
287 break; |
276 break; |
288 case EPhoneViewOpenSoftRejectEditor: |
277 case EPhoneViewOpenSoftRejectEditor: |
289 m_messageController->openSoftRejectMessageEditor(aCommandParam); |
278 m_messageController->openSoftRejectMessageEditor(aCommandParam); |
|
279 m_visibilityHandler->hideDeviceDialogs(false); |
|
280 break; |
|
281 case EPhoneViewSetGlobalNotifiersDisabled: |
|
282 hideDeviceDialogs(aCommandParam); |
|
283 break; |
|
284 case EPhoneViewLaunchLogs: |
|
285 openLogs(aCommandParam); |
290 break; |
286 break; |
291 default: |
287 default: |
292 break; |
288 break; |
293 } |
289 } |
294 CPhoneMediatorFactory::Instance()->Sender()->SendEvent( aCmdId, *aCommandParam ); |
290 CPhoneMediatorFactory::Instance()->Sender()->SendEvent( aCmdId, *aCommandParam ); |
454 case EPhoneViewHsToForegroundAfterCall: { |
450 case EPhoneViewHsToForegroundAfterCall: { |
455 TPhoneCmdParamBoolean *param = static_cast<TPhoneCmdParamBoolean *>(aCommandParam); |
451 TPhoneCmdParamBoolean *param = static_cast<TPhoneCmdParamBoolean *>(aCommandParam); |
456 m_homeScreenToForeground = param->Boolean(); |
452 m_homeScreenToForeground = param->Boolean(); |
457 } |
453 } |
458 break; |
454 break; |
|
455 case EPhoneViewSetIhfFlag: { |
|
456 TPhoneCmdParamBoolean *param = static_cast<TPhoneCmdParamBoolean *>(aCommandParam); |
|
457 |
|
458 PhoneResourceAdapter::Instance()->buttonsController()-> |
|
459 setButtonFlags(PhoneUIQtButtonsController::Ihf, |
|
460 param->Boolean()); |
|
461 } |
|
462 break; |
|
463 case EPhoneViewSetMuteFlag: { |
|
464 TPhoneCmdParamBoolean *param = static_cast<TPhoneCmdParamBoolean *>(aCommandParam); |
|
465 |
|
466 PhoneResourceAdapter::Instance()->buttonsController()-> |
|
467 setButtonFlags(PhoneUIQtButtonsController::Mute, |
|
468 param->Boolean()); |
|
469 } |
|
470 break; |
459 default: |
471 default: |
460 break; |
472 break; |
461 } |
473 } |
462 } |
474 } |
463 |
475 |
557 m_bubbleWrapper->bubbleManager ().endChanges (); |
573 m_bubbleWrapper->bubbleManager ().endChanges (); |
558 |
574 |
559 if (1 == m_bubbleWrapper->bubbles().keys().count()) { |
575 if (1 == m_bubbleWrapper->bubbles().keys().count()) { |
560 setHidden(false); |
576 setHidden(false); |
561 } |
577 } |
562 m_indicatorController->setActiveCallData( data.CLIText(), KNullDesC ); |
578 m_indicatorController->setActiveCallData(); |
563 } |
579 } |
564 |
580 |
565 void PhoneUIQtViewAdapter::createEmergencyCallHeader( |
581 void PhoneUIQtViewAdapter::createEmergencyCallHeader( |
566 int callId, |
582 int callId, |
567 TPhoneCommandParam *commandParam) |
583 TPhoneCommandParam *commandParam) |
576 int bubble = m_bubbleWrapper->createCallHeader (callId); |
592 int bubble = m_bubbleWrapper->createCallHeader (callId); |
577 m_bubbleWrapper->setLabel (bubble, data.LabelText ()); |
593 m_bubbleWrapper->setLabel (bubble, data.LabelText ()); |
578 m_bubbleWrapper->setCli (bubble, data.HeaderText ()); |
594 m_bubbleWrapper->setCli (bubble, data.HeaderText ()); |
579 m_bubbleWrapper->setCiphering(bubble, data.CipheringIndicatorAllowed(), data.Ciphering()); |
595 m_bubbleWrapper->setCiphering(bubble, data.CipheringIndicatorAllowed(), data.Ciphering()); |
580 m_bubbleWrapper->bubbleManager ().endChanges (); |
596 m_bubbleWrapper->bubbleManager ().endChanges (); |
|
597 |
|
598 m_indicatorController->setActiveCallData(); |
581 } |
599 } |
582 |
600 |
583 void PhoneUIQtViewAdapter::updateCallHeaderState ( |
601 void PhoneUIQtViewAdapter::updateCallHeaderState ( |
584 int callId, |
602 int callId, |
585 TPhoneCommandParam *commandParam) |
603 TPhoneCommandParam *commandParam) |
615 m_bubbleWrapper->setCli (bubble, data.CLIText ()); |
633 m_bubbleWrapper->setCli (bubble, data.CLIText ()); |
616 m_bubbleWrapper->setSecondaryCli (bubble, data.CNAPText ()); |
634 m_bubbleWrapper->setSecondaryCli (bubble, data.CNAPText ()); |
617 m_bubbleWrapper->setDivert (bubble, data.Diverted ()); |
635 m_bubbleWrapper->setDivert (bubble, data.Diverted ()); |
618 m_bubbleWrapper->bubbleManager ().endChanges (); |
636 m_bubbleWrapper->bubbleManager ().endChanges (); |
619 } |
637 } |
|
638 m_indicatorController->setActiveCallData(); |
620 |
639 |
621 } |
640 } |
622 |
641 |
623 void PhoneUIQtViewAdapter::updateCallHeaderRemoteInfoAndLabel (int callId, TPhoneCommandParam *commandParam) |
642 void PhoneUIQtViewAdapter::updateCallHeaderRemoteInfoAndLabel (int callId, TPhoneCommandParam *commandParam) |
624 { |
643 { |
679 QList<int> bubbles = m_bubbleWrapper->bubbles().keys(); |
698 QList<int> bubbles = m_bubbleWrapper->bubbles().keys(); |
680 |
699 |
681 m_resourceAdapter->buttonsController()->setButtonFlags( |
700 m_resourceAdapter->buttonsController()->setButtonFlags( |
682 PhoneUIQtButtonsController::DisableJoin, |
701 PhoneUIQtButtonsController::DisableJoin, |
683 (5 <= m_bubbleWrapper->conferenceCallList().count())); |
702 (5 <= m_bubbleWrapper->conferenceCallList().count())); |
|
703 |
|
704 m_resourceAdapter->buttonsController()->setButtonFlags( |
|
705 PhoneUIQtButtonsController::FullConference, |
|
706 (5 <= m_bubbleWrapper->conferenceCallList().count())); |
684 |
707 |
685 for (int j = 0; j < bubbles.size(); ++j){ |
708 for (int j = 0; j < bubbles.size(); ++j){ |
686 int callId = bubbles.at(j); |
709 int callId = bubbles.at(j); |
687 // Clear bubble |
710 // Clear bubble |
688 m_view.clearBubbleCommands(m_bubbleWrapper->bubbles().value(callId)); |
711 m_view.clearBubbleCommands(m_bubbleWrapper->bubbles().value(callId)); |
720 |
743 |
721 TPhoneCmdParamInteger &intParam = |
744 TPhoneCmdParamInteger &intParam = |
722 static_cast<TPhoneCmdParamInteger &>(*commandParam); |
745 static_cast<TPhoneCmdParamInteger &>(*commandParam); |
723 |
746 |
724 m_resourceAdapter->buttonsController()->setButtonFlags( |
747 m_resourceAdapter->buttonsController()->setButtonFlags( |
725 PhoneUIQtButtonsController::DisableJoin, |
748 PhoneUIQtButtonsController::FullConference, |
726 (5 <= m_bubbleWrapper->conferenceCallList().count())); |
749 (5 <= m_bubbleWrapper->conferenceCallList().count())); |
727 |
750 |
728 QMap<PhoneAction::ActionType, PhoneAction *> actions = m_resourceAdapter->convert (intParam.Integer ()); |
751 int callId(-1); |
729 QList<PhoneAction*> values = actions.values(); |
752 int serviceId(-1); |
730 |
753 if ( 0<m_bubbleWrapper->callStates().keys().size() ) { |
|
754 int bubbleId = m_bubbleWrapper->bubbleManager().expandedBubble(); |
|
755 callId = m_bubbleWrapper->callIdByBubbleId(bubbleId); |
|
756 serviceId = m_bubbleWrapper->serviceIdByCallId(callId); |
|
757 } |
|
758 |
|
759 QList<PhoneAction*> actions = m_uiCommandController->toolBarActions( |
|
760 intParam.Integer(), |
|
761 m_bubbleWrapper->callStates(), |
|
762 m_bubbleWrapper->serviceIds(), |
|
763 serviceId, |
|
764 callId ); |
|
765 |
731 if (actions.count()) { |
766 if (actions.count()) { |
732 m_view.setToolbarActions(values); |
767 m_view.setToolbarActions(actions); |
733 } |
768 } |
734 |
769 |
735 qDeleteAll(actions); |
770 qDeleteAll(actions); |
736 } |
771 } |
737 |
772 |
863 { |
898 { |
864 m_bubbleWrapper->bubbleManager().startChanges(); |
899 m_bubbleWrapper->bubbleManager().startChanges(); |
865 m_view.removeExpandAction(m_bubbleWrapper->bubbleId(KConferenceCallId)); |
900 m_view.removeExpandAction(m_bubbleWrapper->bubbleId(KConferenceCallId)); |
866 m_bubbleWrapper->removeConferenceBubble(); |
901 m_bubbleWrapper->removeConferenceBubble(); |
867 m_bubbleWrapper->bubbleManager().endChanges(); |
902 m_bubbleWrapper->bubbleManager().endChanges(); |
|
903 m_indicatorController->clearActiveCallData(); |
868 } |
904 } |
869 |
905 |
870 void PhoneUIQtViewAdapter::isConference(TPhoneCommandParam *commandParam) |
906 void PhoneUIQtViewAdapter::isConference(TPhoneCommandParam *commandParam) |
871 { |
907 { |
872 Q_ASSERT (commandParam->ParamId () == TPhoneCommandParam::EPhoneParamIdBoolean); |
908 Q_ASSERT (commandParam->ParamId () == TPhoneCommandParam::EPhoneParamIdBoolean); |
993 (KConferenceCallId == callId)); |
1029 (KConferenceCallId == callId)); |
994 } |
1030 } |
995 |
1031 |
996 void PhoneUIQtViewAdapter::bringToForeground() |
1032 void PhoneUIQtViewAdapter::bringToForeground() |
997 { |
1033 { |
998 if(!m_carModeEnabled) { |
1034 m_visibilityHandler->bringToForeground(); |
999 m_view.bringToForeground(); |
1035 } |
1000 } |
1036 |
1001 } |
1037 void PhoneUIQtViewAdapter::hideDeviceDialogs(TPhoneCommandParam *commandParam) |
1002 |
|
1003 void PhoneUIQtViewAdapter::showGlobalNote( |
|
1004 TPhoneCommandParam *commandParam) |
|
1005 { |
|
1006 m_noteController->showGlobalNote(commandParam); |
|
1007 } |
|
1008 |
|
1009 void PhoneUIQtViewAdapter::setDialpadVisibility( |
|
1010 TPhoneCommandParam *commandParam) |
|
1011 { |
1038 { |
1012 Q_ASSERT (commandParam->ParamId () == TPhoneCommandParam::EPhoneParamIdBoolean); |
1039 Q_ASSERT (commandParam->ParamId () == TPhoneCommandParam::EPhoneParamIdBoolean); |
1013 TPhoneCmdParamBoolean* booleanParam = |
1040 TPhoneCmdParamBoolean* booleanParam = |
1014 static_cast<TPhoneCmdParamBoolean*>(commandParam); |
1041 static_cast<TPhoneCmdParamBoolean*>(commandParam); |
|
1042 m_visibilityHandler->hideDeviceDialogs(booleanParam->Boolean()); |
|
1043 } |
|
1044 |
|
1045 void PhoneUIQtViewAdapter::showGlobalNote( |
|
1046 TPhoneCommandParam *commandParam) |
|
1047 { |
|
1048 m_noteController->showGlobalNote(commandParam); |
|
1049 } |
|
1050 |
|
1051 void PhoneUIQtViewAdapter::setDialpadVisibility( |
|
1052 TPhoneCommandParam *commandParam) |
|
1053 { |
|
1054 Q_ASSERT (commandParam->ParamId () == TPhoneCommandParam::EPhoneParamIdBoolean); |
|
1055 TPhoneCmdParamBoolean* booleanParam = |
|
1056 static_cast<TPhoneCmdParamBoolean*>(commandParam); |
1015 |
1057 |
1016 if (booleanParam->Boolean()) { |
1058 if (booleanParam->Boolean()) { |
1017 m_dialpadAboutToClose = false; |
1059 m_dialpadAboutToClose = true; |
1018 m_view.showDialpad(); |
1060 m_view.showDialpad(); |
1019 } else { |
1061 } else { |
|
1062 m_clearDialpadOnClose = false; |
1020 m_view.hideDialpad(); |
1063 m_view.hideDialpad(); |
1021 } |
1064 } |
1022 } |
1065 } |
1023 |
1066 |
1024 void PhoneUIQtViewAdapter::removeAllCallHeaders() |
1067 void PhoneUIQtViewAdapter::removeAllCallHeaders() |
1127 values().contains(EPEStateDialing) || |
1170 values().contains(EPEStateDialing) || |
1128 m_bubbleWrapper->callStates(). |
1171 m_bubbleWrapper->callStates(). |
1129 values().contains(EPEStateConnecting)); |
1172 values().contains(EPEStateConnecting)); |
1130 |
1173 |
1131 m_bubbleWrapper->bubbleManager().setBubbleSelectionDisabled(selectionFlag); |
1174 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 } |
1175 } |
1147 |
1176 |
1148 void PhoneUIQtViewAdapter::setHidden(bool hidden) |
1177 void PhoneUIQtViewAdapter::setHidden(bool hidden) |
1149 { |
1178 { |
1150 TRAP_IGNORE(SetHiddenL(hidden)); |
1179 TRAP_IGNORE(SetHiddenL(hidden)); |
1172 } |
1201 } |
1173 |
1202 |
1174 void PhoneUIQtViewAdapter::openContacts() |
1203 void PhoneUIQtViewAdapter::openContacts() |
1175 { |
1204 { |
1176 XQServiceRequest snd("com.nokia.services.phonebookappservices.Launch","launch()", false); |
1205 XQServiceRequest snd("com.nokia.services.phonebookappservices.Launch","launch()", false); |
|
1206 XQRequestInfo info; |
|
1207 info.setForeground(true); |
|
1208 snd.setInfo(info); |
1177 int retValue; |
1209 int retValue; |
1178 snd.send(retValue); |
1210 snd.send(retValue); |
1179 } |
1211 } |
1180 |
1212 |
1181 |
1213 void PhoneUIQtViewAdapter::openLogs(TPhoneCommandParam *commandParam) |
|
1214 { |
|
1215 TPhoneCmdParamString* entryContent = |
|
1216 static_cast<TPhoneCmdParamString*>(commandParam); |
|
1217 |
|
1218 int ordinalPosition = m_visibilityHandler->ordinalPosition(); |
|
1219 |
|
1220 m_homeScreenToForeground = false; |
|
1221 m_visibilityHandler->sendToBackground(m_homeScreenToForeground); |
|
1222 |
|
1223 if (0 == ordinalPosition) { |
|
1224 // Activate logs dialer only if telephone is on the top. |
|
1225 XQServiceRequest snd("com.nokia.services.logsservices.starter", |
|
1226 "startWithNum(int,bool,QString)", false); |
|
1227 |
|
1228 snd << (int)LogsServices::ViewAll; |
|
1229 snd << true; |
|
1230 snd << QString::fromUtf16(entryContent->String()->Ptr(), |
|
1231 entryContent->String()->Length()); |
|
1232 |
|
1233 XQRequestInfo info; |
|
1234 info.setForeground(true); |
|
1235 snd.setInfo(info); |
|
1236 |
|
1237 int retValue = -1; |
|
1238 snd.send(retValue); |
|
1239 } |
|
1240 } |
|
1241 |
|
1242 |
|
1243 |