calendarui/calenlauncher/src/calenlauncher.cpp
branchRCL_3
changeset 65 12af337248b1
equal deleted inserted replaced
60:96907930389d 65:12af337248b1
       
     1 /*
       
     2 * Copyright (c) 2010 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:  Calendar launcher
       
    15 *
       
    16 */
       
    17 // System includes
       
    18 #include <xqservicerequest.h>
       
    19 
       
    20 // User includes
       
    21 #include <calenlauncher.h>
       
    22 
       
    23 /*!
       
    24 	\class CalenLauncher
       
    25  */
       
    26 /*!
       
    27 	Constructor.
       
    28 
       
    29 	\param parent QObject pointer.
       
    30  */
       
    31 CalenLauncher::CalenLauncher(QObject* parent)
       
    32 :QObject(parent)
       
    33 {
       
    34 }
       
    35 
       
    36 /*!
       
    37   Destructor
       
    38  */
       
    39 CalenLauncher::~CalenLauncher()
       
    40 {
       
    41 }
       
    42 
       
    43 /*!
       
    44 	API to launch the calendar application
       
    45 	\param view Claendar view to be launches
       
    46 	\param dateTime Date pertaining to which view has to be populated
       
    47 	\param synchronousLaunch bool value to tell whethe calendar has
       
    48 			to be launched synchronously or asynchronously
       
    49  */
       
    50 void CalenLauncher::launchCalendarApp(CalenView view, 
       
    51 									QDateTime& dateTime, 
       
    52 									bool synchronousLaunch)
       
    53 {
       
    54 	// launch the calendar application
       
    55 	XQServiceRequest request("com.nokia.services.calendar.Launch", 
       
    56 	                         "launchCalendarApp(QDateTime,int)",synchronousLaunch);
       
    57 	// Pass the arguments needed
       
    58 	request << dateTime;
       
    59 	request << ((int)view);
       
    60 	
       
    61 	int retValue;
       
    62 	bool res = request.send(retValue);
       
    63 	if (!res && synchronousLaunch) {
       
    64 		int error = request.latestError();
       
    65 		// Emit the signal with the error id to the caller
       
    66 		emit calendarLaunchFailed(error);
       
    67 	}
       
    68 	
       
    69 	if (!synchronousLaunch) {
       
    70 		// Connect to the signal for async request
       
    71 		connect(&request, SIGNAL(requestError(int)), this, SLOT(handleError(int)));
       
    72 	}
       
    73 }																			
       
    74 
       
    75 void CalenLauncher::handleError(int error)
       
    76 {
       
    77 	// emit the signal to the client
       
    78 	emit calendarLaunchFailed(error);
       
    79 }
       
    80 // End of file	--Don't remove this.