javaextensions/pim/jni/src/eventlistimpl.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:  EventListImpl JNI wrapper.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 //  INCLUDE FILES
       
    20 
       
    21 #include "com_nokia_mj_impl_pim_EventListImpl.h"
       
    22 #include "pimcommon.h"
       
    23 #include "pimbaselist.h"
       
    24 #include "pimbaseitem.h"
       
    25 #include "pimbaserepeatrule.h"
       
    26 #include "pimutils.h"
       
    27 #include "logger.h"
       
    28 
       
    29 JNIEXPORT jintArray
       
    30 JNICALL Java_com_nokia_mj_impl_pim_EventListImpl__1itemsByDate(
       
    31     JNIEnv* aJniEnv, jobject /*aPeer*/, jint aEventListHandle,
       
    32     jint aSearchType, jlong aStartDate, jlong aEndDate,
       
    33     jboolean aInitialEventOnly, jintArray aError)
       
    34 {
       
    35 
       
    36     JELOG2(EPim);
       
    37     pimbaselist* eventList =
       
    38         reinterpret_cast< pimbaselist*>(aEventListHandle);
       
    39     jintArray itemHandles = eventList->itemsByDate(
       
    40                                 aSearchType, aStartDate, aEndDate, aInitialEventOnly,
       
    41                                 aJniEnv, aError);
       
    42 
       
    43     return itemHandles;
       
    44 }
       
    45 
       
    46 JNIEXPORT jintArray
       
    47 JNICALL
       
    48 Java_com_nokia_mj_impl_pim_EventListImpl__1getSupportedRepeatRuleFields(
       
    49     JNIEnv* aJniEnv, jobject /*aPeer*/, jint aEventListHandle,
       
    50     jint aFrequency, jintArray aError)
       
    51 {
       
    52     JELOG2(EPim);
       
    53     pimbaselist* eventList = reinterpret_cast< pimbaselist *>(aEventListHandle);
       
    54     jintArray javaFields = eventList->getSupportedRepeatRuleFields(
       
    55                                aFrequency, aJniEnv, aError);
       
    56     return javaFields;
       
    57 }
       
    58 
       
    59 JNIEXPORT jint
       
    60 JNICALL Java_com_nokia_mj_impl_pim_EventListImpl__1createRepeatRuleHandle(
       
    61     JNIEnv* aJniEnv, jobject /*aPeer*/, jint aEventItemHandle,
       
    62     jintArray aError)
       
    63 {
       
    64     JELOG2(EPim);
       
    65     pimbaseitem* eventItem = reinterpret_cast< pimbaseitem *>(aEventItemHandle);
       
    66     int repeatRuleHandle = 0;
       
    67     int error = 0;
       
    68     try
       
    69     {
       
    70         repeatRuleHandle = eventItem->getRepeatHandle();
       
    71     }
       
    72     catch (int aErr)
       
    73     {
       
    74         error = aErr;
       
    75     }
       
    76     SetJavaErrorCode(aJniEnv, aError, error);
       
    77     return repeatRuleHandle;
       
    78 }