|
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: For Event view container of calendar application. |
|
15 * The class derived from CCalenContainer |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef CALENEVENTVIEWCONTAINER_H |
|
21 #define CALENEVENTVIEWCONTAINER_H |
|
22 |
|
23 // system includes |
|
24 |
|
25 // user includes |
|
26 #include "calenentryutil.h" |
|
27 #include "calencontainer.h" |
|
28 #include <eikmenup.h> |
|
29 #include <cenrepnotifyhandler.h> |
|
30 #include <AknServerApp.h> |
|
31 // forward declarations |
|
32 class CEikRichTextEditor; |
|
33 class CCalenEntryUtil; |
|
34 class CCalenIconDrawer; |
|
35 class CItemFinder; |
|
36 class CRepository; |
|
37 class CCenRepNotifyHandler; |
|
38 class CFindItemMenu; |
|
39 class CCalCalendarInfo; |
|
40 class CCalenIconDrawer; |
|
41 class CDocumentHandler; |
|
42 |
|
43 // class declaration |
|
44 /** |
|
45 * CCalenEventContainer container control class for EventView. |
|
46 */ |
|
47 NONSHARABLE_CLASS(CCalenEventViewContainer):public CCalenContainer, |
|
48 public MCenRepNotifyHandlerCallback, |
|
49 public MEikScrollBarObserver, |
|
50 public MAknServerAppExitObserver |
|
51 { |
|
52 public: |
|
53 /** |
|
54 * C++ constructor. |
|
55 */ |
|
56 CCalenEventViewContainer( CCalenNativeView* aView, |
|
57 MCalenServices& aServices ); |
|
58 |
|
59 /** |
|
60 * Destructor. |
|
61 */ |
|
62 virtual ~CCalenEventViewContainer(); |
|
63 |
|
64 private: // Functions from base classes |
|
65 /** |
|
66 * From CCoeControl, child control was resized. |
|
67 */ |
|
68 void SizeChanged(); |
|
69 |
|
70 /** |
|
71 * From CCoeControl, return child control count. |
|
72 * @return Control count |
|
73 */ |
|
74 TInt CountComponentControls() const; |
|
75 |
|
76 /** |
|
77 * From CCoeControl, return child control pointer. |
|
78 * @param aIndex Child control index |
|
79 * @return Child control pointer. |
|
80 */ |
|
81 CCoeControl* ComponentControl(TInt aIndex) const; |
|
82 |
|
83 /** |
|
84 * From CCoeControl, process key event. |
|
85 * @param aKeyEvent The key event. |
|
86 * @param aType EEventKey | EEventKeyUp | EEventKeyDown. |
|
87 * @return EKeyWasNotConsumed : Key event was not consumed. |
|
88 */ |
|
89 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, |
|
90 TEventCode aType); |
|
91 |
|
92 /** |
|
93 * From CCoeControl, process pointer event. |
|
94 */ |
|
95 void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
96 |
|
97 /** |
|
98 * From CCoeControl |
|
99 */ |
|
100 void Draw(const TRect& /*aRect*/) const; |
|
101 |
|
102 /** |
|
103 * Pass skin information if needed |
|
104 */ |
|
105 TTypeUid::Ptr MopSupplyObject(TTypeUid aId); |
|
106 |
|
107 /** |
|
108 * From CCoeControl, Get help context. |
|
109 * @param aContext Help context |
|
110 */ |
|
111 void GetHelpContext(TCoeHelpContext& aContext) const; |
|
112 |
|
113 /** |
|
114 * From MActiveStep, refresh EventView data. |
|
115 */ |
|
116 TInt DoStepL(); |
|
117 |
|
118 /** |
|
119 * From CCoeControl Handles a resource relative event. |
|
120 * |
|
121 * @param aType The type of change that occured. |
|
122 */ |
|
123 void HandleResourceChange(TInt aType); |
|
124 |
|
125 |
|
126 private: // From CCalenContainer |
|
127 /** |
|
128 * From CCalenContainer Third phase constructor. |
|
129 * This function was called CCalenView::ConstructL(). |
|
130 */ |
|
131 void ConstructImplL(); |
|
132 |
|
133 /** |
|
134 * From CCalenContainer. |
|
135 * This methods is called after calendar settings have changed. |
|
136 */ |
|
137 void UpdateSize(); |
|
138 |
|
139 /** |
|
140 * Create icon index |
|
141 */ |
|
142 void CreateIconIndicesL( RArray<MCalenServices::TCalenIcons>& aIndexArray ); |
|
143 |
|
144 |
|
145 /** |
|
146 * This method is called after pointer event in Navi |
|
147 * decoration object. |
|
148 * @param aDirection right or left |
|
149 */ |
|
150 void HandleNaviDecoratorEventL(TInt aEventID); |
|
151 |
|
152 void HandleLongTapEventL( const TPoint& aPenEventLocation, |
|
153 const TPoint& aPenEventScreenLocation ); |
|
154 |
|
155 |
|
156 public: // from MAknServerAppExitObserver |
|
157 |
|
158 /** |
|
159 * Handle the exit of a connected server app. |
|
160 * This implementation provides S60 default behavior |
|
161 * for handling of the EAknCmdExit exit code. Derived classes |
|
162 * should base-call this implementation if they override this |
|
163 * function. |
|
164 * |
|
165 * @since S60 5.0 |
|
166 * |
|
167 * @param aReason The reason that the server application exited. |
|
168 * This will either be an error code, or the command id that caused |
|
169 * the server app to exit. |
|
170 */ |
|
171 void HandleServerAppExit( TInt aReason ); |
|
172 |
|
173 |
|
174 void HandleLocaleChangedL(/* TInt aReason */); |
|
175 |
|
176 public: // New methods |
|
177 |
|
178 CCalInstance* FindPossibleInstanceL(const TCalenInstanceId& aId, |
|
179 CCalInstanceView& aInstanceView ); |
|
180 |
|
181 /** |
|
182 * Build text editor |
|
183 */ |
|
184 void BuildTextEditorL(); |
|
185 |
|
186 /** |
|
187 * Request for instance view |
|
188 */ |
|
189 TInt RequestInstanceViewL(); |
|
190 |
|
191 /** |
|
192 * Add the data fields |
|
193 */ |
|
194 void AddFieldsL(); |
|
195 |
|
196 /** |
|
197 * Complete population |
|
198 */ |
|
199 void CompletePopulationL(); |
|
200 |
|
201 /** |
|
202 * Getter for titlepane |
|
203 */ |
|
204 TInt GetTitleTextId(); |
|
205 |
|
206 /** |
|
207 * Getter for event view data |
|
208 */ |
|
209 CCalenEntryUtil* GetEventViewData(); |
|
210 |
|
211 /** |
|
212 * Complete a todo entry |
|
213 */ |
|
214 void OnCmdCompleteTaskL(); |
|
215 |
|
216 /** |
|
217 * Restore a todo entry |
|
218 */ |
|
219 void OnCmdRestoreTaskL(); |
|
220 /** |
|
221 * Get item finder |
|
222 */ |
|
223 CItemFinder* GetItemFinder(); |
|
224 /** |
|
225 * Get find item menu |
|
226 */ |
|
227 CFindItemMenu* GetFindItemMenu(); |
|
228 |
|
229 /** |
|
230 * Returns ETrue if event has geo coordinates else EFalse |
|
231 */ |
|
232 TBool IsEventHasMapLocationL(); |
|
233 |
|
234 /** |
|
235 * Returns ETrue if event has location text else EFalse |
|
236 */ |
|
237 TBool IsEventHasNoLocationTextL(); |
|
238 |
|
239 /** |
|
240 * Find a phone number in the form |
|
241 */ |
|
242 void OnCmdFindPhoneNumL(); |
|
243 |
|
244 /** |
|
245 * Find an email address in the form |
|
246 */ |
|
247 void OnCmdFindEmailL(); |
|
248 |
|
249 /** |
|
250 * Find a URL in the form |
|
251 */ |
|
252 void OnCmdFindUrlL(); |
|
253 |
|
254 |
|
255 private: |
|
256 |
|
257 /** |
|
258 * Set the layout data for LAF |
|
259 */ |
|
260 void SetLayoutFromLookAndFeelL(); |
|
261 |
|
262 /** |
|
263 * Convert values from twips to pixels |
|
264 */ |
|
265 TInt PixelsToTwips(TInt aPixels); |
|
266 |
|
267 /** |
|
268 * Set up the Font style |
|
269 */ |
|
270 void SetupFontL(); |
|
271 |
|
272 /** |
|
273 * Creates and initiliazes the icon drawer |
|
274 * Returns the newly created pointer to the object of CCalenIconDrawer |
|
275 */ |
|
276 CCalenIconDrawer* CreateAndInitializeIconsDrawerL(); |
|
277 |
|
278 /** |
|
279 * Set the icons |
|
280 */ |
|
281 void SetIconsL(CCalenIconDrawer* aIconDrawer); |
|
282 |
|
283 /** |
|
284 * Populate the icon drawer with the icons for this entry |
|
285 */ |
|
286 void PopulateIconDrawerL( CCalenIconDrawer& aIconDrawer ); |
|
287 |
|
288 /** |
|
289 * Formats the heading and adds it the the view |
|
290 * Headings are bolded with no indentation. |
|
291 */ |
|
292 void SetFormatAndAddHeadingL( const TDesC& aHeading ); |
|
293 |
|
294 /** |
|
295 * Formats the body and adds it the the view |
|
296 * Body text is not bolded and indented from the leading margin |
|
297 * according to the Calendar viewer LAF |
|
298 */ |
|
299 void SetFormatAndAddBodyL( const TDesC& aBody ); |
|
300 |
|
301 /** |
|
302 * Formats the text and adds it to the view |
|
303 */ |
|
304 void AddFormattedTextL( const TDesC& aText ); |
|
305 |
|
306 /** |
|
307 * Add a text field to the view. |
|
308 */ |
|
309 void AddTextFieldL( TInt aHeadingResource, const TDesC& aBody ); |
|
310 |
|
311 /** |
|
312 * Add a text field to the view. |
|
313 */ |
|
314 void AddTextFieldL( TInt aHeadingResource, TInt aBodyResource ); |
|
315 |
|
316 /** |
|
317 * Add a empty line to the view. |
|
318 */ |
|
319 void AddEmptyLineL(); |
|
320 |
|
321 /** |
|
322 * Add a subject field to the view. |
|
323 */ |
|
324 void AddSubjectFieldL(); |
|
325 |
|
326 /** |
|
327 * Add a location field to the view. |
|
328 */ |
|
329 void AddLocationFieldL(); |
|
330 |
|
331 /** |
|
332 * Add a priority field to the form. |
|
333 */ |
|
334 void AddPriorityFieldL(); |
|
335 |
|
336 /** |
|
337 * Add a time field to the form. |
|
338 */ |
|
339 void AddTimeFieldL( TInt aHeadingResource, const TTime& aTime ); |
|
340 |
|
341 /** |
|
342 * Add a date field to the form. |
|
343 */ |
|
344 void AddDateFieldL( const TTime& aDate ); |
|
345 |
|
346 /** |
|
347 * Add a date field to the form. |
|
348 */ |
|
349 void AddDateFieldL( TInt aHeadingResource, const TTime& aDate ); |
|
350 |
|
351 /** |
|
352 * Add a "date - date" field to the form. |
|
353 */ |
|
354 void AddDateDateFieldL( const TTime& aStartDate, const TTime& aEndDate ); |
|
355 |
|
356 /** |
|
357 * Add an alarm date-time field to the form, in the order: DD.DD.DDDD TT:TT according to localisation. |
|
358 */ |
|
359 void AddAlarmDateAndTimeFieldL( const TTime& aTime ); |
|
360 |
|
361 /** |
|
362 * Set alarm to form. |
|
363 */ |
|
364 void AddAlarmDateTimeFieldL(); |
|
365 |
|
366 /** |
|
367 * Add the repeat information to the form for a recurring appointment |
|
368 * @since Series 60 3.1 |
|
369 */ |
|
370 void AddRepeatFieldL(); |
|
371 |
|
372 /** |
|
373 * Add the time fields to the form |
|
374 * @since Series 60 3.1 |
|
375 */ |
|
376 void AddTimeFieldL(); |
|
377 |
|
378 /** |
|
379 * Add a description to the form |
|
380 * @since Series 60 3.1 |
|
381 */ |
|
382 void AddDescriptionFieldL(); |
|
383 |
|
384 /** |
|
385 * Add a since field to the form |
|
386 * @since Series 60 3.1 |
|
387 */ |
|
388 void AddSinceFieldL(); |
|
389 |
|
390 /** |
|
391 * Adds the attachments names to the viewer |
|
392 */ |
|
393 void AddAttachmentNameL(const TDesC& aText); |
|
394 |
|
395 /** |
|
396 * Getter for min and max times |
|
397 */ |
|
398 void GetMinAndMaxTimesL( RArray<TCalTime>& aTimes, |
|
399 TCalTime& aMinTime, |
|
400 TCalTime& aMaxTime ); |
|
401 /** |
|
402 * Remove duplicate times |
|
403 */ |
|
404 void RemoveDuplicateTimesL( RArray<TCalTime>& aTimes ); |
|
405 |
|
406 /** |
|
407 * Remove excluded times |
|
408 */ |
|
409 void RemoveExcludedTimesL( RArray<TCalTime>& aStartDates, |
|
410 RArray<TCalTime>& aExDates, |
|
411 RPointerArray<CCalEntry>& aChildEntries ); |
|
412 /** |
|
413 * RDate expansion stuff |
|
414 */ |
|
415 TBool GetSeriesRepeatInformationL( CCalEntry& aEntry, |
|
416 TCalenRepeatIndex& aRepeatIndex, |
|
417 TTime& aSeriesStart, |
|
418 TTime& aSeriesEnd ); |
|
419 |
|
420 |
|
421 /** |
|
422 * Check if the given text will fit in the the given width |
|
423 * Used to determine if dates will wrap or not |
|
424 */ |
|
425 TBool TryToFitL( const TDesC& aStr, TInt aMaxWidth, const CFont& aFont ); |
|
426 |
|
427 /** |
|
428 * Convert from a calendar TUint priority to a TInt for the form. |
|
429 */ |
|
430 TInt CalendarPriorityToFormPriority( CCalenEntryUtil::TTodoPriority aCalPriority ); |
|
431 |
|
432 /** |
|
433 * Build Search Buffer |
|
434 */ |
|
435 void BuildSearchBufferL(); |
|
436 |
|
437 /** |
|
438 * Get the text fields from the form as a descriptior. |
|
439 */ |
|
440 void GetTextFieldsFromFormL( TDes& aDesc ); |
|
441 |
|
442 /** |
|
443 * Fetch the current entry's parent from agenda. This should be used |
|
444 * sparingly as it is expensive. It may be worth seeing if there |
|
445 * is any performance improvement by fetching the parent from |
|
446 * CCalenDefaultViewers and passing it through to the constructor of |
|
447 * the editors and viewers, instead of fetching it internally to each |
|
448 * viewer/editor. |
|
449 */ |
|
450 CCalEntry& ParentEntryL(); |
|
451 |
|
452 /** |
|
453 * Fetch all the instances of an entry from agenda. This should be used |
|
454 * sparingly as it is expensive. It may be worth seeing if there |
|
455 * is any performance improvement by fetching the parent from |
|
456 * CCalenDefaultViewers and passing it through to the constructor of |
|
457 * the editors and viewers, instead of fetching it internally to each |
|
458 * viewer/editor. |
|
459 */ |
|
460 RPointerArray<CCalEntry>& AllInstancesL(); |
|
461 |
|
462 /** |
|
463 * From MCenRepNotifyHandlerCallback |
|
464 * Handles the notifier errors |
|
465 * @since Series60 3.0 |
|
466 * @param aId, Key that has changed |
|
467 * @param aNewValue, New value of the key |
|
468 */ |
|
469 void HandleNotifyError( TUint32 aId,TInt aError,CCenRepNotifyHandler* aHandler ); |
|
470 |
|
471 |
|
472 /** |
|
473 * Add calendar info field to the viewer |
|
474 */ |
|
475 void AddCalendarInfoFieldL(); |
|
476 |
|
477 /** |
|
478 * Adds the attachment field in the viewer |
|
479 */ |
|
480 void AddAttachmentFieldL(); |
|
481 |
|
482 /** |
|
483 * Checks if user has tapped on the attahcment names and then opens the corresponding |
|
484 * attachment |
|
485 */ |
|
486 void CheckAndOpenTappedAttachmentL(TTmPosInfo2* posInfo); |
|
487 |
|
488 /** |
|
489 * Opens the respective atatchment tapped |
|
490 */ |
|
491 void OpenViewerL(TInt attachmentToBeOpened); |
|
492 |
|
493 /** |
|
494 * Opens the attachment |
|
495 * |
|
496 * @param RFile File handler to be opened |
|
497 * @param aExitObserver Exit observer that listens for exiting from the attahcment viewer |
|
498 * @return None |
|
499 */ |
|
500 void OpenAttachmentViewerL(RFile& file, MAknServerAppExitObserver& aExitObserver); |
|
501 |
|
502 public: |
|
503 |
|
504 /** |
|
505 * From MEikScrollBarObserver: to Handle scrollbar events |
|
506 * @param CEikScrollBar* : Pointer to the scrollbar |
|
507 * @param TEikScrollEvent : Event on the Scrollbar |
|
508 */ |
|
509 void HandleScrollEventL(CEikScrollBar* aScrollBar, TEikScrollEvent aEventType); |
|
510 |
|
511 /** |
|
512 * Overridden HandleStopCommandL()from base class CCalenContainer.h |
|
513 * To stop the alarm in auto snooze case.and to open the event viewer in normal mode. |
|
514 */ |
|
515 void HandleStopCommandL(); |
|
516 |
|
517 /* |
|
518 * @brief Find calendarinfo object based on calendar name |
|
519 * |
|
520 * @param aName calendar filename |
|
521 * @param aCalendarInfo referance for calendarinfo |
|
522 * @return TBool find status |
|
523 */ |
|
524 static TBool CalendarInfoIdentifierL(const HBufC* aName, |
|
525 const CCalCalendarInfo& aCalendarInfo); |
|
526 |
|
527 protected: |
|
528 |
|
529 class TTextPos |
|
530 { |
|
531 public: |
|
532 TInt iDocStart; |
|
533 TInt iDocEnd; |
|
534 }; |
|
535 |
|
536 private: |
|
537 |
|
538 HBufC* iSearchBuf; //Buffer for search text used by find api |
|
539 HBufC* iTimeFormat; // buffer for the time format string |
|
540 HBufC* iDateFormat; // buffer for the date format string |
|
541 |
|
542 CParaFormat* iParaFormat; // para format for the rich text obj. owned |
|
543 TParaFormatMask iParaFormatMask; // specifying validity of paraformat |
|
544 |
|
545 TCharFormat iCharFormat; // character formating for the rich text obj |
|
546 TCharFormatMask iCharFormatMask; // specifying validity of icharformat |
|
547 |
|
548 TFontSpec iHeadingFontSpec; // font weight of heading text |
|
549 TFontSpec iBodyFontSpec; // font weight of body text |
|
550 |
|
551 const CFont* iBodyFont; // not owned |
|
552 const CFont* iHeadingFont; // not owned |
|
553 TInt iMaxWidth; // maximum width in pixel of text area of the rich text |
|
554 TInt iHeadingIndent; // indent of the heading text measured in twips |
|
555 TInt iBodyIndent; // indent of the body text measured in twips |
|
556 TInt iIconDrawerWidthInPixels; // width of the icon drawer in pixels |
|
557 TInt iEmptyLineHeight; // height of the empty line in twips |
|
558 |
|
559 CEikRichTextEditor* iTextEditor; // rich text obj. owned |
|
560 CAknsBasicBackgroundControlContext* iBgContext; // for skins support |
|
561 |
|
562 CCalenEntryUtil* iEventViewData; // event view data |
|
563 |
|
564 CCalEntry* iEntry; //entry viewed in event view |
|
565 TInt iTitleTextId; // title pane text id |
|
566 |
|
567 // The array of entries returned from FetchL(), based on the entry being edited. |
|
568 // This allows retrieving of the parent entry using ParentEntryL(), which should |
|
569 // be used instead of direct access to this array. |
|
570 RPointerArray<CCalEntry> iFetchedEntries; |
|
571 |
|
572 private: |
|
573 CRepository* iCenRepSession; // Central Repository session |
|
574 // Notifier to listen changes of offline state |
|
575 CCenRepNotifyHandler* iNotifier; |
|
576 TInt iTimeFieldLines; // Number of lines occupied by time field on the viewer |
|
577 TBool iEmbeddedFileOpened; |
|
578 CFindItemMenu* iFindMenu; |
|
579 TCursorSelection iSelectedText; // Cursor selection for the text editor |
|
580 TBool iLocaleChanged; |
|
581 CEikLabel* iLabel; |
|
582 CDocumentHandler* iDocHandler; |
|
583 RArray<TTextPos> iAttachmentPosInfoArray; // Array of start and end positions of each attachment names on the viewer |
|
584 |
|
585 }; |
|
586 |
|
587 #endif // CALENEVENTCONTAINER_H |