X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FCallPresentationModel.cpp;h=298a3fc8ce648bcf84ea90b0754bac36a57ce187;hb=c2d56f706b2044f83221f0eadffa6f19ea200ea8;hp=468f73275e5ee5f2318755d628c09b17056cdaa8;hpb=4f9ce1622ba528aca7834f198a0830bdd1f8cd93;p=apps%2Fosp%2FCall.git diff --git a/src/CallPresentationModel.cpp b/src/CallPresentationModel.cpp index 468f732..298a3fc 100644 --- a/src/CallPresentationModel.cpp +++ b/src/CallPresentationModel.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 // @@ -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 @@ -474,6 +482,7 @@ CallPresentationModel::RejectCall(int callHandle, bool sendMsg, const String& co void CallPresentationModel::OnAppForeground(void) { + AppLogDebug("Enter %d %d",__isDialAppControlRunning ,__isMessageAppControlRunning); if (__isDialAppControlRunning == true) { //This comes here, when Dialer AppControl is finished working. @@ -487,10 +496,10 @@ void CallPresentationModel::OnAppForeground(void) __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) + if( GetCurrentCallCount() == 0 && IsIncomingorDialingCallPresent() == false) { - CallApp* pPhoneApp = static_cast(UiApp::GetInstance()); - pPhoneApp->Terminate(); + CallApp* pCallApp = static_cast(UiApp::GetInstance()); + pCallApp->Terminate(); } } } @@ -713,6 +722,7 @@ CallPresentationModel::LaunchDialAppControl() if(__isDialAppControlRunning == true) { + AppLogDebug("__isDialAppControlRunning == true"); //Do not allow another app control if already running return; } @@ -932,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; + +}