60
|
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:
|
|
15 |
* Defines implementation of CUniSlideLoader class methods.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
// INCLUDE FILES
|
|
22 |
#include "UniSlideLoader.h"
|
|
23 |
|
|
24 |
#include <mtclbase.h>
|
|
25 |
|
|
26 |
#include <eikrted.h>
|
|
27 |
#include <data_caging_path_literals.hrh>
|
|
28 |
#include <barsread.h>
|
|
29 |
|
|
30 |
#include <AknUtils.h>
|
|
31 |
#include <aknlayoutscalable_apps.cdl.h>
|
|
32 |
#include <AknsConstants.h>
|
|
33 |
#include <AknBitmapAnimation.h>
|
|
34 |
|
|
35 |
#include <AudioPreference.h>
|
|
36 |
|
|
37 |
#include <MsgEditorView.h>
|
|
38 |
#include <MsgEditorCommon.h>
|
|
39 |
#include <MsgBaseControl.h>
|
|
40 |
#include <MsgBodyControl.h>
|
|
41 |
#include <msgasynccontrol.h>
|
|
42 |
#include <msgxhtmlbodycontrol.h>
|
|
43 |
|
|
44 |
#include <MsgMediaInfo.h>
|
|
45 |
#include <MsgMimeTypes.h>
|
|
46 |
#include <fileprotectionresolver.h>
|
|
47 |
|
|
48 |
#include <DRMCommon.h>
|
|
49 |
#include <DRMNotifier.h>
|
|
50 |
|
|
51 |
#include <mmsconst.h>
|
|
52 |
|
|
53 |
#include <uniutils.mbg>
|
|
54 |
#include <UniUtils.rsg>
|
|
55 |
|
|
56 |
#include <uniobject.h>
|
|
57 |
#include <unidatamodel.h>
|
|
58 |
#include <unimodelconst.h>
|
|
59 |
#include <unimimeinfo.h>
|
|
60 |
#include <unidrminfo.h>
|
|
61 |
#include <unitextobject.h>
|
|
62 |
|
|
63 |
#include <msgmediacontrol.h>
|
|
64 |
#include <msgaudiocontrol.h>
|
|
65 |
#include <msgimagecontrol.h>
|
|
66 |
#include <msgvideocontrol.h>
|
|
67 |
|
|
68 |
#ifdef RD_SVGT_IN_MESSAGING
|
|
69 |
#include <msgsvgcontrol.h>
|
|
70 |
#endif
|
|
71 |
|
|
72 |
#include "UniUtils.h"
|
|
73 |
#include "UniEditorLogging.h"
|
|
74 |
|
|
75 |
// ==========================================================
|
|
76 |
|
|
77 |
// EXTERNAL DATA STRUCTURES
|
|
78 |
|
|
79 |
// EXTERNAL FUNCTION PROTOTYPES
|
|
80 |
|
|
81 |
// CONSTANTS
|
|
82 |
|
|
83 |
const TInt KViewerAnimationLoopCount = -1;
|
|
84 |
const TInt KEditorAnimationLoopCount = 1;
|
|
85 |
|
|
86 |
// MACROS
|
|
87 |
|
|
88 |
// LOCAL CONSTANTS AND MACROS
|
|
89 |
enum TUniIconType
|
|
90 |
{
|
|
91 |
EUniIconNoRightsSendable, // no rights and can be sent
|
|
92 |
EUniIconNoRightsNotSendable, // no rights but cannot be sent
|
|
93 |
EUniIconDrmSendable, // drm protected content and can be sent
|
|
94 |
EUniIconDrmNotSendable, // drm protected content and cannot be sent
|
|
95 |
EUniIconCorrupted
|
|
96 |
};
|
|
97 |
|
|
98 |
// MODULE DATA STRUCTURES
|
|
99 |
|
|
100 |
// LOCAL FUNCTION PROTOTYPES
|
|
101 |
|
|
102 |
// ================= MEMBER FUNCTIONS =======================
|
|
103 |
|
|
104 |
// ---------------------------------------------------------
|
|
105 |
// CUniSlideLoader::CUniSlideLoader
|
|
106 |
//
|
|
107 |
// Constructor.
|
|
108 |
// ---------------------------------------------------------
|
|
109 |
//
|
|
110 |
CUniSlideLoader::CUniSlideLoader( MUniObjectObserver* aUniObjectObserver,
|
|
111 |
MMsgAsyncControlObserver& aControlObserver,
|
|
112 |
CUniDataModel& aDataModel,
|
|
113 |
CMsgEditorView& aView,
|
|
114 |
TUniControlMode aControlMode ) :
|
|
115 |
CActive( EPriorityStandard ),
|
|
116 |
iControlObserver( aControlObserver ),
|
|
117 |
iDataModel( aDataModel ),
|
|
118 |
iView( aView ),
|
|
119 |
iControlMode( aControlMode ),
|
|
120 |
iResourceLoader( *iView.ControlEnv() ),
|
|
121 |
iUniObjectObserver ( aUniObjectObserver )
|
|
122 |
{
|
|
123 |
CActiveScheduler::Add( this );
|
|
124 |
}
|
|
125 |
|
|
126 |
// ---------------------------------------------------------
|
|
127 |
// CUniSlideLoader::ConstructL
|
|
128 |
//
|
|
129 |
//
|
|
130 |
// ---------------------------------------------------------
|
|
131 |
//
|
|
132 |
void CUniSlideLoader::ConstructL()
|
|
133 |
{
|
|
134 |
if ( !iView.ControlEnv()->IsResourceAvailableL( R_UNUT_EDITOR_WAIT_ANIM ) )
|
|
135 |
{
|
|
136 |
TParse parse;
|
|
137 |
parse.Set( KUniUtilsResourceFileName, &KDC_RESOURCE_FILES_DIR, NULL );
|
|
138 |
TFileName fileName( parse.FullName() );
|
|
139 |
iResourceLoader.OpenL( fileName );
|
|
140 |
}
|
|
141 |
}
|
|
142 |
|
|
143 |
|
|
144 |
// ---------------------------------------------------------
|
|
145 |
// CUniSlideLoader::NewL
|
|
146 |
//
|
|
147 |
// Two-phased constructor.
|
|
148 |
// ---------------------------------------------------------
|
|
149 |
//
|
|
150 |
EXPORT_C CUniSlideLoader* CUniSlideLoader::NewL(
|
|
151 |
MMsgAsyncControlObserver& aControlObserver,
|
|
152 |
CUniDataModel& aDataModel,
|
|
153 |
CMsgEditorView& aView,
|
|
154 |
TUniControlMode aControlMode )
|
|
155 |
{
|
|
156 |
return CUniSlideLoader::NewL( NULL, aControlObserver, aDataModel, aView, aControlMode );
|
|
157 |
}
|
|
158 |
|
|
159 |
|
|
160 |
// ---------------------------------------------------------
|
|
161 |
// CUniSlideLoader::NewL
|
|
162 |
//
|
|
163 |
// Two-phased constructor.
|
|
164 |
// ---------------------------------------------------------
|
|
165 |
//
|
|
166 |
EXPORT_C CUniSlideLoader* CUniSlideLoader::NewL(
|
|
167 |
MUniObjectObserver* aUniObjectObserver,
|
|
168 |
MMsgAsyncControlObserver& aControlObserver,
|
|
169 |
CUniDataModel& aDataModel,
|
|
170 |
CMsgEditorView& aView,
|
|
171 |
TUniControlMode aControlMode )
|
|
172 |
{
|
|
173 |
CUniSlideLoader* self = new ( ELeave ) CUniSlideLoader( aUniObjectObserver,
|
|
174 |
aControlObserver,
|
|
175 |
aDataModel,
|
|
176 |
aView,
|
|
177 |
aControlMode );
|
|
178 |
CleanupStack::PushL( self );
|
|
179 |
self->ConstructL();
|
|
180 |
CleanupStack::Pop();
|
|
181 |
return self;
|
|
182 |
}
|
|
183 |
|
|
184 |
// ---------------------------------------------------------
|
|
185 |
// CUniSlideLoader::~CUniSlideLoader
|
|
186 |
//
|
|
187 |
// Destructor
|
|
188 |
// ---------------------------------------------------------
|
|
189 |
//
|
|
190 |
CUniSlideLoader::~CUniSlideLoader()
|
|
191 |
{
|
|
192 |
Cancel();
|
|
193 |
|
|
194 |
iResourceLoader.Close();
|
|
195 |
|
|
196 |
RemoveObservers( );
|
|
197 |
}
|
|
198 |
|
|
199 |
// ---------------------------------------------------------
|
|
200 |
// CUniSlideLoader::LoadSlideL
|
|
201 |
// ---------------------------------------------------------
|
|
202 |
EXPORT_C void CUniSlideLoader::LoadSlideL(
|
|
203 |
MUniSlideLoaderObserver& aSlideObserver,
|
|
204 |
TInt aSlideNum )
|
|
205 |
{
|
|
206 |
TInt slideCount = iDataModel.SmilModel().SlideCount();
|
|
207 |
if ( slideCount &&
|
|
208 |
( aSlideNum < 0 || aSlideNum >= slideCount ) )
|
|
209 |
{
|
|
210 |
User::Leave( KErrArgument );
|
|
211 |
}
|
|
212 |
iSlideObserver = &aSlideObserver;
|
|
213 |
iLoadedSlide = aSlideNum;
|
|
214 |
iObjectNum = 0;
|
|
215 |
iOperation = ELoadSlide;
|
|
216 |
iError = KErrNone;
|
|
217 |
CompleteSelf();
|
|
218 |
}
|
|
219 |
|
|
220 |
// ---------------------------------------------------------
|
|
221 |
// CUniSlideLoader::LoadObject
|
|
222 |
// ---------------------------------------------------------
|
|
223 |
//
|
|
224 |
EXPORT_C void CUniSlideLoader::LoadObject(
|
|
225 |
MUniSlideLoaderObserver& aSlideObserver,
|
|
226 |
CUniObject* aObject )
|
|
227 |
{
|
|
228 |
iSlideObserver = &aSlideObserver;
|
|
229 |
iOperation = ELoadObject;
|
|
230 |
iObjectNum = 1;
|
|
231 |
iLoadedObject = aObject;
|
|
232 |
iError = KErrNone;
|
|
233 |
CompleteSelf();
|
|
234 |
}
|
|
235 |
|
|
236 |
// ---------------------------------------------------------
|
|
237 |
// CUniSlideLoader::ResetViewL
|
|
238 |
// ---------------------------------------------------------
|
|
239 |
//
|
|
240 |
EXPORT_C void CUniSlideLoader::ResetViewL()
|
|
241 |
{
|
|
242 |
RemoveObservers( );
|
|
243 |
|
|
244 |
// remove control from message text object
|
|
245 |
CUniObject* obj = iDataModel.SmilModel().GetObject( iLoadedSlide, EUniRegionText );
|
|
246 |
if ( obj &&
|
|
247 |
( obj->MediaType() == EMsgMediaText ||
|
|
248 |
obj->MediaType() == EMsgMediaXhtml ) )
|
|
249 |
{
|
|
250 |
static_cast<CUniTextObject*>( obj )->SetText( NULL );
|
|
251 |
}
|
|
252 |
iView.DeleteControlL( EMsgComponentIdBody );
|
|
253 |
iView.DeleteControlL( EMsgComponentIdImage );
|
|
254 |
iView.DeleteControlL( EMsgComponentIdVideo );
|
|
255 |
iView.DeleteControlL( EMsgComponentIdAudio );
|
|
256 |
#ifdef RD_SVGT_IN_MESSAGING
|
|
257 |
iView.DeleteControlL( EMsgComponentIdSvg );
|
|
258 |
#endif
|
|
259 |
}
|
|
260 |
|
|
261 |
// ---------------------------------------------------------
|
|
262 |
// CUniSlideLoader::DoCancel
|
|
263 |
//
|
|
264 |
// ---------------------------------------------------------
|
|
265 |
//
|
|
266 |
void CUniSlideLoader::DoCancel()
|
|
267 |
{
|
|
268 |
iSlideObserver->SlideLoadReady( KErrCancel );
|
|
269 |
}
|
|
270 |
|
|
271 |
// ---------------------------------------------------------
|
|
272 |
// CUniSlideLoader::RunL
|
|
273 |
//
|
|
274 |
// ---------------------------------------------------------
|
|
275 |
//
|
|
276 |
void CUniSlideLoader::RunL()
|
|
277 |
{
|
|
278 |
if ( iOperation == ELoadSlide )
|
|
279 |
{
|
|
280 |
LoadSlideStepL();
|
|
281 |
}
|
|
282 |
else
|
|
283 |
{
|
|
284 |
LoadObjectStepL();
|
|
285 |
}
|
|
286 |
}
|
|
287 |
|
|
288 |
// ---------------------------------------------------------
|
|
289 |
// CUniSlideLoader::RunError
|
|
290 |
//
|
|
291 |
// ---------------------------------------------------------
|
|
292 |
//
|
|
293 |
TInt CUniSlideLoader::RunError( TInt aError )
|
|
294 |
{
|
|
295 |
iError = aError;
|
|
296 |
CompleteSelf();
|
|
297 |
return KErrNone;
|
|
298 |
}
|
|
299 |
|
|
300 |
// ---------------------------------------------------------
|
|
301 |
// CUniSlideLoader::CompleteSelf
|
|
302 |
//
|
|
303 |
// Completes current step of state machine
|
|
304 |
// ---------------------------------------------------------
|
|
305 |
//
|
|
306 |
void CUniSlideLoader::CompleteSelf()
|
|
307 |
{
|
|
308 |
iStatus = KRequestPending;
|
|
309 |
TRequestStatus* pStatus = &iStatus;
|
|
310 |
SetActive();
|
|
311 |
User::RequestComplete( pStatus, KErrNone );
|
|
312 |
}
|
|
313 |
|
|
314 |
// ---------------------------------------------------------
|
|
315 |
// CUniSlideLoader::SetSlideStepL
|
|
316 |
// ---------------------------------------------------------
|
|
317 |
//
|
|
318 |
void CUniSlideLoader::LoadSlideStepL()
|
|
319 |
{
|
|
320 |
CUniObject* obj = iDataModel.SmilModel().GetObjectByIndex( iLoadedSlide, iObjectNum );
|
|
321 |
// must be set before leaving
|
|
322 |
iObjectNum++;
|
|
323 |
if ( obj )
|
|
324 |
{
|
|
325 |
LoadObjectL( obj );
|
|
326 |
}
|
|
327 |
else
|
|
328 |
{
|
|
329 |
if (!iDataModel.SmilModel().GetObject( iLoadedSlide, EUniRegionText ) )
|
|
330 |
{
|
|
331 |
// Add empty text control
|
|
332 |
LoadTextL( NULL );
|
|
333 |
}
|
|
334 |
iSlideObserver->SlideLoadReady( iError );
|
|
335 |
}
|
|
336 |
}
|
|
337 |
|
|
338 |
// ---------------------------------------------------------
|
|
339 |
// CUniSlideLoader::SetObjectStepL
|
|
340 |
// ---------------------------------------------------------
|
|
341 |
//
|
|
342 |
void CUniSlideLoader::LoadObjectStepL()
|
|
343 |
{
|
|
344 |
if ( iObjectNum )
|
|
345 |
{
|
|
346 |
// must be set before leaving
|
|
347 |
iObjectNum--;
|
|
348 |
LoadObjectL( iLoadedObject );
|
|
349 |
}
|
|
350 |
else
|
|
351 |
{
|
|
352 |
iSlideObserver->SlideLoadReady( iError );
|
|
353 |
}
|
|
354 |
}
|
|
355 |
|
|
356 |
// ---------------------------------------------------------
|
|
357 |
// CUniSlideLoader::LoadObjectL
|
|
358 |
// ---------------------------------------------------------
|
|
359 |
//
|
|
360 |
void CUniSlideLoader::LoadObjectL( CUniObject* aObject )
|
|
361 |
{
|
|
362 |
switch ( aObject->Region() )
|
|
363 |
{
|
|
364 |
case EUniRegionText:
|
|
365 |
{
|
|
366 |
LoadTextL( aObject );
|
|
367 |
break;
|
|
368 |
}
|
|
369 |
case EUniRegionImage:
|
|
370 |
{
|
|
371 |
if ( aObject->MediaType() == EMsgMediaVideo ||
|
|
372 |
aObject->MediaTypeBySmilTag() == EMsgMediaVideo )
|
|
373 |
{
|
|
374 |
LoadVideoL( aObject );
|
|
375 |
}
|
|
376 |
#ifdef RD_SVGT_IN_MESSAGING
|
|
377 |
else if ( aObject->MediaType() == EMsgMediaSvg ||
|
|
378 |
aObject->MediaTypeBySmilTag() == EMsgMediaSvg )
|
|
379 |
{
|
|
380 |
LoadSvgL( aObject );
|
|
381 |
}
|
|
382 |
#endif
|
|
383 |
else
|
|
384 |
{
|
|
385 |
LoadImageL( aObject );
|
|
386 |
}
|
|
387 |
break;
|
|
388 |
}
|
|
389 |
case EUniRegionAudio:
|
|
390 |
{
|
|
391 |
LoadAudioL( aObject );
|
|
392 |
break;
|
|
393 |
}
|
|
394 |
case EUniRegionUnresolved:
|
|
395 |
default:
|
|
396 |
{
|
|
397 |
break;
|
|
398 |
}
|
|
399 |
}
|
|
400 |
|
|
401 |
if ( iStatus != KRequestPending )
|
|
402 |
{
|
|
403 |
CompleteSelf();
|
|
404 |
}
|
|
405 |
}
|
|
406 |
|
|
407 |
// ---------------------------------------------------------
|
|
408 |
// CUniSlideLoader::LoadTextL
|
|
409 |
// ---------------------------------------------------------
|
|
410 |
//
|
|
411 |
void CUniSlideLoader::LoadTextL( CUniObject* aObject )
|
|
412 |
{
|
|
413 |
if ( aObject &&
|
|
414 |
aObject->MediaType() == EMsgMediaXhtml )
|
|
415 |
{
|
|
416 |
CMsgXhtmlBodyControl* textControl = CMsgXhtmlBodyControl::NewL( iView, this );
|
|
417 |
CleanupStack::PushL( textControl );
|
|
418 |
|
|
419 |
LoadControlL( *textControl, aObject );
|
|
420 |
|
|
421 |
AddToViewL( textControl, EMsgComponentIdBody, EMsgMediaXhtml, aObject );
|
|
422 |
CleanupStack::Pop( textControl );
|
|
423 |
|
|
424 |
CUniTextObject* obj = static_cast<CUniTextObject*>( aObject );
|
|
425 |
obj->SetText( &( textControl->Editor() ) );
|
|
426 |
|
|
427 |
SetActive();
|
|
428 |
iStatus= KRequestPending;
|
|
429 |
}
|
|
430 |
else
|
|
431 |
{
|
|
432 |
CMsgBodyControl* textControl = CMsgBodyControl::NewL( &iView );
|
|
433 |
CleanupStack::PushL( textControl );
|
|
434 |
|
|
435 |
textControl->SetControlId( EMsgComponentIdBody );
|
|
436 |
|
|
437 |
if ( aObject )
|
|
438 |
{
|
|
439 |
TUint attaCharset = aObject->MimeInfo()->Charset();
|
|
440 |
if ( !attaCharset )
|
|
441 |
{
|
|
442 |
//assume US-ASCII - mandated by RFC 2046
|
|
443 |
attaCharset = KMmsUsAscii;
|
|
444 |
}
|
|
445 |
|
|
446 |
TUint charconvCharsetID = 0;
|
|
447 |
charconvCharsetID = iDataModel.DataUtils().MibIdToCharconvIdL( attaCharset );
|
|
448 |
|
|
449 |
RFile file = CUniDataUtils::GetAttachmentFileL( iDataModel.Mtm(), aObject->AttachmentId() );
|
|
450 |
CleanupClosePushL( file );
|
|
451 |
|
|
452 |
RFileReadStream stream( file );
|
|
453 |
CleanupClosePushL( stream );
|
|
454 |
|
|
455 |
CPlainText::TImportExportParam param;
|
|
456 |
param.iForeignEncoding = charconvCharsetID;
|
|
457 |
param.iOrganisation = CPlainText::EOrganiseByParagraph;
|
|
458 |
|
|
459 |
CPlainText::TImportExportResult result;
|
|
460 |
|
|
461 |
TRAPD( err, textControl->Editor().Text()->ImportTextL( 0, stream, param, result ) );
|
|
462 |
if ( err != KErrNone )
|
|
463 |
{
|
|
464 |
textControl->Reset();
|
|
465 |
User::Leave( err );
|
|
466 |
}
|
|
467 |
|
|
468 |
CleanupStack::PopAndDestroy( 2, &file );
|
|
469 |
|
|
470 |
CUniTextObject* obj = static_cast<CUniTextObject*>( aObject );
|
|
471 |
obj->SetText( &( textControl->Editor() ) );
|
|
472 |
}
|
|
473 |
else
|
|
474 |
{
|
|
475 |
if ( iDataModel.Mtm().Body().DocumentLength() > 0 )
|
|
476 |
{
|
|
477 |
TRAPD( err,
|
|
478 |
{
|
|
479 |
textControl->SetTextContentL( iDataModel.Mtm().Body() );
|
|
480 |
if ( !iDataModel.SmilModel().IsSlide( 0 ) )
|
|
481 |
{
|
|
482 |
// Add slide
|
|
483 |
iDataModel.SmilModel().AddSlideL( 0 );
|
|
484 |
}
|
|
485 |
|
|
486 |
iDataModel.SmilModel().AddTextObjectL( 0, &( textControl->Editor() ) );
|
|
487 |
} );
|
|
488 |
|
|
489 |
if ( err != KErrNone )
|
|
490 |
{
|
|
491 |
textControl->Reset();
|
|
492 |
User::Leave( err );
|
|
493 |
}
|
|
494 |
|
|
495 |
iDataModel.Mtm().Body().Reset();
|
|
496 |
}
|
|
497 |
}
|
|
498 |
|
|
499 |
AddToViewL( textControl, EMsgComponentIdBody, EMsgMediaText, aObject );
|
|
500 |
CleanupStack::Pop( textControl );
|
|
501 |
}
|
|
502 |
}
|
|
503 |
|
|
504 |
// ---------------------------------------------------------
|
|
505 |
// CUniSlideLoader::LoadImageL
|
|
506 |
// ---------------------------------------------------------
|
|
507 |
//
|
|
508 |
void CUniSlideLoader::LoadImageL( CUniObject* aObject )
|
|
509 |
{
|
|
510 |
CMsgImageControl* imageControl = CMsgImageControl::NewL( iView, this );
|
|
511 |
CleanupStack::PushL( imageControl );
|
|
512 |
|
|
513 |
if ( LoadControlL( *imageControl, aObject ) &&
|
|
514 |
ConsumeDrmRights( aObject ) )
|
|
515 |
{
|
|
516 |
if ( iControlMode == EUniControlViewerMode )
|
|
517 |
{
|
|
518 |
imageControl->SetAnimationLoopCount( KViewerAnimationLoopCount );
|
|
519 |
}
|
|
520 |
else
|
|
521 |
{
|
|
522 |
imageControl->SetAnimationLoopCount( KEditorAnimationLoopCount );
|
|
523 |
}
|
|
524 |
|
|
525 |
imageControl->PlayL();
|
|
526 |
}
|
|
527 |
|
|
528 |
UpdateControlIconL( *imageControl, aObject );
|
|
529 |
|
|
530 |
AddToViewL( imageControl, EMsgComponentIdImage, EMsgMediaImage, aObject );
|
|
531 |
|
|
532 |
CleanupStack::Pop( imageControl );
|
|
533 |
}
|
|
534 |
|
|
535 |
// ---------------------------------------------------------
|
|
536 |
// CUniSlideLoader::LoadAudioL
|
|
537 |
// ---------------------------------------------------------
|
|
538 |
//
|
|
539 |
void CUniSlideLoader::LoadAudioL( CUniObject* aObject )
|
|
540 |
{
|
|
541 |
CMsgAudioControl* audioControl = CMsgAudioControl::NewL( iView,
|
|
542 |
this,
|
|
543 |
TMdaPriority( KAudioPriorityMmsViewer ),
|
|
544 |
TMdaPriorityPreference( KAudioPrefMmsViewer ) );
|
|
545 |
CleanupStack::PushL( audioControl );
|
|
546 |
|
|
547 |
if ( iControlMode == EUniControlViewerMode )
|
|
548 |
{
|
|
549 |
LoadControlL( *audioControl, aObject );
|
|
550 |
}
|
|
551 |
|
|
552 |
UpdateControlIconL( *audioControl, aObject );
|
|
553 |
|
|
554 |
AddToViewL( audioControl, EMsgComponentIdAudio, EMsgMediaAudio, aObject );
|
|
555 |
|
|
556 |
CleanupStack::Pop( audioControl );
|
|
557 |
}
|
|
558 |
|
|
559 |
// ---------------------------------------------------------
|
|
560 |
// CUniSlideLoader::LoadVideoL
|
|
561 |
// ---------------------------------------------------------
|
|
562 |
//
|
|
563 |
void CUniSlideLoader::LoadVideoL( CUniObject* aObject )
|
|
564 |
{
|
|
565 |
TInt flags = 0;
|
|
566 |
if ( iControlMode == EUniControlEditorMode )
|
|
567 |
{
|
|
568 |
flags |= CMsgVideoControl::ENoPlayback;
|
|
569 |
}
|
|
570 |
|
|
571 |
CMsgVideoControl* videoControl = CMsgVideoControl::NewL( iView,
|
|
572 |
this,
|
|
573 |
TMdaPriority( KAudioPriorityMmsViewer ),
|
|
574 |
TMdaPriorityPreference( KAudioPrefMmsViewer ),
|
|
575 |
flags );
|
|
576 |
CleanupStack::PushL( videoControl );
|
|
577 |
|
|
578 |
if ( iControlMode == EUniControlViewerMode )
|
|
579 |
{
|
|
580 |
LoadControlL( *videoControl, aObject );
|
|
581 |
}
|
|
582 |
|
|
583 |
UpdateControlIconL( *videoControl, aObject );
|
|
584 |
|
|
585 |
AddToViewL( videoControl, EMsgComponentIdVideo, EMsgMediaVideo, aObject );
|
|
586 |
CleanupStack::Pop( videoControl );
|
|
587 |
}
|
|
588 |
|
|
589 |
// ---------------------------------------------------------
|
|
590 |
// CUniSlideLoader::LoadSvgL
|
|
591 |
// ---------------------------------------------------------
|
|
592 |
//
|
|
593 |
#ifdef RD_SVGT_IN_MESSAGING
|
|
594 |
void CUniSlideLoader::LoadSvgL( CUniObject* aObject )
|
|
595 |
{
|
|
596 |
CMsgSvgControl* svgControl = CMsgSvgControl::NewL( iView, this );
|
|
597 |
CleanupStack::PushL( svgControl );
|
|
598 |
|
|
599 |
if ( LoadControlL( *svgControl, aObject ) )
|
|
600 |
{
|
|
601 |
TParse* parser = new( ELeave ) TParse;
|
|
602 |
CleanupStack::PushL( parser );
|
|
603 |
|
|
604 |
parser->Set( KUniUtilsMBMFileName, &KDC_APP_BITMAP_DIR, NULL );
|
|
605 |
|
|
606 |
svgControl->LoadIndicatorIconL( KAknsIIDQgnGrafMmsPres,
|
|
607 |
parser->FullName(),
|
|
608 |
EMbmUniutilsQgn_graf_mms_pres,
|
|
609 |
EMbmUniutilsQgn_graf_mms_pres + 1 );
|
|
610 |
|
|
611 |
CleanupStack::PopAndDestroy( parser );
|
|
612 |
}
|
|
613 |
|
|
614 |
UpdateControlIconL( *svgControl, aObject );
|
|
615 |
|
|
616 |
AddToViewL( svgControl, EMsgComponentIdSvg, EMsgMediaSvg, aObject );
|
|
617 |
CleanupStack::Pop( svgControl );
|
|
618 |
}
|
|
619 |
#else
|
|
620 |
void CUniSlideLoader::LoadSvgL( CUniObject* /*aObject*/ )
|
|
621 |
{
|
|
622 |
}
|
|
623 |
#endif
|
|
624 |
|
|
625 |
// ---------------------------------------------------------
|
|
626 |
// CUniSlideLoader::LoadControlL
|
|
627 |
// ---------------------------------------------------------
|
|
628 |
//
|
|
629 |
TBool CUniSlideLoader::LoadControlL( MMsgAsyncControl& aMediaControl, CUniObject* aObject )
|
|
630 |
{
|
|
631 |
UNILOGGER_ENTERFN( "SlideLoader: LoadControlL" );
|
|
632 |
|
|
633 |
TBool result( EFalse );
|
|
634 |
|
|
635 |
// Observer is added even if loading fails.
|
|
636 |
aMediaControl.AddObserverL( iControlObserver );
|
|
637 |
if ( iUniObjectObserver )
|
|
638 |
{
|
|
639 |
aObject->SetObserverL( iUniObjectObserver );
|
|
640 |
}
|
|
641 |
TBool drmRightsValid( DrmRightsValid( aObject ) );
|
|
642 |
if ( aObject )
|
|
643 |
{
|
|
644 |
aObject->SetDrmRightsWhenLoaded( drmRightsValid );
|
|
645 |
}
|
|
646 |
if ( ( aObject && drmRightsValid )
|
|
647 |
#ifdef RD_SVGT_IN_MESSAGING
|
|
648 |
|| ( ( aObject && aObject->MediaType() == EMsgMediaSvg )
|
|
649 |
&& !drmRightsValid )
|
|
650 |
#endif
|
|
651 |
)
|
|
652 |
{
|
|
653 |
RFile file = CUniDataUtils::GetAttachmentFileL( iDataModel.Mtm(), aObject->AttachmentId() );
|
|
654 |
CleanupClosePushL( file );
|
|
655 |
|
|
656 |
TRAPD( error, aMediaControl.LoadL( file ) );
|
|
657 |
|
|
658 |
CleanupStack::PopAndDestroy( &file );
|
|
659 |
|
|
660 |
// DRM errors are handled on UpdateControlIconL
|
|
661 |
if ( error != KErrNone )
|
|
662 |
{
|
|
663 |
UNILOGGER_WRITEF( _L("SlideLoader: LoadL = %d "), error );
|
|
664 |
result = EFalse;
|
|
665 |
if ( !IsDRMError( error ) )
|
|
666 |
{
|
|
667 |
UNILOGGER_WRITE( "SlideLoader: Object set corrupted " );
|
|
668 |
aObject->SetCorrupted( ETrue );
|
|
669 |
}
|
|
670 |
}
|
|
671 |
else
|
|
672 |
{
|
|
673 |
result = ETrue;
|
|
674 |
}
|
|
675 |
}
|
|
676 |
|
|
677 |
UNILOGGER_LEAVEFN( "SlideLoader: LoadControlL" );
|
|
678 |
return result;
|
|
679 |
}
|
|
680 |
|
|
681 |
|
|
682 |
// ---------------------------------------------------------
|
|
683 |
// CUniSlideLoader::ReLoadControlL
|
|
684 |
// ---------------------------------------------------------
|
|
685 |
//
|
|
686 |
EXPORT_C void CUniSlideLoader::ReLoadControlL( CMsgMediaControl* aControl, CUniObject* aObject )
|
|
687 |
{
|
|
688 |
UNILOGGER_ENTERFN( "SlideLoader: ReLoadControlL" );
|
|
689 |
if ( !aControl
|
|
690 |
|| !aObject )
|
|
691 |
{
|
|
692 |
User::Leave( KErrNotFound );
|
|
693 |
}
|
|
694 |
|
|
695 |
TInt controlId = aControl->ControlId( );
|
|
696 |
if ( controlId == EMsgComponentIdImage
|
|
697 |
|| controlId == EMsgComponentIdVideo
|
|
698 |
|| controlId == EMsgComponentIdAudio
|
|
699 |
#ifdef RD_SVGT_IN_MESSAGING
|
|
700 |
|| controlId == EMsgComponentIdSvg
|
|
701 |
#endif
|
|
702 |
)
|
|
703 |
{
|
|
704 |
aControl->Stop();
|
|
705 |
aControl->Close();
|
|
706 |
TBool reLoaded = DoReLoadControlL( *aControl, aObject );
|
|
707 |
|
|
708 |
// if controls coded perfectly there should not be need to remove
|
|
709 |
// or add control.
|
|
710 |
if ( controlId == EMsgComponentIdImage
|
|
711 |
&& reLoaded )
|
|
712 |
{
|
|
713 |
// Image does not fit area of icon control
|
|
714 |
iView.RemoveControlL( EMsgComponentIdImage );
|
|
715 |
AddToViewL( aControl, EMsgComponentIdImage, EMsgMediaImage, aObject );
|
|
716 |
|
|
717 |
ConsumeDrmRights( aObject );
|
|
718 |
static_cast<CMsgImageControl*>( aControl )->PlayL();
|
|
719 |
}
|
|
720 |
else if ( controlId == EMsgComponentIdVideo
|
|
721 |
&& reLoaded )
|
|
722 |
{
|
|
723 |
iView.RemoveControlL( EMsgComponentIdVideo );
|
|
724 |
AddToViewL( aControl, EMsgComponentIdVideo, EMsgMediaVideo, aObject );
|
|
725 |
}
|
|
726 |
#ifdef RD_SVGT_IN_MESSAGING
|
|
727 |
else if ( controlId == EMsgComponentIdSvg )
|
|
728 |
{
|
|
729 |
iView.RemoveControlL( EMsgComponentIdSvg );
|
|
730 |
AddToViewL( aControl, EMsgComponentIdSvg, EMsgMediaSvg, aObject );
|
|
731 |
}
|
|
732 |
#endif
|
|
733 |
UpdateControlIconL( *aControl, aObject );
|
|
734 |
}
|
|
735 |
|
|
736 |
}
|
|
737 |
|
|
738 |
// ---------------------------------------------------------
|
|
739 |
// CUniSlideLoader::DoReLoadControlL
|
|
740 |
// ---------------------------------------------------------
|
|
741 |
//
|
|
742 |
TBool CUniSlideLoader::DoReLoadControlL( MMsgAsyncControl& aMediaControl, CUniObject* aObject )
|
|
743 |
{
|
|
744 |
UNILOGGER_ENTERFN( "SlideLoader: DoReLoadControlL" );
|
|
745 |
|
|
746 |
TBool result( EFalse );
|
|
747 |
|
|
748 |
TBool drmRightsValid( DrmRightsValid( aObject ) );
|
|
749 |
|
|
750 |
if ( aObject )
|
|
751 |
{
|
|
752 |
aObject->SetDrmRightsWhenLoaded( drmRightsValid );
|
|
753 |
}
|
|
754 |
if ( aObject && drmRightsValid )
|
|
755 |
{
|
|
756 |
RFile file = CUniDataUtils::GetAttachmentFileL( iDataModel.Mtm(), aObject->AttachmentId() );
|
|
757 |
CleanupClosePushL( file );
|
|
758 |
|
|
759 |
TRAPD( error, aMediaControl.LoadL( file ) );
|
|
760 |
|
|
761 |
CleanupStack::PopAndDestroy( &file );
|
|
762 |
|
|
763 |
// DRM errors are handled on UpdateControlIconL
|
|
764 |
if ( error != KErrNone )
|
|
765 |
{
|
|
766 |
UNILOGGER_WRITEF( _L("SlideLoader: LoadL = %d "), error );
|
|
767 |
result = EFalse;
|
|
768 |
if ( !IsDRMError( error ) )
|
|
769 |
{
|
|
770 |
UNILOGGER_WRITE( "SlideLoader: Object set corrupted " );
|
|
771 |
aObject->SetCorrupted( ETrue );
|
|
772 |
}
|
|
773 |
}
|
|
774 |
else
|
|
775 |
{
|
|
776 |
result = ETrue;
|
|
777 |
}
|
|
778 |
}
|
|
779 |
|
|
780 |
UNILOGGER_LEAVEFN( "SlideLoader: DoReLoadControlL" );
|
|
781 |
return result;
|
|
782 |
}
|
|
783 |
|
|
784 |
|
|
785 |
// ---------------------------------------------------------
|
|
786 |
// CUniSlideLoader::UpdateControlIconL
|
|
787 |
// ---------------------------------------------------------
|
|
788 |
//
|
|
789 |
EXPORT_C void CUniSlideLoader::UpdateControlIconL( CMsgMediaControl& aMediaControl, CUniObject* aObject )
|
|
790 |
{
|
|
791 |
if ( !aObject )
|
|
792 |
{
|
|
793 |
return;
|
|
794 |
}
|
|
795 |
|
|
796 |
TUniIconType iconType( EUniIconNoRightsNotSendable );
|
|
797 |
if ( aObject->MediaType() == EMsgMediaUnknown ||
|
|
798 |
aObject->Corrupted() )
|
|
799 |
{
|
|
800 |
iconType = EUniIconCorrupted;
|
|
801 |
}
|
|
802 |
else
|
|
803 |
{
|
|
804 |
if ( aObject->MediaInfo()->Protection() == EFileProtNoProtection )
|
|
805 |
{
|
|
806 |
iconType = EUniIconNoRightsSendable;
|
|
807 |
}
|
|
808 |
else if ( aObject->MediaInfo()->Protection() & EFileProtSuperDistributable )
|
|
809 |
{
|
|
810 |
iconType = EUniIconDrmSendable;
|
|
811 |
}
|
|
812 |
else if ( aObject->MediaInfo()->Protection() & EFileProtForwardLocked
|
|
813 |
|| aObject->MediaInfo()->Protection() & EFileProtClosedContent )
|
|
814 |
{
|
|
815 |
iconType = EUniIconDrmNotSendable;
|
|
816 |
}
|
|
817 |
// else - no more choices left
|
|
818 |
}
|
|
819 |
|
|
820 |
TBool validDrmRights( DrmRightsValid( aObject ) );
|
|
821 |
|
|
822 |
TAknsItemID iconId;
|
|
823 |
TInt bitmapId( -1 );
|
|
824 |
|
|
825 |
// value must be in sync with iconSize variable
|
|
826 |
TAknWindowLineLayout layOut( AknLayoutScalable_Apps::msg_data_pane_g7().LayoutLine() );
|
|
827 |
|
|
828 |
CAknBitmapAnimation* waitAnimation = NULL;
|
|
829 |
|
|
830 |
#ifdef RD_MSG_LOAD_ANIMATION
|
|
831 |
if ( aMediaControl.State() == EMsgAsyncControlStateOpening )
|
|
832 |
{
|
|
833 |
// Control at loading state so specify wait animation.
|
|
834 |
waitAnimation = CAknBitmapAnimation::NewL();
|
|
835 |
CleanupStack::PushL( waitAnimation );
|
|
836 |
|
|
837 |
TResourceReader resourceReader;
|
|
838 |
iView.ControlEnv()->CreateResourceReaderLC( resourceReader, R_UNUT_EDITOR_WAIT_ANIM );
|
|
839 |
|
|
840 |
waitAnimation->ConstructFromResourceL( resourceReader );
|
|
841 |
|
|
842 |
waitAnimation->ExcludeAnimationFramesFromCache();
|
|
843 |
|
|
844 |
CleanupStack::PopAndDestroy(); // resourceReader
|
|
845 |
}
|
|
846 |
#endif
|
|
847 |
|
|
848 |
switch ( aMediaControl.ControlId( ) )
|
|
849 |
{
|
|
850 |
case EMsgComponentIdAudio:
|
|
851 |
{
|
|
852 |
switch( iconType )
|
|
853 |
{
|
|
854 |
case EUniIconNoRightsSendable:
|
|
855 |
{
|
|
856 |
if ( iControlMode == EUniControlViewerMode )
|
|
857 |
{
|
|
858 |
iconId = KAknsIIDQgnGrafMmsAudioPlay;
|
|
859 |
bitmapId = EMbmUniutilsQgn_graf_mms_audio_play;
|
|
860 |
}
|
|
861 |
else
|
|
862 |
{
|
|
863 |
iconId = KAknsIIDQgnGrafMmsAudioInserted;
|
|
864 |
bitmapId = EMbmUniutilsQgn_graf_mms_audio_inserted;
|
|
865 |
}
|
|
866 |
break;
|
|
867 |
}
|
|
868 |
case EUniIconDrmSendable:
|
|
869 |
{
|
|
870 |
if ( validDrmRights )
|
|
871 |
{
|
|
872 |
iconId = KAknsIIDQgnGrafMmsAudioDrmValidSend;
|
|
873 |
bitmapId = EMbmUniutilsQgn_graf_mms_audio_drm_valid_send;
|
|
874 |
}
|
|
875 |
else
|
|
876 |
{
|
|
877 |
iconId = KAknsIIDQgnGrafMmsAudioDrm;
|
|
878 |
bitmapId = EMbmUniutilsQgn_graf_mms_audio_drm;
|
|
879 |
}
|
|
880 |
break;
|
|
881 |
}
|
|
882 |
case EUniIconDrmNotSendable:
|
|
883 |
{
|
|
884 |
if ( validDrmRights )
|
|
885 |
{
|
|
886 |
iconId = KAknsIIDQgnGrafMmsAudioDrmValidSendForbid;
|
|
887 |
bitmapId = EMbmUniutilsQgn_graf_mms_audio_drm_valid_send_forbid;
|
|
888 |
}
|
|
889 |
else
|
|
890 |
{
|
|
891 |
iconId = KAknsIIDQgnGrafMmsAudioDrmInvalidSendForbid;
|
|
892 |
bitmapId = EMbmUniutilsQgn_graf_mms_audio_drm_invalid_send_forbid;
|
|
893 |
}
|
|
894 |
break;
|
|
895 |
}
|
|
896 |
case EUniIconCorrupted:
|
|
897 |
{
|
|
898 |
iconId = KAknsIIDQgnGrafMmsAudioCorrupted;
|
|
899 |
bitmapId = EMbmUniutilsQgn_graf_mms_audio_corrupted;
|
|
900 |
break;
|
|
901 |
}
|
|
902 |
case EUniIconNoRightsNotSendable:
|
|
903 |
default:
|
|
904 |
{
|
|
905 |
iconId = KAknsIIDQgnGrafMmsAudioDrmValidSendForbid;
|
|
906 |
bitmapId = EMbmUniutilsQgn_graf_mms_audio_drm_valid_send_forbid;
|
|
907 |
break;
|
|
908 |
}
|
|
909 |
}
|
|
910 |
|
|
911 |
layOut = AknLayoutScalable_Apps::msg_data_pane_g6().LayoutLine();
|
|
912 |
break;
|
|
913 |
}
|
|
914 |
case EMsgComponentIdImage:
|
|
915 |
{
|
|
916 |
if ( !validDrmRights )
|
|
917 |
{
|
|
918 |
// Only show icon if rights are not valid. Otherwise show
|
|
919 |
// image itself.
|
|
920 |
switch( iconType )
|
|
921 |
{
|
|
922 |
case EUniIconNoRightsSendable:
|
|
923 |
{
|
|
924 |
// does not occur i.e. Image itself
|
|
925 |
break;
|
|
926 |
}
|
|
927 |
case EUniIconDrmSendable:
|
|
928 |
{
|
|
929 |
iconId = KAknsIIDQgnGrafMmsImageDrm;
|
|
930 |
bitmapId = EMbmUniutilsQgn_graf_mms_image_drm;
|
|
931 |
break;
|
|
932 |
}
|
|
933 |
case EUniIconDrmNotSendable:
|
|
934 |
{
|
|
935 |
iconId = KAknsIIDQgnGrafMmsImageDrmInvalidSendForbid;
|
|
936 |
bitmapId = EMbmUniutilsQgn_graf_mms_image_drm_invalid_send_forbid;
|
|
937 |
break;
|
|
938 |
}
|
|
939 |
case EUniIconCorrupted:
|
|
940 |
{
|
|
941 |
iconId = KAknsIIDQgnGrafMmsImageCorrupted;
|
|
942 |
bitmapId = EMbmUniutilsQgn_graf_mms_image_corrupted;
|
|
943 |
break;
|
|
944 |
}
|
|
945 |
case EUniIconNoRightsNotSendable:
|
|
946 |
default:
|
|
947 |
{
|
|
948 |
iconId = KAknsIIDQgnGrafMmsImageDrmInvalidSendForbid;
|
|
949 |
bitmapId = EMbmUniutilsQgn_graf_mms_image_drm_invalid_send_forbid;
|
|
950 |
break;
|
|
951 |
}
|
|
952 |
}
|
|
953 |
}
|
|
954 |
else
|
|
955 |
{
|
|
956 |
switch( iconType )
|
|
957 |
{
|
|
958 |
case EUniIconCorrupted:
|
|
959 |
{
|
|
960 |
iconId = KAknsIIDQgnGrafMmsImageCorrupted;
|
|
961 |
bitmapId = EMbmUniutilsQgn_graf_mms_image_corrupted;
|
|
962 |
break;
|
|
963 |
}
|
|
964 |
default:
|
|
965 |
{
|
|
966 |
// Image itself.
|
|
967 |
break;
|
|
968 |
}
|
|
969 |
}
|
|
970 |
}
|
|
971 |
|
|
972 |
layOut = AknLayoutScalable_Apps::msg_data_pane_g7().LayoutLine();
|
|
973 |
break;
|
|
974 |
}
|
|
975 |
case EMsgComponentIdVideo:
|
|
976 |
{
|
|
977 |
switch ( iconType )
|
|
978 |
{
|
|
979 |
case EUniIconNoRightsSendable:
|
|
980 |
{
|
|
981 |
if ( iControlMode == EUniControlViewerMode )
|
|
982 |
{
|
|
983 |
iconId = KAknsIIDQgnGrafMmsInsertedVideoView;
|
|
984 |
bitmapId = EMbmUniutilsQgn_graf_mms_inserted_video_view;
|
|
985 |
}
|
|
986 |
else
|
|
987 |
{
|
|
988 |
iconId = KAknsIIDQgnGrafMmsInsertedVideoEdit;
|
|
989 |
bitmapId = EMbmUniutilsQgn_graf_mms_inserted_video_edit;
|
|
990 |
}
|
|
991 |
break;
|
|
992 |
}
|
|
993 |
case EUniIconDrmSendable:
|
|
994 |
{
|
|
995 |
if ( validDrmRights )
|
|
996 |
{
|
|
997 |
iconId = KAknsIIDQgnGrafMmsVideoDrmValidSend;
|
|
998 |
bitmapId = EMbmUniutilsQgn_graf_mms_video_drm_valid_send;
|
|
999 |
}
|
|
1000 |
else
|
|
1001 |
{
|
|
1002 |
iconId = KAknsIIDQgnGrafMmsVideoDrm;
|
|
1003 |
bitmapId = EMbmUniutilsQgn_graf_mms_video_drm;
|
|
1004 |
}
|
|
1005 |
break;
|
|
1006 |
}
|
|
1007 |
case EUniIconDrmNotSendable:
|
|
1008 |
{
|
|
1009 |
if ( validDrmRights )
|
|
1010 |
{
|
|
1011 |
iconId = KAknsIIDQgnGrafMmsVideoDrmValidSendForbid;
|
|
1012 |
bitmapId = EMbmUniutilsQgn_graf_mms_video_drm_valid_send_forbid;
|
|
1013 |
}
|
|
1014 |
else
|
|
1015 |
{
|
|
1016 |
iconId = KAknsIIDQgnGrafMmsVideoDrmInvalidSendForbid;
|
|
1017 |
bitmapId = EMbmUniutilsQgn_graf_mms_video_drm_invalid_send_forbid;
|
|
1018 |
}
|
|
1019 |
break;
|
|
1020 |
}
|
|
1021 |
case EUniIconCorrupted:
|
|
1022 |
{
|
|
1023 |
iconId = KAknsIIDQgnGrafMmsVideoCorrupted;
|
|
1024 |
bitmapId = EMbmUniutilsQgn_graf_mms_video_corrupted;
|
|
1025 |
break;
|
|
1026 |
}
|
|
1027 |
case EUniIconNoRightsNotSendable:
|
|
1028 |
default:
|
|
1029 |
{
|
|
1030 |
iconId = KAknsIIDQgnGrafMmsVideoDrmValidSendForbid;
|
|
1031 |
bitmapId = EMbmUniutilsQgn_graf_mms_video_drm_valid_send_forbid;
|
|
1032 |
break;
|
|
1033 |
}
|
|
1034 |
}
|
|
1035 |
layOut = AknLayoutScalable_Apps::msg_data_pane_g7().LayoutLine();
|
|
1036 |
break;
|
|
1037 |
}
|
|
1038 |
#ifdef RD_SVGT_IN_MESSAGING
|
|
1039 |
case EMsgComponentIdSvg:
|
|
1040 |
{
|
|
1041 |
if ( !validDrmRights )
|
|
1042 |
{
|
|
1043 |
switch ( iconType )
|
|
1044 |
{
|
|
1045 |
// not needed - case EUniIconNoRightsSendable:
|
|
1046 |
case EUniIconDrmSendable:
|
|
1047 |
{
|
|
1048 |
if ( !validDrmRights )
|
|
1049 |
{
|
|
1050 |
iconId = KAknsIIDQgnGrafMmsPresDrmInvalidSend;
|
|
1051 |
bitmapId = EMbmUniutilsQgn_graf_mms_pres_drm_invalid_send;
|
|
1052 |
}
|
|
1053 |
else
|
|
1054 |
{
|
|
1055 |
iconId = KAknsIIDQgnGrafMmsPres;
|
|
1056 |
bitmapId = EMbmUniutilsQgn_graf_mms_pres;
|
|
1057 |
}
|
|
1058 |
break;
|
|
1059 |
}
|
|
1060 |
case EUniIconDrmNotSendable:
|
|
1061 |
{
|
|
1062 |
if ( !validDrmRights )
|
|
1063 |
{
|
|
1064 |
iconId = KAknsIIDQgnGrafMmsPresDrmInvalidSendForbid;
|
|
1065 |
bitmapId = EMbmUniutilsQgn_graf_mms_pres_drm_invalid_send_forbid;
|
|
1066 |
}
|
|
1067 |
else
|
|
1068 |
{
|
|
1069 |
iconId = KAknsIIDQgnGrafMmsPres;
|
|
1070 |
bitmapId = EMbmUniutilsQgn_graf_mms_pres;
|
|
1071 |
}
|
|
1072 |
break;
|
|
1073 |
}
|
|
1074 |
case EUniIconCorrupted:
|
|
1075 |
{
|
|
1076 |
iconId = KAknsIIDQgnGrafMmsPresCorrupted;
|
|
1077 |
bitmapId = EMbmUniutilsQgn_graf_mms_pres_corrupted;
|
|
1078 |
break;
|
|
1079 |
}
|
|
1080 |
default:
|
|
1081 |
{
|
|
1082 |
break;
|
|
1083 |
}
|
|
1084 |
}
|
|
1085 |
}
|
|
1086 |
else
|
|
1087 |
{
|
|
1088 |
switch( iconType )
|
|
1089 |
{
|
|
1090 |
case EUniIconCorrupted:
|
|
1091 |
{
|
|
1092 |
iconId = KAknsIIDQgnGrafMmsPresCorrupted;
|
|
1093 |
bitmapId = EMbmUniutilsQgn_graf_mms_pres_corrupted;
|
|
1094 |
break;
|
|
1095 |
}
|
|
1096 |
default:
|
|
1097 |
{
|
|
1098 |
// Svg itself.
|
|
1099 |
break;
|
|
1100 |
}
|
|
1101 |
}
|
|
1102 |
}
|
|
1103 |
|
|
1104 |
layOut = AknLayoutScalable_Apps::msg_data_pane_g7().LayoutLine();
|
|
1105 |
break;
|
|
1106 |
}
|
|
1107 |
#endif
|
|
1108 |
default:
|
|
1109 |
{
|
|
1110 |
break;
|
|
1111 |
}
|
|
1112 |
}
|
|
1113 |
|
|
1114 |
TAknLayoutRect placeholderLayout;
|
|
1115 |
placeholderLayout.LayoutRect( MsgEditorCommons::MsgDataPane(),
|
|
1116 |
layOut );
|
|
1117 |
|
|
1118 |
if ( waitAnimation )
|
|
1119 |
{
|
|
1120 |
aMediaControl.SetAnimationL( waitAnimation ); // Ownership transferred
|
|
1121 |
CleanupStack::Pop( waitAnimation );
|
|
1122 |
|
|
1123 |
aMediaControl.SetAnimationSizeL( placeholderLayout.Rect().Size() );
|
|
1124 |
}
|
|
1125 |
|
|
1126 |
if ( bitmapId != -1 )
|
|
1127 |
{
|
|
1128 |
TParse* parser = new( ELeave ) TParse;
|
|
1129 |
CleanupStack::PushL( parser );
|
|
1130 |
|
|
1131 |
User::LeaveIfError( parser->Set( KUniUtilsMBMFileName, &KDC_APP_BITMAP_DIR, NULL ) );
|
|
1132 |
|
|
1133 |
aMediaControl.LoadIconL( parser->FullName(), iconId, bitmapId, bitmapId + 1 );
|
|
1134 |
CleanupStack::PopAndDestroy( parser );
|
|
1135 |
|
|
1136 |
aMediaControl.SetIconSizeL( placeholderLayout.Rect().Size() );
|
|
1137 |
}
|
|
1138 |
|
|
1139 |
if ( waitAnimation )
|
|
1140 |
{
|
|
1141 |
aMediaControl.SetAnimationVisibleL( ETrue );
|
|
1142 |
aMediaControl.DrawDeferred();
|
|
1143 |
}
|
|
1144 |
else if ( bitmapId != -1 )
|
|
1145 |
{
|
|
1146 |
aMediaControl.SetIconVisible( ETrue );
|
|
1147 |
aMediaControl.DrawDeferred();
|
|
1148 |
}
|
|
1149 |
}
|
|
1150 |
|
|
1151 |
// ---------------------------------------------------------
|
|
1152 |
// CUniSlideLoader::AddToViewL
|
|
1153 |
// ---------------------------------------------------------
|
|
1154 |
//
|
|
1155 |
void CUniSlideLoader::AddToViewL( CMsgBaseControl* aControl,
|
|
1156 |
TInt aControlId,
|
|
1157 |
TMsgMediaType aType,
|
|
1158 |
CUniObject* aObject )
|
|
1159 |
{
|
|
1160 |
TInt indexAdd = iView.ControlById( EMsgComponentIdAudio ) ? 1 : 0;
|
|
1161 |
TInt index = EMsgAppendControl;
|
|
1162 |
TUniLayout layout = iDataModel.SmilModel().Layout();
|
|
1163 |
|
|
1164 |
switch ( aType )
|
|
1165 |
{
|
|
1166 |
case EMsgMediaText:
|
|
1167 |
case EMsgMediaXhtml:
|
|
1168 |
{
|
|
1169 |
if ( layout == EUniTextFirst )
|
|
1170 |
{
|
|
1171 |
index = EMsgFirstControl + indexAdd;
|
|
1172 |
}
|
|
1173 |
break;
|
|
1174 |
}
|
|
1175 |
case EMsgMediaImage:
|
|
1176 |
{
|
|
1177 |
if ( layout == EUniImageFirst )
|
|
1178 |
{
|
|
1179 |
index = EMsgFirstControl + indexAdd;
|
|
1180 |
}
|
|
1181 |
break;
|
|
1182 |
}
|
|
1183 |
case EMsgMediaVideo:
|
|
1184 |
{
|
|
1185 |
if ( layout == EUniImageFirst )
|
|
1186 |
{
|
|
1187 |
index = EMsgFirstControl + indexAdd;
|
|
1188 |
}
|
|
1189 |
break;
|
|
1190 |
}
|
|
1191 |
#ifdef RD_SVGT_IN_MESSAGING
|
|
1192 |
case EMsgMediaSvg:
|
|
1193 |
{
|
|
1194 |
if ( layout == EUniImageFirst )
|
|
1195 |
{
|
|
1196 |
index = EMsgFirstControl + indexAdd;
|
|
1197 |
}
|
|
1198 |
break;
|
|
1199 |
}
|
|
1200 |
#endif
|
|
1201 |
case EMsgMediaAudio:
|
|
1202 |
{
|
|
1203 |
index = EMsgFirstControl;
|
|
1204 |
break;
|
|
1205 |
}
|
|
1206 |
default:
|
|
1207 |
{
|
|
1208 |
break;
|
|
1209 |
}
|
|
1210 |
}
|
|
1211 |
|
|
1212 |
iView.AddControlL( aControl, aControlId, index, EMsgBody );
|
|
1213 |
|
|
1214 |
if ( aObject )
|
|
1215 |
{
|
|
1216 |
aObject->SetUniqueControlHandle( aControl->UniqueHandle() );
|
|
1217 |
}
|
|
1218 |
}
|
|
1219 |
|
|
1220 |
// ---------------------------------------------------------
|
|
1221 |
// CUniSlideLoader::IsDRMError
|
|
1222 |
// ---------------------------------------------------------
|
|
1223 |
//
|
|
1224 |
TBool CUniSlideLoader::IsDRMError( TInt aError ) const
|
|
1225 |
{
|
|
1226 |
if ( aError == DRMCommon::EGeneralError ||
|
|
1227 |
aError == DRMCommon::EUnknownMIME ||
|
|
1228 |
aError == DRMCommon::EVersionNotSupported ||
|
|
1229 |
aError == DRMCommon::ESessionError ||
|
|
1230 |
aError == DRMCommon::ENoRights ||
|
|
1231 |
aError == DRMCommon::ERightsDBCorrupted ||
|
|
1232 |
aError == DRMCommon::EUnsupported ||
|
|
1233 |
aError == DRMCommon::ERightsExpired ||
|
|
1234 |
aError == DRMCommon::EInvalidRights )
|
|
1235 |
{
|
|
1236 |
return ETrue;
|
|
1237 |
}
|
|
1238 |
else
|
|
1239 |
{
|
|
1240 |
return EFalse;
|
|
1241 |
}
|
|
1242 |
}
|
|
1243 |
|
|
1244 |
// ---------------------------------------------------------
|
|
1245 |
// CUniSlideLoader::DrmRightsValid
|
|
1246 |
// ---------------------------------------------------------
|
|
1247 |
//
|
|
1248 |
TBool CUniSlideLoader::DrmRightsValid( CUniObject* aObject ) const
|
|
1249 |
{
|
|
1250 |
UNILOGGER_ENTERFN( "SlideLoader: DrmRightsValid" );
|
|
1251 |
TBool result( ETrue );
|
|
1252 |
|
|
1253 |
if ( aObject->DrmInfo() )
|
|
1254 |
{
|
|
1255 |
UNILOGGER_WRITE( "SlideLoader: Checking rights " );
|
|
1256 |
TBool alreadyConsumed( EFalse );
|
|
1257 |
|
|
1258 |
result = ( aObject->DrmInfo()->EvaluateRights( alreadyConsumed ) == KErrNone ? ETrue :
|
|
1259 |
EFalse );
|
|
1260 |
if ( alreadyConsumed )
|
|
1261 |
{
|
|
1262 |
UNILOGGER_WRITE( "SlideLoader: rights already consumed " );
|
|
1263 |
// Rights already consumed so rights are always valid.
|
|
1264 |
result = ETrue;
|
|
1265 |
}
|
|
1266 |
}
|
|
1267 |
|
|
1268 |
UNILOGGER_LEAVEFN( "SlideLoader: DrmRightsValid" );
|
|
1269 |
return result;
|
|
1270 |
}
|
|
1271 |
|
|
1272 |
// ---------------------------------------------------------
|
|
1273 |
// CUniSlideLoader::ConsumeDrmRights
|
|
1274 |
// ---------------------------------------------------------
|
|
1275 |
//
|
|
1276 |
TBool CUniSlideLoader::ConsumeDrmRights( CUniObject* aObject ) const
|
|
1277 |
{
|
|
1278 |
UNILOGGER_ENTERFN( "SlideLoader: ConsumeDrmRights" );
|
|
1279 |
TBool result( ETrue );
|
|
1280 |
|
|
1281 |
if ( aObject->DrmInfo() )
|
|
1282 |
{
|
|
1283 |
UNILOGGER_WRITE( "SlideLoader: Consuming rights " );
|
|
1284 |
|
|
1285 |
if ( aObject->DrmInfo()->ConsumeRights() != KErrNone )
|
|
1286 |
{
|
|
1287 |
UNILOGGER_WRITE( "SlideLoader: Consuming rights failed!" );
|
|
1288 |
aObject->SetCorrupted( ETrue );
|
|
1289 |
|
|
1290 |
result = EFalse;
|
|
1291 |
}
|
|
1292 |
}
|
|
1293 |
|
|
1294 |
UNILOGGER_LEAVEFN( "SlideLoader: ConsumeDrmRights" );
|
|
1295 |
return result;
|
|
1296 |
}
|
|
1297 |
|
|
1298 |
// ---------------------------------------------------------
|
|
1299 |
// CUniSlideLoader::MsgAsyncControlStateChanged
|
|
1300 |
//
|
|
1301 |
// Called when media control's state changes. Performs icon and
|
|
1302 |
// animation updating corresponding to current state.
|
|
1303 |
// ---------------------------------------------------------
|
|
1304 |
//
|
|
1305 |
void CUniSlideLoader::MsgAsyncControlStateChanged( CMsgBaseControl& aControl,
|
|
1306 |
TMsgAsyncControlState aNewState,
|
|
1307 |
TMsgAsyncControlState aOldState )
|
|
1308 |
{
|
|
1309 |
UNILOGGER_WRITEF( _L("SlideLoader: MsgAsyncControlStateChanged: aNewState: %d"), aNewState );
|
|
1310 |
UNILOGGER_WRITEF( _L("SlideLoader: MsgAsyncControlStateChanged: aOldState: %d"), aOldState );
|
|
1311 |
|
|
1312 |
CMsgMediaControl* mediaControl = NULL;
|
|
1313 |
CMsgXhtmlBodyControl* xhtmlControl = NULL;
|
|
1314 |
|
|
1315 |
ResolveCorrectControlType( aControl, mediaControl, xhtmlControl );
|
|
1316 |
|
|
1317 |
if ( mediaControl )
|
|
1318 |
{
|
|
1319 |
#ifdef USE_LOGGER
|
|
1320 |
if ( mediaControl->Error() )
|
|
1321 |
{
|
|
1322 |
UNILOGGER_WRITEF( _L("SlideLoader: MsgAsyncControlStateChanged: error: %d"), mediaControl->Error() );
|
|
1323 |
}
|
|
1324 |
#endif
|
|
1325 |
// When DSP is used for audio/video playing, dsp resources are not always available.
|
|
1326 |
// It is handled by setting normal 'ready' icon. No error notes occur.
|
|
1327 |
// If set, no icon update, normal icon stays...
|
|
1328 |
TInt dspResourceLack( EFalse );
|
|
1329 |
switch ( aNewState )
|
|
1330 |
{
|
|
1331 |
case EMsgAsyncControlStateCorrupt:
|
|
1332 |
case EMsgAsyncControlStateNoRights:
|
|
1333 |
case EMsgAsyncControlStateError:
|
|
1334 |
{
|
|
1335 |
// Release the animation.
|
|
1336 |
mediaControl->ReleaseAnimation();
|
|
1337 |
|
|
1338 |
TInt controlId = mediaControl->ControlId();
|
|
1339 |
|
|
1340 |
TUniRegion region( EUniRegionUnresolved );
|
|
1341 |
switch ( controlId )
|
|
1342 |
{
|
|
1343 |
case EMsgComponentIdImage:
|
|
1344 |
{
|
|
1345 |
region = EUniRegionImage;
|
|
1346 |
break;
|
|
1347 |
}
|
|
1348 |
case EMsgComponentIdAudio:
|
|
1349 |
{
|
|
1350 |
region = EUniRegionAudio;
|
|
1351 |
|
|
1352 |
if ( ( aOldState == EMsgAsyncControlStateAboutToPlay ||
|
|
1353 |
aOldState == EMsgAsyncControlStatePlaying ||
|
|
1354 |
aOldState == EMsgAsyncControlStateReady ||
|
|
1355 |
aOldState == EMsgAsyncControlStateStopped ) &&
|
|
1356 |
( mediaControl->Error() == KErrSessionClosed ||
|
|
1357 |
mediaControl->Error() == KErrAccessDenied ) )
|
|
1358 |
{
|
|
1359 |
dspResourceLack = ETrue;
|
|
1360 |
}
|
|
1361 |
break;
|
|
1362 |
}
|
|
1363 |
case EMsgComponentIdVideo:
|
|
1364 |
{
|
|
1365 |
region = EUniRegionImage;
|
|
1366 |
|
|
1367 |
if ( ( aOldState == EMsgAsyncControlStateAboutToPlay ||
|
|
1368 |
aOldState == EMsgAsyncControlStatePlaying ||
|
|
1369 |
aOldState == EMsgAsyncControlStateReady ||
|
|
1370 |
aOldState == EMsgAsyncControlStateStopped ) &&
|
|
1371 |
( mediaControl->Error() == KErrSessionClosed ||
|
|
1372 |
mediaControl->Error() == KErrAccessDenied ) )
|
|
1373 |
{
|
|
1374 |
dspResourceLack = ETrue;
|
|
1375 |
}
|
|
1376 |
break;
|
|
1377 |
}
|
|
1378 |
#ifdef RD_SVGT_IN_MESSAGING
|
|
1379 |
case EMsgComponentIdSvg:
|
|
1380 |
{
|
|
1381 |
region = EUniRegionImage;
|
|
1382 |
break;
|
|
1383 |
}
|
|
1384 |
#endif
|
|
1385 |
default:
|
|
1386 |
{
|
|
1387 |
break;
|
|
1388 |
}
|
|
1389 |
}
|
|
1390 |
|
|
1391 |
if ( dspResourceLack )
|
|
1392 |
{
|
|
1393 |
break;
|
|
1394 |
}
|
|
1395 |
|
|
1396 |
if ( region == EUniRegionUnresolved )
|
|
1397 |
{
|
|
1398 |
return;
|
|
1399 |
}
|
|
1400 |
|
|
1401 |
TInt countObjectsOnSlide( iDataModel.SmilModel().SlideObjectCount( iLoadedSlide ) );
|
|
1402 |
|
|
1403 |
for ( TInt i = 0; i < countObjectsOnSlide; i++ )
|
|
1404 |
{
|
|
1405 |
CUniObject* object = iDataModel.SmilModel().GetObject( iLoadedSlide, region );
|
|
1406 |
if ( object )
|
|
1407 |
{
|
|
1408 |
if ( aNewState == EMsgAsyncControlStateCorrupt ||
|
|
1409 |
aNewState == EMsgAsyncControlStateError )
|
|
1410 |
{
|
|
1411 |
object->SetCorrupted( ETrue );
|
|
1412 |
}
|
|
1413 |
|
|
1414 |
TRAP_IGNORE( UpdateControlIconL( *mediaControl, object ) );
|
|
1415 |
break;
|
|
1416 |
}
|
|
1417 |
}
|
|
1418 |
break;
|
|
1419 |
}
|
|
1420 |
case EMsgAsyncControlStateReady:
|
|
1421 |
{
|
|
1422 |
UNILOGGER_WRITE_TIMESTAMP( "CUniSlideLoader::MsgMediaControlStateChanged" );
|
|
1423 |
|
|
1424 |
if ( mediaControl->IconBitmapId() != KErrNotFound )
|
|
1425 |
{
|
|
1426 |
mediaControl->SetIconVisible( ETrue );
|
|
1427 |
}
|
|
1428 |
|
|
1429 |
// Release the animation.
|
|
1430 |
mediaControl->ReleaseAnimation();
|
|
1431 |
break;
|
|
1432 |
}
|
|
1433 |
default:
|
|
1434 |
{
|
|
1435 |
break;
|
|
1436 |
}
|
|
1437 |
}
|
|
1438 |
}
|
|
1439 |
else if ( xhtmlControl )
|
|
1440 |
{
|
|
1441 |
switch ( aNewState )
|
|
1442 |
{
|
|
1443 |
case EMsgAsyncControlStateError:
|
|
1444 |
case EMsgAsyncControlStateReady:
|
|
1445 |
{
|
|
1446 |
if ( iStatus == KRequestPending )
|
|
1447 |
{
|
|
1448 |
TRequestStatus* pStatus = &iStatus;
|
|
1449 |
User::RequestComplete( pStatus, xhtmlControl->Error() );
|
|
1450 |
}
|
|
1451 |
break;
|
|
1452 |
}
|
|
1453 |
default:
|
|
1454 |
{
|
|
1455 |
break;
|
|
1456 |
}
|
|
1457 |
}
|
|
1458 |
}
|
|
1459 |
}
|
|
1460 |
|
|
1461 |
// ---------------------------------------------------------
|
|
1462 |
// CUniSlideLoader::MsgAsyncControlResourceChanged
|
|
1463 |
//
|
|
1464 |
// ---------------------------------------------------------
|
|
1465 |
//
|
|
1466 |
void CUniSlideLoader::MsgAsyncControlResourceChanged( CMsgBaseControl& aControl, TInt aType )
|
|
1467 |
{
|
|
1468 |
TRAP_IGNORE( DoMsgAsyncControlResourceChangedL( aControl, aType ) );
|
|
1469 |
}
|
|
1470 |
|
|
1471 |
// ---------------------------------------------------------
|
|
1472 |
// CUniSlideLoader::DoMsgAsyncControlResourceChangedL
|
|
1473 |
//
|
|
1474 |
// ---------------------------------------------------------
|
|
1475 |
//
|
|
1476 |
void CUniSlideLoader::DoMsgAsyncControlResourceChangedL( CMsgBaseControl& aControl, TInt aType )
|
|
1477 |
{
|
|
1478 |
if ( aType == KEikDynamicLayoutVariantSwitch )
|
|
1479 |
{
|
|
1480 |
CMsgMediaControl* mediaControl = NULL;
|
|
1481 |
CMsgXhtmlBodyControl* xhtmlControl = NULL;
|
|
1482 |
|
|
1483 |
ResolveCorrectControlType( aControl, mediaControl, xhtmlControl );
|
|
1484 |
|
|
1485 |
if ( mediaControl )
|
|
1486 |
{
|
|
1487 |
SetIconLayoutL( *mediaControl );
|
|
1488 |
}
|
|
1489 |
}
|
|
1490 |
}
|
|
1491 |
|
|
1492 |
// ---------------------------------------------------------
|
|
1493 |
// CUniSlideLoader::SetIconLayoutL
|
|
1494 |
//
|
|
1495 |
// ---------------------------------------------------------
|
|
1496 |
//
|
|
1497 |
void CUniSlideLoader::SetIconLayoutL( CMsgMediaControl& aMediaControl )
|
|
1498 |
{
|
|
1499 |
if ( aMediaControl.IconBitmapId() != KErrNotFound )
|
|
1500 |
{
|
|
1501 |
TAknWindowLineLayout layOut( KErrNotFound );
|
|
1502 |
|
|
1503 |
switch ( aMediaControl.ControlId( ) )
|
|
1504 |
{
|
|
1505 |
case EMsgComponentIdAudio:
|
|
1506 |
{
|
|
1507 |
layOut = AknLayoutScalable_Apps::msg_data_pane_g6().LayoutLine();
|
|
1508 |
break;
|
|
1509 |
}
|
|
1510 |
case EMsgComponentIdImage:
|
|
1511 |
case EMsgComponentIdVideo:
|
|
1512 |
case EMsgComponentIdSvg:
|
|
1513 |
default:
|
|
1514 |
{
|
|
1515 |
layOut = AknLayoutScalable_Apps::msg_data_pane_g7().LayoutLine();
|
|
1516 |
break;
|
|
1517 |
}
|
|
1518 |
}
|
|
1519 |
|
|
1520 |
TAknLayoutRect iconLayout;
|
|
1521 |
iconLayout.LayoutRect( MsgEditorCommons::MsgDataPane(),
|
|
1522 |
layOut );
|
|
1523 |
|
|
1524 |
TSize placeholderSize( iconLayout.Rect().Size() );
|
|
1525 |
|
|
1526 |
aMediaControl.SetIconSizeL( placeholderSize );
|
|
1527 |
aMediaControl.SetAnimationSizeL( placeholderSize );
|
|
1528 |
}
|
|
1529 |
}
|
|
1530 |
|
|
1531 |
// ---------------------------------------------------------
|
|
1532 |
// CUniSlideLoader::ResolveCorrectControlType
|
|
1533 |
// ---------------------------------------------------------
|
|
1534 |
//
|
|
1535 |
void CUniSlideLoader::ResolveCorrectControlType( CMsgBaseControl& aControl,
|
|
1536 |
CMsgMediaControl*& aMediaControl,
|
|
1537 |
CMsgXhtmlBodyControl*& aXhtmlControl )
|
|
1538 |
{
|
|
1539 |
aMediaControl = NULL;
|
|
1540 |
aXhtmlControl = NULL;
|
|
1541 |
|
|
1542 |
TInt controlType = aControl.ControlType();
|
|
1543 |
|
|
1544 |
if ( controlType == EMsgImageControl ||
|
|
1545 |
controlType == EMsgVideoControl ||
|
|
1546 |
controlType == EMsgAudioControl ||
|
|
1547 |
controlType == EMsgSvgControl )
|
|
1548 |
{
|
|
1549 |
aMediaControl = static_cast<CMsgMediaControl*>( &aControl );
|
|
1550 |
}
|
|
1551 |
else if ( controlType == EMsgXhtmlBodyControl )
|
|
1552 |
{
|
|
1553 |
aXhtmlControl = static_cast<CMsgXhtmlBodyControl*>( &aControl );
|
|
1554 |
}
|
|
1555 |
}
|
|
1556 |
|
|
1557 |
// ---------------------------------------------------------
|
|
1558 |
// RemoveObservers(
|
|
1559 |
// ---------------------------------------------------------
|
|
1560 |
//
|
|
1561 |
void CUniSlideLoader::RemoveObservers( )
|
|
1562 |
{
|
|
1563 |
if ( iUniObjectObserver )
|
|
1564 |
{
|
|
1565 |
CUniObject* obj = ObjectByBaseControl( iView.ControlById( EMsgComponentIdBody ) );
|
|
1566 |
if ( obj )
|
|
1567 |
{
|
|
1568 |
obj->RemoveObserver( iUniObjectObserver );
|
|
1569 |
}
|
|
1570 |
obj = ObjectByBaseControl( iView.ControlById( EMsgComponentIdImage ) );
|
|
1571 |
if ( obj )
|
|
1572 |
{
|
|
1573 |
obj->RemoveObserver( iUniObjectObserver );
|
|
1574 |
}
|
|
1575 |
obj = ObjectByBaseControl( iView.ControlById( EMsgComponentIdVideo ) );
|
|
1576 |
if ( obj )
|
|
1577 |
{
|
|
1578 |
obj->RemoveObserver( iUniObjectObserver );
|
|
1579 |
}
|
|
1580 |
obj = ObjectByBaseControl( iView.ControlById( EMsgComponentIdAudio ) );
|
|
1581 |
if ( obj )
|
|
1582 |
{
|
|
1583 |
obj->RemoveObserver( iUniObjectObserver );
|
|
1584 |
}
|
|
1585 |
#ifdef RD_SVGT_IN_MESSAGING
|
|
1586 |
obj = ObjectByBaseControl( iView.ControlById( EMsgComponentIdSvg ) );
|
|
1587 |
if ( obj )
|
|
1588 |
{
|
|
1589 |
obj->RemoveObserver( iUniObjectObserver );
|
|
1590 |
}
|
|
1591 |
#endif
|
|
1592 |
}
|
|
1593 |
}
|
|
1594 |
|
|
1595 |
|
|
1596 |
// ---------------------------------------------------------
|
|
1597 |
// ObjectByBaseControl
|
|
1598 |
// ---------------------------------------------------------
|
|
1599 |
//
|
|
1600 |
CUniObject* CUniSlideLoader::ObjectByBaseControl( CMsgBaseControl* aControl )
|
|
1601 |
{
|
|
1602 |
if ( aControl )
|
|
1603 |
{
|
|
1604 |
TInt controlId = aControl->ControlId( );
|
|
1605 |
TUniRegion region( EUniRegionUnresolved );
|
|
1606 |
switch ( controlId )
|
|
1607 |
{
|
|
1608 |
case EMsgComponentIdImage:
|
|
1609 |
region = EUniRegionImage;
|
|
1610 |
break;
|
|
1611 |
case EMsgComponentIdAudio:
|
|
1612 |
region = EUniRegionAudio;
|
|
1613 |
break;
|
|
1614 |
case EMsgComponentIdVideo:
|
|
1615 |
region = EUniRegionImage;
|
|
1616 |
break;
|
|
1617 |
#ifdef RD_SVGT_IN_MESSAGING
|
|
1618 |
case EMsgComponentIdSvg:
|
|
1619 |
region = EUniRegionImage;
|
|
1620 |
break;
|
|
1621 |
#endif
|
|
1622 |
case EMsgComponentIdBody:
|
|
1623 |
region = EUniRegionText;
|
|
1624 |
break;
|
|
1625 |
default:
|
|
1626 |
break;
|
|
1627 |
}
|
|
1628 |
if ( region == EUniRegionUnresolved )
|
|
1629 |
{
|
|
1630 |
return NULL;
|
|
1631 |
}
|
|
1632 |
|
|
1633 |
TInt countObjectsOnSlide(
|
|
1634 |
iDataModel.SmilModel().SlideObjectCount( iLoadedSlide ) );
|
|
1635 |
for ( TInt i = 0; i < countObjectsOnSlide; i++ )
|
|
1636 |
{
|
|
1637 |
CUniObject* object = iDataModel.SmilModel().GetObject( iLoadedSlide, region );
|
|
1638 |
if ( object )
|
|
1639 |
{
|
|
1640 |
return object;
|
|
1641 |
}
|
|
1642 |
}
|
|
1643 |
}
|
|
1644 |
return NULL;
|
|
1645 |
}
|
|
1646 |
|
|
1647 |
// End of File
|