|
1 /* |
|
2 * Copyright (c) 2009 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: MR Attachment field for editor and viewer |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CMRATTACHMENTSFIELD_H |
|
20 #define CMRATTACHMENTSFIELD_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <eikedwob.h> |
|
24 |
|
25 #include "esmrdef.h" |
|
26 #include "cesmrfield.h" |
|
27 #include "cesmrrichtextviewer.h" |
|
28 #include "cmrattachmentui.h" |
|
29 |
|
30 // Forward declarations |
|
31 class CEikButtonGroupContainer; |
|
32 class MESMRMeetingRequestEntry; |
|
33 class CMRLabel; |
|
34 class CAknsBasicBackgroundControlContext; |
|
35 class CMRImage; |
|
36 class CESMRRichTextViewer; |
|
37 class CCalAttachment; |
|
38 class CMRAttachmentUi; |
|
39 class CMRAttachmentCommandHandler; |
|
40 |
|
41 NONSHARABLE_CLASS( CMRAttachmentsField ): public CESMRField, |
|
42 public MEikEdwinSizeObserver, |
|
43 public MESMRRichTextObserver, |
|
44 public MMRAttachmentUiObserver |
|
45 |
|
46 { |
|
47 public: |
|
48 /** |
|
49 * Two phase constructor. |
|
50 */ |
|
51 static CMRAttachmentsField* NewL(); |
|
52 |
|
53 /** |
|
54 * Destructor. |
|
55 */ |
|
56 ~CMRAttachmentsField(); |
|
57 |
|
58 protected: // From CESMRField |
|
59 TSize MinimumSize(); |
|
60 void InitializeL(); |
|
61 void InternalizeL( MESMRCalEntry& aEntry ); |
|
62 void ExternalizeL( MESMRCalEntry& aEntry ); |
|
63 TBool ExecuteGenericCommandL( TInt aCommand ); |
|
64 void SetOutlineFocusL( TBool aFocus ); |
|
65 void ListObserverSet(); |
|
66 TBool HandleSingletapEventL( const TPoint& aPosition ); |
|
67 void HandleLongtapEventL( const TPoint& aPosition ); |
|
68 TBool HandleRawPointerEventL( const TPointerEvent& aPointerEvent ); |
|
69 void DynInitMenuPaneL( |
|
70 TInt aResourceId, |
|
71 CEikMenuPane* aMenuPane ); |
|
72 |
|
73 protected: // From CCoeControl |
|
74 TInt CountComponentControls() const; |
|
75 CCoeControl* ComponentControl( TInt aInd ) const; |
|
76 void SizeChanged(); |
|
77 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
78 void SetContainerWindowL( const CCoeControl& aControl ); |
|
79 |
|
80 protected: // From MEikEdwinSizeObserver |
|
81 TBool HandleEdwinSizeEventL( CEikEdwin* aEdwin, TEdwinSizeEvent aType, TSize aDesirableEdwinSize); |
|
82 |
|
83 public: // From MESMRRichTextObserver |
|
84 TBool HandleRichTextLinkSelection( const CESMRRichTextLink* aLink ); |
|
85 |
|
86 public: // From MMRAttachmentUiObserver |
|
87 void AttachmentOperationCompleted( MDesC16Array& aArray ); |
|
88 |
|
89 private: // Implementation |
|
90 |
|
91 CMRAttachmentsField(); |
|
92 void ConstructL(); |
|
93 |
|
94 void UpdateAttachmentsListL(); |
|
95 HBufC* ClipTextLC( const TDesC& aText, const CFont& aFont, TInt aWidth ); |
|
96 void UpdateFieldL(); |
|
97 HBufC* AttachmentNameAndSizeL( const TDesC& aDes, const CCalAttachment& aAttachment ); |
|
98 TBool AddAttachmentL(); |
|
99 TInt LineSpacing(); |
|
100 TInt FocusMargin(); |
|
101 |
|
102 private: //data |
|
103 // Own: Title of this field |
|
104 CMRLabel* iTitle; |
|
105 // Own: Field icon |
|
106 CMRImage* iFieldIcon; |
|
107 // Owned. Attendee editor. |
|
108 CESMRRichTextViewer* iRichTextViewer; |
|
109 // Not owned. CBA. |
|
110 CEikButtonGroupContainer* iButtonGroupContainer; |
|
111 // Own. Background control context. |
|
112 CAknsBasicBackgroundControlContext* iBgCtrlContext; |
|
113 // Attachment count |
|
114 TInt iAttachmentCount; |
|
115 /// Own: Attachment ui for adding attachments |
|
116 CMRAttachmentUi* iAttachmentUi; |
|
117 /// Ref: Reference to internalized entry |
|
118 MESMRCalEntry* iEntry; |
|
119 // Field rect for comparison purposes |
|
120 TRect iFieldRect; |
|
121 // Rich Text viewer size |
|
122 TSize iRichTextSize; |
|
123 /// Own: Attachment command handler |
|
124 CMRAttachmentCommandHandler* iAttCommandHandler; |
|
125 }; |
|
126 |
|
127 #endif // CMRATTACHMENTSFIELD_H |