2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.1 (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 if(__pSettingsMgr != null)
84 __pSettingsMgr->AddSettingEventListener(this);
90 SettingsPresentationModel::AddSettingEventListener(ISettingsEventListener* pSettingsEventListener)
93 if (__pSettingsEventListener == null && pSettingsEventListener != null)
95 __pSettingsEventListener = pSettingsEventListener;
102 SettingsPresentationModel::RemoveSettingEventListener(void)
104 __pSettingsEventListener = null;
108 SettingsPresentationModel::GetRejectMessageListN(void)
110 return __pSettingsMgr->GetRejectMessageListN();
115 SettingsPresentationModel::IsCallToBeRejected(Tizen::Base::String& phoneNumber)
117 return __pSettingsMgr->IsCallToBeRejected(phoneNumber);
121 //////////////////////////////////////////////////
122 // Settings Event Listener Methods //
123 //////////////////////////////////////////////////
126 SettingsPresentationModel::HandleGetCallWaitingResponse(bool isCallSuccessful, bool callWaitingActivated)
128 if (__pSettingsEventListener != null)
130 __pSettingsEventListener->HandleGetCallWaitingResponse(isCallSuccessful, callWaitingActivated);
135 SettingsPresentationModel::HandleSetCallWaitingResponse(bool isCallSuccessful, bool isCallWaitingEnabled)
137 if (__pSettingsEventListener != null)
139 __pSettingsEventListener->HandleSetCallWaitingResponse(isCallSuccessful, isCallWaitingEnabled);
144 SettingsPresentationModel::HandleGetCallForwardResponse(bool isCallSuccessful, CallForwardCondition callFwdCondition, const String& callFwdNumber, bool callForwardActivated, int noReplyWaitTime)
146 if (__pSettingsEventListener != null)
148 __pSettingsEventListener->HandleGetCallForwardResponse(isCallSuccessful, callFwdCondition, callFwdNumber, callForwardActivated, noReplyWaitTime);
153 SettingsPresentationModel::HandleSetCallForwardResponse(bool isCallSuccessful, CallForwardCondition callFwdCondition, const String& callFwdNumber, bool isCallForwardActivated, int noReplyWaitTime)
155 if (__pSettingsEventListener != null)
157 __pSettingsEventListener->HandleSetCallForwardResponse(isCallSuccessful, callFwdCondition, callFwdNumber, isCallForwardActivated, noReplyWaitTime);
162 SettingsPresentationModel::HandleGetCallBarringResponse(bool isCallSuccessful, CallBarringType callBarringType, bool isBarringActivated)
164 if (__pSettingsEventListener != null)
166 __pSettingsEventListener->HandleGetCallBarringResponse(isCallSuccessful, callBarringType, isBarringActivated);
171 SettingsPresentationModel::HandleSetCallBarringResponse(bool isCallSuccessful, CallBarringType callBarringType, bool isBarringActivated)
173 if (__pSettingsEventListener != null)
175 __pSettingsEventListener->HandleSetCallBarringResponse(isCallSuccessful, callBarringType, isBarringActivated);
180 SettingsPresentationModel::HandleFlightMode(bool isFlightModeActivated)
182 CallPresentationModel::GetInstance()->EndAllCall();
186 SettingsPresentationModel::SetCallState(CallState callState)
188 return __pSettingsMgr->SetCallState(callState);
192 SettingsPresentationModel::GetFlightModeStatus(void)
194 return __pSettingsMgr->GetFlightModeStatus();