License and Privilege changes
[apps/osp/Call.git] / src / CallEndCallForm.cpp
index ae7ada8..deabc22 100644 (file)
@@ -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
 //
@@ -53,6 +53,10 @@ static const wchar_t* IDC_CALLER1_LABEL = L"IDC_CALLER1_LABEL";
 static const wchar_t* IDC_KEY_BG_LABEL = L"IDC_KEY_BG_LABEL";
 static const wchar_t* IDC_CALLER1_BIGPHOTO_LABEL = L"IDC_CALLER1_BIGPHOTO_LABEL";
 static const wchar_t* IDB_END_CALL_DEFAULT_ICON = L"C01-1_call_default_caller ID_720x720.png";
+static const wchar_t* IDC_VOICECALL_BUTTON = L"IDC_VOICECALL_BUTTON";
+static const wchar_t* IDC_VIDEOCALL_BUTTON = L"IDC_VIDEOCALL_BUTTON";
+static const wchar_t* IDC_ADD_TO_CONTACT_BUTTON = L"IDC_ADD_TO_CONTACT_BUTTON";
+static const wchar_t* IDC_MSG_BUTTON = L"IDC_MSG_BUTTON";
 
 
 EndCallForm::EndCallForm(void)
@@ -115,7 +119,7 @@ EndCallForm::InitializeCallButtonsPanel(void)
                __pCallButtonsPanel = new (std::nothrow) CallButtonsPanel();
                __pCallButtonsPanel->ConstructPanel(this, FORMTYPE_ENDCALL);
                __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
-               AddControl(*__pCallButtonsPanel);
+               AddControl(__pCallButtonsPanel);
        }
 
        RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
@@ -164,6 +168,11 @@ EndCallForm::OnActionPerformed(const Control& source, int actionId)
        {
        case IDA_VOICE_CALL:
        {
+               if (__isMsgAppControlLaunched == true)
+               {
+                       //AppControl already launched.
+                       return;
+               }
                //check if EndCallTimer is running, then cancel it
                if(__pEndCallEventTimer != null)
                {
@@ -180,6 +189,22 @@ EndCallForm::OnActionPerformed(const Control& source, int actionId)
                bool isSimInitialized = __pCallPresentor->CheckSimInitializationIsCompleted();
                if (isSimInitialized)
                {
+                       //Disable all buttons
+                       Button* pButton = static_cast<Button*>(GetControl(IDC_VIDEOCALL_BUTTON,true));
+                       pButton->SetEnabled(false);
+                       pButton->Invalidate(true);
+                       pButton = static_cast<Button*>(GetControl(IDC_VOICECALL_BUTTON,true));
+                       pButton->SetEnabled(false);
+                       pButton->Invalidate(true);
+                       pButton = static_cast<Button*>(GetControl(IDC_ADD_TO_CONTACT_BUTTON,true));
+                       if(pButton->GetShowState() == true)
+                       {
+                               pButton->SetEnabled(false);
+                               pButton->Invalidate(true);
+                       }
+                       pButton = static_cast<Button*>(GetControl(IDC_MSG_BUTTON,true));
+                       pButton->SetEnabled(false);
+                       pButton->Invalidate(true);
                        //Check if dialing an emergency call
                        bool isEmergencyCall = __pCallPresentor->IsEmergencyNumber(*contactTxt, true);
                        if (isEmergencyCall)
@@ -216,6 +241,19 @@ EndCallForm::OnActionPerformed(const Control& source, int actionId)
                {
                        //cancel EndCallTimer, if AppControl request was successful.
                        __pEndCallEventTimer->Cancel();
+                       //Disable the call buttons
+                       Button* pButton = static_cast<Button*>(GetControl(IDC_VIDEOCALL_BUTTON,true));
+                       pButton->SetEnabled(false);
+                       pButton->Invalidate(true);
+                       pButton = static_cast<Button*>(GetControl(IDC_VOICECALL_BUTTON,true));
+                       pButton->SetEnabled(false);
+                       pButton->Invalidate(true);
+                       pButton = static_cast<Button*>(GetControl(IDC_ADD_TO_CONTACT_BUTTON,true));
+                       if(pButton->GetShowState() == true)
+                       {
+                               pButton->SetEnabled(false);
+                               pButton->Invalidate(true);
+                       }
                }
        }
        break;
@@ -229,6 +267,21 @@ EndCallForm::OnActionPerformed(const Control& source, int actionId)
                        return;
                }
                HandleAddToContacts();
+               Button* pButton = static_cast<Button*>(GetControl(IDC_VIDEOCALL_BUTTON,true));
+               pButton->SetEnabled(false);
+               pButton->Invalidate(true);
+               pButton = static_cast<Button*>(GetControl(IDC_VOICECALL_BUTTON,true));
+               pButton->SetEnabled(false);
+               pButton->Invalidate(true);
+               pButton = static_cast<Button*>(GetControl(IDC_ADD_TO_CONTACT_BUTTON,true));
+               if(pButton->GetShowState() == true)
+               {
+                       pButton->SetEnabled(false);
+                       pButton->Invalidate(true);
+               }
+               pButton = static_cast<Button*>(GetControl(IDC_MSG_BUTTON,true));
+               pButton->SetEnabled(false);
+               pButton->Invalidate(true);
        }
        break;
 
@@ -340,7 +393,10 @@ EndCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& cu
                }
                else if(pEndCall->GetCalllogType() == CALL_LOG_TYPE_VOICE_INCOMING)
                {
-                       __pCallButtonsPanel->ShowOrHideAddtoContactsButton(true);
+                       if(pEndCall->GetContactNumber().IsEmpty() == false)
+                       {
+                               __pCallButtonsPanel->ShowOrHideAddtoContactsButton(true);
+                       }
                }
 
        }
@@ -362,6 +418,8 @@ EndCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& cu
                delete pArgs;
                pArgs = null;
        }
+       CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
+       pCallApp->SetTopMostWindow(false);
        AddOrientationEventListener(*this);
 }
 
@@ -526,7 +584,7 @@ EndCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
 {
        if (__pSmallPhotoLabel != null)
        {
-               RemoveControl(*__pSmallPhotoLabel);
+               RemoveControl(__pSmallPhotoLabel);
                __pSmallPhotoLabel = null;
        }
        //Draw Small Photo and show on small photo label
@@ -535,7 +593,7 @@ EndCallForm::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);
 }
 
@@ -633,6 +691,22 @@ EndCallForm::OnForeground(void)
                }
                __pCallPresentor->AppControlRequestCompleted();
        }
+       //Enable all buttons
+       Button* pButton = static_cast<Button*>(GetControl(IDC_VIDEOCALL_BUTTON,true));
+       pButton->SetEnabled(true);
+       pButton->Invalidate(true);
+       pButton = static_cast<Button*>(GetControl(IDC_VOICECALL_BUTTON,true));
+       pButton->SetEnabled(true);
+       pButton->Invalidate(true);
+       pButton = static_cast<Button*>(GetControl(IDC_ADD_TO_CONTACT_BUTTON,true));
+       if(pButton->GetShowState() == true)
+       {
+               pButton->SetEnabled(true);
+               pButton->Invalidate(true);
+       }
+       pButton = static_cast<Button*>(GetControl(IDC_MSG_BUTTON,true));
+       pButton->SetEnabled(true);
+       pButton->Invalidate(true);
        AppLogDebug("Exit");
 }