calendarui/multicaluidialog/src/multicaluidialogmodel.cpp
branchRCL_3
changeset 13 0f07cd1b5772
parent 0 f979ecb2b13e
child 21 9711e452b5e9
equal deleted inserted replaced
12:38571fd2a704 13:0f07cd1b5772
    24 #include <calcalendariterator.h>
    24 #include <calcalendariterator.h>
    25 // user include.
    25 // user include.
    26 #include "multicaluidialogmodel.h"
    26 #include "multicaluidialogmodel.h"
    27 #include "calendarui_debug.h"
    27 #include "calendarui_debug.h"
    28 
    28 
       
    29 _LIT( KCalendarDatabaseFilePath, "c:calendar" );
       
    30 
    29 // ----------------------------------------------------------------------------
    31 // ----------------------------------------------------------------------------
    30 // CMultiCalUiDialogModel::CMultiCalUiDialogModel
    32 // CMultiCalUiDialogModel::CMultiCalUiDialogModel
    31 // Constructor
    33 // Constructor
    32 // ----------------------------------------------------------------------------
    34 // ----------------------------------------------------------------------------
    33 //
    35 //
   146 
   148 
   147     for (TInt index = 0; index < iCalendarInfoList.Count(); index++)
   149     for (TInt index = 0; index < iCalendarInfoList.Count(); index++)
   148         {
   150         {
   149         iCalendarStatus.Append(0);
   151         iCalendarStatus.Append(0);
   150 
   152 
   151         if (!index) //First create the default session
   153        /* if (!index) //First create the default session
   152             {
   154             {
   153             const TPtrC name = iCalendarInfoList[index]->FileNameL();
   155             const TPtrC name = iCalendarInfoList[index]->FileNameL();
   154             defaultSession->OpenL(name);
   156             defaultSession->OpenL(name);
   155             iCalSessionArray.Append(defaultSession);
   157             iCalSessionArray.Append(defaultSession);
   156             CCalEntryView* entryView = CCalEntryView::NewL(*defaultSession);
   158             CCalEntryView* entryView = CCalEntryView::NewL(*defaultSession);
   157             CleanupStack::PushL(entryView);
   159             CleanupStack::PushL(entryView);
   158             iCalEntryViewArray.Append(entryView);
   160             iCalEntryViewArray.Append(entryView);
   159             CleanupStack::Pop(entryView);
   161             CleanupStack::Pop(entryView);
   160             }
   162             }
   161         else
   163         else*/
   162             {
   164             {
   163             CCalSession* session = CCalSession::NewL(*defaultSession);
   165             CCalSession* session = CCalSession::NewL(*defaultSession);
   164             CleanupStack::PushL(session);
   166             CleanupStack::PushL(session);
   165             const TPtrC name = iCalendarInfoList[index]->FileNameL();
   167             const TPtrC name = iCalendarInfoList[index]->FileNameL();
   166             session->OpenL(name);
   168             session->OpenL(name);
   232 void CMultiCalUiDialogModel::StoreCalEntryL()
   234 void CMultiCalUiDialogModel::StoreCalEntryL()
   233     {
   235     {
   234     TRACE_ENTRY_POINT
   236     TRACE_ENTRY_POINT
   235     //Create copy for entires.
   237     //Create copy for entires.
   236     RPointerArray<CCalEntry> copyEntries;
   238     RPointerArray<CCalEntry> copyEntries;
   237     CreateCopyL(copyEntries);
       
   238 
       
   239     //Store the copy into calendars
   239     //Store the copy into calendars
   240     for (TInt i = 0; i < iCalEntryViewArray.Count(); i++)
   240     for (TInt i = 0; i < iCalEntryViewArray.Count(); i++)
   241         {
   241         {
   242         if (iCalendarStatus[i])
   242         if (iCalendarStatus[i])
   243             {
   243             {
   244             TInt numSuccess;
   244             TInt numSuccess;            
       
   245             CreateCopyL(copyEntries);
   245             iCalEntryViewArray[i]->StoreL(copyEntries, numSuccess);
   246             iCalEntryViewArray[i]->StoreL(copyEntries, numSuccess);
       
   247             copyEntries.ResetAndDestroy();
   246             }
   248             }
   247         }
   249         }
   248 
   250 
   249     copyEntries.ResetAndDestroy();
   251     
   250     TRACE_EXIT_POINT;
   252     TRACE_EXIT_POINT;
   251     }
   253     }
   252 
   254 
   253 // ----------------------------------------------------------------------------
   255 // ----------------------------------------------------------------------------
   254 // CMultiCalUiDialogModel::CreateCopyL
   256 // CMultiCalUiDialogModel::CreateCopyL
   303             *iCalendarsSession);
   305             *iCalendarsSession);
   304     CleanupStack::PushL(calIter);
   306     CleanupStack::PushL(calIter);
   305     CCalCalendarInfo* calendarInfo = calIter->FirstL();
   307     CCalCalendarInfo* calendarInfo = calIter->FirstL();
   306     while (calendarInfo)
   308     while (calendarInfo)
   307         {
   309         {
   308         aCalendarInfoList.AppendL(calendarInfo);
   310         TPtrC fileNamePtr = calendarInfo->FileNameL();
       
   311         if(fileNamePtr.CompareF(KCalendarDatabaseFilePath))
       
   312            {
       
   313            aCalendarInfoList.AppendL(calendarInfo);
       
   314            }
       
   315         else
       
   316            {
       
   317            delete calendarInfo;
       
   318            }
   309         calendarInfo = calIter->NextL();
   319         calendarInfo = calIter->NextL();
   310         }
   320         }
   311     CleanupStack::PopAndDestroy(calIter);
   321     CleanupStack::PopAndDestroy(calIter);
   312 
   322 
   313     TRACE_EXIT_POINT;
   323     TRACE_EXIT_POINT;