|
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: |
|
15 * Wrapper for handling GMS message. It wraps a CGmsModel. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __GMSWRAPPER_H_ |
|
22 #define __GMSWRAPPER_H_ |
|
23 |
|
24 // INCLUDES |
|
25 |
|
26 #include <e32base.h> |
|
27 |
|
28 // DATA TYPES |
|
29 |
|
30 enum TGmsWrapperPanic |
|
31 { |
|
32 EGmsWrNoModel1, |
|
33 EGmsWrNoPicture, |
|
34 EGmsWrNoPicture2, |
|
35 EGmsWrFilenameEmpty, |
|
36 EGmsWrTmpPicFileNotNeeded, |
|
37 EGmsWrTmpFileAlreadyExists, |
|
38 EGmsWrFilenameEmpty2, |
|
39 EGmsWrNoPic1 |
|
40 }; |
|
41 |
|
42 // FUNCTION PROTOTYPES |
|
43 |
|
44 // FORWARD DECLARATIONS |
|
45 |
|
46 class CMsgEditorView; |
|
47 class CEikStatusPane; |
|
48 class CGmsModel; |
|
49 class RFs; |
|
50 class CRichText; |
|
51 |
|
52 // CLASS DECLARATION |
|
53 |
|
54 /** |
|
55 * Class for handling GMS data and UI operations. |
|
56 */ |
|
57 class CGmsWrapper : public CBase |
|
58 { |
|
59 public: // construction and destruction |
|
60 |
|
61 /** |
|
62 * Two phased constructor. |
|
63 * @param aFs Reference to RFs. |
|
64 * @return The newly constructed object. |
|
65 */ |
|
66 IMPORT_C static CGmsWrapper* NewL(RFs& aFs); |
|
67 |
|
68 /// Destructor. |
|
69 IMPORT_C ~CGmsWrapper(); |
|
70 |
|
71 public: // new functions |
|
72 |
|
73 /** |
|
74 * Loads the message data from the rich text. It also creates a |
|
75 * temporary file for the picture. |
|
76 * @param aMsgRich The message data in a CRichText. |
|
77 */ |
|
78 IMPORT_C void LoadMsgL(const CRichText& aMsgRich); |
|
79 |
|
80 /** |
|
81 * Creates a picture control, loads it with picture data, and adds the |
|
82 * new control to the view. The LoadMsgL() or PictureSelectionPopupL() |
|
83 * must have been called before this. |
|
84 * @param aView Reference to the view that gets the new control. |
|
85 * @param aId The ID that is assigned to the new image control. |
|
86 */ |
|
87 IMPORT_C void AddPictureControlToViewL(CMsgEditorView& aView, TInt aId); |
|
88 |
|
89 /** |
|
90 * This method is deprecated, do not use. |
|
91 */ |
|
92 IMPORT_C void PictureSelectionPopupL(TInt aBadPicTextResId); |
|
93 |
|
94 /** |
|
95 * Gives the body user text as a CRichText which is on the |
|
96 * cleanup stack. |
|
97 * @return The body text as CRichText. |
|
98 */ |
|
99 IMPORT_C CRichText* GetTextLC(); |
|
100 |
|
101 /** |
|
102 * This sets the text. |
|
103 * @param aRich The text. |
|
104 */ |
|
105 IMPORT_C void SetTextL(CRichText& aRich); |
|
106 |
|
107 /** |
|
108 * Gets the entire message as HBufC. |
|
109 * @return The entire message as HBufC on CleanupStack. |
|
110 */ |
|
111 IMPORT_C HBufC* GetMessageLC(); |
|
112 |
|
113 /** |
|
114 * Sets the Picture Message title to the status pane. |
|
115 * @param aStatusPane Reference to the status pane. |
|
116 * @param aTitleTextResIs title resource id |
|
117 */ |
|
118 IMPORT_C void SetPictureMsgTitleL(CEikStatusPane& aStatusPane, |
|
119 TInt aTitleTextResIs); |
|
120 |
|
121 /** |
|
122 * Size of message minus the space taken up by the text payload. |
|
123 * @return Message size excluding text. |
|
124 */ |
|
125 IMPORT_C TInt MsgSizeExcludingText(); |
|
126 |
|
127 /** |
|
128 * Adds the picture to Photo Album. |
|
129 * @param aDefaultNameResIs default name resource |
|
130 * @param aPictureCopiedResId resource for copied note |
|
131 */ |
|
132 IMPORT_C void AddToPhotoAlbumL(TInt aDefaultNameResIs, |
|
133 TInt aPictureCopiedResId); |
|
134 |
|
135 /** |
|
136 * Accessor for iModel. |
|
137 * @return Constant reference to iModel. |
|
138 */ |
|
139 IMPORT_C const CGmsModel& Model() const; |
|
140 |
|
141 private: |
|
142 |
|
143 /// Panic wrapper. |
|
144 void Panic(TGmsWrapperPanic aCode); |
|
145 |
|
146 /** |
|
147 * Creates a temporary bitmap from the data that has been loaded. |
|
148 * The LoadMsgL() has been called before this. The file is deleted |
|
149 * in the destructor. A temp file is not needed if |
|
150 * PictureSelectionPopupL() has been used, because in that case there |
|
151 * exists the original picture file in Photoalbum that we can use. |
|
152 */ |
|
153 void ExportBitmapToTempFileL(); |
|
154 |
|
155 private: // construction |
|
156 |
|
157 /// Second phase constructor |
|
158 void ConstructL(); |
|
159 |
|
160 /** |
|
161 * Constructor. |
|
162 * @param aFs Reference to RFs. |
|
163 */ |
|
164 CGmsWrapper(RFs& aFs); |
|
165 |
|
166 private: // prohibited |
|
167 |
|
168 /// Default constructor prohibited. |
|
169 CGmsWrapper(); |
|
170 |
|
171 /// Copy contructor prohibited. |
|
172 CGmsWrapper(const CGmsWrapper& aSource); |
|
173 |
|
174 /// Assignment operator prohibited. |
|
175 const CGmsWrapper& operator=(const CGmsWrapper& aSource); |
|
176 |
|
177 private: // data |
|
178 |
|
179 /// Own: picture |
|
180 CGmsModel* iModel; |
|
181 |
|
182 mutable RFs& iFs; |
|
183 |
|
184 /// picture file name |
|
185 TFileName iFileName; |
|
186 |
|
187 /// if a temporary ota file exists |
|
188 TBool iExistsTmpFile; |
|
189 |
|
190 }; |
|
191 |
|
192 |
|
193 #endif //__GMSWRAPPER_H_ |
|
194 |
|
195 // end of file |