|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: PIMManager JNI wrapper. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <jni.h> |
|
21 #include "com_nokia_mj_impl_pim_PIMManager.h" |
|
22 #include <badesca.h> |
|
23 #include "pimcommon.h" |
|
24 #include "pimbasemanager.h" |
|
25 #include "pimbaseitem.h" |
|
26 #include "mpimlocalizationmanager.h" |
|
27 #include "pimpanics.h" |
|
28 #include "logger.h" |
|
29 #include "pimutils.h" |
|
30 |
|
31 JNIEXPORT jint |
|
32 JNICALL Java_com_nokia_mj_impl_pim_PIMManager__1createPIMManager( |
|
33 JNIEnv* aJniEnv, |
|
34 jobject /*aPeer*/, |
|
35 jintArray aError) |
|
36 { |
|
37 JELOG2(EPim); |
|
38 int error = 0; |
|
39 pimbasemanager* manager = NULL; |
|
40 try |
|
41 { |
|
42 manager = pimbasemanager::getInstance(); |
|
43 } |
|
44 catch (int aError) |
|
45 { |
|
46 error = aError; |
|
47 } |
|
48 SetJavaErrorCode(aJniEnv, aError, error); |
|
49 return reinterpret_cast<int>(manager); |
|
50 |
|
51 } |
|
52 |
|
53 JNIEXPORT void |
|
54 JNICALL Java_com_nokia_mj_impl_pim_PIMManager__1dispose( |
|
55 JNIEnv* /*aJniEnv*/, |
|
56 jobject /*aPeer*/, |
|
57 jint aManagerHandle) |
|
58 { |
|
59 JELOG2(EPim); |
|
60 pimbasemanager* manager = reinterpret_cast< pimbasemanager *>(aManagerHandle); |
|
61 manager->dispose(); |
|
62 |
|
63 } |
|
64 |
|
65 JNIEXPORT jint |
|
66 JNICALL Java_com_nokia_mj_impl_pim_PIMManager__1openPIMList( |
|
67 JNIEnv* aJniEnv, |
|
68 jobject /*aPeer*/, |
|
69 jint aManagerHandle, |
|
70 jint aPimListType, |
|
71 jstring aPimListName, |
|
72 jintArray aError) |
|
73 { |
|
74 JELOG2(EPim); |
|
75 pimbasemanager* manager = reinterpret_cast< pimbasemanager *>(aManagerHandle); |
|
76 pimbaselist* list = NULL; |
|
77 int error = 0; |
|
78 try |
|
79 { |
|
80 list = manager->openPimList( |
|
81 static_cast< TPIMListType>(aPimListType),aPimListName, aJniEnv); |
|
82 } |
|
83 catch (int aError) |
|
84 { |
|
85 error = aError; |
|
86 } |
|
87 SetJavaErrorCode(aJniEnv, aError, error); |
|
88 |
|
89 // We now own the list (through the handle). The ownership of |
|
90 // the list is transferred to the Java side peer list object. |
|
91 return reinterpret_cast<int>(list); |
|
92 |
|
93 } |
|
94 |
|
95 JNIEXPORT jobjectArray |
|
96 JNICALL Java_com_nokia_mj_impl_pim_PIMManager__1listPIMLists( |
|
97 JNIEnv* aJniEnv, |
|
98 jobject /*aPeer*/, |
|
99 jint aManagerHandle, |
|
100 jint aPimListType, |
|
101 jintArray aError) |
|
102 { |
|
103 JELOG2(EPim); |
|
104 pimbasemanager* manager = |
|
105 reinterpret_cast< pimbasemanager *>(aManagerHandle); |
|
106 |
|
107 jobjectArray javaStringArray = NULL; |
|
108 |
|
109 javaStringArray = manager->listPimLists( |
|
110 static_cast< TPIMListType>(aPimListType), |
|
111 aError, |
|
112 aJniEnv); |
|
113 |
|
114 return javaStringArray; |
|
115 } |
|
116 |
|
117 |
|
118 |
|
119 // End of File |