modify license, permission and remove ^M char
[platform/framework/native/uifw.git] / src / ui / FUi_AccessibilitySystemSettingLoader.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an ”AS IS” BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 #include <FBaseString.h>
19 #include <FBaseSysLog.h>
20 #include <FLclLocaleManager.h>
21 #include <FSys_SettingInfoImpl.h>
22 #include "FUi_AccessibilitySystemSettingLoader.h"
23 #include "FUi_AccessibilityManager.h"
24 #include "FUi_EcoreEvasMgr.h"
25 #include "FUi_EcoreEvas.h"
26
27 using namespace Tizen::Base;
28 using namespace Tizen::Locales;
29 using namespace Tizen::System;
30
31 namespace Tizen { namespace Ui {
32
33 bool _activated = false;
34 bool _screenReaderActivated = false;
35
36 _AccessibilitySystemSettingLoader::_AccessibilitySystemSettingLoader(_AccessibilityManager& manager)
37         : __pManager(&manager)
38 {
39         _screenReaderActivated = IsScreenReaderActivated();
40         _activated = _screenReaderActivated;
41         _SettingInfoImpl::AddSettingEventListenerForInternal(*this);
42 }
43 _AccessibilitySystemSettingLoader::~_AccessibilitySystemSettingLoader(void)
44 {
45         _SettingInfoImpl::RemoveSettingEventListenerForInternal(*this);
46 }
47 void
48 _AccessibilitySystemSettingLoader::OnSettingChanged(String& key)
49 {
50         if (key == L"http://tizen.org/setting/locale.country" || key == L"http://tizen.org/setting/locale.language")
51         {
52                 __pManager->OnChangedLocale();
53         }
54         else if (key == L"http://tizen.org/setting/speech.tts.screen")
55         {
56                 _AccessibilityManager::GetInstance()->OnAccessibilityScreenReaderIsActivated(IsScreenReaderActivated());
57         }
58 }
59
60 bool
61 _AccessibilitySystemSettingLoader::IsAccessibilityActivated(void)
62 {
63         return _activated;
64 }
65
66 bool
67 _AccessibilitySystemSettingLoader::IsScreenReaderActivated(void)
68 {
69         return GetEcoreEvasMgr()->GetEcoreEvas()->IsAccessibilityScreenReaderActivated();
70 }
71
72 float
73 _AccessibilitySystemSettingLoader::GetLargeFontSize(void)
74 {
75         return -1;
76 }
77
78 Locale
79 _AccessibilitySystemSettingLoader::GetLocale(void)
80 {
81         Locale locale(LANGUAGE_INVALID, COUNTRY_INVALID);
82         LocaleManager localeMgr;
83         localeMgr.Construct();
84         locale = localeMgr.GetSystemLocale();
85         return locale;
86 }
87
88 void
89 _AccessibilitySystemSettingLoader::SetSystemSetting(const Tizen::Base::String key, bool value)
90 {
91         if (key == L"AccessibilityActivationStatus")
92         {
93                 _activated = value;
94         }
95         else if (key == L"ScreenReaderActivationStatus")
96         {
97                 _screenReaderActivated = value;
98                 _AccessibilityManager::GetInstance()->OnAccessibilityScreenReaderIsActivated(value);
99         }
100 }
101
102 }}
103