creator/inc/creator_calendar.h
changeset 0 d6fe6244b863
child 11 4df3a095718c
equal deleted inserted replaced
-1:000000000000 0:d6fe6244b863
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __CREATORCALENDARINTERIM_H__
       
    22 #define __CREATORCALENDARINTERIM_H__
       
    23 
       
    24 #include "creator_model.h"
       
    25 #include "creator_modulebase.h"
       
    26 #include "creator_calendarbase.h"
       
    27 
       
    28 #include <e32base.h>
       
    29 #include <e32std.h>
       
    30 
       
    31 //#include <calenlauncher.h> 
       
    32 #include <calentry.h>
       
    33 #include <calentryview.h>
       
    34 #include <caltime.h>
       
    35 #include <calsession.h>
       
    36 #include <calprogresscallback.h>
       
    37 #include <calcategory.h>
       
    38 #include <caluser.h>
       
    39 #include <calrrule.h>
       
    40 #if(!defined __SERIES60_30__ && !defined __SERIES60_31__)
       
    41 #include <MVPbkSingleContactOperationObserver.h>
       
    42 #include <MVPbkContactStoreListObserver.h>
       
    43 #include <MVPbkContactFindObserver.h>
       
    44 class CVPbkContactManager;
       
    45 #endif
       
    46 
       
    47 class CCreatorEngine;
       
    48 class CCalenderInterimParameters;
       
    49 class CAsyncWaiter;
       
    50 
       
    51 #if(!defined __SERIES60_30__ && !defined __SERIES60_31__)
       
    52 class CCreatorInterimCalendar : public CCreatorCalendarBase, public MCalProgressCallBack, 
       
    53 public MVPbkSingleContactOperationObserver, public MVPbkContactStoreListObserver, public MVPbkContactFindObserver
       
    54 #else
       
    55 class CCreatorInterimCalendar : public CCreatorCalendarBase, public MCalProgressCallBack
       
    56 #endif
       
    57     {
       
    58 public: 
       
    59     static CCreatorInterimCalendar* NewL(CCreatorEngine* aEngine);
       
    60     static CCreatorInterimCalendar* NewLC(CCreatorEngine* aEngine);
       
    61     ~CCreatorInterimCalendar();
       
    62 
       
    63 private:
       
    64     CCreatorInterimCalendar();
       
    65     void ConstructL(CCreatorEngine* aEngine); // from MCreatorModuleBase
       
    66     void AddRepeatingRuleL(const TCalTime& aStartTime, CCalEntry& aCalEntry, CCalenderInterimParameters* parameters=0);
       
    67     void SetRandomAlarmL(CCalEntry& aCalEntry);
       
    68     void SetAlarmL(CCalEntry& aCalEntry, CCalenderInterimParameters* params);
       
    69     void AddAttendeesL(CCalEntry& aCalEntry, CCalenderInterimParameters* parameters=0);
       
    70     void SetPhoneOwnerL(CCalEntry& aCalEntry, const TDesC& aCN, const TDesC& aEmail, const TDesC& aSentBy );
       
    71     void SetOrganizerL(CCalEntry& aCalEntry, const TDesC& aCN, const TDesC& aEmail, const TDesC& aSentBy);
       
    72     void SetOrganizerL(CCalEntry& aCalEntry, CCalenderInterimParameters* parameters );
       
    73     
       
    74 public:
       
    75     TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase
       
    76 
       
    77     TInt CreateAppointmentEntryL(CCreatorModuleBaseParameters *aParameters);    
       
    78     TInt CreateEventEntryL(CCreatorModuleBaseParameters *aParameters);
       
    79     TInt CreateAnniversaryEntryL(CCreatorModuleBaseParameters *aParameters); 
       
    80     TInt CreateTodoEntryL(CCreatorModuleBaseParameters *aParameters);
       
    81     TInt CreateReminderEntryL(CCreatorModuleBaseParameters *aParameters);
       
    82     
       
    83     void GenerateRandomId(TDes8& aText);
       
    84     void DeleteAllL();
       
    85     void DeleteAllCreatedByCreatorL();
       
    86     
       
    87 public:
       
    88 #if(!defined __SERIES60_30__ && !defined __SERIES60_31__)
       
    89     // From MVPbkSingleContactOperationObserver:
       
    90     virtual void VPbkSingleContactOperationComplete(
       
    91             MVPbkContactOperationBase& aOperation,
       
    92             MVPbkStoreContact* aContact );
       
    93     
       
    94     virtual void VPbkSingleContactOperationFailed(
       
    95             MVPbkContactOperationBase& aOperation, 
       
    96             TInt aError );
       
    97     
       
    98     // From MVPbkContactStoreListObserver
       
    99     virtual void OpenComplete();
       
   100     virtual void StoreReady(MVPbkContactStore&);
       
   101     virtual void StoreUnavailable(MVPbkContactStore&, TInt);
       
   102     virtual void HandleStoreEventL(MVPbkContactStore&, TVPbkContactStoreEvent);
       
   103     
       
   104     // From MVPbkContactFindObserver
       
   105     virtual void FindCompleteL( MVPbkContactLinkArray* aResults );
       
   106     virtual void FindFailed( TInt aError );
       
   107     void HandleSingleContactResultL();
       
   108 #endif
       
   109 
       
   110 private:
       
   111 
       
   112     CCalenderInterimParameters* iParameters;
       
   113     TTime   iRandomModeStartTime;
       
   114     TTime   iRandomModeEndTime;
       
   115     TInt    iNumberRepeatingEntries;
       
   116     TInt    iNumberOfAttendees;
       
   117     CCalEntryView* 		iCalEntryView;
       
   118     CCalSession* 		iCalSession;
       
   119     TBool iSetAlarm;
       
   120     CDesCArrayFlat* iSoundFileArray;
       
   121     CAsyncWaiter* iWaiter;
       
   122     HBufC* iTmpCN;
       
   123     HBufC* iTmpEmail;
       
   124     RArray<TUint32> iEntryIds; // TCalLocalUid ( == TUint32 ) CCalEntry::LocalUidL
       
   125     
       
   126 #if(!defined __SERIES60_30__ && !defined __SERIES60_31__)
       
   127     CVPbkContactManager* iContactManager;
       
   128     MVPbkContactLinkArray* iExistingContacts;
       
   129     MVPbkStoreContact* iTempContact;
       
   130 #endif
       
   131 public:
       
   132 
       
   133     //Observer implementation for MCalProgressCallBack
       
   134 	void Progress(TInt aPercentageCompleted);
       
   135 	
       
   136 	void Completed(TInt aError);
       
   137 	
       
   138 	TBool NotifyProgress();
       
   139 
       
   140     };
       
   141 
       
   142 class CCreatorCalenderAttendee : public CBase
       
   143 {
       
   144 public:
       
   145     virtual ~CCreatorCalenderAttendee();
       
   146     static CCreatorCalenderAttendee* NewL();
       
   147     void SetCommonNameL(const TDesC& aName);
       
   148     void SetEmailAddressL(const TDesC& aEmail);
       
   149     void SetRole(CCalAttendee::TCalRole aRole);
       
   150     void SetStatus(CCalAttendee::TCalStatus);
       
   151     
       
   152     const TDesC& CommonName() const;
       
   153     const TDesC& EmailAddress() const;
       
   154     CCalAttendee::TCalRole Role() const;
       
   155     CCalAttendee::TCalStatus Status() const;
       
   156     
       
   157 private:
       
   158     CCreatorCalenderAttendee();
       
   159     TPtrC  iDummy;
       
   160     HBufC* iCommonName;
       
   161     HBufC* iEmailAddress;
       
   162     CCalAttendee::TCalRole iRole;
       
   163     CCalAttendee::TCalStatus iStatus;
       
   164 };
       
   165 
       
   166 class CCalenderInterimParameters : public CCreatorModuleBaseParameters
       
   167     {
       
   168 public:
       
   169 
       
   170 	void ParseL(CCommandParser* parser, TParseParams aCase);
       
   171 	TBool IsAllowedEntryStatus(CCalEntry::TType aType, CCalEntry::TStatus aStatus);
       
   172 
       
   173 	TCalRRule::TType iRecurrentFrequency;
       
   174 	TInt iRecurrentInterval;
       
   175 	TTime iRecurrentStartTime;
       
   176 	TTime iRecurrentEndTime;
       
   177 	TInt iRepeatingCount; // This is used when running a script...
       
   178 	TTime iAlarmTime; // NullTTime means no alarm
       
   179 	TBool iUseRandomAlarmTime; // ETrue if random alarm should be set. Overwrites the iAlarmTime.
       
   180 	
       
   181 	RPointerArray<CCreatorCalenderAttendee> iAttendees;
       
   182 	RArray<TLinkIdParam> iAttendeeLinkIds; // For attendees. Stores the linked contact ids.
       
   183 	HBufC* iOrganizerName;
       
   184 	HBufC* iOrganizerEmail;
       
   185 		 
       
   186 	HBufC*  iDescription;
       
   187 	HBufC*  iSummary;
       
   188 	HBufC*  iLocation;
       
   189 	TTime   iStartTime;
       
   190 	TTime   iEndTime;
       
   191 	TInt    iNumberRepeatingEntries; // This is used when user input is used...
       
   192 	TInt    iNumberOfAttendees; // Number of randomly generated attendees
       
   193 	TInt    iNumberOfExistingAttendees; // Number of attendees selected from existing contacts.
       
   194 	
       
   195 	//An appointment, which has a start time and end time.
       
   196     TTime   iAppointmentStartTime;
       
   197     TTime   iAppointmentEndTime;
       
   198     HBufC*  iAppointmentLocation;
       
   199     HBufC*  iAppointmentReason;
       
   200 
       
   201     //An event, which has a start time and end time.
       
   202     
       
   203     TTime   iEventStartTime;
       
   204     TTime   iEventEndTime;
       
   205     HBufC*  iEventReason;
       
   206 
       
   207     //A reminder, which has a start time only.
       
   208     TTime   iReminderStartTime;
       
   209     HBufC*  iReminderReason;
       
   210     
       
   211     //An anniversary, which has a start time and end time.
       
   212     TTime   iAnniversaryStartTime;
       
   213     TTime   iAnniversaryEndTime;
       
   214     HBufC*  iAnniversaryReason;
       
   215 
       
   216     //A to-do, which can have a start time and end time (the end time is the due date), or can be undated.
       
   217     TTime   iTodoStartTime;//optional
       
   218     TTime   iTodoDueTime;//also end time (optional)
       
   219     HBufC*  iTodoTask;
       
   220     TInt    iTodoPriority;
       
   221 
       
   222     TTime   iRandomModeStartTime;
       
   223     TTime   iRandomModeEndTime;
       
   224     
       
   225     CCalEntry::TStatus iStatus;
       
   226     
       
   227 public:
       
   228 	CCalenderInterimParameters();
       
   229     ~CCalenderInterimParameters();   
       
   230     
       
   231     };
       
   232 
       
   233 
       
   234 
       
   235 #endif // __CREATORCALENDARINTERIM_H__