|
1 /* |
|
2 * Copyright (c) 2002 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: The model part of preview. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CALENPREVIEWDATA_H |
|
20 #define CALENPREVIEWDATA_H |
|
21 |
|
22 #include "CalendarVariant.hrh" |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 #include <AknUtils.h> |
|
27 #include <calentry.h> // for CCalEntry::TType |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CCalInstance; |
|
31 class CCalenDocument; |
|
32 class CCalenPreviewEntry; |
|
33 class CCalenCommonUI; |
|
34 class CCalenGlobalData; |
|
35 class CCalenPreviewLayoutManager; |
|
36 class MCalenServices; |
|
37 class CCalCalendarInfo; |
|
38 |
|
39 // LOCAL CONSTANTS AND MACROS |
|
40 const TInt KPopupMaxEntries = 4; |
|
41 |
|
42 // CLASS DECLARATION |
|
43 /** |
|
44 * CCalenPreviewData stores and handles construction of preview data |
|
45 * @lib Calendar.exe |
|
46 * @since 5.0 |
|
47 */ |
|
48 NONSHARABLE_CLASS( CCalenPreviewData ) : public CBase |
|
49 { |
|
50 public: // Constructors and destructor |
|
51 |
|
52 /** |
|
53 * Two-phased constructor. |
|
54 */ |
|
55 static CCalenPreviewData* NewL(CCalenPreviewLayoutManager *aLayoutManager, |
|
56 MCalenServices& aServices, |
|
57 TInt aMaxInstances, |
|
58 TTime aFocusedTime); |
|
59 static CCalenPreviewData* NewL(CCalenPreviewLayoutManager *aLayoutManager, |
|
60 MCalenServices& aServices, |
|
61 TInt aMaxInstances, |
|
62 CCalInstance* aInstance); |
|
63 |
|
64 /** |
|
65 * Destructor. |
|
66 */ |
|
67 virtual ~CCalenPreviewData(); |
|
68 |
|
69 public: |
|
70 TInt InstanceCount() const; |
|
71 TInt EntryCount() const; |
|
72 |
|
73 CCalInstance* Instance(TInt aIndex); |
|
74 CCalenPreviewEntry* Entry(TInt aIndex); |
|
75 |
|
76 void ProcessMonthInstancesL(const TTime aRangeStart, |
|
77 const TBool aIsToday); |
|
78 void ProcessWeekInstancesL(const TTime aStart, |
|
79 const TTime aEnd); |
|
80 |
|
81 TBool NotShownEntries() const; |
|
82 |
|
83 void CreateEntriesL(const TTime& aDay); |
|
84 |
|
85 void SetToday(TBool aToday); |
|
86 TBool Today(); |
|
87 |
|
88 void SetTimedRangeL(const TTime acurrent, const TInt aRange); |
|
89 |
|
90 /* |
|
91 * @brief Find calendarinfo object based on calendar name |
|
92 * |
|
93 * @param aName calendar filename |
|
94 * @param aCalendarInfo referance for calendarinfo |
|
95 * @return TBool find status |
|
96 */ |
|
97 static TBool CalendarInfoIdentifierL(const HBufC* aName, |
|
98 const CCalCalendarInfo& aCalendarInfo); |
|
99 |
|
100 void DeleteInstances(); |
|
101 |
|
102 |
|
103 private: |
|
104 /** |
|
105 * C++ default constructor. |
|
106 */ |
|
107 CCalenPreviewData(CCalenPreviewLayoutManager *aLayoutManager, |
|
108 MCalenServices& aServices, |
|
109 TInt aMaxInstances); |
|
110 /** |
|
111 * By default Symbian 2nd phase constructor is private. |
|
112 */ |
|
113 void ConstructL(const TTime& aDay); |
|
114 |
|
115 void RemoveInstancesL(const CCalEntry::TType aType); |
|
116 void RemoveInstances(); |
|
117 void RemoveInstance(TInt aIndex); |
|
118 void PrioritizeTodosL(); |
|
119 |
|
120 void FindInstancesL(const TTime& aDay); |
|
121 void RemoveLine(const CCalEntry::TType aType, |
|
122 TInt& aRowsUsed, TInt aRows); |
|
123 |
|
124 void RemoveMeetingLineL(TInt& aRowsUsed, TInt aRows); |
|
125 |
|
126 static TInt TodoPrioCompare(const CCalInstance& aInstance_1, const CCalInstance& aInstance_2); |
|
127 static TInt DoTodoPrioCompareL(const CCalEntry& aEntry_1, const CCalEntry& aEntry_2); |
|
128 |
|
129 private: // Data |
|
130 CCalenPreviewLayoutManager *iLayoutManager; |
|
131 RPointerArray<CCalInstance> iInstances; |
|
132 RPointerArray<CCalenPreviewEntry> iEntries; |
|
133 TBool iNotShownEntries; |
|
134 TBool iSingleInstance; |
|
135 TBool iToday; |
|
136 TInt iRange; |
|
137 TTime iCurrent; |
|
138 TInt iMaxInstances; |
|
139 RPointerArray<CCalInstance> iTodoPriorityOrder; |
|
140 MCalenServices& iServices; |
|
141 }; |
|
142 |
|
143 #endif // CALENPREVIEWDATA_H |
|
144 |
|
145 |
|
146 // End of File |