2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file CallSettingsPresentationModel.cpp
19 * @brief Setting Presentation model
21 #include "CallSettingsConstants.h"
22 #include "CallSettingsManager.h"
23 #include "CallSettingsPresentationModel.h"
24 #include "CallPresentationModel.h"
26 using namespace Tizen::Base;
27 using namespace Tizen::Base::Collection;
28 using namespace Tizen::Social;
30 SettingsPresentationModel* SettingsPresentationModel::__pInstance = null;
32 SettingsPresentationModel::SettingsPresentationModel()
34 __pSettingsMgr = null;
35 __pSettingsEventListener = null;
38 SettingsPresentationModel::~SettingsPresentationModel()
43 SettingsPresentationModel::CreateInstance(void)
45 __pInstance = new (std::nothrow) SettingsPresentationModel();
46 result r = __pInstance->Construct();
53 atexit(&(SettingsPresentationModel::DestroyInstance));
56 SettingsPresentationModel*
57 SettingsPresentationModel::GetInstance(void)
59 if (__pInstance == null)
67 SettingsPresentationModel::DestroyInstance(void)
69 if (__pInstance->__pSettingsMgr != null)
71 __pInstance->__pSettingsMgr->RemoveSettingEventListener(__pInstance);
72 __pInstance->__pSettingsMgr = null;
78 SettingsPresentationModel::Construct(void)
80 //Construct Settings Manager
81 __pSettingsMgr = SettingsManager::GetInstance();
82 __pSettingsMgr->AddSettingEventListener(this);
87 SettingsPresentationModel::AddSettingEventListener(ISettingsEventListener* pSettingsEventListener)
90 if (__pSettingsEventListener == null && pSettingsEventListener != null)
92 __pSettingsEventListener = pSettingsEventListener;
99 SettingsPresentationModel::RemoveSettingEventListener(void)
101 __pSettingsEventListener = null;
105 SettingsPresentationModel::GetRejectMessageListN(void)
107 return __pSettingsMgr->GetRejectMessageListN();
112 SettingsPresentationModel::IsCallToBeRejected(Tizen::Base::String& phoneNumber)
114 return __pSettingsMgr->IsCallToBeRejected(phoneNumber);
118 //////////////////////////////////////////////////
119 // Settings Event Listener Methods //
120 //////////////////////////////////////////////////
123 SettingsPresentationModel::HandleGetCallWaitingResponse(bool isCallSuccessful, bool callWaitingActivated)
125 if (__pSettingsEventListener != null)
127 __pSettingsEventListener->HandleGetCallWaitingResponse(isCallSuccessful, callWaitingActivated);
132 SettingsPresentationModel::HandleSetCallWaitingResponse(bool isCallSuccessful, bool isCallWaitingEnabled)
134 if (__pSettingsEventListener != null)
136 __pSettingsEventListener->HandleSetCallWaitingResponse(isCallSuccessful, isCallWaitingEnabled);
141 SettingsPresentationModel::HandleGetCallForwardResponse(bool isCallSuccessful, CallForwardCondition callFwdCondition, const String& callFwdNumber, bool callForwardActivated, int noReplyWaitTime)
143 if (__pSettingsEventListener != null)
145 __pSettingsEventListener->HandleGetCallForwardResponse(isCallSuccessful, callFwdCondition, callFwdNumber, callForwardActivated, noReplyWaitTime);
150 SettingsPresentationModel::HandleSetCallForwardResponse(bool isCallSuccessful, CallForwardCondition callFwdCondition, const String& callFwdNumber, bool isCallForwardActivated, int noReplyWaitTime)
152 if (__pSettingsEventListener != null)
154 __pSettingsEventListener->HandleSetCallForwardResponse(isCallSuccessful, callFwdCondition, callFwdNumber, isCallForwardActivated, noReplyWaitTime);
159 SettingsPresentationModel::HandleGetCallBarringResponse(bool isCallSuccessful, CallBarringType callBarringType, bool isBarringActivated)
161 if (__pSettingsEventListener != null)
163 __pSettingsEventListener->HandleGetCallBarringResponse(isCallSuccessful, callBarringType, isBarringActivated);
168 SettingsPresentationModel::HandleSetCallBarringResponse(bool isCallSuccessful, CallBarringType callBarringType, bool isBarringActivated)
170 if (__pSettingsEventListener != null)
172 __pSettingsEventListener->HandleSetCallBarringResponse(isCallSuccessful, callBarringType, isBarringActivated);
177 SettingsPresentationModel::HandleFlightMode(bool isFlightModeActivated)
179 CallPresentationModel::GetInstance()->EndAllCall();
183 SettingsPresentationModel::SetCallState(CallState callState)
185 return __pSettingsMgr->SetCallState(callState);
189 SettingsPresentationModel::GetFlightModeStatus(void)
191 return __pSettingsMgr->GetFlightModeStatus();