javacommons/utils/src.s60/formatternative.cpp
branchRCL_3
changeset 24 6c158198356e
parent 21 4376525cdefb
--- a/javacommons/utils/src.s60/formatternative.cpp	Thu Jul 15 18:31:06 2010 +0300
+++ b/javacommons/utils/src.s60/formatternative.cpp	Thu Aug 19 09:48:13 2010 +0300
@@ -16,10 +16,14 @@
 */
 
 
-//#include <avkon.rsg>
 #include <memory>
 #include <stringresourcereader.h>
-#include <aknutils.h>
+
+#ifdef RD_JAVA_UI_QT
+#include <QLocale>
+#else // RD_JAVA_UI_QT
+#include <AknUtils.h>
+#endif // RD_JAVA_UI_QT
 
 #include "com_nokia_mj_impl_utils_Formatter.h"
 #include "com_nokia_mj_impl_utils_ResourceLoader.h"
@@ -45,7 +49,6 @@
 const TInt KMaxNumberFormatSize = 40;
 using namespace java::util;
 
-// _LIT( KAvkonResFile, "z:\\resource\\avkon.rsc" );
 
 JNIEXPORT jstring JNICALL Java_com_nokia_mj_impl_utils_Formatter__1formatInteger
 (JNIEnv *aJni, jobject, jint aNumber)
@@ -68,7 +71,10 @@
               "Cannot format %d to current locale. Error: %d", aNumber, error);
     }
 
-    AknTextUtils::LanguageSpecificNumberConversion( numberPtr );
+#ifndef RD_JAVA_UI_QT
+        AknTextUtils::LanguageSpecificNumberConversion( numberPtr );
+#endif // RD_JAVA_UI_QT
+
     return aJni->NewString(
                (const jchar*)numberPtr.Ptr(), numberPtr.Length());
 }
@@ -116,8 +122,24 @@
     std::wstring wstr = JniUtils::jstringToWstring(aEnv, str);
     HBufC* buf = S60CommonUtils::wstringToDes(wstr.c_str());
     TPtr ptr(buf->Des());
+
+#ifndef RD_JAVA_UI_QT
     AknTextUtils::LanguageSpecificNumberConversion( ptr );
+#endif // RD_JAVA_UI_QT
     ret = S60CommonUtils::NativeToJavaString(*aEnv, ptr);
     delete buf; buf = NULL;
     return ret;
 }
+
+JNIEXPORT jstring JNICALL Java_com_nokia_mj_impl_utils_ResourceLoader__1getLocaleIdQt
+  (JNIEnv *env, jclass)
+{
+#ifdef RD_JAVA_UI_QT
+    QString localeName = QLocale::system().name();
+    jstring loc = env->NewString(localeName.utf16(), localeName.size());
+    return loc;
+#else // RD_JAVA_UI_QT
+    (void)env;     // just to suppress a warning
+    return NULL;
+#endif // RD_JAVA_UI_QT
+}