From 424735f91dbf5847640aca4011a309dbef7b1e31 Mon Sep 17 00:00:00 2001
From: Lars Knoll <lars.knoll@nokia.com>
Date: Wed, 9 Jun 2010 23:00:20 +0200
Subject: Add a isWrittenRightToLeft() method to QLocale.

This helps us keeping the code in the key mappers
that detect keyboard changes simple and is useful
for other cases as well.

Task-number: Part of QT-3292
Reviewed-by: Simon Hausmann
---
 src/corelib/tools/qlocale.cpp | 19 +++++++++++++++++++
 src/corelib/tools/qlocale.h   |  2 ++
 2 files changed, 21 insertions(+)

diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index c000dc8..8f50f2e 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -3478,6 +3478,25 @@ QLocale::MeasurementSystem QLocale::measurementSystem() const
 }
 
 /*!
+  \since 4.7
+
+  Returns true if the language is written right to left.
+*/
+bool QLocale::isWrittenRightToLeft() const
+{
+    Language lang = language();
+    if (lang == QLocale::Arabic ||
+        lang == QLocale::Hebrew ||
+        lang == QLocale::Persian ||
+        lang == QLocale::Urdu ||
+        lang == QLocale::Syriac)
+        return true;
+
+    return false;
+}
+
+
+/*!
     \since 4.5
 
     Returns the localized name of the "AM" suffix for times specified using
diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h
index f2fd892..f8b5c55 100644
--- a/src/corelib/tools/qlocale.h
+++ b/src/corelib/tools/qlocale.h
@@ -666,6 +666,8 @@ public:
 
     MeasurementSystem measurementSystem() const;
 
+    bool isWrittenRightToLeft() const;
+
     inline bool operator==(const QLocale &other) const;
     inline bool operator!=(const QLocale &other) const;
 
-- 
cgit v0.12