diff -r bab96b7ed1a4 -r f39ed5e045e0 phoneapp/phoneuiqtviewadapter/src/phoneuicommandcontroller.cpp --- a/phoneapp/phoneuiqtviewadapter/src/phoneuicommandcontroller.cpp Tue Jun 15 14:14:38 2010 +0100 +++ b/phoneapp/phoneuiqtviewadapter/src/phoneuicommandcontroller.cpp Thu Jul 22 16:33:21 2010 +0100 @@ -93,9 +93,8 @@ int callId) { QMap translatedActions; - bool sameServices = areServicesSame(callStates, serviceIds); QList commands = buttonCommandList( - callState, emergencyCall, sameServices, callStates.values()); + callState, emergencyCall, callStates.values()); PhoneCommandExtensionWrapper *extension = commandExtension(serviceId); @@ -127,8 +126,57 @@ return translatedActions; } +QList PhoneUiCommandController::toolBarActions( + int resourceId, + QMap callStates, + QMap serviceIds, + int serviceId, + int callId) +{ + QList actions; + + //Set tool bar button flags + setJoinFlag(callStates, serviceIds); + setConferenceFlag(callStates.values()); + setHoldFlag(callStates.value(callId)); + setMultiCallFlag(callStates.values()); + setOutgoingFlag(callStates.values()); + + //Get tool bar item list by resource id. + QList commands = PhoneResourceAdapter::Instance()-> + convertToToolBarCommandList(resourceId); + + if (serviceId != -1) { + PhoneCommandExtensionWrapper *extension = commandExtension(serviceId); + + if (extension) { + QList callInfo; + extension->getCallInfoList( + callInfo,callStates,serviceIds,callId); + + QList toolBarCmdList; + + mapToExtensionToolBarItems(commands,toolBarCmdList); + //Modify tool bar command list by extension + extension->modifyToolBarCommandList(callInfo,toolBarCmdList); + // Map tool bar item list back to the phone action tool bar item list. + mapToPhoneActionToolBarItems(toolBarCmdList,commands); + } + } + + for ( int i=0; i < commands.count(); ++i) { + PhoneAction *action = mapCommandToAction( + commands.at(i).mCommandId, !commands.at(i).mEnabled); + if (action) { + actions.append(action); + } + } + + return actions; +} + QList PhoneUiCommandController::menuCommands( - QMap callStates, QMap serviceIds ) + QMap callStates, QMap serviceIds ) const { PHONE_DEBUG("PhoneMenuController::menuCommands"); QList commands; @@ -188,7 +236,7 @@ qDeleteAll(values); } -int PhoneUiCommandController::mapCommand(int command) +int PhoneUiCommandController::mapCommand(int command) const { int ret(-1); @@ -202,12 +250,6 @@ case PhoneInCallCmdSwitchToVideo: ret = EPhoneInCallCmdSwitchToVideo; break; - case PhoneInCallCmdSendMessage: - //TODO - break; - case PhoneInCallShareVideo: - //TODO - break; case PhoneInCallCmdHandoverToWlan: ret = EPhoneCmdHandoverToWlan; break; @@ -230,7 +272,7 @@ } TUid PhoneUiCommandController::ResolveImplementationUidL( - TUint32 aServiceId, TServicePropertyName aPropertyName ) + TUint32 aServiceId, TServicePropertyName aPropertyName ) const { TUid implUid = { 0 }; CSPEntry* entry = CSPEntry::NewLC(); @@ -272,16 +314,14 @@ } } - if ( -1 == pluginInd ) - { + if ( -1 == pluginInd ) { wrapper = new PhoneCommandExtensionWrapper( pluginUid.iUid ); - if (wrapper) + if (wrapper) { m_commandExtensions.append( wrapper ); } - else - { + } else { wrapper = m_commandExtensions[pluginInd]; - } + } m_lastCommandExtension = wrapper; return wrapper; @@ -302,14 +342,14 @@ } bool PhoneUiCommandController::areServicesSame( - QMap callStates, QMap serviceIds) + QMap callStates, QMap serviceIds) const { bool ret(true); int serviceId(-1); for(int i=0;i callStates, QMap serviceIds) const +{ + bool disable(PhoneResourceAdapter::Instance()->buttonsController()-> + getButtonFlags(PhoneUIQtButtonsController::FullConference)); + + if (!disable) { + disable = !areServicesSame(callStates, serviceIds); + } + + PhoneResourceAdapter::Instance()->buttonsController()-> + setButtonFlags(PhoneUIQtButtonsController::DisableJoin, disable); +} + +void PhoneUiCommandController::setHoldFlag(int callState) const +{ + bool hold = (callState == EPEStateHeldConference || + callState == EPEStateHeld ); + + PhoneResourceAdapter::Instance()->buttonsController()-> + setButtonFlags(PhoneUIQtButtonsController::Hold,hold); +} + +void PhoneUiCommandController::setOutgoingFlag( + QList callStates) const +{ + bool outgoing(callStates.contains(EPEStateDialing) || + callStates.contains(EPEStateConnecting)); + + PhoneResourceAdapter::Instance()->buttonsController()-> + setButtonFlags(PhoneUIQtButtonsController::Outgoing, outgoing); +} + +void PhoneUiCommandController::setConferenceFlag( + QList callStates) const +{ + bool conference(callStates.contains(EPEStateConnectedConference) || + callStates.contains(EPEStateHeldConference)); + + PhoneResourceAdapter::Instance()->buttonsController()-> + setButtonFlags(PhoneUIQtButtonsController::Conference, conference); +} + +void PhoneUiCommandController::setMultiCallFlag( + QList callStates) const +{ + bool multicall(false); + + if (1buttonsController()-> + setButtonFlags(PhoneUIQtButtonsController::MultiCall, multicall); +} + +void PhoneUiCommandController::mapToExtensionToolBarItems( + const QList &sourceList, + QList &toolBarCmdList) const +{ + toolBarCmdList.clear(); + + for (int i=0;i &sourceList, + QList &commandList) const +{ + commandList.clear(); + + for (int i=0;i PhoneUiCommandController::buttonCommandList( int callState, bool emergencyCall, - bool sameServices, - QList callStates) + QList callStates) const { QList ret; @@ -333,6 +460,36 @@ case EPEStateDialing: case EPEStateConnecting: { + if (!emergencyCall) { + if (PhoneResourceAdapter::Instance()->buttonsController()-> + getButtonFlags( + PhoneUIQtButtonsController::IhfAsPushButton)) { + if (PhoneResourceAdapter::Instance()->buttonsController()->getButtonFlags( + PhoneUIQtButtonsController::BluetoothAvailable)) { + if (PhoneResourceAdapter::Instance()->buttonsController()->getButtonFlags( + PhoneUIQtButtonsController::Btaa)) { + ret.append(PhoneInCallCmdHandset); + } else { + ret.append(PhoneInCallCmdBtHandsfree); + } + } else { + if (!PhoneResourceAdapter::Instance()->buttonsController()-> + getButtonFlags(PhoneUIQtButtonsController::Ihf)) { + ret.append(PhoneInCallCmdActivateIhf); + } else { + ret.append(PhoneInCallCmdDeactivateIhf); + } + } + } else { + if (PhoneResourceAdapter::Instance()->buttonsController()-> + getButtonFlags(PhoneUIQtButtonsController::Mute)) { + ret.append(PhoneInCallCmdUnmute); + } else { + ret.append(PhoneInCallCmdMute); + } + } + } + ret.append(PhoneInCallCmdEndOutgoingCall); } break; @@ -347,49 +504,35 @@ break; case EPEStateConnected: - case EPEStateConnectedConference: { - if (!emergencyCall) { - if ( 1 == callStates.size() || - (2 == callStates.size() && - callStates.contains(EPEStateRinging)) ) { - ret.append(PhoneInCallCmdHold); - } else { - - if (EPEStateConnectedConference == callState) { - ret.append(PhoneInCallCmdSwap); - } else if (sameServices && - false == PhoneResourceAdapter::Instance()->buttonsController()-> - getButtonFlags(PhoneUIQtButtonsController::DisableJoin)) { - if ( callStates.contains(EPEStateHeldConference) ) { - ret.append(PhoneInCallCmdJoinToConference); - } else { - ret.append(PhoneInCallCmdCreateConference); - } - } - } - } - - ret.append(PhoneInCallCmdEndActive); - } - break; - + case EPEStateConnectedConference: case EPEStateHeld: case EPEStateHeldConference: { - if (1 == callStates.size() || - (2 == callStates.size() && - callStates.contains(EPEStateRinging))) { - - ret.append(PhoneInCallCmdUnhold); - } else { - if (EPEStateHeldConference == callState) { - ret.append(PhoneInCallCmdSwap); - } else if (sameServices && - false == PhoneResourceAdapter::Instance()->buttonsController()-> - getButtonFlags(PhoneUIQtButtonsController::DisableJoin)) { - if ( callStates.contains(EPEStateConnectedConference)) { - ret.append(PhoneInCallCmdJoinToConference); + if (!emergencyCall) { + if (PhoneResourceAdapter::Instance()->buttonsController()-> + getButtonFlags( + PhoneUIQtButtonsController::IhfAsPushButton)) { + if (PhoneResourceAdapter::Instance()->buttonsController()->getButtonFlags( + PhoneUIQtButtonsController::BluetoothAvailable)) { + if (PhoneResourceAdapter::Instance()->buttonsController()->getButtonFlags( + PhoneUIQtButtonsController::Btaa)) { + ret.append(PhoneInCallCmdHandset); + } else { + ret.append(PhoneInCallCmdBtHandsfree); + } } else { - ret.append(PhoneInCallCmdCreateConference); + if (!PhoneResourceAdapter::Instance()->buttonsController()-> + getButtonFlags(PhoneUIQtButtonsController::Ihf)) { + ret.append(PhoneInCallCmdActivateIhf); + } else { + ret.append(PhoneInCallCmdDeactivateIhf); + } + } + } else { + if (PhoneResourceAdapter::Instance()->buttonsController()-> + getButtonFlags(PhoneUIQtButtonsController::Mute)) { + ret.append(PhoneInCallCmdUnmute); + } else { + ret.append(PhoneInCallCmdMute); } } } @@ -408,7 +551,8 @@ return ret; } -PhoneAction *PhoneUiCommandController::mapCommandToAction(int command) +PhoneAction *PhoneUiCommandController::mapCommandToAction( + int command, bool disabled) const { PhoneAction *action=0; @@ -416,6 +560,7 @@ case PhoneInCallCmdJoinToConference: { action = new PhoneAction; action->setIcon(HbIcon("qtg_mono_join_call")); + action->setDisabled(disabled); action->setCommand(EPhoneInCallCmdJoin); } break; @@ -423,6 +568,7 @@ case PhoneInCallCmdCreateConference: { action = new PhoneAction; action->setIcon(HbIcon("qtg_mono_join_call")); + action->setDisabled(disabled); action->setCommand(EPhoneInCallCmdCreateConference); } break; @@ -430,7 +576,8 @@ case PhoneInCallCmdAnswer: { action = new PhoneAction; action->setIcon(HbIcon("qtg_mono_call")); - action->setCommand (EPhoneCallComingCmdAnswer); + action->setDisabled(disabled); + action->setCommand (EPhoneCallComingCmdAnswer); action->setActionRole(PhoneAction::Accept); } break; @@ -438,6 +585,7 @@ case PhoneInCallCmdReject: { action = new PhoneAction; action->setIcon(HbIcon("qtg_mono_reject_call")); + action->setDisabled(disabled); action->setCommand (EPhoneCallComingCmdReject); action->setActionRole(PhoneAction::Decline); } @@ -446,6 +594,7 @@ case PhoneInCallCmdHold: { action = new PhoneAction; action->setIcon(HbIcon("qtg_mono_hold_call")); + action->setDisabled(disabled); action->setCommand(EPhoneInCallCmdHold); } break; @@ -453,6 +602,7 @@ case PhoneInCallCmdUnhold: { action = new PhoneAction; action->setIcon(HbIcon("qtg_mono_call")); + action->setDisabled(disabled); action->setCommand(EPhoneInCallCmdUnhold); } break; @@ -460,6 +610,7 @@ case PhoneInCallCmdEndActive: { action = new PhoneAction; action->setIcon(HbIcon("qtg_mono_end_call")); + action->setDisabled(disabled); action->setCommand(EPhoneInCallCmdEndThisActiveCall); action->setActionRole(PhoneAction::Decline); } @@ -468,6 +619,7 @@ case PhoneInCallCmdEndOutgoingCall: { action = new PhoneAction; action->setIcon(HbIcon("qtg_mono_end_call")); + action->setDisabled(disabled); action->setCommand(EPhoneInCallCmdEndThisOutgoingCall); action->setActionRole(PhoneAction::Decline); } @@ -476,6 +628,7 @@ case PhoneInCallCmdReplace: { action = new PhoneAction; action->setIcon(HbIcon("qtg_mono_replace_call")); + action->setDisabled(disabled); action->setCommand(EPhoneInCallCmdReplace); action->setActionRole(PhoneAction::Accept); } @@ -483,11 +636,81 @@ case PhoneInCallCmdSwap: { action = new PhoneAction; - action->setIcon(HbIcon("qtg_mono_swap")); + action->setIcon(HbIcon("qtg_mono_replace_call")); + action->setDisabled(disabled); action->setCommand(EPhoneInCallCmdSwap); } break; - + case PhoneCallComingCmdSoftReject: { + action = new PhoneAction; + action->setIcon(HbIcon("qtg_mono_send")); + action->setDisabled(disabled); + action->setCommand(EPhoneCallComingCmdSoftReject); + } + break; + case PhoneCallComingCmdSilent: { + action = new PhoneAction; + action->setIcon(HbIcon("qtg_mono_speaker_off")); + action->setDisabled(disabled); + action->setCommand(EPhoneCallComingCmdSilent); + } + break; + case PhoneInCallCmdOpenDialer: { + action = new PhoneAction; + action->setIcon(HbIcon("qtg_mono_dialer")); + action->setDisabled(disabled); + action->setCommand(EPhoneInCallCmdDialer); + } + break; + case PhoneInCallCmdMute: { + action = new PhoneAction; + action->setIcon(HbIcon("qtg_mono_mic_mute")); + action->setDisabled(disabled); + action->setCommand(EPhoneInCallCmdMute); + } + break; + case PhoneInCallCmdUnmute: { + action = new PhoneAction; + action->setIcon(HbIcon("qtg_mono_mic_unmute")); + action->setDisabled(disabled); + action->setCommand(EPhoneInCallCmdUnmute); + } + break; + case PhoneInCallCmdActivateIhf: { + action = new PhoneAction; + action->setIcon(HbIcon("qtg_mono_speaker")); + action->setDisabled(disabled); + action->setCommand(EPhoneInCallCmdActivateIhf); + } + break; + case PhoneInCallCmdDeactivateIhf: { + action = new PhoneAction; + action->setIcon(HbIcon("qtg_mono_mobile")); + action->setDisabled(disabled); + action->setCommand(EPhoneInCallCmdDeactivateIhf); + } + break; + case PhoneInCallCmdOpenContacts: { + action = new PhoneAction; + action->setIcon(HbIcon("qtg_mono_contacts")); + action->setDisabled(disabled); + action->setCommand(EPhoneInCallCmdContacts); + } + break; + case PhoneInCallCmdBtHandsfree: { + action = new PhoneAction; + action->setIcon(HbIcon("qtg_mono_bluetooth_headset")); + action->setDisabled(disabled); + action->setCommand(EPhoneInCallCmdBtHandsfree); + } + break; + case PhoneInCallCmdHandset: { + action = new PhoneAction; + action->setIcon(HbIcon("qtg_mono_mobile")); + action->setDisabled(disabled); + action->setCommand(EPhoneInCallCmdHandset); + } + break; default: break; }