Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Archived:Calendar Importer Symbian API

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Article Metadata
Code ExampleCompatibility
Platform(s): S60 3rd Edition, FP2
S60 3rd Edition FP2
Article
Keywords: Calendar Importer API
Created: User:Technical writer 1 (13 Jun 2008)
Last edited: lpvalente (04 Oct 2012)


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

Contents

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

This page was last modified on 4 October 2012, at 14:15.
54 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×