javacommons/utils/src.s60/formatternative.cpp
changeset 48 e0d6e9bd3ca7
parent 47 f40128debb5d
child 83 26b2b12093af
--- a/javacommons/utils/src.s60/formatternative.cpp	Wed Jun 23 18:07:10 2010 +0300
+++ b/javacommons/utils/src.s60/formatternative.cpp	Tue Jul 06 14:10:26 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
+}