|
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: ContactImpl JNI wrapper. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include "com_nokia_mj_impl_pim_ContactImpl.h" |
|
22 #include "pimbasemanager.h" |
|
23 #include "pimbaseitem.h" |
|
24 #include "pimcommon.h" |
|
25 #include "pimutils.h" |
|
26 #include "logger.h" |
|
27 |
|
28 |
|
29 JNIEXPORT jint |
|
30 JNICALL Java_com_nokia_mj_impl_pim_ContactImpl__1createNativePeer( |
|
31 JNIEnv* aJniEnv, |
|
32 jobject /*aPeer*/, |
|
33 jint aManagerHandle, |
|
34 jintArray aError) |
|
35 { |
|
36 JELOG2(EPim); |
|
37 pimbasemanager* pimManager = reinterpret_cast< pimbasemanager*>(aManagerHandle); |
|
38 pimbaseitem* item = NULL; |
|
39 int error = 0; |
|
40 try |
|
41 { |
|
42 item = pimbaseitem::getContactItemInstance(pimManager); |
|
43 } |
|
44 catch (int aError) |
|
45 { |
|
46 error = aError; |
|
47 } |
|
48 SetJavaErrorCode(aJniEnv, aError, error); |
|
49 |
|
50 return reinterpret_cast<int>(item); |
|
51 |
|
52 } |
|
53 |
|
54 JNIEXPORT jint |
|
55 JNICALL Java_com_nokia_mj_impl_pim_ContactImpl__1getPreferredIndex( |
|
56 JNIEnv* aJniEnv, |
|
57 jobject /*aPeer*/, |
|
58 jint aContactItemHandle, |
|
59 jint aField, |
|
60 jintArray aError) |
|
61 { |
|
62 JELOG2(EPim); |
|
63 pimbaseitem* item = reinterpret_cast< pimbaseitem *>(aContactItemHandle); |
|
64 int error = 0; |
|
65 int preferredIndex = 0; |
|
66 try |
|
67 { |
|
68 preferredIndex = item->getPreferredIndex(aField); |
|
69 } |
|
70 catch (int aError) |
|
71 { |
|
72 error = aError; |
|
73 } |
|
74 SetJavaErrorCode(aJniEnv, aError, error); |
|
75 |
|
76 return preferredIndex; |
|
77 } |
|
78 |
|
79 // End of File |