|
1 /* |
|
2 * Copyright (c) 2005-2007 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: Unified Message Editor Objects view dialog. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_UNIOBJECTSVIEWDIALOG_H |
|
20 #define C_UNIOBJECTSVIEWDIALOG_H |
|
21 |
|
22 // ========== INCLUDE FILES ================================ |
|
23 |
|
24 #include <MsgViewAttachmentsDialog.h> |
|
25 #include <MsgAttachmentUtils.h> |
|
26 #include <AknServerApp.h> |
|
27 |
|
28 #include "unimodelconst.h" // TUniLayout |
|
29 #include <uniobject.h> |
|
30 |
|
31 // ========== CONSTANTS ==================================== |
|
32 |
|
33 // ========== MACROS ======================================= |
|
34 |
|
35 // ========== FUNCTION PROTOTYPES ========================== |
|
36 |
|
37 // ========== FORWARD DECLARATIONS ========================= |
|
38 |
|
39 class CSendUi; |
|
40 class CMsvEntry; |
|
41 class CMessageData; |
|
42 class CUniObject; |
|
43 class CUniDataModel; |
|
44 class CUniDataUtils; |
|
45 class CUniObjectsModel; |
|
46 class CUniObjectsInfo; |
|
47 |
|
48 // ========== DATA TYPES =================================== |
|
49 |
|
50 enum TUniObjectsDialogExitCmd |
|
51 { |
|
52 EUniObjectsViewExit, |
|
53 EUniObjectsViewBack |
|
54 }; |
|
55 |
|
56 // ========== CLASS DECLARATION ============================ |
|
57 |
|
58 /** |
|
59 * Unified Editor Objects view dialog. |
|
60 * |
|
61 * @lib UniUtils.lib |
|
62 * |
|
63 * @since S60 3.2 |
|
64 */ |
|
65 NONSHARABLE_CLASS( CUniObjectsViewDialog ) : public CMsgViewAttachmentsDialog, |
|
66 public MUniObjectObserver |
|
67 |
|
68 { |
|
69 public: |
|
70 |
|
71 enum TUniObjectsDialogType |
|
72 { |
|
73 EEditor, |
|
74 EViewer, |
|
75 EForward |
|
76 }; |
|
77 |
|
78 public: |
|
79 |
|
80 /** |
|
81 * Factory method that creates objects view. |
|
82 * |
|
83 * @since S60 3.2 |
|
84 * |
|
85 * @param aDialogType type of the dialog (editor, viewer or forward) |
|
86 * @param aAttachmentModel reference to attachment model |
|
87 * @param aDocument reference to document owning SmilModel |
|
88 * @param aExitCmd Exit command issued for dialog |
|
89 * @return Return value of dialogs ExecuteLD |
|
90 */ |
|
91 IMPORT_C static TInt ObjectsViewL( TUniObjectsDialogType aDialogType, |
|
92 CUniObjectsModel& aAttachmentModel, |
|
93 CEikonEnv* aEikonEnv, |
|
94 TUniObjectsDialogExitCmd& aExitCmd, |
|
95 CUniDataModel& aDataModel, |
|
96 TInt aFocusedItemIndex = -1 ); |
|
97 |
|
98 /** |
|
99 * Constructor. |
|
100 * |
|
101 * @since S60 3.2 |
|
102 * |
|
103 * @param aTitle title for dialog (shown in title pane) |
|
104 * @param aDialogType type of the dialog (editor, viewer or forward) |
|
105 * @param aMenuId resource id for menu |
|
106 * @param aAttachmentModel reference to attachment model |
|
107 * @param aDocument reference to document owning SmilModel |
|
108 * @param aResourceOffset offset of the resource file (got from |
|
109 * eikenv->AddResourceFileL) |
|
110 * @param aExitCmd Exit command issued for dialog |
|
111 */ |
|
112 CUniObjectsViewDialog( TDesC& aTitle, |
|
113 TUniObjectsDialogType aDialogType, |
|
114 TInt aMenuId, |
|
115 CUniObjectsModel& aAttachmentModel, |
|
116 TInt aResourceOffset, |
|
117 TUniObjectsDialogExitCmd& aExitCmd, |
|
118 CUniDataModel& aDataModel, |
|
119 TInt aFocusedItemIndex ); |
|
120 |
|
121 /** |
|
122 * Destructor. |
|
123 * |
|
124 * @since S60 3.2 |
|
125 */ |
|
126 virtual ~CUniObjectsViewDialog(); |
|
127 |
|
128 public: // from CAknDialog |
|
129 |
|
130 /** |
|
131 * From CAknDialog. See akndialg.h |
|
132 * |
|
133 * @since S60 3.2 |
|
134 */ |
|
135 void ProcessCommandL( TInt aCommandId ); |
|
136 |
|
137 /** |
|
138 * From CAknDialog. See akndialg.h |
|
139 * |
|
140 * @since S60 3.2 |
|
141 */ |
|
142 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
143 |
|
144 /** |
|
145 * From CAknDialog. See akndialg.h |
|
146 * |
|
147 * @since S60 3.2 |
|
148 */ |
|
149 void DynInitMenuPaneL( TInt aMenuId, CEikMenuPane* aMenuPane ); |
|
150 |
|
151 /** |
|
152 * From CEikDialog |
|
153 * Sets the layout for the dialog. Called just before the dialog |
|
154 * is activated |
|
155 */ |
|
156 void PreLayoutDynInitL(); |
|
157 |
|
158 public: // from MApaServerAppExitObserver |
|
159 |
|
160 /** |
|
161 * Handle the exit of a connected server app. |
|
162 * This implementation provides S60 default behavior |
|
163 * for handling of the EAknCmdExit exit code. Derived classes |
|
164 * should base-call this implementation if they override this |
|
165 * function. |
|
166 * |
|
167 * @since S60 3.2 |
|
168 * |
|
169 * @param aReason The reason that the server application exited. |
|
170 * This will either be an error code, or the command id that caused |
|
171 * the server app to exit. |
|
172 */ |
|
173 void HandleServerAppExit( TInt aReason ); |
|
174 |
|
175 private: |
|
176 |
|
177 /** |
|
178 * Loads form data. |
|
179 */ |
|
180 void LoadFormDataL(); |
|
181 |
|
182 /** |
|
183 * Remove attachment from model. |
|
184 * @param aIndex |
|
185 */ |
|
186 void RemoveAttachmentL( TInt aIndex ); |
|
187 |
|
188 /** |
|
189 * Change order of attachment. |
|
190 * @param aCommandId |
|
191 * @param aNewPosition |
|
192 */ |
|
193 void ChangeOrderL( TInt aCommandId, TInt aNewPosition ); |
|
194 |
|
195 /** |
|
196 * From CCoeControl, returns help context |
|
197 */ |
|
198 void GetHelpContext( TCoeHelpContext& aContext ) const; |
|
199 |
|
200 /** |
|
201 * By default Symbian constructor is private. |
|
202 */ |
|
203 void ConstructL( CMsvEntry& aEntry ); |
|
204 |
|
205 /** |
|
206 * "Calculates" on which slide we are. |
|
207 * @return slide number |
|
208 */ |
|
209 TInt SlideNumber( TInt aIndex ); |
|
210 |
|
211 /** |
|
212 * Checks whether there are both image and text present |
|
213 * @return ETrue if both image and text are present, EFalse otherwise |
|
214 */ |
|
215 TBool IsImageAndTextPresent(); |
|
216 |
|
217 /** |
|
218 * Launches help application |
|
219 */ |
|
220 void LaunchHelpL(); |
|
221 |
|
222 /** |
|
223 * Processes menu command open. |
|
224 * @param aIndex Index of the item to be opened |
|
225 */ |
|
226 void ProcessCommandOpenL( TInt aIndex ); |
|
227 |
|
228 /** |
|
229 * Processes menu command save. |
|
230 * @param aIndex Index of the item to be saved |
|
231 */ |
|
232 void ProcessCommandSaveL( TInt aIndex ); |
|
233 |
|
234 /** |
|
235 * Processes menu command remove. |
|
236 * @param aIndex Index of the item to be removed |
|
237 */ |
|
238 void ProcessCommandRemoveL( TInt aIndex ); |
|
239 |
|
240 /** |
|
241 * Processes menu command send. |
|
242 * @param aIndex Index of the item to be removed |
|
243 */ |
|
244 void ProcessCommandSendL( CMessageData& aMsgData, |
|
245 TInt aIndex, |
|
246 TUid aServiceId, |
|
247 TUid aBioUid ); |
|
248 |
|
249 /** |
|
250 * Creates a temporary text file in Unicode format |
|
251 */ |
|
252 void CreateTempTextFileL( CUniObject* aObject, TFileName& aTempFileName ); |
|
253 |
|
254 /** |
|
255 * Creates a temporary path |
|
256 */ |
|
257 void CreateTempPathL( const TDesC& aFileName, TFileName& aTempFileName ); |
|
258 |
|
259 /** |
|
260 * Checks whether an attachment file is of bio message type |
|
261 */ |
|
262 TBool BioMessageTypeL( TPtrC8 aMimeType, |
|
263 TUid& aBioUid ); |
|
264 |
|
265 /* |
|
266 * PopulateAttachmentModelL |
|
267 * Populates given model from smilmodel contents |
|
268 * |
|
269 * @param aObjectsViewModel |
|
270 */ |
|
271 static void PopulateAttachmentModelL( CUniObjectsModel& aObjectsViewModel, |
|
272 CUniDataModel& aUniDataModel ); |
|
273 |
|
274 /** |
|
275 * Creates an CUniObjectsInfo* from an CUniObject |
|
276 * to be used when populating objects view model |
|
277 * |
|
278 * @param aObjectsViewModel |
|
279 * @param aObject - Object to get info from. |
|
280 * @param aAttachment - Indicate the object is attachment object |
|
281 * (i.e. not referenced from SMIL) |
|
282 * @param aSlideNumber - Number of slide on which object is located. |
|
283 * @return new CUniObjectsinfo object |
|
284 */ |
|
285 static CUniObjectsInfo* CreateObjectsInfoL( CUniObjectsModel& aObjectsViewModel, |
|
286 CUniObject& aObject, |
|
287 TBool aAttachmentObject, |
|
288 TInt aSlideNumber ); |
|
289 |
|
290 /** |
|
291 * Resolves DRM type to CUniObject object. |
|
292 * |
|
293 * @param aObject - Object to get info from. |
|
294 * |
|
295 * @return DRM type |
|
296 */ |
|
297 static TInt GetObjectsInfoDRMTypeL( CUniObject& aObject ); |
|
298 |
|
299 /// MUniObjectObserver |
|
300 void HandleUniObjectEvent( CUniObject& aUniObject, |
|
301 TUniObjectEvent aUniEvent ); |
|
302 |
|
303 /** |
|
304 * Checks whether objects has drm rights left just now |
|
305 * @return TBool |
|
306 */ |
|
307 TBool IsRightsNow( CUniObject& aObject ) const; |
|
308 |
|
309 /** |
|
310 * Checks whether object has drm rights when downloaded to the current slide |
|
311 * @return TBool |
|
312 */ |
|
313 TBool IsDrmRightsWhenLoaded( CUniObject& aObject ) const; |
|
314 |
|
315 private: // data |
|
316 |
|
317 TUniObjectsDialogType iDialogType; |
|
318 |
|
319 TInt iResourceOffset; |
|
320 |
|
321 CUniDataModel& iDataModel; |
|
322 |
|
323 CSendUi* iSendUi; |
|
324 |
|
325 TInt iSupportedFeatures; |
|
326 |
|
327 TUniObjectsDialogExitCmd iExitCmd; |
|
328 |
|
329 TInt iFocusedItemIndex; |
|
330 }; |
|
331 |
|
332 #endif // C_UNIOBJECTSVIEWDIALOG_H |
|
333 |
|
334 // End of File |