X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FCallActiveCallForm.cpp;h=6ee1eb32dd9053b8f78927dda274c003d4cb9dbf;hb=11a1a23167d24edfa0c5988cdcf8fdfe3b5aec2c;hp=b00089d3c67fc33826c01c9f703c3f5a87f7bfaf;hpb=6a3ed04a7ca44470fdfeb8f35980f99eab5314b2;p=apps%2Fosp%2FCall.git diff --git a/src/CallActiveCallForm.cpp b/src/CallActiveCallForm.cpp index b00089d..6ee1eb3 100644 --- a/src/CallActiveCallForm.cpp +++ b/src/CallActiveCallForm.cpp @@ -1,7 +1,7 @@ // // Copyright (c) 2012 Samsung Electronics Co., Ltd. // -// Licensed under the Flora License, Version 1.0 (the License); +// Licensed under the Flora License, Version 1.1 (the License); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // @@ -109,6 +109,8 @@ ActiveCallForm::ActiveCallForm(FormType formType) __pSmallPhotoLabel = null; __pActiveCallInfo = null; __pHeldCallInfo = null; + __isSwapInProgress = false; + __pAddressbook = null; } ActiveCallForm::~ActiveCallForm(void) @@ -215,7 +217,7 @@ ActiveCallForm::ShowDTMFKeypad(void) AppLog("DTMF Keypad rect(%d,%d,%d,%d)",rect.x,rect.y,rect.width,rect.height); __pDTMFKeypad = new (std::nothrow) DtmfKeyPadPanel(); __pDTMFKeypad->Initialize(this, rect); - AddControl(*__pDTMFKeypad); + AddControl(__pDTMFKeypad); //set layout relation w.r.t call buttons panel RelativeLayout* pRelativeLayout = dynamic_cast(GetLandscapeLayoutN()); @@ -226,11 +228,12 @@ ActiveCallForm::ShowDTMFKeypad(void) } } __pDTMFKeypad->SetShowState(true); + EditField* pTextBox = static_cast(__pDTMFKeypad->GetControl(IDC_TEXTBOX)); if(__DtmfString.IsEmpty() == false) { - EditField* pTextBox = static_cast(__pDTMFKeypad->GetControl(IDC_TEXTBOX)); pTextBox->SetText(__DtmfString); } + pTextBox->SetFocus(); __pDTMFKeypad->Draw(true); __pDTMFKeypad->Show(); } @@ -275,6 +278,7 @@ ActiveCallForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui { //in Portrait mode it is hidden beneath DTMF Keypad. SetShowStateOnKeypad(false); + DestroyMoreOptionsMenuList(); } if(__pDTMFKeypad->GetShowState() == true) { @@ -299,7 +303,7 @@ ActiveCallForm::HideDTMFKeypad(void) { __DtmfString = static_cast(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText(); - RemoveControl(*__pDTMFKeypad); + RemoveControl(__pDTMFKeypad); __pDTMFKeypad = null; } } @@ -321,7 +325,7 @@ ActiveCallForm::InitializeCallButtonsPanel(void) __pCallButtonsPanel = new (std::nothrow) CallButtonsPanel(); __pCallButtonsPanel->ConstructPanel(this, __formType); __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds()); - r = AddControl(*__pCallButtonsPanel); + r = AddControl(__pCallButtonsPanel); } RelativeLayout* pRelativeLayout = dynamic_cast(GetPortraitLayoutN()); @@ -453,6 +457,7 @@ ActiveCallForm::SetHoldButtonStatus(bool toHoldCall) pHoldBtn->SetActionId(cmdId); pHoldBtn->SetNormalBitmap(Point(0, 0),*normalImg); pHoldBtn->SetPressedBitmap(Point(0, 0),*pressImg); + pHoldBtn->Invalidate(true); } if (pHoldLbl) { @@ -483,7 +488,7 @@ ActiveCallForm::CreateMoreOptionsMenuList(void) pBgPopupArwBmp = null; // Adds a Label to the Form - AddControl(*__pMoreOptionsListAnchor); + AddControl(__pMoreOptionsListAnchor); } //create options menu list @@ -494,7 +499,7 @@ ActiveCallForm::CreateMoreOptionsMenuList(void) __pMoreOptionsList->SetItemProvider(*this); __pMoreOptionsList->AddListViewItemEventListener(*this); //Add option list to the form - AddControl(*__pMoreOptionsList); + AddControl(__pMoreOptionsList); } else { @@ -509,14 +514,14 @@ ActiveCallForm::DestroyMoreOptionsMenuList(void) if (__pMoreOptionsListAnchor != null) { //removes and delete the child control - RemoveControl(*__pMoreOptionsListAnchor); + RemoveControl(__pMoreOptionsListAnchor); __pMoreOptionsListAnchor = null; } if (__pMoreOptionsList != null) { //removes and delete the child control - RemoveControl(*__pMoreOptionsList); + RemoveControl(__pMoreOptionsList); __pMoreOptionsList = null; } } @@ -577,6 +582,7 @@ ActiveCallForm::OnActionPerformed(const Control& source, int actionId) { //hide only in portrait mode. SetShowStateOnKeypad(false); + DestroyMoreOptionsMenuList(); } //Hide the hold button as it goes behind DTMF keypad SetHoldButtonShowState(false); @@ -729,8 +735,12 @@ ActiveCallForm::OnActionPerformed(const Control& source, int actionId) case IDA_SWAP_CALLS: { - AppAssert(__formType == FORMTYPE_MULTIPLECALLS); - __pCallPresentor->SwapCalls(); + if(IsSwapInProgress() == false) + { + AppAssert(__formType == FORMTYPE_MULTIPLECALLS); + __pCallPresentor->SwapCalls(); + SetSwapInProgress(true); + } } break; @@ -842,6 +852,18 @@ ActiveCallForm::OnActionPerformed(const Control& source, int actionId) } } +bool +ActiveCallForm::IsSwapInProgress(void) +{ + return __isSwapInProgress; +} + +void +ActiveCallForm::SetSwapInProgress(bool progress) +{ + __isSwapInProgress = progress; +} + void ActiveCallForm::SetTextToDTMFTextField(const String& dtmfStr) { @@ -859,7 +881,7 @@ ActiveCallForm::SetTextToDTMFTextField(const String& dtmfStr) pTextBox->InsertTextAtCursorPosition(dtmfStr); //pTextBox->AppendText(dtmfStr); - pTextBox->SetFocus(); + // pTextBox->SetFocus(); pTextBox->Invalidate(true); } } @@ -878,6 +900,14 @@ ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& //Initialize keypad and buttons InitializeCallButtonsPanel(); + AddressbookManager* pAddressbookManager = AddressbookManager::GetInstance(); + __pAddressbook = pAddressbookManager->GetAddressbookN(DEFAULT_ADDRESSBOOK_ID); + if(__pAddressbook != null) + { + __pAddressbook->SetAddressbookChangeEventListener(this); + } + + if (__pActiveCallInfo != null) { delete __pActiveCallInfo; @@ -939,9 +969,9 @@ ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& activeContactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN)); } ShowPersonDetails(activeContactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo); - //show call active time using Timer - __activeCallStartTime = pCall->GetCallConnectTime(); + //__activeCallStartTime = pCall->GetCallConnectTime(); + __activeCallStartTime = pCall->GetDurationTime(); ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime); } break; @@ -955,7 +985,8 @@ ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& *__pActiveCallInfo = *pCall; //show call active time using Timer - __activeCallStartTime = pCall->GetCallConnectTime(); + //__activeCallStartTime = pCall->GetCallConnectTime(); + __activeCallStartTime = pCall->GetDurationTime(); ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime); } break; @@ -999,8 +1030,14 @@ ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& __pCallButtonsPanel->EnableAddCallButton(true); } + + //bring button on top + __pCallButtonsPanel->SetButtonPosition(); + + //show call active time using Timer - __activeCallStartTime = __pActiveCallInfo->GetCallConnectTime(); + //__activeCallStartTime = __pActiveCallInfo->GetCallConnectTime(); + __activeCallStartTime = __pActiveCallInfo->GetDurationTime(); ShowTimerInfo(IDC_CALLER1_TIME_LABEL, __pActiveCallInfo->IsOnHold(),__activeCallStartTime); } break; @@ -1052,6 +1089,10 @@ ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& pArgs = null; } + //update position of call buttons panel + Label* pKeysBgLbl = static_cast(GetControl(IDC_KEY_BG_LABEL, true)); + __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds()); + CallApp* pCallApp = static_cast(CallApp::GetInstance()); pCallApp->SetTopMostWindow(false); } @@ -1060,11 +1101,6 @@ void ActiveCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId) { RemoveOrientationEventListener(*this); - if (__pCallButtonsPanel != null) - { - RemoveControl(*__pCallButtonsPanel); - __pCallButtonsPanel = null; - } if (__pActiveCallTimer != null) { __pActiveCallTimer->Cancel(); @@ -1087,6 +1123,10 @@ ActiveCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& __DtmfString.Clear(); CallApp* pCallApp = static_cast(CallApp::GetInstance()); pCallApp->RemoveAppStateChangeListener(*this); + if(__pAddressbook != null) + { + __pAddressbook->SetAddressbookChangeEventListener(null); + } } void @@ -1160,6 +1200,113 @@ ActiveCallForm::HandleConfCallChanged(void) } void +ActiveCallForm::OnContactsChanged(const Tizen::Base::Collection::IList& contactChangeInfoList) +{ + AppLog("Enter"); + switch (__formType) + { + + case FORMTYPE_OUTGOINGCALL: + case FORMTYPE_ACTIVECALL: + { + String pContactNumber; + pContactNumber.Append(__pActiveCallInfo->GetContactNumber()); + Contact* pContact = __pCallPresentor->GetContactN(__pActiveCallInfo->GetContactNumber()); + if(pContact == null) + { + __pActiveCallInfo->ResetContactNumber(null); + __pActiveCallInfo->ResetContactInfo(null); + + } + else + { + __pActiveCallInfo->SetContactNumber(pContactNumber); + __pActiveCallInfo->SetContactInfo(*pContact); + } + if(pContact != null) + { + delete pContact; + pContact = null; + } + ShowPersonDetails(pContactNumber, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo); + } + break; + + case FORMTYPE_EMERGENCYACTIVECALL: + { + } + break; + + case FORMTYPE_MULTIPLECALLS: + { + + IListT* pCallsList = __pCallPresentor->GetCallListN(); + if(pCallsList != null) + { + int listCount = pCallsList->GetCount(); + for(int index = 0; index < listCount; index++) + { + AppCallInfo callInfo; + Contact* pContact; + pCallsList->GetAt(index, callInfo); + if(__pActiveCallInfo == null) + { + __pActiveCallInfo = new (std::nothrow) AppCallInfo(); + } + *__pActiveCallInfo = callInfo; + String contactNumber; + contactNumber.Append(__pActiveCallInfo->GetContactNumber()); + pContact = __pCallPresentor->GetContactN(__pActiveCallInfo->GetContactNumber()); + if(pContact == null) + { + __pActiveCallInfo->ResetContactNumber(null); + __pActiveCallInfo->ResetContactInfo(null); + + } + else + { + __pActiveCallInfo->SetContactNumber(contactNumber); + __pActiveCallInfo->SetContactInfo(*pContact); + } + if(pContact != null) + { + delete pContact; + pContact = null; + } + if(callInfo.IsConferenceCall() == true) + { + continue; + } + if(callInfo.IsOnHold() == false) + { + ShowPersonDetails(contactNumber, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo); + } + else + { + ShowPersonDetails(contactNumber, IDC_NUMBER2_LABEL, IDC_CALLER2_LABEL, true,__pActiveCallInfo); + } + + } + + delete pCallsList; + pCallsList = null; + } + } + break; + default: + break; + } + AppLog("Exit"); +} + +void +ActiveCallForm::OnCategoriesChanged(const Tizen::Base::Collection::IList& categoryChangeInfoList) +{ + //No implementation +} + + +void ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListT& activeCallsList) { AppLog("ENTER"); @@ -1259,7 +1406,8 @@ ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListTGetCallConnectTime(); + //__activeCallStartTime = __pActiveCallInfo->GetCallConnectTime(); + __activeCallStartTime = __pActiveCallInfo->GetDurationTime(); ShowTimerInfo(IDC_CALLER1_TIME_LABEL,false,__activeCallStartTime); } else @@ -1315,14 +1463,16 @@ ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListTFetchCallerNameN(); + String* pDisplayName = pCallInfo->FetchLatestCallerNameN(phoneNumber); ShowCallerName(*pDisplayName, nameLblName); - Bitmap* pPhotoBitmap = pCallInfo->FetchCallerPhotoN(); + Bitmap* pPhotoBitmap = pCallInfo->FetchLatestCallerPhotoN(phoneNumber); ShowCallerPhoto(pPhotoBitmap, isSecondCaller); //free resources @@ -1442,7 +1592,7 @@ ActiveCallForm::ShowCallerPhoto(Bitmap* pPhotoId, bool isSecondCaller) //Remove small photo label if (__pSmallPhotoLabel != null) { - RemoveControl(*__pSmallPhotoLabel); + RemoveControl(__pSmallPhotoLabel); __pSmallPhotoLabel = null; } @@ -1500,6 +1650,7 @@ ActiveCallForm::ShowCallerPhoto(Bitmap* pPhotoId, bool isSecondCaller) if (pPhotoLbl) { pPhotoLbl->SetBackgroundBitmap(*pDefaultPhoto); + pPhotoLbl->Invalidate(true); } delete pDefaultPhoto; } @@ -1544,7 +1695,7 @@ ActiveCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId) { if (__pSmallPhotoLabel != null) { - RemoveControl(*__pSmallPhotoLabel); + RemoveControl(__pSmallPhotoLabel); __pSmallPhotoLabel = null; } //Draw Small Photo and show on small photo label @@ -1553,7 +1704,7 @@ ActiveCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId) __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0)); __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId); // Add a Label to the Form - AddControl(*__pSmallPhotoLabel); + AddControl(__pSmallPhotoLabel); __pSmallPhotoLabel->Invalidate(true); } @@ -1582,7 +1733,9 @@ ActiveCallForm::ShowTimerInfo(const String& timerLblName, bool isOnHold, long lo SetHoldButtonStatus(true); //current system time long long currTime = 0; - SystemTime::GetTicks(currTime); + //SystemTime::GetTicks(currTime); + CallApp* pPhoneApp = static_cast(CallApp::GetInstance()); + currTime = pPhoneApp->GetCallAppTicks(); //Set call duration TimeSpan diffSpan(abs(startTime - currTime)); @@ -1622,9 +1775,15 @@ void ActiveCallForm::SetHoldButtonShowState(bool showState) { Label* pLblControl = static_cast(GetControl(IDC_HOLD_LABEL)); - pLblControl->SetShowState(showState); + if(pLblControl != null) + { + pLblControl->SetShowState(showState); + } Button* pButtonControl = static_cast(GetControl(IDC_HOLD_BUTTON)); - pButtonControl->SetShowState(showState); + if(pButtonControl != null) + { + pButtonControl->SetShowState(showState); + } } void @@ -1788,7 +1947,8 @@ ActiveCallForm::OnListViewItemStateChanged(ListView& listView, int index, int el { //Goto conference call list form SceneManager* pSceneManager = SceneManager::GetInstance(); - pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SCENE_CONFCALLLIST), null); + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SCENE_CONFCALLLIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE, + SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_KEEP), null); } void