108 //Modify command list by extension |
106 //Modify command list by extension |
109 extension->modifyPushButtonCommandList(callInfo,commands); |
107 extension->modifyPushButtonCommandList(callInfo,commands); |
110 } |
108 } |
111 |
109 |
112 if (1 == commands.count()) { |
110 if (1 == commands.count()) { |
113 PhoneAction *action = mapCommandToAction(commands.at(0)); |
111 HbAction *action = createAction(commands.at(0)); |
114 if (action) { |
112 if (action) { |
115 translatedActions[PhoneAction::LeftButton] = action; |
113 translatedActions.append(action); |
116 } |
114 } |
117 } else if (1 < commands.count()){ |
115 } else if (1 < commands.count()){ |
118 PhoneAction *action = mapCommandToAction(commands.at(0)); |
116 HbAction *action = createAction(commands.at(0)); |
119 PhoneAction *action2 = mapCommandToAction(commands.at(1)); |
117 HbAction *action2 = createAction(commands.at(1)); |
120 if (action) { |
118 if (action) { |
121 translatedActions[PhoneAction::LeftButton] = action; |
119 translatedActions.append(action); |
122 } |
120 } |
123 if (action2) { |
121 if (action2) { |
124 translatedActions[PhoneAction::RightButton] = action2; |
122 translatedActions.append(action2); |
125 } |
123 } |
126 } |
124 } |
127 |
125 |
128 return translatedActions; |
126 return translatedActions; |
129 } |
127 } |
130 |
128 |
131 QList<PhoneAction *> PhoneUiCommandController::toolBarActions( |
129 QList<HbAction *> PhoneUiCommandController::toolBarActions( |
132 int resourceId, |
130 int resourceId, |
133 QMap<int,int> callStates, |
131 QMap<int,int> callStates, |
134 QMap<int,int> serviceIds, |
132 QMap<int,int> serviceIds, |
135 int serviceId, |
133 int serviceId, |
136 int callId) |
134 int callId) |
137 { |
135 { |
138 PHONE_TRACE |
136 PHONE_TRACE |
139 QList<PhoneAction *> actions; |
|
140 |
137 |
141 //Set tool bar button flags |
138 //Set tool bar button flags |
142 setJoinFlag(callStates, serviceIds); |
139 setJoinFlag(callStates, serviceIds); |
143 setConferenceFlag(callStates.values()); |
140 setConferenceFlag(callStates.values()); |
144 setHoldFlag(callStates.value(callId)); |
141 setHoldFlag(callStates.value(callId)); |
145 setMultiCallFlag(callStates.values()); |
142 setMultiCallFlag(callStates.values()); |
146 setOutgoingFlag(callStates.values()); |
143 setOutgoingFlag(callStates.values()); |
147 |
144 |
148 //Get tool bar item list by resource id. |
145 //Get tool bar item list by resource id. |
149 QList<PhoneAction::ToolBarItem> commands = PhoneResourceAdapter::Instance()-> |
146 QList<XQTelUiCommandExtension::ToolBarCommand> toolBarCmdList = |
150 convertToToolBarCommandList(resourceId); |
147 PhoneResourceAdapter::Instance()->convertToToolBarCommandList(resourceId); |
151 |
148 |
152 if (serviceId != -1) { |
149 if (serviceId != -1) { |
153 PhoneCommandExtensionWrapper *extension = commandExtension(serviceId); |
150 PhoneCommandExtensionWrapper *extension = commandExtension(serviceId); |
154 |
151 |
155 if (extension) { |
152 if (extension) { |
156 QList<XQTelUiCommandExtension::CallInfo> callInfo; |
153 QList<XQTelUiCommandExtension::CallInfo> callInfo; |
157 extension->getCallInfoList( |
154 extension->getCallInfoList( |
158 callInfo,callStates,serviceIds,callId); |
155 callInfo,callStates,serviceIds,callId); |
159 |
156 |
160 QList<XQTelUiCommandExtension::ToolBarCommand> toolBarCmdList; |
|
161 |
|
162 mapToExtensionToolBarItems(commands,toolBarCmdList); |
|
163 //Modify tool bar command list by extension |
157 //Modify tool bar command list by extension |
164 extension->modifyToolBarCommandList(callInfo,toolBarCmdList); |
158 extension->modifyToolBarCommandList(callInfo,toolBarCmdList); |
165 // Map tool bar item list back to the phone action tool bar item list. |
159 |
166 mapToPhoneActionToolBarItems(toolBarCmdList,commands); |
160 } |
167 } |
161 } |
168 } |
162 |
169 |
163 QList<HbAction *> actions; |
170 for ( int i=0; i < commands.count(); ++i) { |
164 for ( int i=0; i < toolBarCmdList.count(); ++i) { |
171 PhoneAction *action = mapCommandToAction( |
165 HbAction *action = createAction( |
172 commands.at(i).mCommandId, !commands.at(i).mEnabled); |
166 toolBarCmdList[i].mCommandId, |
|
167 toolBarCmdList[i].mIsEnabled); |
173 if (action) { |
168 if (action) { |
174 actions.append(action); |
169 actions.append(action); |
175 } |
170 } |
176 } |
171 } |
177 |
172 |
562 } |
528 } |
563 |
529 |
564 return ret; |
530 return ret; |
565 } |
531 } |
566 |
532 |
567 PhoneAction *PhoneUiCommandController::mapCommandToAction( |
533 |
568 int command, bool disabled) const |
534 |
569 { |
535 HbAction *PhoneUiCommandController::createAction( |
570 PhoneAction *action=0; |
536 int extensionCommand, bool enabled) const |
571 |
537 { |
572 switch( command ) { |
538 QScopedPointer<HbAction> action(new HbAction); |
|
539 action->setEnabled(enabled); |
|
540 |
|
541 switch (extensionCommand) { |
573 case PhoneInCallCmdJoinToConference: { |
542 case PhoneInCallCmdJoinToConference: { |
574 action = new PhoneAction; |
|
575 action->setIcon(HbIcon("qtg_mono_join_call")); |
543 action->setIcon(HbIcon("qtg_mono_join_call")); |
576 action->setDisabled(disabled); |
544 action->setProperty("command", EPhoneInCallCmdJoin); |
577 action->setCommand(EPhoneInCallCmdJoin); |
|
578 } |
545 } |
579 break; |
546 break; |
580 |
547 |
581 case PhoneInCallCmdCreateConference: { |
548 case PhoneInCallCmdCreateConference: { |
582 action = new PhoneAction; |
|
583 action->setIcon(HbIcon("qtg_mono_join_call")); |
549 action->setIcon(HbIcon("qtg_mono_join_call")); |
584 action->setDisabled(disabled); |
550 action->setProperty("command", EPhoneInCallCmdCreateConference); |
585 action->setCommand(EPhoneInCallCmdCreateConference); |
|
586 } |
551 } |
587 break; |
552 break; |
588 |
553 |
589 case PhoneInCallCmdAnswer: { |
554 case PhoneInCallCmdAnswer: { |
590 action = new PhoneAction; |
|
591 action->setIcon(HbIcon("qtg_mono_call")); |
555 action->setIcon(HbIcon("qtg_mono_call")); |
592 action->setDisabled(disabled); |
556 action->setProperty("command", EPhoneCallComingCmdAnswer); |
593 action->setCommand (EPhoneCallComingCmdAnswer); |
557 action->setSoftKeyRole(QAction::PositiveSoftKey); |
594 action->setActionRole(PhoneAction::Accept); |
|
595 } |
558 } |
596 break; |
559 break; |
597 |
560 |
598 case PhoneInCallCmdReject: { |
561 case PhoneInCallCmdReject: { |
599 action = new PhoneAction; |
|
600 action->setIcon(HbIcon("qtg_mono_reject_call")); |
562 action->setIcon(HbIcon("qtg_mono_reject_call")); |
601 action->setDisabled(disabled); |
563 action->setProperty("command", EPhoneCallComingCmdReject); |
602 action->setCommand (EPhoneCallComingCmdReject); |
564 action->setSoftKeyRole(QAction::NegativeSoftKey); |
603 action->setActionRole(PhoneAction::Decline); |
|
604 } |
565 } |
605 break; |
566 break; |
606 |
567 |
607 case PhoneInCallCmdHold: { |
568 case PhoneInCallCmdHold: { |
608 action = new PhoneAction; |
|
609 action->setIcon(HbIcon("qtg_mono_hold_call")); |
569 action->setIcon(HbIcon("qtg_mono_hold_call")); |
610 action->setDisabled(disabled); |
570 action->setProperty("command", EPhoneInCallCmdHold); |
611 action->setCommand(EPhoneInCallCmdHold); |
|
612 } |
571 } |
613 break; |
572 break; |
614 |
573 |
615 case PhoneInCallCmdUnhold: { |
574 case PhoneInCallCmdUnhold: { |
616 action = new PhoneAction; |
|
617 action->setIcon(HbIcon("qtg_mono_call")); |
575 action->setIcon(HbIcon("qtg_mono_call")); |
618 action->setDisabled(disabled); |
576 action->setProperty("command", EPhoneInCallCmdUnhold); |
619 action->setCommand(EPhoneInCallCmdUnhold); |
|
620 } |
577 } |
621 break; |
578 break; |
622 |
579 |
623 case PhoneInCallCmdEndActive: { |
580 case PhoneInCallCmdEndActive: { |
624 action = new PhoneAction; |
|
625 action->setIcon(HbIcon("qtg_mono_end_call")); |
581 action->setIcon(HbIcon("qtg_mono_end_call")); |
626 action->setDisabled(disabled); |
582 action->setProperty("command", EPhoneInCallCmdEndThisActiveCall); |
627 action->setCommand(EPhoneInCallCmdEndThisActiveCall); |
583 action->setSoftKeyRole(QAction::NegativeSoftKey); |
628 action->setActionRole(PhoneAction::Decline); |
|
629 } |
584 } |
630 break; |
585 break; |
631 |
586 |
632 case PhoneInCallCmdEndOutgoingCall: { |
587 case PhoneInCallCmdEndOutgoingCall: { |
633 action = new PhoneAction; |
|
634 action->setIcon(HbIcon("qtg_mono_end_call")); |
588 action->setIcon(HbIcon("qtg_mono_end_call")); |
635 action->setDisabled(disabled); |
589 action->setProperty("command", EPhoneInCallCmdEndThisOutgoingCall); |
636 action->setCommand(EPhoneInCallCmdEndThisOutgoingCall); |
590 action->setSoftKeyRole(QAction::NegativeSoftKey); |
637 action->setActionRole(PhoneAction::Decline); |
|
638 } |
591 } |
639 break; |
592 break; |
640 |
593 |
641 case PhoneInCallCmdReplace: { |
594 case PhoneInCallCmdReplace: { |
642 action = new PhoneAction; |
|
643 action->setIcon(HbIcon("qtg_mono_replace_call")); |
595 action->setIcon(HbIcon("qtg_mono_replace_call")); |
644 action->setDisabled(disabled); |
596 action->setProperty("command", EPhoneInCallCmdReplace); |
645 action->setCommand(EPhoneInCallCmdReplace); |
597 action->setSoftKeyRole(QAction::PositiveSoftKey); |
646 action->setActionRole(PhoneAction::Accept); |
|
647 } |
598 } |
648 break; |
599 break; |
649 |
600 |
650 case PhoneInCallCmdSwap: { |
601 case PhoneInCallCmdSwap: { |
651 action = new PhoneAction; |
|
652 action->setIcon(HbIcon("qtg_mono_swap_call")); |
602 action->setIcon(HbIcon("qtg_mono_swap_call")); |
653 action->setDisabled(disabled); |
603 action->setProperty("command", EPhoneInCallCmdSwap); |
654 action->setCommand(EPhoneInCallCmdSwap); |
|
655 } |
604 } |
656 break; |
605 break; |
657 case PhoneCallComingCmdSoftReject: { |
606 case PhoneCallComingCmdSoftReject: { |
658 action = new PhoneAction; |
|
659 action->setIcon(HbIcon("qtg_mono_send")); |
607 action->setIcon(HbIcon("qtg_mono_send")); |
660 action->setDisabled(disabled); |
608 action->setProperty("command", EPhoneCallComingCmdSoftReject); |
661 action->setCommand(EPhoneCallComingCmdSoftReject); |
|
662 } |
609 } |
663 break; |
610 break; |
664 case PhoneCallComingCmdSilent: { |
611 case PhoneCallComingCmdSilent: { |
665 action = new PhoneAction; |
|
666 action->setIcon(HbIcon("qtg_mono_speaker_off")); |
612 action->setIcon(HbIcon("qtg_mono_speaker_off")); |
667 action->setDisabled(disabled); |
613 action->setProperty("command", EPhoneCallComingCmdSilent); |
668 action->setCommand(EPhoneCallComingCmdSilent); |
|
669 } |
614 } |
670 break; |
615 break; |
671 case PhoneInCallCmdOpenDialer: { |
616 case PhoneInCallCmdOpenDialer: { |
672 action = new PhoneAction; |
|
673 action->setIcon(HbIcon("qtg_mono_dialer")); |
617 action->setIcon(HbIcon("qtg_mono_dialer")); |
674 action->setDisabled(disabled); |
618 action->setProperty("command", EPhoneInCallCmdDialer); |
675 action->setCommand(EPhoneInCallCmdDialer); |
|
676 } |
619 } |
677 break; |
620 break; |
678 case PhoneInCallCmdMute: { |
621 case PhoneInCallCmdMute: { |
679 action = new PhoneAction; |
|
680 action->setIcon(HbIcon("qtg_mono_mic_mute")); |
622 action->setIcon(HbIcon("qtg_mono_mic_mute")); |
681 action->setDisabled(disabled); |
623 action->setProperty("command", EPhoneInCallCmdMute); |
682 action->setCommand(EPhoneInCallCmdMute); |
|
683 } |
624 } |
684 break; |
625 break; |
685 case PhoneInCallCmdUnmute: { |
626 case PhoneInCallCmdUnmute: { |
686 action = new PhoneAction; |
|
687 action->setIcon(HbIcon("qtg_mono_mic_unmute")); |
627 action->setIcon(HbIcon("qtg_mono_mic_unmute")); |
688 action->setDisabled(disabled); |
628 action->setProperty("command", EPhoneInCallCmdUnmute); |
689 action->setCommand(EPhoneInCallCmdUnmute); |
|
690 } |
629 } |
691 break; |
630 break; |
692 case PhoneInCallCmdActivateIhf: { |
631 case PhoneInCallCmdActivateIhf: { |
693 action = new PhoneAction; |
|
694 action->setIcon(HbIcon("qtg_mono_speaker")); |
632 action->setIcon(HbIcon("qtg_mono_speaker")); |
695 action->setDisabled(disabled); |
633 action->setProperty("command", EPhoneInCallCmdActivateIhf); |
696 action->setCommand(EPhoneInCallCmdActivateIhf); |
|
697 } |
634 } |
698 break; |
635 break; |
699 case PhoneInCallCmdDeactivateIhf: { |
636 case PhoneInCallCmdDeactivateIhf: { |
700 action = new PhoneAction; |
|
701 action->setIcon(HbIcon("qtg_mono_mobile")); |
637 action->setIcon(HbIcon("qtg_mono_mobile")); |
702 action->setDisabled(disabled); |
638 action->setProperty("command", EPhoneInCallCmdDeactivateIhf); |
703 action->setCommand(EPhoneInCallCmdDeactivateIhf); |
|
704 } |
639 } |
705 break; |
640 break; |
706 case PhoneInCallCmdOpenContacts: { |
641 case PhoneInCallCmdOpenContacts: { |
707 action = new PhoneAction; |
|
708 action->setIcon(HbIcon("qtg_mono_contacts")); |
642 action->setIcon(HbIcon("qtg_mono_contacts")); |
709 action->setDisabled(disabled); |
643 action->setProperty("command", EPhoneInCallCmdContacts); |
710 action->setCommand(EPhoneInCallCmdContacts); |
|
711 } |
644 } |
712 break; |
645 break; |
713 case PhoneInCallCmdBtHandsfree: { |
646 case PhoneInCallCmdBtHandsfree: { |
714 action = new PhoneAction; |
|
715 action->setIcon(HbIcon("qtg_mono_bluetooth_headset")); |
647 action->setIcon(HbIcon("qtg_mono_bluetooth_headset")); |
716 action->setDisabled(disabled); |
648 action->setProperty("command", EPhoneInCallCmdBtHandsfree); |
717 action->setCommand(EPhoneInCallCmdBtHandsfree); |
|
718 } |
649 } |
719 break; |
650 break; |
720 case PhoneInCallCmdHandset: { |
651 case PhoneInCallCmdHandset: { |
721 action = new PhoneAction; |
|
722 action->setIcon(HbIcon("qtg_mono_mobile")); |
652 action->setIcon(HbIcon("qtg_mono_mobile")); |
723 action->setDisabled(disabled); |
653 action->setProperty("command", EPhoneInCallCmdHandset); |
724 action->setCommand(EPhoneInCallCmdHandset); |
654 } |
725 } |
655 break; |
726 break; |
656 default: { |
727 default: |
657 delete action.take(); |
|
658 } |
728 break; |
659 break; |
729 } |
660 } |
730 |
661 |
731 return action; |
662 return action.take(); |
732 } |
663 } |
733 |
664 |
734 bool PhoneUiCommandController::emergencyCall(QMap<int,int> callStates) const |
665 bool PhoneUiCommandController::emergencyCall(QMap<int,int> callStates) const |
735 { |
666 { |
736 return callStates.keys().contains(KEmergencyCallId); |
667 return callStates.keys().contains(KEmergencyCallId); |