javaextensions/pim/jni/src/todoimpl.cpp
branchRCL_3
changeset 14 04becd199f91
equal deleted inserted replaced
13:f5050f1da672 14:04becd199f91
       
     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:  ToDoImpl JNI wrapper.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 //  INCLUDE FILES
       
    20 
       
    21 #include "com_nokia_mj_impl_pim_ToDoImpl.h"
       
    22 #include "pimbasemanager.h"
       
    23 #include "pimbaseitem.h"
       
    24 #include "pimcommon.h"
       
    25 #include "pimutils.h"
       
    26 #include "logger.h"
       
    27 
       
    28 JNIEXPORT jint
       
    29 JNICALL Java_com_nokia_mj_impl_pim_ToDoImpl__1createNativePeer(
       
    30     JNIEnv* aJniEnv,
       
    31     jobject /*aPeer*/,
       
    32     jint aManagerHandle,
       
    33     jintArray aError)
       
    34 {
       
    35     JELOG2(EPim);
       
    36     pimbasemanager* pimManager = reinterpret_cast< pimbasemanager *>(aManagerHandle);
       
    37     pimbaseitem* todoItem = NULL;
       
    38     int error = 0;
       
    39     try
       
    40     {
       
    41         todoItem = pimbaseitem::getToDoItemInstance(pimManager);
       
    42     }
       
    43     catch (int aError)
       
    44     {
       
    45         error = aError;
       
    46     }
       
    47     SetJavaErrorCode(aJniEnv, aError, error);
       
    48     if (error != 0)
       
    49         return 0;
       
    50     return reinterpret_cast<int>(todoItem);
       
    51 
       
    52 }
       
    53 
       
    54 // End of File