You Are Here:

Community: Wiki

This page was last modified on 13 October 2008, at 19:42.

CS001027 - Calendar Importer API

From Forum Nokia Wiki



ID CS001027 Creation date June 13, 2008
Platform S60 3rd Edition, FP2 Tested on devices
Category Symbian C++ Subcategory Calendar


Keywords (APIs, classes, methods, functions): Calendar Importer API


Note!
This API is not part of the public SDK. It can be found in the SDK API Plug-in.


Purpose

The Calendar Importer API provides a class that imports a vCalendar into a CCalEntry compatible with the S60 Calendar.

Header files

#include <calsession.h>
#include <calprogresscallback.h>
#include <calentryview.h>
#include <calenimporter.h>
#include <f32file.h>
#include <S32FILE.H>
#include <agnimportobserver.h>

Libraries

efsrv.lib 
calinterimapi.lib
calenimp.lib
estor.lib

Code example

The CCalSession is the interface to the Calendar file. The instantiation of CCalSession will result in a connection to the Calendar Server.

void CCalendarEventsEngine::ConstructL()
{
iCalSession = CCalSession::NewL();
//Open the default calendar file
iCalSession->OpenL(iCalSession->DefaultFileNameL());
iWaiter =new (ELeave) CActiveSchedulerWait;
// calender importer
iImporter=CCalenImporter::NewL(*iCalSession);
}

Virtual functions

// Called during calendar entry view creation
void CCalendarEventsEngine::Progress(TInt aProgress)
{
}
 
// Called on completion of calendar entry view creation
void CCalendarEventsEngine::Completed(TInt aError)
{
iWaiter->AsyncStop();
}
 
// Returns whether or not progress notification is required
TBool CCalendarEventsEngine::NotifyProgress()
{
// Progress notification is required
return ETrue;
}

Importing calender entries from a file:

void CCalendarEventsEngine::ImportEntriesL()
{
// calender entries file
_LIT(KFile,"C:\\CalEntriesFile.txt");
User::LeaveIfError(iFs.Connect());
TInt err = iRReadStream.Open(iFs,KFile,EFileRead);
// An array of calender entries
RPointerArray<CCalEntry> calEntryArray;
iImporter->ImportVCalendarL(iRReadStream,calEntryArray);
for (TInt k=0; k<calEntryArray.Count();k++)
{
// get information from this entry
CCalEntry* calEntry = calEntryArray[k];
TPtrC description = calEntry->SummaryL();
if(iWaiter->IsStarted())
{
iWaiter->AsyncStop();
}
// View class for accessing calendar entries
iCalEntryView = CCalEntryView::NewL(*iCalSession,*this);
iWaiter->Start();
TInt success(0);
iCalEntryView->StoreL(calEntryArray, success);
delete iCalEntryView;
}
calEntryArray.ResetAndDestroy();
iRReadStream.Close();
iFs.Close();
}

Example application

The following sample application has been tested in the S60 3rd FP2 emulator. File:CalenderImpportExport.zip

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fTalkE3aE4cargeE5fscreenE5fsaverX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqfntypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZtypeQUqfntypeZWikiContentQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqfntypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ