[Tizen] Add a flag to check whether it is forced to enable
[platform/core/uifw/dali-adaptor.git] / dali / internal / accessibility / common / accessibility-adaptor-impl.cpp
index 3f877f1..e057821 100644 (file)
@@ -19,6 +19,7 @@
 #include <dali/internal/accessibility/common/accessibility-adaptor-impl.h>
 
 // EXTERNAL INCLUDES
+#include <system_settings.h>
 #include <dali/public-api/object/type-registry.h>
 #include <dali/integration-api/debug.h>
 #include <dali/integration-api/events/touch-event-integ.h>
@@ -50,13 +51,22 @@ Debug::Filter* gAccessibilityAdaptorLogFilter = Debug::Filter::New(Debug::NoLogg
 AccessibilityAdaptor::AccessibilityAdaptor()
 : mReadPosition(),
   mActionHandler( NULL ),
-  mIsEnabled( false )
+  mIsEnabled( false ),
+  mIsForced( false )
 {
   mAccessibilityGestureDetector = new AccessibilityGestureDetector();
 }
 
 void AccessibilityAdaptor::EnableAccessibility()
 {
+  bool accessibilityState = false;
+  system_settings_get_value_bool( SYSTEM_SETTINGS_KEY_ACCESSIBILITY_TTS, &accessibilityState );
+  if(accessibilityState == false)
+  {
+    DALI_LOG_ERROR("The Current Accessibility system cannot run. \n");
+    return;
+  }
+
   if(mIsEnabled == false)
   {
     mIsEnabled = true;
@@ -94,6 +104,16 @@ bool AccessibilityAdaptor::IsEnabled() const
   return mIsEnabled;
 }
 
+void AccessibilityAdaptor::SetForcedEnable( bool forced )
+{
+  mIsForced = forced;
+}
+
+bool AccessibilityAdaptor::IsForcedEnable() const
+{
+  return mIsForced;
+}
+
 Vector2 AccessibilityAdaptor::GetReadPosition() const
 {
   return mReadPosition;
@@ -257,7 +277,7 @@ bool AccessibilityAdaptor::HandleActionScrollEvent(const TouchPoint& point, uint
   Integration::TouchEvent touchEvent;
   Integration::HoverEvent hoverEvent;
   Integration::TouchEventCombiner::EventDispatchType type = mCombiner.GetNextTouchEvent( Integration::Point( point ), timeStamp, touchEvent, hoverEvent );
-  if( type == Integration::TouchEventCombiner::DispatchTouch || type == Integration::TouchEventCombiner::DispatchBoth ) // hover event is ignored
+  if( type == Integration::TouchEventCombiner::DISPATCH_TOUCH || type == Integration::TouchEventCombiner::DISPATCH_BOTH ) // hover event is ignored
   {
     // Process the touch event in accessibility gesture detector
     if( mAccessibilityGestureDetector )
@@ -270,19 +290,6 @@ bool AccessibilityAdaptor::HandleActionScrollEvent(const TouchPoint& point, uint
   return ret;
 }
 
-bool AccessibilityAdaptor::HandleActionTouchEvent(const TouchPoint& point, uint32_t timeStamp)
-{
-  bool ret = false;
-
-  Dali::TouchEvent touch = Integration::NewTouchEvent( timeStamp, point );
-
-  if( mActionHandler )
-  {
-    ret = mActionHandler->AccessibilityActionTouch( touch );
-  }
-  return ret;
-}
-
 bool AccessibilityAdaptor::HandleActionBackEvent()
 {
   bool ret = false;