Fix for 38340 38396 tizen_2.1 accepted/tizen_2.1/20130520.093018 submit/tizen_2.1/20130516.041617
authorAmith Kumar Mahale <amith.m@samsung.com>
Tue, 14 May 2013 13:50:38 +0000 (19:20 +0530)
committerAmith Kumar Mahale <amith.m@samsung.com>
Tue, 14 May 2013 13:50:38 +0000 (19:20 +0530)
Change-Id: I183f0a9d7dbe10bb8b7ad1b8b267859e05629b14
Signed-off-by: Amith Kumar Mahale <amith.m@samsung.com>
inc/CallPresentationModel.h
src/CallEndCallForm.cpp
src/CallIncomingCallForm.cpp
src/CallPresentationModel.cpp
src/CallSettingDataService.cpp

index b7137ad..1762c7b 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <FApp.h>
 #include <FTelephony.h>
+#include <FMessaging.h>
 #include "CallAppControlRequestMgr.h"
 #include "CallTypes.h"
 #include "CallITelephonyEventListener.h"
@@ -44,6 +45,7 @@ class CallPresentationModel: public ITelephonyEventListener
                , public Tizen::App::IAppControlResponseListener
                , public Tizen::Telephony::ITelephonyNetworkEventListener
                , public Tizen::Telephony::ITelephonySimEventListener
+               , public Tizen::Messaging::ISmsListener
 {
 public:
        //create a singleton instance
@@ -155,6 +157,10 @@ public:
        void AbortAppControlRequest(void);
        //Used to complete any running AppControl request.
        void AppControlRequestCompleted(void);
+       //Used to send message
+       void SendMessage(Tizen::Base::String& strMsg,Tizen::Base::String& recpientNum);
+       //Checks if message sending is in progress
+       bool IsMessageSendingInProgress(void);
 
        //Event Listener methods from ITelephonyEventListener
        virtual void HandleCallConnected(Tizen::Base::Collection::IListT<AppCallInfo>& pCallList);
@@ -169,6 +175,7 @@ public:
        virtual void OnAppForeground(void);
        virtual void OnTelephonyNetworkStatusChanged(const Tizen::Telephony::NetworkStatus& networkStatus);
        virtual void OnTelephonySimStateChanged(Tizen::Telephony::SimState state);
+       virtual void OnSmsMessageSent(result r);
 
 private:
        static CallPresentationModel* __pInstance;
@@ -180,11 +187,13 @@ private:
        // incoming call is rejected with "Reject With message" by opening Msg AppControl.
        bool __isMessageAppControlRunning;
        bool __isDialAppControlRunning;
+       bool __isMessageSendInProgress;
        //Used to manage AppControl requests.
        CallAppControlRequestMgr* __pAppControlMgr;
        Tizen::Telephony::NetworkManager*       __pNetworkManager;
        Tizen::Telephony::SimStateManager* __psimStateManager;
        Tizen::Telephony::SimInfo*              __psimInfo;
+       Tizen::Messaging::SmsManager* __pSmsManager;
 };
 
 #endif // _PHN_CALL_PRESENTATION_MODEL_H_
index deabc22..0dffa99 100644 (file)
@@ -47,6 +47,8 @@ const int X_PHOTO_LBL = 166;
 const int Y_PHOTO_LBL = 232;
 const int W_PHOTO_LBL = 388;
 const int H_PHOTO_LBL = 388;
+const int END_CALL_TIMER_VAL = 2000;
+const int END_CALL_WAIT_TIMER_VAL = 500;
 static const wchar_t* IDL_END_CALL_FORM = L"IDL_END_CALL_FORM";
 static const wchar_t* IDC_NUMBER1_LABEL = L"IDC_NUMBER1_LABEL";
 static const wchar_t* IDC_CALLER1_LABEL = L"IDC_CALLER1_LABEL";
@@ -59,6 +61,7 @@ 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)
 : BaseForm(FORMTYPE_ENDCALL)
 {
@@ -628,8 +631,18 @@ EndCallForm::OnAppControlCompleteResponseReceived(const AppId& appId, const Stri
 void
 EndCallForm::HandleLastCallCompletion(void)
 {
-       CallApp* pPhoneApp = (static_cast<CallApp*>(UiApp::GetInstance()));
-       pPhoneApp->Terminate();
+       //Check if message sending is in progress if yes
+       //wait for it to complete by restarting the timer
+       AppLogDebug("Enter");
+       if(__pCallPresentor->IsMessageSendingInProgress() == true)
+       {
+               __pEndCallEventTimer->Start(END_CALL_WAIT_TIMER_VAL);
+       }
+       else
+       {
+               CallApp* pPhoneApp = (static_cast<CallApp*>(UiApp::GetInstance()));
+               pPhoneApp->Terminate();
+       }
 }
 
 void
@@ -642,7 +655,7 @@ EndCallForm::OnForeground(void)
        {
                if(__pEndCallEventTimer != null)
                {
-                       __pEndCallEventTimer->Start(2000);
+                       __pEndCallEventTimer->Start(END_CALL_TIMER_VAL);
                }
                if (__pContactNumber != null && __pContactNumber->IsEmpty() == false)
                {
index f68fba0..0262de7 100644 (file)
@@ -19,7 +19,6 @@
  * @brief      Incoming Call form implementation
  */
 #include <FBaseColIList.h>
-#include <FMessaging.h>
 #include "CallIncomingCallForm.h"
 #include "CallAppUtility.h"
 #include "CallSettingsManager.h"
@@ -32,7 +31,6 @@ using namespace Tizen::App;
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
 using namespace Tizen::Graphics;
-using namespace Tizen::Messaging;
 using namespace Tizen::Ui;
 using namespace Tizen::Ui::Animations;
 using namespace Tizen::Ui::Controls;
@@ -138,16 +136,6 @@ const wchar_t* IDI_REJECT_ARROW_VISUAL_ELE_NAME = L"RejectArrowVisEle";
 const wchar_t* IDI_REJECT_FINAL_VISUAL_ELE_NAME = L"RejectFinalVisEle";
 const wchar_t* IDI_ACCEPT_FINAL_VISUAL_ELE_NAME = L"AcceptFinalVisEle";
 
-class SmsListener
-       : public Object
-       , public ISmsListener
-{
-public:
-               void  OnSmsMessageSent(result r)
-               {
-               }
-};
-
 IncomingCallForm::IncomingCallForm(void)
        : BaseForm(FORMTYPE_INCOMINGCALL)
 {
@@ -666,42 +654,12 @@ IncomingCallForm::OnActionPerformed(const Control& source, int actionId)
        case IDA_SEND_REJECT_MSG6:
        {
                __pCallPresentor->RejectCall(__incomingCallHandle, false,*__pActiveContactNo);
-               SmsListener* pSmsListener = new (std::nothrow) SmsListener();
-               SmsManager* pSmsManager = new (std::nothrow) SmsManager();
-               result r = pSmsManager->Construct(*pSmsListener);
-               if (IsFailed(r) == false)
-               {
-                       RecipientList recipient;
-                       recipient.Add(RECIPIENT_TYPE_TO,*__pActiveContactNo);
-                       SmsMessage smsMessage;
-                       String textToBeSent;
-                       //calculate msgIndex
-                       int msgIndex = IDA_SEND_REJECT_MSG1;
-                       msgIndex = actionId - msgIndex;
-                       __pRejectMessageList->GetAt(msgIndex, textToBeSent);
-                       r = smsMessage.SetText(textToBeSent);
-                       if (IsFailed(r) == false)
-                       {
-                               r = pSmsManager->Send(smsMessage,recipient,true);
-                               if (IsFailed(r) == true)
-                               {
-                                       //todo: error message
-                               }
-                       }
-                       else
-                       {
-                               //todo: error message
-                       }
-               }
-               else
-               {
-                       //todo: error message
-               }
-               delete pSmsListener;
-               delete pSmsManager;
-               /*ArrayListT<CallInfo>* pCallList  = static_cast<ArrayListT<CallInfo>*>(__pCallPresentor->GetCallListN());
-               __pCallPresentor->HandleCallConnected(*pCallList);
-               pCallList = null;*/
+               String textToBeSent;
+               //calculate msgIndex
+               int msgIndex = IDA_SEND_REJECT_MSG1;
+               msgIndex = actionId - msgIndex;
+               __pRejectMessageList->GetAt(msgIndex, textToBeSent);
+               __pCallPresentor->SendMessage(textToBeSent,*__pActiveContactNo);
        }
        break;
 
index c15a32e..298a3fc 100644 (file)
@@ -41,6 +41,7 @@ using namespace Tizen::Social;
 using namespace Tizen::Ui::Scenes;
 using namespace Tizen::Telephony;
 using namespace Tizen::Base::Utility;
+using namespace Tizen::Messaging;
 
 CallPresentationModel* CallPresentationModel::__pInstance = null;
 
@@ -55,6 +56,8 @@ CallPresentationModel::CallPresentationModel(void)
        __pNetworkManager = null;
        __psimStateManager = null;
        __psimInfo = null;
+       __pSmsManager = null;
+       __isMessageSendInProgress = false;
 }
 
 CallPresentationModel::~CallPresentationModel(void)
@@ -77,6 +80,11 @@ CallPresentationModel::~CallPresentationModel(void)
                delete __psimInfo;
                __psimInfo = null;
        }
+       if(__pSmsManager != null)
+       {
+               delete __pSmsManager;
+               __pSmsManager = null;
+       }
 }
 
 void
@@ -934,3 +942,56 @@ CallPresentationModel::IsSimAvailable(void)
 
 }
 
+void
+CallPresentationModel::SendMessage(String& strMsg,String& recpientNum)
+{
+       AppLogDebug("Enter");
+       if(__pSmsManager == null)
+       {
+               __pSmsManager = new (std::nothrow) SmsManager();
+       }
+       result r = __pSmsManager->Construct(*this);
+       if (IsFailed(r) == false)
+       {
+               RecipientList recipient;
+               recipient.Add(RECIPIENT_TYPE_TO,recpientNum);
+               SmsMessage smsMessage;
+               r = smsMessage.SetText(strMsg);
+               if (IsFailed(r) == false)
+               {
+                       r = __pSmsManager->Send(smsMessage,recipient,true);
+                       if (IsFailed(r) == true)
+                       {
+                               //todo: error message
+                       }
+                       else
+                       {
+                               __isMessageSendInProgress = true;
+                       }
+               }
+               else
+               {
+                       //todo: error message
+               }
+       }
+       else
+       {
+               //todo: error message
+       }
+
+}
+
+bool
+CallPresentationModel::IsMessageSendingInProgress(void)
+{
+       AppLogDebug("Enter %d",__isMessageSendInProgress);
+       return __isMessageSendInProgress;
+}
+
+void
+CallPresentationModel::OnSmsMessageSent(result r)
+{
+       AppLogDebug("Enter");
+       __isMessageSendInProgress = false;
+
+}
index 50ffc76..e9fa956 100644 (file)
@@ -30,7 +30,7 @@ using namespace Tizen::Io;
 using namespace Tizen::App;
 using namespace Tizen::Social;
 
-static const wchar_t* REJECT_DATABASE_PATH = L"/opt/usr/apps/zktdpemtmw/";
+static const wchar_t* REJECT_DATABASE_PATH = L"/opt/apps/zktdpemtmw/shared/";
 
 CallSettingDataService* CallSettingDataService::__pCallSettingDataService = null;
 Database* CallSettingDataService::__pDatabase = null;
@@ -75,7 +75,7 @@ CallSettingDataService::OpenDatabase(void)
                return E_OBJ_ALREADY_EXIST;
        }
        __pDatabase = new (std::nothrow) Database();
-       r = __pDatabase->Construct(__strDbName, true);
+       r = __pDatabase->Construct(__strDbName, "r");
        TryCatch(r == E_SUCCESS, , "CallSettingDataService::OpenDatabase() database construct failed");
 
        r = CreateCallRejectTableDatabase();