|
1 /* |
|
2 * Copyright (c) 2006,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: CUniEditorSendUiOperation, operation for opening messages created by SendUI |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // ========== INCLUDE FILES ================================ |
|
21 |
|
22 #include <mmsconst.h> |
|
23 |
|
24 #include <unidatautils.h> |
|
25 #include <MsgMimeTypes.h> |
|
26 #include <unismilmodel.h> |
|
27 #include <MsgMediaInfo.h> |
|
28 #include <MsgTextInfo.h> |
|
29 #include <MsgImageInfo.h> |
|
30 #include <MsgVideoInfo.h> |
|
31 |
|
32 #include <MmsConformance.h> |
|
33 |
|
34 #include "UniEditorSendUiOperation.h" |
|
35 #include "UniEditorProcessTextOperation.h" |
|
36 |
|
37 // ========== EXTERNAL DATA STRUCTURES ===================== |
|
38 |
|
39 // ========== EXTERNAL FUNCTION PROTOTYPES ================= |
|
40 |
|
41 // ========== CONSTANTS ==================================== |
|
42 |
|
43 const TUint KSendAsDeleteAllPercentage = 80; |
|
44 |
|
45 // ========== MACROS ======================================= |
|
46 |
|
47 // ========== LOCAL CONSTANTS AND MACROS =================== |
|
48 |
|
49 // ========== MODULE DATA STRUCTURES ======================= |
|
50 |
|
51 // ========== LOCAL FUNCTION PROTOTYPES ==================== |
|
52 |
|
53 // ========== LOCAL FUNCTIONS ============================== |
|
54 |
|
55 // ========== MEMBER FUNCTIONS ============================= |
|
56 |
|
57 // --------------------------------------------------------- |
|
58 // CUniEditorSendUiOperation::NewL |
|
59 // |
|
60 // Factory method. |
|
61 // --------------------------------------------------------- |
|
62 // |
|
63 CUniEditorSendUiOperation* CUniEditorSendUiOperation::NewL( |
|
64 MUniEditorOperationObserver& aObserver, |
|
65 CUniEditorDocument& aDocument, |
|
66 RFs& aFs ) |
|
67 { |
|
68 CUniEditorSendUiOperation* self = |
|
69 new ( ELeave ) CUniEditorSendUiOperation( aObserver, aDocument, aFs ); |
|
70 |
|
71 CleanupStack::PushL( self ); |
|
72 self->ConstructL(); |
|
73 CleanupStack::Pop( self ); |
|
74 |
|
75 return self; |
|
76 } |
|
77 |
|
78 // --------------------------------------------------------- |
|
79 // CUniEditorSendUiOperation::CUniEditorSendUiOperation |
|
80 // |
|
81 // Constructor. |
|
82 // --------------------------------------------------------- |
|
83 // |
|
84 CUniEditorSendUiOperation::CUniEditorSendUiOperation( |
|
85 MUniEditorOperationObserver& aObserver, |
|
86 CUniEditorDocument& aDocument, |
|
87 RFs& aFs ) : |
|
88 CUniEditorOperation( aObserver, aDocument, aFs, EUniEditorOperationSendUi ) |
|
89 { |
|
90 } |
|
91 |
|
92 |
|
93 // --------------------------------------------------------- |
|
94 // CUniEditorSendUiOperation::CUniEditorSendUiOperation |
|
95 // |
|
96 // Destructor. |
|
97 // --------------------------------------------------------- |
|
98 // |
|
99 CUniEditorSendUiOperation::~CUniEditorSendUiOperation() |
|
100 { |
|
101 Cancel(); |
|
102 delete iImageOperation; |
|
103 delete iVideoOperation; |
|
104 #ifdef RD_MSG_XHTML_SUPPORT |
|
105 delete iTextOperation; |
|
106 #endif |
|
107 } |
|
108 |
|
109 // --------------------------------------------------------- |
|
110 // CUniEditorSendUiOperation::Start |
|
111 // --------------------------------------------------------- |
|
112 // |
|
113 void CUniEditorSendUiOperation::Start() |
|
114 { |
|
115 ResetErrors(); |
|
116 |
|
117 iOperationState = EUniEditorSendUiCheck; |
|
118 iObjectsSize = 0; |
|
119 iObjectNum = 0; |
|
120 iSlideNum = 0; |
|
121 iDeleteAll = EFalse; |
|
122 |
|
123 CompleteSelf( KErrNone ); |
|
124 } |
|
125 |
|
126 // --------------------------------------------------------- |
|
127 // CUniEditorSendUiOperation::ConstructL |
|
128 // |
|
129 // 2nd phase constructor. |
|
130 // --------------------------------------------------------- |
|
131 // |
|
132 void CUniEditorSendUiOperation::ConstructL() |
|
133 { |
|
134 BaseConstructL(); |
|
135 |
|
136 iDeleteAllLimit = ( iDocument.MaxMessageSize() * KSendAsDeleteAllPercentage ) / 100; |
|
137 iOptimizedFlow = EFalse; |
|
138 } |
|
139 |
|
140 // --------------------------------------------------------- |
|
141 // CUniEditorSendUiOperation::DoCancelCleanup |
|
142 // |
|
143 // --------------------------------------------------------- |
|
144 // |
|
145 void CUniEditorSendUiOperation::DoCancelCleanup() |
|
146 { |
|
147 if ( iImageOperation ) |
|
148 { |
|
149 iImageOperation->Cancel(); |
|
150 } |
|
151 |
|
152 if ( iVideoOperation ) |
|
153 { |
|
154 iVideoOperation->Cancel(); |
|
155 } |
|
156 #ifdef RD_MSG_XHTML_SUPPORT |
|
157 if ( iTextOperation ) |
|
158 { |
|
159 iTextOperation->Cancel(); |
|
160 } |
|
161 #endif |
|
162 } |
|
163 |
|
164 // --------------------------------------------------------- |
|
165 // CUniEditorSendUiOperation::RunL |
|
166 // |
|
167 // --------------------------------------------------------- |
|
168 // |
|
169 void CUniEditorSendUiOperation::RunL() |
|
170 { |
|
171 PrintOperationAndState(); |
|
172 |
|
173 if ( !SetErrorAndReport( iStatus.Int() ) ) |
|
174 { |
|
175 DoSendUiStepL(); |
|
176 } |
|
177 } |
|
178 |
|
179 // --------------------------------------------------------- |
|
180 // CUniEditorSendUiOperation::DoSendUiStepL |
|
181 // |
|
182 // --------------------------------------------------------- |
|
183 // |
|
184 void CUniEditorSendUiOperation::DoSendUiStepL() |
|
185 { |
|
186 switch ( iOperationState ) |
|
187 { |
|
188 case EUniEditorSendUiCheck: |
|
189 { |
|
190 DoSendUiCheckL(); |
|
191 break; |
|
192 } |
|
193 case EUniEditorSendUiPrepareObject: |
|
194 { |
|
195 DoSendUiPrepareObjectL(); |
|
196 break; |
|
197 } |
|
198 case EUniEditorSendUiPrepareAttachments: |
|
199 { |
|
200 DoSendUiPrepareAttachmentsL(); |
|
201 break; |
|
202 } |
|
203 case EUniEditorSendUiEnd: |
|
204 { |
|
205 iObserver.EditorOperationEvent( EUniEditorOperationSendUi, |
|
206 EUniEditorOperationComplete ); |
|
207 break; |
|
208 } |
|
209 default: |
|
210 { |
|
211 iObserver.EditorOperationEvent( EUniEditorOperationSendUi, |
|
212 EUniEditorOperationError ); |
|
213 break; |
|
214 } |
|
215 } |
|
216 } |
|
217 |
|
218 // --------------------------------------------------------- |
|
219 // CUniEditorSendUiOperation::DoSendUiCheckL |
|
220 // |
|
221 // Check message content when message created by SendAs |
|
222 // --------------------------------------------------------- |
|
223 // |
|
224 void CUniEditorSendUiOperation::DoSendUiCheckL() |
|
225 { |
|
226 // check is it, one embedded object with jpeg image |
|
227 // captured from camera\ seleted from photo\ filemanager |
|
228 TInt objectCount =iDocument.DataModel()->ObjectList().Count() ; |
|
229 TInt slideCount =iDocument.DataModel()->SmilModel().SlideCount() ; |
|
230 if ( (objectCount == 1)&&(slideCount == 1)&& |
|
231 (iDocument.DataModel()->AttachmentList().Count()== 0)) |
|
232 { |
|
233 CUniObject* obj = |
|
234 iDocument.DataModel()->SmilModel().GetObjectByIndex( slideCount-1, objectCount-1 ); |
|
235 if(obj->MediaInfo()->MimeType().CompareF( KMsgMimeImageJpeg )== 0) |
|
236 { |
|
237 iOptimizedFlow = ETrue; |
|
238 iObserver.EditorOperationEvent( EUniEditorOperationSendUi, |
|
239 EUniEditorOperationPartialComplete ); |
|
240 iOptimizedFlow = EFalse; |
|
241 } |
|
242 } |
|
243 |
|
244 if ( iDocument.DataModel()->ObjectList().Count() || |
|
245 iDocument.DataModel()->AttachmentList().Count() ) |
|
246 { |
|
247 DoCheckFilesL(); |
|
248 } |
|
249 |
|
250 if ( iDocument.DataModel()->ObjectList().Count() ) |
|
251 { |
|
252 iDocument.DataModel()->SmilModel().SortSlidesL(); |
|
253 } |
|
254 |
|
255 iOperationState = EUniEditorSendUiPrepareObject; |
|
256 CompleteSelf( KErrNone ); |
|
257 } |
|
258 |
|
259 // --------------------------------------------------------- |
|
260 // CUniEditorSendUiOperation::DoCheckFilesL |
|
261 // --------------------------------------------------------- |
|
262 // |
|
263 void CUniEditorSendUiOperation::DoCheckFilesL() |
|
264 { |
|
265 TInt slideCount = iDocument.DataModel()->SmilModel().SlideCount(); |
|
266 |
|
267 //It's important to go from end to beginning |
|
268 //because slides may be removed |
|
269 for ( TInt i = slideCount; --i >= 0 ; ) |
|
270 { |
|
271 //It's important to go from end to beginning |
|
272 //because objects may be removed |
|
273 for ( TInt ii = iDocument.DataModel()->SmilModel().SlideObjectCount(i); --ii >= 0 ;) |
|
274 { |
|
275 CUniObject* obj = iDocument.DataModel()->SmilModel().GetObjectByIndex( i, ii ); |
|
276 |
|
277 TMmsConformance conformance = |
|
278 iDocument.DataModel()->MmsConformance().MediaConformance( *obj->MediaInfo() ); |
|
279 |
|
280 TUint32 confStatus = conformance.iConfStatus; |
|
281 |
|
282 TBool remove = EFalse; |
|
283 if ( confStatus & EMmsConfNokDRM ) |
|
284 { |
|
285 remove = ETrue; |
|
286 SetError( EUniSendUiForbidden ); |
|
287 } |
|
288 else if ( confStatus & EMmsConfNokCorrupt ) |
|
289 { |
|
290 SetError( EUniSendUiCorrupted ); |
|
291 } |
|
292 else if ( confStatus & ( EMmsConfNokNotEnoughInfo | EMmsConfNokNotSupported ) || |
|
293 ( iDocument.CreationMode() == EMmsCreationModeRestricted && |
|
294 confStatus & EMmsConfNokFreeModeOnly ) ) |
|
295 { |
|
296 remove = ETrue; |
|
297 SetError( EUniSendUiUnsupported ); |
|
298 } |
|
299 else if ( !conformance.iCanAdapt && |
|
300 confStatus & EMmsConfNokTooBig ) |
|
301 { |
|
302 remove = ETrue; |
|
303 SetError( EUniSendUiTooBig ); |
|
304 } |
|
305 |
|
306 if ( remove ) |
|
307 { |
|
308 iDocument.DataModel()->SmilModel().RemoveObjectByIndexL( i, ii ); |
|
309 remove = EFalse; |
|
310 } |
|
311 } |
|
312 |
|
313 if ( !iDocument.DataModel()->SmilModel().SlideObjectCount( i ) ) |
|
314 { |
|
315 iDocument.DataModel()->SmilModel().RemoveSlide( i ); |
|
316 } |
|
317 } |
|
318 |
|
319 CUniObjectList& attachments = iDocument.DataModel()->AttachmentList(); |
|
320 //It's important to go from end to beginning |
|
321 //because attachments may be removed |
|
322 for ( TInt j = attachments.Count(); --j >= 0 ; ) |
|
323 { |
|
324 CUniObject* obj = attachments.GetByIndex( j ); |
|
325 |
|
326 TMmsConformance conformance = |
|
327 iDocument.DataModel()->MmsConformance().MediaConformance( *obj->MediaInfo() ); |
|
328 |
|
329 TUint32 confStatus = conformance.iConfStatus; |
|
330 |
|
331 if ( iDocument.CreationMode() != EMmsCreationModeRestricted ) |
|
332 { |
|
333 // Mask "FreeModeOnly" away in free mode |
|
334 confStatus &= ~EMmsConfNokFreeModeOnly; |
|
335 // Mask "Scaling needed" away in free mode |
|
336 confStatus &= ~EMmsConfNokScalingNeeded; |
|
337 } |
|
338 |
|
339 if ( confStatus & EMmsConfNokDRM ) |
|
340 { |
|
341 attachments.RemoveObjectL( obj ); |
|
342 SetError( EUniSendUiForbidden ); |
|
343 delete obj; |
|
344 } |
|
345 else if ( confStatus & EMmsConfNokCorrupt ) |
|
346 { |
|
347 SetError( EUniSendUiCorrupted ); |
|
348 } |
|
349 else if ( confStatus != EMmsConfOk ) |
|
350 { |
|
351 attachments.RemoveObjectL( obj ); |
|
352 SetError( EUniSendUiUnsupported ); |
|
353 delete obj; |
|
354 } |
|
355 } |
|
356 } |
|
357 |
|
358 // --------------------------------------------------------- |
|
359 // CUniEditorSendUiOperation::DoSendUiPrepareObjectL |
|
360 // |
|
361 // Processes images and checks whether message size is below |
|
362 // max size. If not removes as many objects as needed. |
|
363 // --------------------------------------------------------- |
|
364 // |
|
365 void CUniEditorSendUiOperation::DoSendUiPrepareObjectL() |
|
366 { |
|
367 VerifyPreparedObjectL(); |
|
368 |
|
369 CUniObject* obj = iDocument.DataModel()->SmilModel().GetObjectByIndex( iSlideNum, iObjectNum ); |
|
370 |
|
371 if ( obj ) |
|
372 { |
|
373 DoPrepareObjectL( obj ); |
|
374 } |
|
375 else |
|
376 { |
|
377 iOperationState = EUniEditorSendUiPrepareAttachments; |
|
378 CompleteSelf( KErrNone ); |
|
379 } |
|
380 } |
|
381 |
|
382 // --------------------------------------------------------- |
|
383 // CUniEditorSendUiOperation::VerifyPreparedObjectL |
|
384 // --------------------------------------------------------- |
|
385 // |
|
386 void CUniEditorSendUiOperation::VerifyPreparedObjectL() |
|
387 { |
|
388 if ( iPreparedObject ) |
|
389 { |
|
390 TBool remove = EFalse; |
|
391 |
|
392 // Conformance status check! |
|
393 TMmsConformance conformance = |
|
394 iDocument.DataModel()->MmsConformance().MediaConformance( *iPreparedObject->MediaInfo() ); |
|
395 |
|
396 TUint32 confStatus = conformance.iConfStatus; |
|
397 if ( iPreparedObject->MediaType() == EMsgMediaText ) |
|
398 { |
|
399 // Mask "ConversionNeeded" away for text objects |
|
400 // -> Will be always converted to UTF-8 anyway |
|
401 confStatus &= ~EMmsConfNokConversionNeeded; |
|
402 } |
|
403 |
|
404 if ( iDocument.CreationMode() != EMmsCreationModeRestricted ) |
|
405 { |
|
406 // Mask "FreeModeOnly" away in free mode |
|
407 confStatus &= ~EMmsConfNokFreeModeOnly; |
|
408 // Mask "Scaling needed" away in free mode |
|
409 confStatus &= ~EMmsConfNokScalingNeeded; |
|
410 //Mask "Corrupted" away in free mode |
|
411 confStatus &= ~EMmsConfNokCorrupt; |
|
412 } |
|
413 |
|
414 // Mask "Too big" away as there is a separate check for that |
|
415 confStatus &= ~EMmsConfNokTooBig; |
|
416 |
|
417 if ( confStatus != EMmsConfOk ) |
|
418 { |
|
419 SetError( EUniSendUiUnsupported ); |
|
420 remove = ETrue; |
|
421 } |
|
422 |
|
423 TInt currentSize = iObjectsSize + |
|
424 iPreparedObject->Size() + |
|
425 iDocument.DataModel()->SmilModel().SmilComposeSize( iSlideNum + 1, iObjectNum + 1 ); |
|
426 |
|
427 if ( !remove && |
|
428 TUint( currentSize ) > iDocument.MaxMessageSize() ) |
|
429 { |
|
430 // Remove if above max size |
|
431 if ( TUint( iPreviousSize ) > iDeleteAllLimit ) |
|
432 { |
|
433 //Once above "delete all limit" delete all the rest. |
|
434 iDeleteAll = ETrue; |
|
435 } |
|
436 remove = ETrue; |
|
437 SetError( EUniSendUiTooBig ); |
|
438 } |
|
439 else |
|
440 { |
|
441 // Don't remove. Update previous size. |
|
442 iPreviousSize = currentSize; |
|
443 } |
|
444 |
|
445 if ( remove ) |
|
446 { |
|
447 iDocument.DataModel()->SmilModel().RemoveObjectByIndexL( iSlideNum, iObjectNum ); |
|
448 |
|
449 if ( !iDocument.DataModel()->SmilModel().SlideObjectCount( iSlideNum ) ) |
|
450 { |
|
451 iDocument.DataModel()->SmilModel().RemoveSlide( iSlideNum ); |
|
452 } |
|
453 } |
|
454 else |
|
455 { |
|
456 iObjectsSize += iPreparedObject->Size(); |
|
457 iObjectNum++; |
|
458 |
|
459 if ( iObjectNum >= iDocument.DataModel()->SmilModel().SlideObjectCount( iSlideNum ) ) |
|
460 { |
|
461 iSlideNum++; |
|
462 iObjectNum = 0; |
|
463 } |
|
464 } |
|
465 } |
|
466 } |
|
467 |
|
468 // --------------------------------------------------------- |
|
469 // CUniEditorSendUiOperation::DoPrepareObjectL |
|
470 // --------------------------------------------------------- |
|
471 // |
|
472 void CUniEditorSendUiOperation::DoPrepareObjectL( CUniObject* aObject ) |
|
473 { |
|
474 switch ( aObject->MediaType() ) |
|
475 { |
|
476 case EMsgMediaImage: |
|
477 { |
|
478 if ( !iImageOperation ) |
|
479 { |
|
480 iImageOperation = CUniEditorProcessImageOperation::NewL( *this, iDocument, iFs ); |
|
481 } |
|
482 |
|
483 // Processes if needed: |
|
484 iImageOperation->Process( static_cast<CMsgImageInfo*>( aObject->MediaInfo() ), |
|
485 aObject->AttachmentId(), |
|
486 iPreviousSize ); |
|
487 iPreparedObject = aObject; |
|
488 |
|
489 SetPending(); |
|
490 return; |
|
491 } |
|
492 case EMsgMediaVideo: |
|
493 { |
|
494 //We need video conversion only for mp4 videos |
|
495 if ( aObject->MimeType().Compare( KMsgMimeVideoMp4 ) == 0 ) |
|
496 { |
|
497 if ( CUniEditorConvertVideoOperation::IsImplementedL() ) |
|
498 { |
|
499 if ( !iVideoOperation ) |
|
500 { |
|
501 iVideoOperation = CUniEditorConvertVideoOperation::NewL( *this, iDocument, iFs ); |
|
502 } |
|
503 |
|
504 // Processes if needed: |
|
505 iVideoOperation->Process( static_cast<CMsgVideoInfo*>( aObject->MediaInfo() ), |
|
506 aObject->AttachmentId(), |
|
507 iDocument.MaxMessageSize() ); |
|
508 iPreparedObject = aObject; |
|
509 |
|
510 SetPending(); |
|
511 return; |
|
512 } |
|
513 } |
|
514 break; |
|
515 } |
|
516 case EMsgMediaXhtml: |
|
517 { |
|
518 #ifdef RD_MSG_XHTML_SUPPORT |
|
519 // Processes all XHTML objects and converts them into plain text. |
|
520 iTextOperation = CUniEditorProcessTextOperation::NewL( *this, iDocument, iFs ); |
|
521 iTextOperation->Start(); |
|
522 |
|
523 SetPending(); |
|
524 return; |
|
525 #else |
|
526 break; |
|
527 #endif |
|
528 } |
|
529 case EMsgMediaText: |
|
530 case EMsgMediaAudio: |
|
531 default: |
|
532 { |
|
533 // nothing |
|
534 break; |
|
535 } |
|
536 } |
|
537 |
|
538 iPreparedObject = aObject; |
|
539 CompleteSelf( KErrNone ); |
|
540 } |
|
541 |
|
542 // --------------------------------------------------------- |
|
543 // CUniEditorSendUiOperation::DoSendUiPrepareAttachmentsL |
|
544 // --------------------------------------------------------- |
|
545 // |
|
546 void CUniEditorSendUiOperation::DoSendUiPrepareAttachmentsL() |
|
547 { |
|
548 TInt smilSize = iObjectsSize + iDocument.DataModel()->SmilModel().SmilComposeSize(); |
|
549 |
|
550 TInt attaSize = 0; |
|
551 TInt j = 0; |
|
552 |
|
553 CUniObjectList& attachments = iDocument.DataModel()->AttachmentList(); |
|
554 |
|
555 if ( attachments.Count() ) |
|
556 { |
|
557 while ( TUint( smilSize + attaSize ) < iDocument.MaxMessageSize() ) |
|
558 { |
|
559 attaSize += attachments.GetByIndex( j )->Size(); |
|
560 j++; |
|
561 if ( j >= attachments.Count() && |
|
562 TUint( smilSize + attaSize ) < iDocument.MaxMessageSize() ) |
|
563 { |
|
564 j++; |
|
565 break; |
|
566 } |
|
567 } |
|
568 j--; |
|
569 while ( j < attachments.Count() ) |
|
570 { |
|
571 CUniObject* obj = attachments.GetByIndex( j ); |
|
572 attachments.RemoveObjectL( obj ); |
|
573 SetError( EUniSendUiTooBig ); |
|
574 delete obj; |
|
575 } |
|
576 } |
|
577 iOperationState = EUniEditorSendUiEnd; |
|
578 CompleteSelf( KErrNone ); |
|
579 } |
|
580 |
|
581 // --------------------------------------------------------- |
|
582 // CUniEditorSendUiOperation::HandleOperationEvent |
|
583 // --------------------------------------------------------- |
|
584 // |
|
585 void CUniEditorSendUiOperation::HandleOperationEvent( TUniEditorOperationType aOperation, |
|
586 TUniEditorOperationEvent /*aEvent*/ ) |
|
587 { |
|
588 TBool remove( EFalse ); |
|
589 |
|
590 TMsvAttachmentId attaId( KMsvNullIndexEntryId ); |
|
591 CMsgMediaInfo* info = NULL; |
|
592 |
|
593 if ( aOperation == EUniEditorOperationProcessImage ) |
|
594 { |
|
595 // Process image error handling |
|
596 CArrayFixFlat<TInt>* errors = iImageOperation->GetErrors(); |
|
597 for ( TInt i = 0; i < errors->Count(); i++ ) |
|
598 { |
|
599 if ( errors->At( i ) == EUniProcessImgUserAbort ) |
|
600 { |
|
601 iOperationState = EUniEditorSendUiEnd; |
|
602 } |
|
603 else if ( ( errors->At( i ) == EUniProcessImgCouldNotScale && |
|
604 iDocument.CreationMode() == EMmsCreationModeRestricted ) || |
|
605 errors->At( i ) == EUniProcessImgNotFound ) |
|
606 { |
|
607 remove = ETrue; |
|
608 } |
|
609 |
|
610 SetError( errors->At( i ) ); |
|
611 } |
|
612 |
|
613 info = iImageOperation->DetachImageInfo(); |
|
614 iImageOperation->DetachAttachmentId( attaId ); |
|
615 } |
|
616 else if ( aOperation == EUniEditorOperationConvertVideo ) |
|
617 { |
|
618 // Convert video error handling |
|
619 CArrayFixFlat<TInt>* errors = iVideoOperation->GetErrors(); |
|
620 for ( TInt i = 0; i < errors->Count(); i++ ) |
|
621 { |
|
622 if ( errors->At( i ) == EUniConvertVidUserAbort ) |
|
623 { |
|
624 iOperationState = EUniEditorSendUiEnd; |
|
625 } |
|
626 else if ( ( errors->At( i ) == EUniConvertVidFailed && |
|
627 iDocument.CreationMode() == EMmsCreationModeRestricted ) || |
|
628 errors->At( i ) == EUniConvertVidNotFound ) |
|
629 { |
|
630 remove = ETrue; |
|
631 } |
|
632 |
|
633 SetError( errors->At( i ) ); |
|
634 } |
|
635 |
|
636 info = iVideoOperation->DetachVideoInfo(); |
|
637 iVideoOperation->DetachAttachmentId( attaId ); |
|
638 } |
|
639 #ifdef RD_MSG_XHTML_SUPPORT |
|
640 else if ( aOperation == EUniEditorOperationProcessText ) |
|
641 { |
|
642 CArrayFixFlat<TInt>* errors = iTextOperation->GetErrors(); |
|
643 for ( TInt i = 0; i < errors->Count(); i++ ) |
|
644 { |
|
645 SetError( errors->At( i ) ); |
|
646 } |
|
647 } |
|
648 #endif |
|
649 |
|
650 if ( info ) |
|
651 { |
|
652 TRAPD( error, |
|
653 iDocument.DataModel()->SmilModel().RemoveObjectL( iSlideNum, iPreparedObject ) ); |
|
654 |
|
655 if ( !error ) |
|
656 { |
|
657 iPreparedObject = NULL; |
|
658 TRAP_IGNORE( iPreparedObject = iDocument.DataModel()->SmilModel().AddStoredObjectL( iSlideNum, attaId, info ) ); |
|
659 } |
|
660 else // --> original object remains... |
|
661 { |
|
662 delete info; |
|
663 } |
|
664 } |
|
665 |
|
666 if ( remove && iPreparedObject ) |
|
667 { |
|
668 TRAPD( err, iDocument.DataModel()->SmilModel().RemoveObjectByIndexL( iSlideNum, iObjectNum ) ); |
|
669 |
|
670 if ( !err && |
|
671 !iDocument.DataModel()->SmilModel().SlideObjectCount( iSlideNum ) ) |
|
672 { |
|
673 iDocument.DataModel()->SmilModel().RemoveSlide( iSlideNum ); |
|
674 } |
|
675 |
|
676 iPreparedObject = NULL; |
|
677 } |
|
678 |
|
679 //else --> original object remains... |
|
680 CompleteOperation( KErrNone ); |
|
681 } |
|
682 // --------------------------------------------------------- |
|
683 // CUniEditorSendUiOperation::IsOptimizedFlagSet |
|
684 // --------------------------------------------------------- |
|
685 // |
|
686 TBool CUniEditorSendUiOperation::IsOptimizedFlagSet() |
|
687 { |
|
688 return iOptimizedFlow; |
|
689 } |
|
690 // EOF |