equal
deleted
inserted
replaced
17 |
17 |
18 |
18 |
19 //#include <avkon.rsg> |
19 //#include <avkon.rsg> |
20 #include <memory> |
20 #include <memory> |
21 #include <stringresourcereader.h> |
21 #include <stringresourcereader.h> |
|
22 #include <aknutils.h> |
22 |
23 |
23 #include "com_nokia_mj_impl_utils_Formatter.h" |
24 #include "com_nokia_mj_impl_utils_Formatter.h" |
24 #include "com_nokia_mj_impl_utils_ResourceLoader.h" |
25 #include "com_nokia_mj_impl_utils_ResourceLoader.h" |
25 #include "javajniutils.h" |
26 #include "javajniutils.h" |
|
27 #include "s60commonutils.h" |
26 #include "logger.h" |
28 #include "logger.h" |
27 |
29 |
28 enum EDateTimeFormat |
30 enum EDateTimeFormat |
29 { |
31 { |
30 DATE_LONG = 1, |
32 DATE_LONG = 1, |
39 const TUint JavaLowerTimeFor1970 = 254771200; |
41 const TUint JavaLowerTimeFor1970 = 254771200; |
40 |
42 |
41 // const TInt KMaxDateTimeStringSize = 50; |
43 // const TInt KMaxDateTimeStringSize = 50; |
42 const TInt KMaxDateFormatSize = 30; |
44 const TInt KMaxDateFormatSize = 30; |
43 const TInt KMaxNumberFormatSize = 40; |
45 const TInt KMaxNumberFormatSize = 40; |
|
46 using namespace java::util; |
44 |
47 |
45 // _LIT( KAvkonResFile, "z:\\resource\\avkon.rsc" ); |
48 // _LIT( KAvkonResFile, "z:\\resource\\avkon.rsc" ); |
46 |
49 |
47 JNIEXPORT jstring JNICALL Java_com_nokia_mj_impl_utils_Formatter__1formatInteger |
50 JNIEXPORT jstring JNICALL Java_com_nokia_mj_impl_utils_Formatter__1formatInteger |
48 (JNIEnv *aJni, jobject, jint aNumber) |
51 (JNIEnv *aJni, jobject, jint aNumber) |
63 { |
66 { |
64 WLOG2(EUtils, |
67 WLOG2(EUtils, |
65 "Cannot format %d to current locale. Error: %d", aNumber, error); |
68 "Cannot format %d to current locale. Error: %d", aNumber, error); |
66 } |
69 } |
67 |
70 |
|
71 AknTextUtils::LanguageSpecificNumberConversion( numberPtr ); |
68 return aJni->NewString( |
72 return aJni->NewString( |
69 (const jchar*)numberPtr.Ptr(), numberPtr.Length()); |
73 (const jchar*)numberPtr.Ptr(), numberPtr.Length()); |
70 } |
74 } |
71 |
75 |
72 JNIEXPORT jstring JNICALL Java_com_nokia_mj_impl_utils_Formatter__1formatDate |
76 JNIEXPORT jstring JNICALL Java_com_nokia_mj_impl_utils_Formatter__1formatDate |
103 |
107 |
104 { |
108 { |
105 return (jint)User::Language(); |
109 return (jint)User::Language(); |
106 } |
110 } |
107 |
111 |
|
112 JNIEXPORT jstring JNICALL Java_com_nokia_mj_impl_utils_Formatter__1formatDigits |
|
113 (JNIEnv * aEnv, jclass, jstring str) |
|
114 { |
|
115 jstring ret = str; |
|
116 std::wstring wstr = JniUtils::jstringToWstring(aEnv, str); |
|
117 HBufC* buf = S60CommonUtils::wstringToDes(wstr.c_str()); |
|
118 TPtr ptr(buf->Des()); |
|
119 AknTextUtils::LanguageSpecificNumberConversion( ptr ); |
|
120 ret = S60CommonUtils::NativeToJavaString(*aEnv, ptr); |
|
121 delete buf; buf = NULL; |
|
122 return ret; |
|
123 } |