|
1 /* |
|
2 * Copyright (c) 2005-2006 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 #ifndef C_AICALENDARPLUGIN2_H |
|
20 #define C_AICALENDARPLUGIN2_H |
|
21 |
|
22 #include <AknsDrawUtils.h> |
|
23 #include <AknUtils.h> |
|
24 #include <aicontentpublisher.h> |
|
25 #include <aipropertyextension.h> |
|
26 #include <aieventhandlerextension.h> |
|
27 #include "PluginDataChangeObserver.h" |
|
28 |
|
29 class CAIAgendaPluginEngineIf; |
|
30 class CAICalendarPlugin2ConstantData; |
|
31 class CAICalendarPlugin2Data; |
|
32 class CAiCalendarPlugin2EventItem; |
|
33 class MAiStrParser; |
|
34 |
|
35 |
|
36 /** |
|
37 * Active Idle Calendar plug-in 2. |
|
38 * Main class of Active Idle's Calenda plug-in 2 implementation. |
|
39 * |
|
40 * @lib aicalendarplugin2 |
|
41 * @since S60 3.2 |
|
42 */ |
|
43 NONSHARABLE_CLASS( CAICalendarPlugin2 ): public CAiContentPublisher, |
|
44 public MAiPropertyExtension, |
|
45 public MAiEventHandlerExtension, |
|
46 public MPluginDataChangeObserver |
|
47 { |
|
48 public: |
|
49 |
|
50 // Construction |
|
51 |
|
52 static CAICalendarPlugin2* NewL(); |
|
53 |
|
54 ~CAICalendarPlugin2(); |
|
55 |
|
56 // From CAiContentPublisher |
|
57 |
|
58 void Resume( TAiTransitionReason aReason ); |
|
59 |
|
60 void Suspend( TAiTransitionReason aReason ); |
|
61 |
|
62 void Stop( TAiTransitionReason aReason ); |
|
63 |
|
64 void SubscribeL( MAiContentObserver& aObserver ); |
|
65 |
|
66 void ConfigureL( RAiSettingsItemArray& aSettings ); |
|
67 |
|
68 TAny* Extension( TUid aUid ); |
|
69 |
|
70 // from MAiPropertyExtension |
|
71 |
|
72 TAny* GetPropertyL( TInt aProperty ); |
|
73 |
|
74 void SetPropertyL( TInt aProperty, TAny* aValue ); |
|
75 |
|
76 // from MAiEventHandlerExtension |
|
77 |
|
78 void HandleEvent( TInt aEvent, const TDesC& aParam ); |
|
79 |
|
80 // From MPluginDataChangeObserver |
|
81 |
|
82 void PluginDataChanged( const RPointerArray<CCalInstance>& aEntryArray, |
|
83 TBool aHadEvents ); |
|
84 |
|
85 private: |
|
86 |
|
87 // Construction |
|
88 |
|
89 CAICalendarPlugin2(); |
|
90 |
|
91 void ConstructL(); |
|
92 |
|
93 // New methods |
|
94 |
|
95 void DoResumeL( TAiTransitionReason aReason ); |
|
96 |
|
97 void CreateIconsL(); |
|
98 |
|
99 void CreateBitmapSkinnedIconL( const TAknsItemID& aSkinIconId, |
|
100 const TDesC& aFilename, |
|
101 const TInt aNormalIconId, |
|
102 const TInt aNormalMaskId, |
|
103 CFbsBitmap*& aBitmap, |
|
104 CFbsBitmap*& aMask ); |
|
105 |
|
106 void FillDataArraysL( const RPointerArray<CCalInstance>& aEntryArray ); |
|
107 |
|
108 void PublishDataArraysL(); |
|
109 |
|
110 void PublishTodayTimedItemsForArrayL( |
|
111 RPointerArray<CAiCalendarPlugin2EventItem>& aArray, |
|
112 TInt& aPublishIndex, |
|
113 TInt& aLineUsage, |
|
114 TInt aMaxLinesAvailable, |
|
115 TInt aArrayOffset = 0, |
|
116 TInt aExtraLineReservation = 0 ); |
|
117 |
|
118 void CleanAll( TInt aIndex ); |
|
119 |
|
120 void CleanTimeRelated( TInt aIndex ); |
|
121 |
|
122 void CleanTexts( TInt aIndex ); |
|
123 |
|
124 void CleanIcon( TInt aIndex ); |
|
125 |
|
126 void Clean( TInt aItem, TInt aIndex ); |
|
127 |
|
128 void CleanInfo(); |
|
129 |
|
130 void PublishTimedEventTexts( CAiCalendarPlugin2EventItem& aData, |
|
131 TInt aIndex, |
|
132 TInt& aLineUsage ); |
|
133 |
|
134 void PublishNonTimedEventTexts( CAiCalendarPlugin2EventItem& aData, |
|
135 TInt aIndex ); |
|
136 |
|
137 void PublishTimeRelatedTexts( CAiCalendarPlugin2EventItem& aData, |
|
138 TInt aIndex, |
|
139 TInt& aLineUsage ); |
|
140 |
|
141 void PublishFutureItemsForArrayL( |
|
142 RPointerArray<CAiCalendarPlugin2EventItem>& aArray, |
|
143 TInt& aPublishIndex, |
|
144 TInt& aLineUsage, |
|
145 TInt aMaxLinesAvailable ); |
|
146 |
|
147 void PublishIconL( const TInt aIconId, TInt aIndex ); |
|
148 |
|
149 void PublishIconL( const TInt aIconId, TInt aIndex, TInt aDestination ); |
|
150 |
|
151 |
|
152 TBool CompareChecksums( TInt aChecksumIndex, |
|
153 TInt aItemChecksum, |
|
154 TBool aIsIcon = EFalse ); |
|
155 |
|
156 private: // Data members |
|
157 |
|
158 RPointerArray<CFbsBitmap> iBitmaps; |
|
159 RPointerArray<CFbsBitmap> iMasks; |
|
160 |
|
161 /** |
|
162 * Constant data container class. |
|
163 * Own. |
|
164 */ |
|
165 CAICalendarPlugin2ConstantData* iConstantData; |
|
166 |
|
167 /** |
|
168 * Calendar event data container class. |
|
169 * Own. |
|
170 */ |
|
171 CAICalendarPlugin2Data* iEventData; |
|
172 |
|
173 /** |
|
174 * Agenda plugin engine. |
|
175 * Own. |
|
176 */ |
|
177 CAIAgendaPluginEngineIf* iEngine; |
|
178 |
|
179 /** |
|
180 * Lines in use for AI Calendar plugin 2 content. |
|
181 */ |
|
182 TInt iActualLinesInUse; |
|
183 |
|
184 /** |
|
185 * Number of lines fixed for non timed events. |
|
186 */ |
|
187 TInt iNonTimedItemReservation; |
|
188 |
|
189 /* |
|
190 * Current content observer. |
|
191 * Not owned. |
|
192 */ |
|
193 MAiContentObserver* iCurrentObserver; |
|
194 |
|
195 /** |
|
196 * String parser utility. |
|
197 * Owned. |
|
198 */ |
|
199 MAiStrParser* iStrParser; |
|
200 |
|
201 /** |
|
202 * Resource file offset for calendar resource. |
|
203 */ |
|
204 TInt iCalendarResourceFileOffset; |
|
205 |
|
206 /** |
|
207 * Resource file offset for calendar resource. |
|
208 */ |
|
209 TInt iTextResourceFileOffset; |
|
210 |
|
211 /** |
|
212 * Plugin icon filename. |
|
213 * Owned. |
|
214 */ |
|
215 HBufC* iPluginIconFileName; |
|
216 |
|
217 /** |
|
218 * Calendar icon filename. |
|
219 * Owned. |
|
220 */ |
|
221 HBufC* iCalendarIconFileName; |
|
222 |
|
223 |
|
224 /** |
|
225 * Store data checksums, to prevent publishing same data. |
|
226 */ |
|
227 RArray<TInt> iPublishedDataStore; |
|
228 |
|
229 /** |
|
230 * Store data checksums, to prevent publishing same data. |
|
231 */ |
|
232 RArray<TInt> iNewCollectedDataStore; |
|
233 |
|
234 /** |
|
235 * Calendar eventItem UID. |
|
236 */ |
|
237 HBufC8* iPrevUid; |
|
238 }; |
|
239 |
|
240 #endif // C_AICALENDARPLUGIN2_H |
|
241 |
|
242 |
|
243 // End of File |