00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "CalRead.h"
00018
00019 CCalRead* CCalRead::NewL()
00020 {
00021 CCalRead* self = new (ELeave) CCalRead();
00022 CleanupStack::PushL(self);
00023 self->ConstructL();
00024 CleanupStack::Pop(self);
00025 return self;
00026 }
00027
00028 CCalRead::~CCalRead()
00029 {
00030 delete iCalView;
00031 delete iCalSes;
00032 }
00033
00034 void CCalRead::ConstructL()
00035 {
00036 iCalSes = CCalSession::NewL();
00037 const TDesC& name = iCalSes->DefaultFileNameL();
00038 TRAPD(error, iCalSes->CreateCalFileL(name));
00039 if (error != KErrAlreadyExists)
00040 {
00041 User::LeaveIfError(error);
00042 }
00043 iCalSes->OpenL(KNullDesC);
00044 iCalView = CCalEntryView::NewL(*iCalSes, *this);
00045 }
00046
00047
00048 CCalEntryView& CCalRead::CalView()
00049 {
00050 return *iCalView;
00051 }
00052
00053 CDesCArray* CCalRead::GetAttendeesL(TCalLocalUid aEventId)
00054 {
00055 CDesCArray* result = NULL;
00056
00057 CCalEntry* entry = iCalView->FetchL(aEventId);
00058
00059 if (NULL != entry)
00060 {
00061 CleanupStack::PushL(entry);
00062 RPointerArray<CCalAttendee>& list = entry->AttendeesL();
00063 if (list.Count() > 0)
00064 {
00065 result = new (ELeave) CDesCArrayFlat(list.Count());
00066 CleanupStack::PushL(result);
00067 for (TInt ii = 0 ; ii < list.Count() ; ++ii)
00068 {
00069 result->AppendL(list[ii]->Address());
00070 }
00071 CleanupStack::Pop(result);
00072 }
00073 CleanupStack::PopAndDestroy(entry);
00074 }
00075 return result;
00076 }
00077
00078