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 = CCalInstanceView::NewL(*iCalSes, *this);
00045 }
00046
00047 CCalInstanceView& CCalRead::CalView()
00048 {
00049 return *iCalView;
00050 }
00051
00052 TBool CCalRead::CheckFreeL(TTime aStartUtc, TTimeIntervalMinutes aSlot)
00053 {
00054 TBool result = ETrue;
00055 TCalTime start;
00056 TCalTime end;
00057 start.SetTimeUtcL(aStartUtc);
00058 TTime endUtc = aStartUtc + aSlot;
00059 end.SetTimeUtcL(endUtc);
00060 CalCommon::TCalTimeRange range(start, end);
00061 RPointerArray<CCalInstance> array;
00062 CleanupResetAndDestroyPushL(array);
00063 iCalView->FindInstanceL(array, CalCommon::EIncludeAll, range);
00064 if (array.Count() > 0)
00065 {
00066 result = EFalse;
00067 }
00068 CleanupStack::PopAndDestroy(&array);
00069 return result;
00070 }
00071
00072
00073