Fixed recursive appcontrol issue. Fixed Call reject from event injector during answer...
authorAmith Kumar Mahale <amith.m@samsung.com>
Tue, 16 Apr 2013 13:38:05 +0000 (19:08 +0530)
committerAmith Kumar Mahale <amith.m@samsung.com>
Tue, 16 Apr 2013 13:38:05 +0000 (19:08 +0530)
Change-Id: Ib8ff379333bcd08aafdd38c623f0796a254979d3
Signed-off-by: Amith Kumar Mahale <amith.m@samsung.com>
15 files changed:
inc/CallAppControlRequestMgr.h [new file with mode: 0644]
inc/CallAppMainForm.h [deleted file]
inc/CallIncomingCallForm.h
inc/CallPresentationModel.h
res/screen-size-normal/IDF_FORM.xml [deleted file]
src/CallActiveCallForm.cpp
src/CallApp.cpp
src/CallAppControlRequestMgr.cpp [new file with mode: 0644]
src/CallAppMainForm.cpp [deleted file]
src/CallBaseForm.cpp
src/CallDtmfKeypadPanel.cpp
src/CallEndCallForm.cpp
src/CallIncomingCallForm.cpp
src/CallPresentationModel.cpp
src/CallTelephonyManager.cpp

diff --git a/inc/CallAppControlRequestMgr.h b/inc/CallAppControlRequestMgr.h
new file mode 100644 (file)
index 0000000..45e4ea5
--- /dev/null
@@ -0,0 +1,64 @@
+//
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file               CallAppControlRequestMgr.h
+ * @brief              This is the header file for the %CallAppControlRequestMgr class.
+ *
+ * This header file contains the declarations for %CallAppControlRequestMgr class.
+ */
+#ifndef _CALL_APPCONTROL_REQUEST_MGR_H_
+#define _CALL_APPCONTROL_REQUEST_MGR_H_
+
+class CallAppControlRequestMgr {
+
+public:
+//create a singleton instance
+static CallAppControlRequestMgr* GetInstance(void);
+
+private:
+       CallAppControlRequestMgr(void);
+       CallAppControlRequestMgr(CallAppControlRequestMgr& requestMgr);
+       virtual ~CallAppControlRequestMgr(void);
+       CallAppControlRequestMgr& operator =(const CallAppControlRequestMgr& requestMgr);
+
+       result Construct(void);
+       static void CreateInstance(void);
+       static void DestroyInstance(void);
+
+public://methods
+
+       //Used to check if there is any AppControl request in progress.
+       bool IsAppControlRunning(void);
+       //Used to abort any running AppControl request.
+       void AbortAppControlRequest(void);
+       //Used to complete any running AppControl request.
+       void AppControlRequestCompleted(void);
+       //Used to make Message AppControl request to compose message.
+       bool LaunchComposeMessageAppControl(Tizen::Base::String& contactNumber, Tizen::App::IAppControlResponseListener* pListener);
+       //Used to make "ViewContact" AppControl request.
+       bool LaunchViewContactAppControl(Tizen::Base::String& contactId, Tizen::App::IAppControlResponseListener* pListener);
+       //Used to make "AddContact" AppControl request.
+       bool LaunchAddContactAppControl(Tizen::Base::String& contactNumber, Tizen::App::IAppControlResponseListener* pListener);
+       //Launch "Dialer" AppControl request.
+       bool LaunchDialerAppControl(Tizen::App::IAppControlResponseListener* pListener);
+
+private:
+       static CallAppControlRequestMgr* __pInstance;
+       Tizen::App::AppControl* __pOpenedAppControl;
+};
+
+#endif // _CALL_APPCONTROL_REQUEST_MGR_H_
diff --git a/inc/CallAppMainForm.h b/inc/CallAppMainForm.h
deleted file mode 100644 (file)
index b31ddd5..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef _CALLAPP_MAIN_FORM_H_
-#define _CALLAPP_MAIN_FORM_H_
-
-#include <FBase.h>
-#include <FUi.h>
-
-
-class CallAppMainForm
-       : public Tizen::Ui::Controls::Form
-       , public Tizen::Ui::IActionEventListener
-       , public Tizen::Ui::Controls::IFormBackEventListener
-       , public Tizen::Ui::Scenes::ISceneEventListener
-{
-public:
-       CallAppMainForm(void);
-       virtual ~CallAppMainForm(void);
-       bool Initialize(void);
-
-public:
-       virtual result OnInitializing(void);
-       virtual result OnTerminating(void);
-       virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
-       virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source);
-       virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
-                                                                  const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs);
-       virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
-                                                                       const Tizen::Ui::Scenes::SceneId& nextSceneId);
-
-protected:
-       static const int ID_BUTTON_OK = 101;
-};
-
-#endif //_CALLAPP_MAIN_FORM_H_
index 752a5be..eccdeb8 100644 (file)
@@ -79,6 +79,8 @@ public:
        virtual void UpdateItem(int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem){};
        // From 'ITableViewItemProvider' - Gets the default height of an item.
        virtual int GetDefaultItemHeight(void);
+       //Handles call disconnect
+       void CallDisconnected(void);
        // From 'ITableViewItemEventListener' - Called when the state of a TableViewItem in the TableView is changed.
        virtual void OnTableViewItemStateChanged(Tizen::Ui::Controls::TableView& tableView, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status){};
        // From 'ITableViewItemEventListener' - Called when the TableViewContextItem is opened or closed.
index 50d07e4..da03c8e 100644 (file)
@@ -24,6 +24,7 @@
 #define _PHN_CALL_PRESENTATION_MODEL_H_
 
 #include <FApp.h>
+#include "CallAppControlRequestMgr.h"
 #include "CallTypes.h"
 #include "CallITelephonyEventListener.h"
 #include "CalllogManager.h"
@@ -51,7 +52,6 @@ private:
        virtual ~CallPresentationModel(void);
        CallPresentationModel& operator =(const CallPresentationModel& presentor);
 
-
        result Construct(void);
        static void CreateInstance(void);
        static void DestroyInstance(void);
@@ -130,9 +130,24 @@ public:
        //Function is used to auto reject the call based on call settings and return true, if rejected.
        bool CheckIncomingCallToBeRejected(AppCallInfo* pIncomingCallInfo);
        //Launch dial appcontrol for add call senario
-       result LaunchDialAppControl();
+       void LaunchDialAppControl();
        //Used to check if Join button should be enabled or not
        bool IsEnableJoinCallButton(void);
+       //Used to check if incomig call is present
+       bool IsIncomingorDialingCallPresent(void);
+       //Used to launch Messaging AppControl to compose message.
+       bool LaunchComposeMessageAppControl(Tizen::Base::String& contactNumber, Tizen::App::IAppControlResponseListener* pListener);
+       //Used to make "ViewContact" AppControl request.
+       bool LaunchViewContactAppControl(Tizen::Base::String& contactId, Tizen::App::IAppControlResponseListener* pListener);
+       //Used to make "AddContact" AppControl request.
+       bool LaunchAddContactAppControl(Tizen::Base::String& contactNumber, Tizen::App::IAppControlResponseListener* pListener);
+       //Used to check if there is any AppControl request in progress.
+       bool IsAppControlRunning(void);
+       //Used to abort any running AppControl request.
+       void AbortAppControlRequest(void);
+       //Used to complete any running AppControl request.
+       void AppControlRequestCompleted(void);
+
        //Event Listener methods from ITelephonyEventListener
        virtual void HandleCallConnected(Tizen::Base::Collection::IListT<AppCallInfo>& pCallList);
        virtual void HandleCallDisconnected(bool isLastCall, Tizen::Base::Collection::IListT<AppCallInfo>& pCallList);
@@ -155,6 +170,8 @@ private:
        // incoming call is rejected with "Reject With message" by opening Msg AppControl.
        bool __isMessageAppControlRunning;
        bool __isDialAppControlRunning;
+       //Used to manage AppControl requests.
+       CallAppControlRequestMgr* __pAppControlMgr;
 };
 
 #endif // _PHN_CALL_PRESENTATION_MODEL_H_
diff --git a/res/screen-size-normal/IDF_FORM.xml b/res/screen-size-normal/IDF_FORM.xml
deleted file mode 100644 (file)
index 46aa4df..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
-       This XML file was automatically generated by UiBuilder - do not modify by hand.
--->
-<!DOCTYPE Scene SYSTEM "UIForm.dtd">
-<Scene Bversion="2.0.0.201303280947" Dversion="20120315">
-    <LogicalCoordinate>720</LogicalCoordinate>
-    <Form id="IDF_FORM">
-        <property backgroundColor="" backgroundColorOpacity="100" notificationTrayOpenEnabled="false" orientation="Automatic:4Dir" softKey0NormalIcon="" softKey0PressedIcon="" softKey0Text="" softKey1NormalIcon="" softKey1PressedIcon="" softKey1Text="" title="" titleAlign="ALIGN_CENTER" titleIcon="" translucentFooter="false" translucentHeader="false" translucentIndicator="false"/>
-        <layout mode="Portrait" style="FORM_STYLE_INDICATOR|FORM_STYLE_HEADER|FORM_STYLE_FOOTER" type="LAYOUT_RELATIVE"/>
-        <layout mode="Landscape" style="FORM_STYLE_INDICATOR|FORM_STYLE_HEADER|FORM_STYLE_FOOTER" type="LAYOUT_RELATIVE"/>
-    </Form>
-    <Footer>
-        <property backgroundBitmapPath="" color="" colorOpacity="0" disabledButtonColor="" disabledButtonColorOpacity="0" disabledButtonTextColor="" disabledItemColor="" disabledItemColorOpacity="0" disabledItemTextColor="" footerStyle="FOOTER_STYLE_BUTTON_TEXT" highlightedButtonColor="" highlightedButtonColorOpacity="0" highlightedButtonTextColor="" highlightedItemColor="" highlightedItemColorOpacity="0" highlightedItemTextColor="" normalButtonColor="" normalButtonColorOpacity="0" normalButtonTextColor="" normalItemColor="" normalItemColorOpacity="0" normalItemTextColor="" pressedButtonColor="" pressedButtonColorOpacity="0" pressedButtonTextColor="" pressedItemColor="" pressedItemColorOpacity="0" pressedItemTextColor="" selectedItemColor="" selectedItemColorOpacity="0" selectedItemTextColor="" showBackButton="true"/>
-        <itemSet/>
-    </Footer>
-    <Header>
-        <property accessibilityHint="" backgroundBitmapPath="" color="" colorOpacity="0" descriptionText="" descriptionTextColor="" disabledButtonColor="" disabledButtonColorOpacity="0" disabledButtonTextColor="" disabledItemColor="" disabledItemColorOpacity="0" disabledItemTextColor="" headerStyle="HEADER_STYLE_TITLE" highlightedButtonColor="" highlightedButtonColorOpacity="0" highlightedButtonTextColor="" highlightedItemColor="" highlightedItemColorOpacity="0" highlightedItemTextColor="" normalButtonColor="" normalButtonColorOpacity="0" normalButtonTextColor="" normalItemColor="" normalItemColorOpacity="0" normalItemTextColor="" pressedButtonColor="" pressedButtonColorOpacity="0" pressedButtonTextColor="" pressedItemColor="" pressedItemColorOpacity="0" pressedItemTextColor="" selectedItemColor="" selectedItemColorOpacity="0" selectedItemTextColor="" titleIconPath="" titleText="Hello Tizen!" titleTextColor=""/>
-        <itemSet/>
-    </Header>
-    <Button id="IDC_BUTTON_OK" parent="IDF_FORM">
-        <property DisabledBitmapX="0.0" DisabledBitmapY="0.0" NormalBitmapX="0.0" NormalBitmapY="0.0" PressedBitmapX="0.0" PressedBitmapY="0.0" accessibilityHint="" disableTextColor="" disabledBGBitmapPath="" disabledBitmapPath="" disabledColor="" disabledColorOpacity="0" highlightedBGBitmapPath="" highlightedBitmapPath="" highlightedBitmapX="0.0" highlightedBitmapY="0.0" highlightedColor="" highlightedColorOpacity="0" highlightedTextColor="" horizontalAlign="ALIGN_CENTER" normalBGBitmapPath="" normalBitmapPath="" normalColor="" normalColorOpacity="0" normalTextColor="" pressedBGBitmapPath="" pressedBitmapPath="" pressedColor="" pressedColorOpacity="0" pressedTextColor="" text="OK" textSize="32.0" verticalAlign="ALIGN_MIDDLE"/>
-        <layout bottomRelation="" bottomRelationType="" centerHorizontal="true" centerVertical="true" height="135.0" horizontalFitPolicy="FIT_POLICY_FIXED" leftRelation="" leftRelationType="" marginBottom="0.0" marginLeft="0.0" marginRight="0.0" marginTop="0.0" mode="Portrait" rightRelation="" rightRelationType="" topRelation="" topRelationType="" verticalFitPolicy="FIT_POLICY_FIXED" width="420.0" x="150.0" y="438.0"/>
-        <layout bottomRelation="" bottomRelationType="" centerHorizontal="true" centerVertical="true" height="102.0" horizontalFitPolicy="FIT_POLICY_FIXED" leftRelation="" leftRelationType="" marginBottom="0.0" marginLeft="0.0" marginRight="0.0" marginTop="0.0" mode="Landscape" rightRelation="" rightRelationType="" topRelation="" topRelationType="" verticalFitPolicy="FIT_POLICY_FIXED" width="400.0" x="0.0" y="20.0"/>
-    </Button>
-</Scene>
index 469527e..0f06c69 100644 (file)
@@ -592,15 +592,7 @@ ActiveCallForm::OnActionPerformed(const Control& source, int actionId)
                //switch to Dialer Form to make an call
                if(__pCallPresentor->GetCurrentCallCount() == 1)
                {
-/*             ArrayList* pArgs = new (std::nothrow) ArrayList(SingleObjectDeleter);
-               pArgs->Construct();
-               String* formType = new (std::nothrow) String();
-               formType->Append(__formType);
-               pArgs->Add(formType);
-               pSceneManager->GoForward( ForwardSceneTransition(IDSCN_DIALER, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
-                               SCENE_HISTORY_OPTION_NO_HISTORY), pArgs);*/
-                       __pCallPresentor->LaunchDialAppControl();
-
+               __pCallPresentor->LaunchDialAppControl();
                }
        }
        break;
index 99397f9..b9f46b6 100644 (file)
@@ -309,6 +309,11 @@ CallApp::HandleIncomingCallAppControlRequest(RequestId reqId,const IMap* pArgsMa
                bool isCallRejected = pCallPresentor->CheckIncomingCallToBeRejected(pIncomingCall);
                if(isCallRejected == false)
                {
+                       //Abort any AppControl Request running already to show incoming call screen
+                       if (pCallPresentor->IsAppControlRunning() == true)
+                       {
+                               pCallPresentor->AbortAppControlRequest();
+                       }
                        //save app launch argument list
                        __pLaunchArgs = new (std::nothrow) ArrayList(SingleObjectDeleter);
                        __pLaunchArgs->Construct(1);
@@ -327,7 +332,7 @@ CallApp::HandleIncomingCallAppControlRequest(RequestId reqId,const IMap* pArgsMa
                else
                {
                        //Show messageBox showing automatic call rejection
-               /*      MessageBox callRejectedInoMsgBox;
+                       /*MessageBox callRejectedInoMsgBox;
                        String msg(L"Call From ");
                        msg.Append(contactNumber);
                        msg.Append(L" Rejected.");
@@ -343,7 +348,6 @@ CallApp::HandleIncomingCallAppControlRequest(RequestId reqId,const IMap* pArgsMa
                                AppLog("Terminate Phone Application");
                                Terminate();
                        }
-
                }
                //set success message
                appControlResult = APP_CTRL_RESULT_SUCCEEDED;
@@ -410,7 +414,6 @@ CallApp::HandleDialCallAppControlRequest(RequestId reqId,const IMap* pArgsMap,co
                                Terminate();
                                return;
                        }
-
                }
                //call type
                pKey = new (std::nothrow) String(PARAM_CALL_TYPE);
@@ -445,6 +448,11 @@ CallApp::HandleDialCallAppControlRequest(RequestId reqId,const IMap* pArgsMap,co
                        int currentActiveCallCount = pCallPresentor->GetCurrentCallCount();
                        if(currentActiveCallCount <= 1)
                        {
+                               //Abort any AppControl Request running already to show incoming call screen
+                               if (pCallPresentor->IsAppControlRunning() == true)
+                               {
+                                       pCallPresentor->AbortAppControlRequest();
+                               }
                                //make an outgoing call with given number
                                String* contactTxt = new (std::nothrow) String(phoneNumber);
                                __pLaunchArgs =  new (std::nothrow) ArrayList(SingleObjectDeleter);
@@ -489,13 +497,23 @@ bool
 CallApp::CheckNumberIsValid(String phoneNumber)
 {
        //Pattern to compare all characters except 0-9 * # P ; , +
-       String phoneNumberPattern(L"[^0-9*#P,+;]");
-       RegularExpression checkPhoneNumber;
+       String phoneNumberPattern(L"[^0-9*#P,p+;]");
+       String phoneNumberEndingWithHash(L"#$");
+       RegularExpression checkPhoneNumber,checkHash;
        checkPhoneNumber.Construct(phoneNumberPattern);
+       checkHash.Construct(phoneNumberEndingWithHash);
        //If there is any character other than these listed above then display invalid number
        bool resultMatch = checkPhoneNumber.Match(phoneNumber,false);
        //return false for patterns other than 0-9 * # P ; , +
-       return !resultMatch;
+       bool endsWithHash = checkHash.Match(phoneNumber,false);
+       //returns false for any numbers that end with Hash
+       if(resultMatch == true || endsWithHash == true)
+       {
+               //return phone number is invalid
+               return false;
+       }
+
+       return true;
 
 }
 
diff --git a/src/CallAppControlRequestMgr.cpp b/src/CallAppControlRequestMgr.cpp
new file mode 100644 (file)
index 0000000..504cc4e
--- /dev/null
@@ -0,0 +1,284 @@
+//
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file       CallAppControlRequestMgr.cpp
+ * @brief      Manages AppControl Request to other apps.
+ */
+#include <FApp.h>
+#include "CallAppControlRequestMgr.h"
+#include "CallTypes.h"
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+CallAppControlRequestMgr* CallAppControlRequestMgr::__pInstance = null;
+
+CallAppControlRequestMgr::CallAppControlRequestMgr(void)
+{
+       __pOpenedAppControl = null;
+}
+
+CallAppControlRequestMgr::~CallAppControlRequestMgr(void)
+{
+       if (__pOpenedAppControl != null)
+       {
+               delete __pOpenedAppControl;
+               __pOpenedAppControl = null;
+       }
+}
+
+void
+CallAppControlRequestMgr::CreateInstance(void)
+{
+       __pInstance = new (std::nothrow) CallAppControlRequestMgr();
+       result r = __pInstance->Construct();
+       if(IsFailed(r))
+       {
+               delete __pInstance;
+               __pInstance = null;
+               return;
+       }
+
+       std::atexit(DestroyInstance);
+}
+
+CallAppControlRequestMgr*
+CallAppControlRequestMgr::GetInstance(void)
+{
+       if (__pInstance == null)
+       {
+               CreateInstance();
+       }
+       return __pInstance;
+}
+
+void
+CallAppControlRequestMgr::DestroyInstance(void)
+{
+       if (__pInstance != null)
+       {
+               delete __pInstance;
+               __pInstance = null;
+       }
+}
+
+result
+CallAppControlRequestMgr::Construct(void)
+{
+       return E_SUCCESS;
+}
+
+bool
+CallAppControlRequestMgr::IsAppControlRunning(void)
+{
+       AppLog("ENTER");
+       return (__pOpenedAppControl != null);
+}
+
+void
+CallAppControlRequestMgr::AbortAppControlRequest(void)
+{
+       AppLog("ENTER");
+       if (__pOpenedAppControl != null)
+       {
+               result r = __pOpenedAppControl->Stop();
+               AppLog("Abort failed with r=%d", r);
+               delete __pOpenedAppControl;
+               __pOpenedAppControl = null;
+       }
+       AppLog("ENTER");
+}
+
+void
+CallAppControlRequestMgr::AppControlRequestCompleted(void)
+{
+       AppLog("ENTER");
+       if (__pOpenedAppControl != null)
+       {
+               delete __pOpenedAppControl;
+               __pOpenedAppControl = null;
+       }
+}
+
+bool
+CallAppControlRequestMgr::LaunchComposeMessageAppControl(String& contactNumber, IAppControlResponseListener* pListener)
+{
+       if (__pOpenedAppControl != null)
+       {
+               //An AppControl is already running.
+               String provider = __pOpenedAppControl->GetAppControlProviderId();
+               String operation = __pOpenedAppControl->GetOperationId();
+               AppLog( "Error:- AppControl is already running for provider id = %ls, operation id = %ls",
+                               provider.GetPointer(), operation.GetPointer());
+               return false;
+       }
+
+       result r = E_FAILURE;
+       //request parameters
+       HashMap extraData;
+       extraData.Construct();
+       extraData.Add(new (std::nothrow) String(MESSAGE_TYPE), new (std::nothrow) String(MESSAGE_SMS_TYPE));
+       extraData.Add(new (std::nothrow) String(MESSAGE_TO), new (std::nothrow) String(contactNumber));
+
+       __pOpenedAppControl = AppManager::FindAppControlN(PROVIDER_ID_MESSAGE, OPERATION_ID_COMPOSE);
+       if (__pOpenedAppControl != null)
+       {
+               r = __pOpenedAppControl->Start(null, null, &extraData, pListener);
+       }
+       extraData.RemoveAll(true);
+
+       if(r != E_SUCCESS)
+       {
+               //AppControl request failed, delete AppControl.
+               delete __pOpenedAppControl;
+               __pOpenedAppControl = null;
+               return false;
+       }
+       else
+       {
+               //AppControl request was successful.
+               return true;
+       }
+}
+
+bool
+CallAppControlRequestMgr::LaunchViewContactAppControl(String& contactId, IAppControlResponseListener* pListener)
+{
+       AppLogDebug("ENTER");
+       if (__pOpenedAppControl != null)
+       {
+               //An AppControl is already running.
+               String provider = __pOpenedAppControl->GetAppControlProviderId();
+               String operation = __pOpenedAppControl->GetOperationId();
+               AppLog( "Error:- AppControl is already running for provider id = %ls, operation id = %ls",
+                               provider.GetPointer(), operation.GetPointer());
+               return false;
+       }
+
+       result r = E_FAILURE;
+       //request parameters
+       HashMap extraData;
+       extraData.Construct();
+       extraData.Add(new (std::nothrow) String(CONTACTS_VIEW_TYPE), new (std::nothrow) String(CONTACTS_VIEW_TYPE_CONTACT));
+       extraData.Add(new (std::nothrow) String(CONTACTS_VIEW_TYPE_CONTACT), new (std::nothrow) String(CONTACTS_VIEW_TYPE_CONTACT));
+       extraData.Add(new (std::nothrow) String(CONTACT_KEY_ITEM_ID), new (std::nothrow) String(contactId));
+       extraData.Add(new (std::nothrow) String(CONTACTS_ID_KEY), new (std::nothrow) String(contactId));
+       extraData.Add(new (std::nothrow) String(CONTACT_KEY_ITEM_TYPE), new (std::nothrow) String(ITEM_TYPE_PERSON));
+
+       __pOpenedAppControl = AppManager::FindAppControlN(PROVIDER_ID_CONTACTS, OPERATION_ID_VIEW);
+       if (__pOpenedAppControl != null)
+       {
+               r = __pOpenedAppControl->Start(null, null, &extraData, pListener);
+       }
+       extraData.RemoveAll(true);
+
+       if(r != E_SUCCESS)
+       {
+               //AppControl request failed, delete AppControl.
+               delete __pOpenedAppControl;
+               __pOpenedAppControl = null;
+               return false;
+       }
+       else
+       {
+               //AppControl request was successful.
+               return true;
+       }
+}
+
+bool
+CallAppControlRequestMgr::LaunchAddContactAppControl(String& contactNumber, IAppControlResponseListener* pListener)
+{
+       AppLogDebug("ENTER");
+       if (__pOpenedAppControl != null)
+       {
+               //An AppControl is already running.
+               String provider = __pOpenedAppControl->GetAppControlProviderId();
+               String operation = __pOpenedAppControl->GetOperationId();
+               AppLog( "Error:- AppControl is already running for provider id = %ls, operation id = %ls",
+                               provider.GetPointer(), operation.GetPointer());
+               return false;
+       }
+
+       result r = E_FAILURE;
+       //request parameters
+       HashMap extraData;
+       extraData.Construct();
+       extraData.Add(new (std::nothrow) String(INPUT_TYPE_PHONE), new (std::nothrow) String(contactNumber));
+       extraData.Add(new (std::nothrow) String(CONTACT_KEY_ITEM_TYPE), new (std::nothrow) String(ITEM_TYPE_CONTACT));
+
+       __pOpenedAppControl = AppManager::FindAppControlN(PROVIDER_ID_CONTACTS, OPERATION_ID_ADD);
+       if (__pOpenedAppControl != null)
+       {
+               r = __pOpenedAppControl->Start(null, null, &extraData, pListener);
+       }
+       extraData.RemoveAll(true);
+
+       if(r != E_SUCCESS)
+       {
+               //AppControl request failed, delete AppControl.
+               delete __pOpenedAppControl;
+               __pOpenedAppControl = null;
+               return false;
+       }
+       else
+       {
+               //AppControl request was successful.
+               return true;
+       }
+}
+
+bool
+CallAppControlRequestMgr::LaunchDialerAppControl(IAppControlResponseListener* pListener)
+{
+       AppLogDebug("ENTER");
+       if (__pOpenedAppControl != null)
+       {
+               //An AppControl is already running.
+               String provider = __pOpenedAppControl->GetAppControlProviderId();
+               String operation = __pOpenedAppControl->GetOperationId();
+               AppLog( "Error:- AppControl is already running for provider id = %ls, operation id = %ls",
+                               provider.GetPointer(), operation.GetPointer());
+               return false;
+       }
+
+       result r = E_FAILURE;
+       HashMap extraData;
+       extraData.Construct();
+       extraData.Add(new (std::nothrow) String(PARAM_PHONE_NUMBER), new (std::nothrow) String(L""));
+
+       __pOpenedAppControl = AppManager::FindAppControlN(PROVIDER_ID_PHONE, OPERATION_ID_DIAL);
+       if (__pOpenedAppControl != null)
+       {
+               r = __pOpenedAppControl->Start(null, null, &extraData, pListener);
+       }
+       extraData.RemoveAll(true);
+
+       if(r != E_SUCCESS)
+       {
+               //AppControl request failed, delete AppControl.
+               delete __pOpenedAppControl;
+               __pOpenedAppControl = null;
+               return false;
+       }
+       else
+       {
+               //AppControl request was successful.
+               return true;
+       }
+}
diff --git a/src/CallAppMainForm.cpp b/src/CallAppMainForm.cpp
deleted file mode 100644 (file)
index e430387..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-#include <FApp.h>
-#include "CallAppMainForm.h"
-
-using namespace Tizen::Base;
-using namespace Tizen::App;
-using namespace Tizen::Ui;
-using namespace Tizen::Ui::Controls;
-using namespace Tizen::Ui::Scenes;
-
-
-CallAppMainForm::CallAppMainForm(void)
-{
-}
-
-CallAppMainForm::~CallAppMainForm(void)
-{
-}
-
-bool
-CallAppMainForm::Initialize(void)
-{
-       Construct(L"IDF_FORM");
-
-       return true;
-}
-
-result
-CallAppMainForm::OnInitializing(void)
-{
-       result r = E_SUCCESS;
-
-       // TODO:
-       // Add your initialization code here
-
-       // Setup back event listener
-       SetFormBackEventListener(this);
-
-       // Get a button via resource ID
-       Tizen::Ui::Controls::Button *pButtonOk = static_cast<Button*>(GetControl(L"IDC_BUTTON_OK"));
-       if (pButtonOk != null)
-       {
-               pButtonOk->SetActionId(ID_BUTTON_OK);
-               pButtonOk->AddActionEventListener(*this);
-       }
-
-       return r;
-}
-
-result
-CallAppMainForm::OnTerminating(void)
-{
-       result r = E_SUCCESS;
-
-       // TODO:
-       // Add your termination code here
-       return r;
-}
-
-void
-CallAppMainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
-{
-       SceneManager* pSceneManager = SceneManager::GetInstance();
-       AppAssert(pSceneManager);
-
-       switch(actionId)
-       {
-       case ID_BUTTON_OK:
-               AppLog("OK Button is clicked!");
-               break;
-
-       default:
-               break;
-       }
-}
-
-void
-CallAppMainForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
-{
-       UiApp* pApp = UiApp::GetInstance();
-       AppAssert(pApp);
-       pApp->Terminate();
-}
-
-void
-CallAppMainForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
-                                                                                 const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
-{
-       // TODO:
-       // Add your scene activate code here
-       AppLog("OnSceneActivatedN");
-}
-
-void
-CallAppMainForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
-                                                                                  const Tizen::Ui::Scenes::SceneId& nextSceneId)
-{
-       // TODO:
-       // Add your scene deactivate code here
-       AppLog("OnSceneDeactivated");
-}
-
index 0f1ab33..8122a03 100644 (file)
@@ -19,6 +19,7 @@
  * @brief      Base class for all Call forms
  */
 #include "CallActiveCallForm.h"
+#include "CallIncomingCallForm.h"
 #include "CallBaseForm.h"
 #include "CallInfo.h"
 #include "CallPresentationModel.h"
@@ -65,6 +66,29 @@ BaseForm::OnActionPerformed(const Control& source, int actionId)
 void
 BaseForm::HandleCallConnected(IListT<AppCallInfo>& pCallList)
 {
+       if(__pCallPresentor->IsIncomingorDialingCallPresent() == true)
+       {
+               //This scenario will come, if 1 call is disconnected from conf. call having 2 participants.
+               //In this case, if there is any dialing call exists, then ignore.
+               //Else, if there is any incoming call exists, then update call option popup.
+               switch (__formType)
+               {
+               case FORMTYPE_INCOMINGCALL:
+               {
+                       IncomingCallForm* pIncomingCallForm = dynamic_cast<IncomingCallForm*>(this);
+                       if (pIncomingCallForm != null)
+                       {
+                               pIncomingCallForm->CallDisconnected();
+                       }
+               }
+                       break;
+
+               default:
+                       break;
+               }
+               return;
+       }
+
        SceneManager* pSceneManager = SceneManager::GetInstance();
 
        switch (__formType)
@@ -160,12 +184,35 @@ BaseForm::HandleCallConnected(IListT<AppCallInfo>& pCallList)
 }
 
 void
-BaseForm::HandleCallDisconnected(bool isLastCall, IListT<AppCallInfo>& pCallList)
+BaseForm::HandleCallDisconnected(bool isLastCall, IListT<AppCallInfo>& pCurrentActiveCallList)
 {
+       if(__pCallPresentor->IsIncomingorDialingCallPresent() == true)
+       {
+               //This scenario will come, if this disconnected call is neither incoming nor dialing call.
+               //In this case, if there is any dialing call exists, then ignore.
+               //Else, if there is any incoming call exists, then update call option popup.
+               switch (__formType)
+               {
+               case FORMTYPE_INCOMINGCALL:
+               {
+                       IncomingCallForm* pIncomingCallForm = dynamic_cast<IncomingCallForm*>(this);
+                       if (pIncomingCallForm != null)
+                       {
+                               pIncomingCallForm->CallDisconnected();
+                       }
+               }
+                       break;
+
+               default:
+                       break;
+               }
+               return;
+       }
+
        SceneManager* pSceneManager = SceneManager::GetInstance();
        CallApp* pPhoneApp = static_cast<CallApp*>(UiApp::GetInstance());
 
-       int callCount = pCallList.GetCount();
+       int callCount = pCurrentActiveCallList.GetCount();
        if (callCount > 0)
        {
                //Ownership - To be deleted in 'OnSceneActivatedN' of next form
@@ -175,7 +222,7 @@ BaseForm::HandleCallDisconnected(bool isLastCall, IListT<AppCallInfo>& pCallList
                {
                        //fetch call info and add to list
                        AppCallInfo callInfo;
-                       result r = pCallList.GetAt(index, callInfo);
+                       result r = pCurrentActiveCallList.GetAt(index, callInfo);
                        if (r == E_SUCCESS)
                        {
                                //copy call information to new instance
@@ -188,7 +235,7 @@ BaseForm::HandleCallDisconnected(bool isLastCall, IListT<AppCallInfo>& pCallList
                {
                        //fetch call info and add to list
                        AppCallInfo callInfo;
-                       result r = pCallList.GetAt(0, callInfo);
+                       result r = pCurrentActiveCallList.GetAt(0, callInfo);
                        if (r == E_SUCCESS)
                        {
                                //copy call information to new instance
@@ -211,7 +258,7 @@ BaseForm::HandleCallDisconnected(bool isLastCall, IListT<AppCallInfo>& pCallList
                        }
                        else
                        {
-                               if (pCallList.GetCount() == 1)
+                               if (pCurrentActiveCallList.GetCount() == 1)
                                {
                                        if (callInfo.IsConferenceCall() == true)
                                        {
@@ -291,6 +338,29 @@ BaseForm::HandleCallSwapOccured(IListT<AppCallInfo>& pCallList)
 void
 BaseForm::HandleConferenceChange(void)
 {
+       if(__pCallPresentor->IsIncomingorDialingCallPresent() == true)
+       {
+               //This scenario will come, if 1 call is disconnected from conf. call having more than 2 participants.
+               //In this case, if there is any dialing call exists, then ignore.
+               //Else, if there is any incoming call exists, then update call option popup.
+               switch (__formType)
+               {
+               case FORMTYPE_INCOMINGCALL:
+               {
+                       IncomingCallForm* pIncomingCallForm = dynamic_cast<IncomingCallForm*>(this);
+                       if (pIncomingCallForm != null)
+                       {
+                               pIncomingCallForm->CallDisconnected();
+                       }
+               }
+                       break;
+
+               default:
+                       break;
+               }
+               return;
+       }
+
        switch (__formType)
        {
        case FORMTYPE_CONFCALLLIST:
index 6288388..d86d432 100644 (file)
@@ -413,7 +413,7 @@ DtmfKeyPadPanel::DrawTextToCanvas(const String& buttonText, int textFontStyle, C
        pTextElement->SetFont(*font);
 
        //get dimensions of the text
-       Dimension textDimension;
+       FloatDimension textDimension;
        font->GetTextExtent(buttonText, buttonText.GetLength(), textDimension);
        textDimension.height = textDimension.height + font->GetDescender();
        //create enriched text
index 33fbefa..9ce5742 100644 (file)
@@ -212,32 +212,12 @@ EndCallForm::OnActionPerformed(const Control& source, int actionId)
                        return;
                }
                //launch message AppControl
-               __isMsgAppControlLaunched = true;
-               result r = E_SUCCESS;
-               HashMap extraData;
-               extraData.Construct();
-
-               extraData.Add(new (std::nothrow) String(MESSAGE_TYPE), new (std::nothrow) String(MESSAGE_SMS_TYPE));
-               extraData.Add(new (std::nothrow) String(MESSAGE_TO), new (std::nothrow) String(*__pContactNumber));
-
-               AppControl* pAc = AppManager::FindAppControlN(PROVIDER_ID_MESSAGE, OPERATION_ID_COMPOSE);
-               if (pAc != null)
+               __isMsgAppControlLaunched = __pCallPresentor->LaunchComposeMessageAppControl(*__pContactNumber, this);
+               if (__isMsgAppControlLaunched == true && __pEndCallEventTimer != null)
                {
-                       r = pAc->Start(null, null, &extraData, this);
-                       if(r != E_SUCCESS)
-                       {
-                               //AppControl request failed, reset flag.
-                               __isMsgAppControlLaunched = false;
-                       }
-                       else if (r == E_SUCCESS && __pEndCallEventTimer != null)
-                       {
-                               //cancel EndCallTimer, if AppControl request was successful.
-                               __pEndCallEventTimer->Cancel();
-                       }
-                       delete pAc;
+                       //cancel EndCallTimer, if AppControl request was successful.
+                       __pEndCallEventTimer->Cancel();
                }
-
-               extraData.RemoveAll(true);
        }
        break;
 
@@ -262,60 +242,29 @@ void
 EndCallForm::HandleAddToContacts(void)
 {
        AppLogDebug("Enter");
-       //Launch Contact AppControl
-       __isContactAppControlLaunched = true;
-       Contact* pContact = __pCallPresentor->GetContactN(*__pContactNumber);
-       AppControl* pAc = null;
-       result r = E_SUCCESS;
-       HashMap extraData;
-       extraData.Construct();
 
+       Contact* pContact = __pCallPresentor->GetContactN(*__pContactNumber);
+       //Launch Contact AppControl
+       String requestParameter;
        if (pContact != null)
        {
-               AppLogDebug("View Contact");
                //View Contact
-               String idVal;
-               idVal.Append(pContact->GetRecordId());
-               extraData.Add(new (std::nothrow) String(CONTACTS_VIEW_TYPE), new (std::nothrow) String(CONTACTS_VIEW_TYPE_CONTACT));
-               extraData.Add(new (std::nothrow) String(CONTACTS_VIEW_TYPE_CONTACT), new (std::nothrow) String(CONTACTS_VIEW_TYPE_CONTACT));
-               extraData.Add(new (std::nothrow) String(CONTACT_KEY_ITEM_ID), new (std::nothrow) String(idVal));
-               extraData.Add(new (std::nothrow) String(CONTACTS_ID_KEY), new (std::nothrow) String(idVal));
-               extraData.Add(new (std::nothrow) String(CONTACT_KEY_ITEM_TYPE), new (std::nothrow) String(ITEM_TYPE_PERSON));
-                pAc = AppManager::FindAppControlN(PROVIDER_ID_CONTACTS, OPERATION_ID_VIEW);
-
-       }
-       else
-       {
-               AppLogDebug("Add Contact");
-               extraData.Add(new (std::nothrow) String(INPUT_TYPE_PHONE), new (std::nothrow) String(*__pContactNumber));
-               extraData.Add(new (std::nothrow) String(CONTACT_KEY_ITEM_TYPE), new (std::nothrow) String(ITEM_TYPE_CONTACT));
-               pAc = AppManager::FindAppControlN(PROVIDER_ID_CONTACTS, OPERATION_ID_ADD);
-
-       }
-       if (pAc != null)
-       {
-               r = pAc->Start(null, null, &extraData, this);
-               if(r != E_SUCCESS)
-               {
-                       //AppControl request failed, reset flag.
-                       __isContactAppControlLaunched = false;
-               }
-               else if (r == E_SUCCESS && __pEndCallEventTimer != null)
-               {
-                       //cancel EndCallTimer, if AppControl request was success.
-                       __pEndCallEventTimer->Cancel();
-               }
-               delete pAc;
+               requestParameter.Append(pContact->GetRecordId());
+               __isContactAppControlLaunched = __pCallPresentor->LaunchViewContactAppControl(requestParameter, this);
+               delete pContact;
+               pContact = null;
        }
        else
        {
-               __isContactAppControlLaunched = false;
+               //Add To Contact
+               requestParameter.Append(*__pContactNumber);
+               __isContactAppControlLaunched = __pCallPresentor->LaunchAddContactAppControl(requestParameter, this);
        }
-       extraData.RemoveAll(true);
-       if(pContact != null)
+
+       if (__isContactAppControlLaunched == true && __pEndCallEventTimer != null)
        {
-               delete pContact;
-               pContact = null;
+               //cancel EndCallTimer, if AppControl request was success.
+               __pEndCallEventTimer->Cancel();
        }
 }
 
@@ -559,7 +508,6 @@ EndCallForm::ShowThumbnailImage(const Bitmap* pPhotoId,const String& photoLabel)
                delete pBackground;
                delete pShadow;
        }
-
 }
 
 void
@@ -595,6 +543,7 @@ EndCallForm::OnAppControlCompleteResponseReceived(const AppId& appId, const Stri
        {
                //Message AppControl request completed.
                __isMsgAppControlLaunched = false;
+               __pCallPresentor->AppControlRequestCompleted();
        }
        //AppControl completed, goto initial scene if present
        //else exit.
@@ -604,10 +553,8 @@ EndCallForm::OnAppControlCompleteResponseReceived(const AppId& appId, const Stri
 void
 EndCallForm::HandleLastCallCompletion(void)
 {
-
        CallApp* pPhoneApp = (static_cast<CallApp*>(UiApp::GetInstance()));
        pPhoneApp->Terminate();
-
 }
 
 void
@@ -618,25 +565,40 @@ EndCallForm::OnForeground(void)
        //as we do not know if it success or failed.
        if(__isContactAppControlLaunched == true)
        {
-               //CallApp* pPhoneApp = (static_cast<CallApp*>(UiApp::GetInstance()));
-               //pPhoneApp->Terminate();
                if(__pEndCallEventTimer != null)
                {
                        __pEndCallEventTimer->Start(2000);
                }
+               if (__pContactNumber != null && __pContactNumber->IsEmpty() == false)
+               {
+                       Contact* pContact = __pCallPresentor->GetContactN(*__pContactNumber);
+                       //before setting check if the contact is deleted
+                       if(pContact != null)
+                       {
+                               SetContactButtonState(false);
+                               delete pContact;
+                               pContact = null;
+                       }
+                       else
+                       {
+                               SetContactButtonState(true);
+                       }
+               }
+
+               //notify app control completed
+               __isContactAppControlLaunched = false;
+               __pCallPresentor->AppControlRequestCompleted();
        }
-       __isContactAppControlLaunched = false;
 
        if (__isMsgAppControlLaunched == true)
        {
                //Message AppControl request completed.
-               //CallApp* pPhoneApp = (static_cast<CallApp*>(UiApp::GetInstance()));
-               //pPhoneApp->Terminate();
                if(__pEndCallEventTimer != null)
                {
                        __pEndCallEventTimer->Start(2000);
                }
                __isMsgAppControlLaunched = false;
+               __pCallPresentor->AppControlRequestCompleted();
        }
        AppLogDebug("Exit");
 }
index bd304c8..887aeca 100644 (file)
@@ -673,7 +673,6 @@ IncomingCallForm::OnActionPerformed(const Control& source, int actionId)
        case IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL:
        {
                HideRejectMessagePanel();
-
        }
        break;
 
@@ -1478,7 +1477,6 @@ IncomingCallForm::OnTouchMoved(const Control& source, const Point& currentPositi
 void
 IncomingCallForm::OnItemSelected(int itemIndex)
 {
-
        ArrayList* pArgs = new (std::nothrow) ArrayList(SingleObjectDeleter);
        pArgs->Construct();
 
@@ -1486,7 +1484,6 @@ IncomingCallForm::OnItemSelected(int itemIndex)
        Integer* argIndex = new (std::nothrow) Integer(itemIndex);
        pArgs->Add(argIndex);
        SendUserEvent(REQUEST_ITEM_SELECTED,pArgs);
-
 }
 
 void
@@ -1504,30 +1501,17 @@ IncomingCallForm::HandleMultipleCallSelection(int itemIndex)
        __pAcceptVisElem->SetOpacity(1.0f);
        __pRejectVisElem->SetOpacity(1.00f);
 
-       /*for (int i = 0; i < COUNT_ARROW_ELEMENTS; i++)
-       {
-               __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
-               String RejectVisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
-               RejectVisualEleName.Append(i);
-               __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(RejectVisualEleName,true);
-               __pRejectArrowVisElem->SetOpacity(0.0f);
-               __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
-               String AcceptVisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
-               AcceptVisualEleName.Append(i);
-               __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(AcceptVisualEleName,true);
-               __pAcceptArrowVisElem->SetOpacity(0.0f);
-       }*/
        if (__pRejectFinalVisElem != null)
        {
                __pRejectFinalVisElem->Destroy();
                __pRejectFinalVisElem = null;
        }
-
        if (__pAcceptFinalVisElem != null)
        {
                __pAcceptFinalVisElem->Destroy();
                __pAcceptFinalVisElem = null;
        }
+
        if (__pOptionPopup)
        {
                delete __pOptionPopup;
@@ -1536,7 +1520,7 @@ IncomingCallForm::HandleMultipleCallSelection(int itemIndex)
        //accept call
        if(itemIndex != IDA_BUTTON_CANCEL_OPTIONS_POPUP)
        {
-       __pCallPresentor->AcceptIncomingCall(CallAnsweringOptions(itemIndex),__incomingCallHandle);
+               __pCallPresentor->AcceptIncomingCall(CallAnsweringOptions(itemIndex),__incomingCallHandle);
        }
 }
 
@@ -1613,3 +1597,52 @@ IncomingCallForm::OnForeground(void)
 {
        __pCallPresentor->OnAppForeground();
 }
+
+void
+IncomingCallForm::CallDisconnected(void)
+{
+       //check if no call option popup is shown, then remain on incoming call screen.
+       //As user has neither accepted nor rejected incoming call.
+       if (__pOptionPopup == null)
+       {
+               return;
+       }
+
+       //fetch already active call list and show updated option popup
+       ArrayListT<AppCallInfo>* pCallList  = static_cast<ArrayListT<AppCallInfo>*>(__pCallPresentor->GetCallListN());
+       if (pCallList != null && pCallList->GetCount() > 0)
+       {
+               //then atleast 1 active call exist.
+               AppCallInfo phnCallInfo;
+               pCallList->GetAt(0,phnCallInfo);
+               //Check if only 1 call exist and it is on Hold
+               if(pCallList->GetCount() == 1 && phnCallInfo.IsOnHold())
+               {
+                       //directly accept call
+                       __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);
+               }
+               else
+               {
+                       //Either 1 call exist and not "on Hold".
+                       //Or 2 calls exist.
+                       if(__pOptionPopup != null)
+                       {
+                               delete __pOptionPopup;
+                               __pOptionPopup = null;
+                       }
+                       __pOptionPopup = new (std::nothrow) CallOptionPopup(*this,*(__pCallPresentor));
+                       __pOptionPopup->Initialize();
+                       __pOptionPopup->SetShowState(true);
+                       __pOptionPopup->Draw();
+                       __pOptionPopup->Show();
+               }
+               pCallList->RemoveAll();
+       }
+       else
+       {
+               //no active call - Accept the  incoming call
+               __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);
+       }
+       delete pCallList;
+       pCallList = null;
+}
index dda4b4b..95f1e6b 100644 (file)
@@ -22,6 +22,7 @@
 #include <FUi.h>
 #include <FMedia.h>
 #include "CallApp.h"
+#include "CallAppControlRequestMgr.h"
 #include "CallActiveCallForm.h"
 #include "CallInfo.h"
 #include "CallPresentationModel.h"
@@ -48,12 +49,14 @@ CallPresentationModel::CallPresentationModel(void)
        __pSettingsPresentor = null;
        __isMessageAppControlRunning = false;
        __isDialAppControlRunning = false;
+       __pAppControlMgr = null;
 }
 
 CallPresentationModel::~CallPresentationModel(void)
 {
        __pTelephonyMgr = null;
        __pSettingsPresentor = null;
+       __pAppControlMgr =null;
 }
 
 void
@@ -97,6 +100,7 @@ CallPresentationModel::Construct(void)
        //Fetch Telephony Manager
        __pTelephonyMgr = TelephonyManager::GetInstance(this);
        __pSettingsPresentor = SettingsPresentationModel::GetInstance();
+       __pAppControlMgr = CallAppControlRequestMgr::GetInstance();
        return E_SUCCESS;
 }
 
@@ -386,26 +390,10 @@ CallPresentationModel::RejectCall(int callHandle, bool sendMsg, const String& co
                return false;
        }
 
-       if (sendMsg == true)
+       if (sendMsg == true && __pAppControlMgr != null)
        {
-               //launch message
-               result r = E_SUCCESS;
-               HashMap extraData;
-               extraData.Construct();
-
-               extraData.Add(new (std::nothrow) String(MESSAGE_TYPE), new (std::nothrow) String(MESSAGE_SMS_TYPE));
-               extraData.Add(new (std::nothrow) String(MESSAGE_TO), new (std::nothrow) String(contactNumber));
-
-               AppControl* pAc = AppManager::FindAppControlN(PROVIDER_ID_MESSAGE, OPERATION_ID_COMPOSE);
-               if (pAc != null)
-               {
-                       AppLogDebug("Start");
-                       r = pAc->Start(null, null, &extraData, this);
-                       __isMessageAppControlRunning = true;
-                       delete pAc;
-               }
-
-               extraData.RemoveAll(true);
+               //launch compose message AppControl
+               __isMessageAppControlRunning = __pAppControlMgr->LaunchComposeMessageAppControl(*(const_cast<String*>(&contactNumber)), this);
        }
        AppLogDebug("Exit");
        return true;
@@ -417,6 +405,7 @@ void CallPresentationModel::OnAppForeground(void)
        {
                //This comes here, when Message AppControl is finished working.
                __isMessageAppControlRunning = false;
+               __pAppControlMgr->AppControlRequestCompleted();
                //Check if this was the last call, then terminate application.
                //And if any calls are active, then those cases are already handled from Other places.
                if( GetCurrentCallCount() == 0)
@@ -434,6 +423,7 @@ CallPresentationModel::OnAppControlCompleteResponseReceived(const AppId& appId,
        {
                //This comes here, when Message AppControl is finished working.
                __isMessageAppControlRunning = false;
+               __pAppControlMgr->AppControlRequestCompleted();
                //Check if this was the last call, then terminate application.
                //And if any calls are active, then those cases are already handled from Other places.
                if( GetCurrentCallCount() == 0)
@@ -446,6 +436,7 @@ CallPresentationModel::OnAppControlCompleteResponseReceived(const AppId& appId,
        {
                __isDialAppControlRunning = false;
 
+               __pAppControlMgr->AppControlRequestCompleted();
                if(appControlResult == APP_CTRL_RESULT_SUCCEEDED)
                {
                        String* pKey = new (std::nothrow) String(PARAM_PHONE_NUMBER);
@@ -587,8 +578,7 @@ CallPresentationModel::HandleCallDisconnected(bool isLastCall, Tizen::Base::Coll
        //1) Defer from sending call disconnected event to form, in case Msg AppControl is running,
        //to avoid PhoneApp from going to EndCall form, where it shows for 3 sec. and automatically closes.
        //2) Do not send call disconnected event to any form, in case an incoming call or dialing call is present.
-       if (__pTelEventListener != null && __isMessageAppControlRunning == false
-                       && __pTelephonyMgr->IsIncomingorDialingCallPresent() == false)
+       if (__pTelEventListener != null && __isMessageAppControlRunning == false )
        {
                __pTelEventListener->HandleCallDisconnected(isLastCall, pCallList);
        }
@@ -622,7 +612,7 @@ void
 CallPresentationModel::HandleConferenceChange(void)
 {
        //1) Do not send conf. call changed event to any form, in case an incoming call or dialing call is present.
-       if (__pTelEventListener != null && __pTelephonyMgr->IsIncomingorDialingCallPresent() == false)
+       if (__pTelEventListener != null)
        {
                __pTelEventListener->HandleConferenceChange();
        }
@@ -637,32 +627,22 @@ CallPresentationModel::HandleTelephonyError(int errorCode)
        }
 }
 
-result
+void
 CallPresentationModel::LaunchDialAppControl()
 {
-       result r = E_SUCCESS;
-       AppControl* pAppControl = null;
 
        if(__isDialAppControlRunning == true)
        {
                //Do not allow another app control if already running
-               return r;
+               return;
        }
 
-       HashMap extraData;
-       extraData.Construct();
-       extraData.Add(new (std::nothrow) String(PARAM_PHONE_NUMBER), new (std::nothrow) String(L""));
-
-       pAppControl = AppManager::FindAppControlN(PROVIDER_ID_PHONE, OPERATION_ID_DIAL);
-       if (pAppControl != null)
+       //Launch dialer AppControl
+       if (__pAppControlMgr != null)
        {
-               r = pAppControl->Start(null, null, &extraData, this);
-               __isDialAppControlRunning = true;
+               __isDialAppControlRunning = __pAppControlMgr->LaunchDialerAppControl(this);
        }
 
-       extraData.RemoveAll(true);
-
-       return r;
 }
 
 bool
@@ -723,3 +703,68 @@ CallPresentationModel::IsEnableJoinCallButton(void)
        pConfCallInfo = null;
        return true;
 }
+
+bool
+CallPresentationModel::IsIncomingorDialingCallPresent(void)
+{
+       //returns false, if incoming call or dialed call is present.
+       return __pTelephonyMgr->IsIncomingorDialingCallPresent();
+}
+
+bool
+CallPresentationModel::LaunchComposeMessageAppControl(String& contactNumber, IAppControlResponseListener* pListener)
+{
+       if (__pAppControlMgr != null)
+       {
+               return __pAppControlMgr->LaunchComposeMessageAppControl(contactNumber, pListener);
+       }
+       return false;
+}
+
+bool
+CallPresentationModel::LaunchViewContactAppControl(String& contactId, IAppControlResponseListener* pListener)
+{
+       if (__pAppControlMgr != null)
+       {
+               return __pAppControlMgr->LaunchViewContactAppControl(contactId, pListener);
+       }
+       return false;
+}
+
+bool
+CallPresentationModel::LaunchAddContactAppControl(Tizen::Base::String& contactNumber, Tizen::App::IAppControlResponseListener* pListener)
+{
+       if (__pAppControlMgr != null)
+       {
+               return __pAppControlMgr->LaunchAddContactAppControl(contactNumber, pListener);
+       }
+       return false;
+}
+
+bool
+CallPresentationModel::IsAppControlRunning(void)
+{
+       if (__pAppControlMgr != null)
+       {
+               return __pAppControlMgr->IsAppControlRunning();
+       }
+       return false;
+}
+
+void
+CallPresentationModel::AbortAppControlRequest(void)
+{
+       if (__pAppControlMgr != null)
+       {
+               __pAppControlMgr->AbortAppControlRequest();
+       }
+}
+
+void
+CallPresentationModel::AppControlRequestCompleted(void)
+{
+       if (__pAppControlMgr != null)
+       {
+               __pAppControlMgr->AppControlRequestCompleted();
+       }
+}
index 9b31aa4..767107a 100644 (file)
@@ -1591,16 +1591,12 @@ TelephonyManager::HandleParticipantEndedFromConference(unsigned int participantC
                __pActiveCallList->Add(pActiveCall->GetCallHandle()->ToLong(), *pActiveCall);
                pActiveCall = null;
 
-               //Check if there is no incoming or dialing call exist, then only notify to change screen, Else ignore
-               if (IsIncomingorDialingCallPresent() == false)
-               {
-                       //using the callConnected to switch to single active screen
-                       //or update multiple active call screen
-                       IListT<AppCallInfo>* pActiveCallList = __pActiveCallList->GetValuesN();
-                       __pEventListener->HandleCallConnected(*pActiveCallList);
-                       delete pActiveCallList;
-                       pActiveCallList = null;
-               }
+               //using the callConnected to switch to single active screen
+               //or update multiple active call screen
+               IListT<AppCallInfo>* pActiveCallList = __pActiveCallList->GetValuesN();
+               __pEventListener->HandleCallConnected(*pActiveCallList);
+               delete pActiveCallList;
+               pActiveCallList = null;
        }
        else
        {
@@ -2214,6 +2210,7 @@ TelephonyManager::CheckIncomingCallToBeRejected(AppCallInfo* pIncomingCallInfo)
 void
 TelephonyManager::HandleCallback(TapiHandle* pHandle, const char* pNotiId, void* pData, void* pUserData)
 {
+       AppLogDebug("Enter");
        unsigned int tempHandle = 0;
        TelephonyManager* pTelManager = (TelephonyManager*) pUserData;
        if (pTelManager->__pSoundManager == null)