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 CUniObjectsViewDialog class methods.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
// ========== INCLUDE FILES ================================
|
|
22 |
#include "UniObjectsViewDialog.h"
|
|
23 |
|
|
24 |
#include <gulicon.h>
|
|
25 |
#include <eikenv.h> // Eikon Enviroment
|
|
26 |
#include <eikdll.h> // Application start
|
|
27 |
#include <eikmenup.h> // for CEikMenuPane
|
|
28 |
#include <eikmenub.h> // for CEikMenuBar
|
|
29 |
#include <bautils.h> // NearestLanguageFile
|
|
30 |
#include <aknlists.h>
|
|
31 |
#include <apgcli.h> // RApaLsSession
|
|
32 |
#include <AknQueryDialog.h>
|
|
33 |
#include <aknnotewrappers.h>
|
|
34 |
#include <DocumentHandler.h> // doc handler
|
|
35 |
#include <StringLoader.h> // StringLoader
|
|
36 |
#include <data_caging_path_literals.hrh>
|
|
37 |
#include <txtrich.h> // CRichText
|
|
38 |
#include <avkon.hrh>
|
|
39 |
|
|
40 |
#include <mmsvattachmentmanager.h>
|
|
41 |
#include <msvstore.h>
|
|
42 |
#include <msvstd.h> // TMsvId
|
|
43 |
#include <biodb.h> // CBioDatabase
|
|
44 |
#include <mtclbase.h>
|
|
45 |
|
|
46 |
#include <NpdApi.h>
|
|
47 |
|
|
48 |
#include <sendui.h>
|
|
49 |
#include <SenduiMtmUids.h>
|
|
50 |
#include <Sendnorm.rsg>
|
|
51 |
#include <CMessageData.h>
|
|
52 |
|
|
53 |
#include <msgtextutils.h>
|
|
54 |
#include <MsgMediaInfo.h>
|
|
55 |
|
|
56 |
#include <MsgEditorAppUi.rsg> // atta dlg base resouce identifiers
|
|
57 |
#include <UniUtils.rsg> // obj view resouce identifiers
|
|
58 |
#include <AiwGenericParam.h>
|
|
59 |
|
|
60 |
// Features
|
|
61 |
#include <featmgr.h>
|
|
62 |
|
|
63 |
#include <fileprotectionresolver.h>
|
|
64 |
|
|
65 |
// Help
|
|
66 |
#include <csxhelp/unif.hlp.hrh>
|
|
67 |
#include <csxhelp/mms.hlp.hrh>
|
|
68 |
#include <hlplch.h> // For HlpLauncher
|
|
69 |
|
|
70 |
#include "UniUtils.h"
|
|
71 |
|
|
72 |
#include <unimodelconst.h>
|
|
73 |
#include <unidatamodel.h>
|
|
74 |
#include <unidatautils.h>
|
|
75 |
#include <uniobject.h>
|
|
76 |
#include <unidrminfo.h>
|
|
77 |
#include <unismilmodel.h>
|
|
78 |
#include <uniobjectlist.h>
|
|
79 |
#include <unimimeinfo.h>
|
|
80 |
#include <uniobjectsinfo.h>
|
|
81 |
#include <uniobjectsmodel.h>
|
|
82 |
|
|
83 |
#include <MsgEditorCommon.h>
|
|
84 |
#include <MsgMimeTypes.h>
|
|
85 |
|
|
86 |
#include <MsgEditorAppUi.hrh> // atta dlg base commands
|
|
87 |
#include "UniObjectsViewDialog.hrh" // obj view commands
|
|
88 |
|
|
89 |
#include <UniUtils.rsg>
|
|
90 |
|
|
91 |
#include "UniEditorLogging.h"
|
|
92 |
|
|
93 |
#include "UniObjectsListArray.h"
|
|
94 |
|
|
95 |
// ========== EXTERNAL DATA STRUCTURES =====================
|
|
96 |
|
|
97 |
// ========== EXTERNAL FUNCTION PROTOTYPES =================
|
|
98 |
|
|
99 |
// ========== CONSTANTS ====================================
|
|
100 |
|
|
101 |
_LIT( KMmsFormatTwoDigits, "%x_%x\\" );
|
|
102 |
|
|
103 |
const TUid KNotepadUID3 = { 0x1000599d };
|
|
104 |
const TUid KUidMmsViewer = { 0x100058DF };
|
|
105 |
const TUid KUniEditorAppId = { 0x102072D8 };
|
|
106 |
|
|
107 |
// ========== MACROS =======================================
|
|
108 |
|
|
109 |
// ========== LOCAL CONSTANTS AND MACROS ===================
|
|
110 |
|
|
111 |
// ========== MODULE DATA STRUCTURES =======================
|
|
112 |
|
|
113 |
// ========== LOCAL FUNCTION PROTOTYPES ====================
|
|
114 |
|
|
115 |
// ========== LOCAL FUNCTIONS ==============================
|
|
116 |
|
|
117 |
// ========== MEMBER FUNCTIONS =============================
|
|
118 |
|
|
119 |
// ---------------------------------------------------------
|
|
120 |
// CUniObjectsViewDialog::ObjectsViewL
|
|
121 |
// ---------------------------------------------------------
|
|
122 |
//
|
|
123 |
EXPORT_C TInt CUniObjectsViewDialog::ObjectsViewL( TUniObjectsDialogType aDialogType,
|
|
124 |
CUniObjectsModel& aAttachmentModel,
|
|
125 |
CEikonEnv* aEikonEnv,
|
|
126 |
TUniObjectsDialogExitCmd& aExitCmd,
|
|
127 |
CUniDataModel& aDataModel,
|
|
128 |
TInt aFocusedItemIndex )
|
|
129 |
{
|
|
130 |
TFileName* fileName = new ( ELeave ) TFileName;
|
|
131 |
CleanupStack::PushL( fileName );
|
|
132 |
|
|
133 |
TParse parse;
|
|
134 |
User::LeaveIfError( parse.Set( KUniUtilsResourceFileName, &KDC_RESOURCE_FILES_DIR, NULL ) );
|
|
135 |
*fileName = parse.FullName();
|
|
136 |
|
|
137 |
BaflUtils::NearestLanguageFile( aEikonEnv->FsSession(), *fileName );
|
|
138 |
TInt offset = aEikonEnv->AddResourceFileL( *fileName );
|
|
139 |
|
|
140 |
CleanupStack::PopAndDestroy( fileName );
|
|
141 |
|
|
142 |
TInt menuId = R_UNUT_EDITOR_OBJECTS_MENU;
|
|
143 |
|
|
144 |
switch ( aDialogType )
|
|
145 |
{
|
|
146 |
case EViewer:
|
|
147 |
{
|
|
148 |
menuId = R_UNUT_VIEWER_OBJECTS_MENU;
|
|
149 |
break;
|
|
150 |
}
|
|
151 |
case EForward:
|
|
152 |
{
|
|
153 |
menuId = R_UNUT_FORWARD_OBJECTS_MENU;
|
|
154 |
break;
|
|
155 |
}
|
|
156 |
case EEditor:
|
|
157 |
{
|
|
158 |
menuId = R_UNUT_EDITOR_OBJECTS_MENU;
|
|
159 |
break;
|
|
160 |
}
|
|
161 |
default:
|
|
162 |
{
|
|
163 |
break;
|
|
164 |
}
|
|
165 |
}
|
|
166 |
|
|
167 |
HBufC* title = aEikonEnv->AllocReadResourceLC( R_UNUT_OBJECTS_TITLE );
|
|
168 |
TInt ret = 0;
|
|
169 |
|
|
170 |
PopulateAttachmentModelL( aAttachmentModel, aDataModel );
|
|
171 |
|
|
172 |
CUniObjectsViewDialog* dlg = new ( ELeave ) CUniObjectsViewDialog (
|
|
173 |
*title,
|
|
174 |
aDialogType,
|
|
175 |
menuId,
|
|
176 |
aAttachmentModel,
|
|
177 |
offset,
|
|
178 |
aExitCmd,
|
|
179 |
aDataModel,
|
|
180 |
aFocusedItemIndex );
|
|
181 |
|
|
182 |
CleanupStack::PushL( dlg );
|
|
183 |
dlg->ConstructL( aDataModel.Mtm().Entry() );
|
|
184 |
CleanupStack::Pop( dlg );
|
|
185 |
|
|
186 |
ret = dlg->ExecuteLD( R_MEB_VIEW_ATTACHMENT_DIALOG ); // wait dialog.
|
|
187 |
CleanupStack::PopAndDestroy( title ); // store, title
|
|
188 |
|
|
189 |
return ret;
|
|
190 |
}
|
|
191 |
|
|
192 |
|
|
193 |
// ---------------------------------------------------------
|
|
194 |
// CUniObjectsViewDialog::CUniObjectsViewDialog
|
|
195 |
// ---------------------------------------------------------
|
|
196 |
//
|
|
197 |
CUniObjectsViewDialog::CUniObjectsViewDialog( TDesC& aTitle,
|
|
198 |
TUniObjectsDialogType aDialogType,
|
|
199 |
TInt aMenuId,
|
|
200 |
CUniObjectsModel& aAttachmentModel,
|
|
201 |
TInt aResourceOffset,
|
|
202 |
TUniObjectsDialogExitCmd& aExitCmd,
|
|
203 |
CUniDataModel& aDataModel,
|
|
204 |
TInt aFocusedItemIndex ) :
|
|
205 |
CMsgViewAttachmentsDialog( aTitle, aMenuId, aAttachmentModel ),
|
|
206 |
iDialogType( aDialogType ),
|
|
207 |
iResourceOffset( aResourceOffset ),
|
|
208 |
iDataModel( aDataModel ),
|
|
209 |
iSupportedFeatures( 0 ),
|
|
210 |
iExitCmd( aExitCmd ),
|
|
211 |
iFocusedItemIndex( aFocusedItemIndex )
|
|
212 |
{
|
|
213 |
iExitCmd = EUniObjectsViewBack;
|
|
214 |
}
|
|
215 |
|
|
216 |
// ---------------------------------------------------------
|
|
217 |
// CUniObjectsViewDialog::~CUniObjectsViewDialog
|
|
218 |
// ---------------------------------------------------------
|
|
219 |
//
|
|
220 |
CUniObjectsViewDialog::~CUniObjectsViewDialog()
|
|
221 |
{
|
|
222 |
if ( iResourceOffset != -1 )
|
|
223 |
{
|
|
224 |
iEikonEnv->DeleteResourceFile( iResourceOffset );
|
|
225 |
}
|
|
226 |
|
|
227 |
// Remove drm info observer
|
|
228 |
CUniObjectsModel& model( static_cast<CUniObjectsModel&>( iAttachmentModel ) );
|
|
229 |
TInt countObjects = model.NumberOfItems( );
|
|
230 |
for ( TInt i = 0; i < countObjects; i++ )
|
|
231 |
{
|
|
232 |
CUniObject* obj =
|
|
233 |
static_cast<CUniObjectsInfo&>
|
|
234 |
( model.AttachmentInfoAt( i ) ).Object();
|
|
235 |
if ( obj )
|
|
236 |
{
|
|
237 |
obj->RemoveObserver( this );
|
|
238 |
}
|
|
239 |
}
|
|
240 |
|
|
241 |
delete iSendUi;
|
|
242 |
}
|
|
243 |
|
|
244 |
// ---------------------------------------------------------
|
|
245 |
// CUniObjectsViewDialog::ConstructL
|
|
246 |
// ---------------------------------------------------------
|
|
247 |
//
|
|
248 |
void CUniObjectsViewDialog::ConstructL( CMsvEntry& aEntry )
|
|
249 |
{
|
|
250 |
FeatureManager::InitializeLibL();
|
|
251 |
|
|
252 |
if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
|
|
253 |
{
|
|
254 |
iSupportedFeatures |= EUniFeatureHelp;
|
|
255 |
}
|
|
256 |
if ( FeatureManager::FeatureSupported( KFeatureIdDrmFull ) )
|
|
257 |
{
|
|
258 |
iSupportedFeatures |= EUniFeatureDrmFull;
|
|
259 |
}
|
|
260 |
if ( FeatureManager::FeatureSupported( KFeatureIdJapanese ) )
|
|
261 |
{
|
|
262 |
iSupportedFeatures |= EUniFeatureJapanese;
|
|
263 |
}
|
|
264 |
|
|
265 |
FeatureManager::UnInitializeLib();
|
|
266 |
|
|
267 |
CMsgViewAttachmentsDialog::ConstructL( aEntry );
|
|
268 |
|
|
269 |
if ( iDialogType == EViewer )
|
|
270 |
{
|
|
271 |
iSendUi = CSendUi::NewL();
|
|
272 |
}
|
|
273 |
|
|
274 |
// Add drm info observer
|
|
275 |
CUniObjectsModel& model( static_cast<CUniObjectsModel&>( iAttachmentModel ) );
|
|
276 |
TInt countObjects = model.NumberOfItems( );
|
|
277 |
for ( TInt i = 0; i < countObjects; i++ )
|
|
278 |
{
|
|
279 |
CUniObject* obj =
|
|
280 |
static_cast<CUniObjectsInfo&>
|
|
281 |
( model.AttachmentInfoAt( i ) ).Object();
|
|
282 |
if ( obj )
|
|
283 |
{
|
|
284 |
// concept of 'DRM rights when loaded' is different
|
|
285 |
// current status applies; consumed status does not matter
|
|
286 |
obj->SetDrmRightsWhenLoadedObjects( IsRightsNow( *obj ) );
|
|
287 |
obj->SetObserverL( this );
|
|
288 |
}
|
|
289 |
|
|
290 |
}
|
|
291 |
// Enable task swapper to options menu after launch has been completed.
|
|
292 |
}
|
|
293 |
|
|
294 |
// ---------------------------------------------------------
|
|
295 |
// CMsgViewAttachmentsDialog::LoadFormDataL
|
|
296 |
// ---------------------------------------------------------
|
|
297 |
//
|
|
298 |
void CUniObjectsViewDialog::LoadFormDataL()
|
|
299 |
{
|
|
300 |
// iconarray for two icons.
|
|
301 |
// index 0: application icon.
|
|
302 |
// index 1: indicator.
|
|
303 |
iIconArray = new ( ELeave ) CArrayPtrFlat<CGulIcon>( 2 );
|
|
304 |
|
|
305 |
iListBox->ItemDrawer()->FormattedCellData()->SetIconArrayL( iIconArray );
|
|
306 |
|
|
307 |
// list items is not actually an array but object that returns
|
|
308 |
// list item text for listbox in MdcaPoint method.
|
|
309 |
iListItems = CUniObjectListItemArray::NewL( iAttachmentModel, iIconArray, iDataModel.DataUtils() );
|
|
310 |
iListBox->Model()->SetItemTextArray( iListItems );
|
|
311 |
iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
|
|
312 |
}
|
|
313 |
|
|
314 |
// ---------------------------------------------------------
|
|
315 |
// CUniObjectsViewDialog::PreLayoutDynInitL
|
|
316 |
//
|
|
317 |
// Sets the intial focus if given. Also enables open middle softkey.
|
|
318 |
// Assumes that empty slides are not set initially focused.
|
|
319 |
// ---------------------------------------------------------
|
|
320 |
//
|
|
321 |
void CUniObjectsViewDialog::PreLayoutDynInitL()
|
|
322 |
{
|
|
323 |
CMsgViewAttachmentsDialog::PreLayoutDynInitL();
|
|
324 |
|
|
325 |
if ( iFocusedItemIndex != -1)
|
|
326 |
{
|
|
327 |
iListBox->SetCurrentItemIndex( iFocusedItemIndex );
|
|
328 |
if ( ButtonGroupContainer().ControlOrNull( EAknSoftkeyOpen ) )
|
|
329 |
{
|
|
330 |
ButtonGroupContainer().MakeCommandVisible( EAknSoftkeyOpen, ETrue );
|
|
331 |
}
|
|
332 |
}
|
|
333 |
}
|
|
334 |
|
|
335 |
// ---------------------------------------------------------
|
|
336 |
// CUniObjectsViewDialog::ProcessCommandL
|
|
337 |
// ---------------------------------------------------------
|
|
338 |
//
|
|
339 |
void CUniObjectsViewDialog::ProcessCommandL( TInt aCommandId )
|
|
340 |
{
|
|
341 |
HideMenu();
|
|
342 |
|
|
343 |
TInt index = CurrentListItemIndex();
|
|
344 |
|
|
345 |
switch ( aCommandId )
|
|
346 |
{
|
|
347 |
case EMmsObjectsTextFirst:
|
|
348 |
case EMmsObjectsTextSecond:
|
|
349 |
ChangeOrderL( aCommandId, 0 );
|
|
350 |
break;
|
|
351 |
case EMsgViewAttachmentCmdOpen:
|
|
352 |
ProcessCommandOpenL( index );
|
|
353 |
break;
|
|
354 |
case EMsgViewAttachmentCmdSave:
|
|
355 |
ProcessCommandSaveL( index );
|
|
356 |
break;
|
|
357 |
case EMsgViewAttachmentCmdRemove:
|
|
358 |
{
|
|
359 |
CUniObjectsInfo& selectedObject = static_cast<CUniObjectsInfo&>
|
|
360 |
( iAttachmentModel.AttachmentInfoAt( CurrentListItemIndex() ) );
|
|
361 |
TBool emptySlide = ( selectedObject.Flags() & CUniObjectsInfo::EMmsSlide );
|
|
362 |
if(emptySlide)
|
|
363 |
break;
|
|
364 |
ProcessCommandRemoveL( index );
|
|
365 |
}
|
|
366 |
break;
|
|
367 |
|
|
368 |
case EAknCmdHelp:
|
|
369 |
{
|
|
370 |
LaunchHelpL();
|
|
371 |
}
|
|
372 |
break;
|
|
373 |
|
|
374 |
case EMmsObjectsSendVia:
|
|
375 |
{
|
|
376 |
CArrayFix<TUid>* uids = new ( ELeave ) CArrayFixFlat<TUid>( 1 );
|
|
377 |
CleanupStack::PushL( uids );
|
|
378 |
|
|
379 |
CUniObjectsInfo& selectedObject = static_cast<CUniObjectsInfo&>
|
|
380 |
( iAttachmentModel.AttachmentInfoAt( index ) );
|
|
381 |
CUniObject* obj = selectedObject.Object();
|
|
382 |
|
|
383 |
// TODO bio support
|
|
384 |
TSendingCapabilities requiredCapabilities = KCapabilitiesForAllServices;
|
|
385 |
requiredCapabilities.iFlags = TSendingCapabilities::ESupportsAttachments;
|
|
386 |
|
|
387 |
if ( obj->MediaType() == EMsgMediaText )
|
|
388 |
{
|
|
389 |
requiredCapabilities.iFlags |= TSendingCapabilities::ESupportsBodyText;
|
|
390 |
}
|
|
391 |
|
|
392 |
if ( iDialogType != EViewer )
|
|
393 |
{
|
|
394 |
uids->AppendL( KSenduiMtmMmsUid ); // MMS menu item, if already in editor
|
|
395 |
}
|
|
396 |
|
|
397 |
CMessageData* msgData = CMessageData::NewLC();
|
|
398 |
RFile fileHandle;
|
|
399 |
if ( obj->AttachmentId() == KMsvNullIndexEntryId )
|
|
400 |
{
|
|
401 |
fileHandle = CUniDataUtils::GetAttachmentFileL( iDataModel.Mtm(), obj->AttachmentId() );
|
|
402 |
}
|
|
403 |
else
|
|
404 |
{
|
|
405 |
// Always pass full file path to SendUi. Even
|
|
406 |
// in case of attachments.
|
|
407 |
CMsvStore* store = iMessageEntry->ReadStoreL();
|
|
408 |
CleanupStack::PushL( store );
|
|
409 |
MMsvAttachmentManager& manager = store->AttachmentManagerL();
|
|
410 |
fileHandle = manager.GetAttachmentFileL( obj->AttachmentId() );
|
|
411 |
CleanupStack::PopAndDestroy( store );
|
|
412 |
}
|
|
413 |
CleanupClosePushL( fileHandle );
|
|
414 |
|
|
415 |
TUid bioUid;
|
|
416 |
bioUid.iUid = 0;
|
|
417 |
if ( fileHandle.SubSessionHandle() )
|
|
418 |
{
|
|
419 |
msgData->AppendAttachmentHandleL( fileHandle );
|
|
420 |
if ( obj->MediaInfo() )
|
|
421 |
{
|
|
422 |
if ( BioMessageTypeL( obj->MediaInfo()->MimeType(), bioUid ) )
|
|
423 |
{
|
|
424 |
requiredCapabilities.iFlags |= TSendingCapabilities::ESupportsBioSending;
|
|
425 |
}
|
|
426 |
}
|
|
427 |
}
|
|
428 |
|
|
429 |
TUid serviceId = iSendUi->ShowSendQueryL( msgData,
|
|
430 |
requiredCapabilities,
|
|
431 |
uids );
|
|
432 |
ProcessCommandSendL( *msgData, index, serviceId, bioUid );
|
|
433 |
|
|
434 |
CleanupStack::PopAndDestroy( 3, uids ); // + fileHandle, msgData
|
|
435 |
}
|
|
436 |
break;
|
|
437 |
|
|
438 |
case EEikCmdExit:
|
|
439 |
case EAknCmdExit:
|
|
440 |
iExitCmd = EUniObjectsViewExit;
|
|
441 |
// Fallthrough
|
|
442 |
default:
|
|
443 |
// call parent class to process other commands.
|
|
444 |
CMsgViewAttachmentsDialog::ProcessCommandL( aCommandId );
|
|
445 |
break;
|
|
446 |
}
|
|
447 |
|
|
448 |
}
|
|
449 |
|
|
450 |
// ---------------------------------------------------------
|
|
451 |
// CUniObjectsViewDialog::ProcessCommandOpenL
|
|
452 |
// ---------------------------------------------------------
|
|
453 |
//
|
|
454 |
void CUniObjectsViewDialog::ProcessCommandOpenL( TInt aIndex )
|
|
455 |
{
|
|
456 |
CUniObjectsInfo& selectedObject =
|
|
457 |
static_cast<CUniObjectsInfo&>( iAttachmentModel.AttachmentInfoAt( aIndex ) );
|
|
458 |
CUniObject* obj = selectedObject.Object();
|
|
459 |
|
|
460 |
if ( obj->MediaType() == EMsgMediaText )
|
|
461 |
{
|
|
462 |
if ( !iBusy )
|
|
463 |
{
|
|
464 |
iBusy = ETrue;
|
|
465 |
CleanupStack::PushL( TCleanupItem( CleanupPointer, &iBusy ) );
|
|
466 |
|
|
467 |
TUint mibCharset = obj->MimeInfo()->Charset();
|
|
468 |
if ( !mibCharset )
|
|
469 |
{
|
|
470 |
//assume US-ASCII - mandated by RFC 2046
|
|
471 |
mibCharset = KCharacterSetMIBEnumUsAscii;
|
|
472 |
}
|
|
473 |
TUint charconvCharsetID = iDataModel.DataUtils().MibIdToCharconvIdL( mibCharset );
|
|
474 |
|
|
475 |
RFile file = CUniDataUtils::GetAttachmentFileL( iDataModel.Mtm(), obj->AttachmentId() );
|
|
476 |
CleanupClosePushL( file );
|
|
477 |
// Takes ownership of "file":
|
|
478 |
CNotepadApi::ExecFileViewerL( file,
|
|
479 |
NULL,
|
|
480 |
ETrue,
|
|
481 |
EFalse,
|
|
482 |
charconvCharsetID );
|
|
483 |
CleanupStack::Pop( &file );
|
|
484 |
|
|
485 |
// sets iBusy to EFalse.
|
|
486 |
CleanupStack::PopAndDestroy(); // CleanupPointer
|
|
487 |
}
|
|
488 |
}
|
|
489 |
else
|
|
490 |
{
|
|
491 |
if ( iDialogType == EViewer )
|
|
492 |
{
|
|
493 |
if ( selectedObject.IsSaved() )
|
|
494 |
{
|
|
495 |
SetOpenParamList( NULL );
|
|
496 |
}
|
|
497 |
else if ( !OpenParamList() )
|
|
498 |
{
|
|
499 |
CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC();
|
|
500 |
//Applications that require Media Player to show the save
|
|
501 |
//option must set the EGenericParamAllowSave to ETrue.
|
|
502 |
//If they don't need the save option there is no need to set
|
|
503 |
//the parameter to EFalse.
|
|
504 |
TAiwVariant allowSaveVariant( ETrue );
|
|
505 |
TAiwGenericParam genericParamAllowSave( EGenericParamAllowSave,
|
|
506 |
allowSaveVariant );
|
|
507 |
paramList->AppendL( genericParamAllowSave );
|
|
508 |
//paramList->AppendL( EGenericParamAllowSave );
|
|
509 |
SetOpenParamList( paramList );
|
|
510 |
CleanupStack::Pop( paramList );
|
|
511 |
}
|
|
512 |
}
|
|
513 |
|
|
514 |
CMsgViewAttachmentsDialog::ProcessCommandL( EMsgViewAttachmentCmdOpen );
|
|
515 |
}
|
|
516 |
}
|
|
517 |
|
|
518 |
// ---------------------------------------------------------
|
|
519 |
// CUniObjectsViewDialog::ProcessCommandSaveL
|
|
520 |
// ---------------------------------------------------------
|
|
521 |
//
|
|
522 |
void CUniObjectsViewDialog::ProcessCommandSaveL( TInt aIndex )
|
|
523 |
{
|
|
524 |
CUniObjectsInfo& selectedObject = static_cast<CUniObjectsInfo&>
|
|
525 |
( iAttachmentModel.AttachmentInfoAt( aIndex ) );
|
|
526 |
CUniObject* obj = selectedObject.Object();
|
|
527 |
if ( obj->MediaType() == EMsgMediaText )
|
|
528 |
{
|
|
529 |
// Save text files directly to Notepad.
|
|
530 |
// This is needed because automatic character set recognation
|
|
531 |
// is not too reliable.
|
|
532 |
TUint mibCharset = obj->MimeInfo()->Charset();
|
|
533 |
if ( !mibCharset )
|
|
534 |
{
|
|
535 |
//assume US-ASCII - mandated by RFC 2046
|
|
536 |
mibCharset = KCharacterSetMIBEnumUsAscii;
|
|
537 |
}
|
|
538 |
TUint charconvCharsetID = iDataModel.DataUtils().MibIdToCharconvIdL( mibCharset );
|
|
539 |
|
|
540 |
RFile file = CUniDataUtils::GetAttachmentFileL( iDataModel.Mtm(), obj->AttachmentId() );
|
|
541 |
CleanupClosePushL( file );
|
|
542 |
CNotepadApi::SaveFileAsMemoL(
|
|
543 |
file,
|
|
544 |
charconvCharsetID );
|
|
545 |
CleanupStack::PopAndDestroy(); // file
|
|
546 |
|
|
547 |
// Show confirmation note
|
|
548 |
RApaLsSession appList;
|
|
549 |
if ( appList.Connect() == KErrNone )
|
|
550 |
{
|
|
551 |
TApaAppInfo appInfo;
|
|
552 |
if ( appList.GetAppInfo( appInfo, KNotepadUID3 ) == KErrNone )
|
|
553 |
{
|
|
554 |
HBufC* text = StringLoader::LoadLC( R_UNUT_FILE_SAVED_TO, appInfo.iCaption );
|
|
555 |
CAknConfirmationNote* note = new ( ELeave ) CAknConfirmationNote( ETrue );
|
|
556 |
note->ExecuteLD( *text );
|
|
557 |
CleanupStack::PopAndDestroy( text );
|
|
558 |
}
|
|
559 |
appList.Close();
|
|
560 |
}
|
|
561 |
|
|
562 |
// Set saved information
|
|
563 |
selectedObject.SetSaved( ETrue );
|
|
564 |
if ( obj )
|
|
565 |
{
|
|
566 |
obj->SetSaved( ETrue );
|
|
567 |
}
|
|
568 |
}
|
|
569 |
else
|
|
570 |
{
|
|
571 |
CMsgViewAttachmentsDialog::ProcessCommandL( EMsgViewAttachmentCmdSave );
|
|
572 |
|
|
573 |
// Set saved information
|
|
574 |
if ( selectedObject.IsSaved( )
|
|
575 |
&& obj )
|
|
576 |
{
|
|
577 |
obj->SetSaved( ETrue );
|
|
578 |
}
|
|
579 |
}
|
|
580 |
}
|
|
581 |
|
|
582 |
// ---------------------------------------------------------
|
|
583 |
// CUniObjectsViewDialog::ProcessCommandRemoveL
|
|
584 |
// ---------------------------------------------------------
|
|
585 |
//
|
|
586 |
void CUniObjectsViewDialog::ProcessCommandRemoveL( TInt aIndex )
|
|
587 |
{
|
|
588 |
if ( ( aIndex != -1 ) && iAttachmentModel.NumberOfItems() )
|
|
589 |
{
|
|
590 |
CMsgAttachmentInfo& attInfo = iAttachmentModel.AttachmentInfoAt( aIndex );
|
|
591 |
|
|
592 |
// Get the file name from atta info full path name.
|
|
593 |
TParsePtrC parser( attInfo.FileName() );
|
|
594 |
TFileName fileName2( parser.NameAndExt() );
|
|
595 |
|
|
596 |
if ( fileName2.Length() == 0 )
|
|
597 |
{
|
|
598 |
fileName2 = iDataModel.DataUtils().DefaultFileName();
|
|
599 |
}
|
|
600 |
|
|
601 |
HBufC* prompt = StringLoader::LoadLC(
|
|
602 |
R_UNUT_QUERY_COMMON_CONF_REMOVE,
|
|
603 |
fileName2,
|
|
604 |
iCoeEnv );
|
|
605 |
|
|
606 |
CAknQueryDialog* dlg = CAknQueryDialog::NewL();
|
|
607 |
TInt ret = dlg->ExecuteLD( R_UNUT_REMOVE_OBJECT_QUERY, *prompt );
|
|
608 |
|
|
609 |
CleanupStack::PopAndDestroy( prompt );
|
|
610 |
|
|
611 |
if ( ret )
|
|
612 |
{
|
|
613 |
TBool removingLastOfSlide = EFalse;
|
|
614 |
TBool setSeparatorToNext = EFalse;
|
|
615 |
if ( iDataModel.SmilModel().SlideObjectCount( SlideNumber( aIndex ) ) == 1 )
|
|
616 |
{
|
|
617 |
removingLastOfSlide = ETrue;
|
|
618 |
}
|
|
619 |
else if ( ( ( aIndex + 1 ) < iAttachmentModel.NumberOfItems() ) &&
|
|
620 |
( SlideNumber( aIndex ) == SlideNumber( aIndex + 1 ) ) )
|
|
621 |
{
|
|
622 |
CUniObjectsInfo& object = static_cast<CUniObjectsInfo&>
|
|
623 |
( iAttachmentModel.AttachmentInfoAt( aIndex ) );
|
|
624 |
if ( object.IsSeparator() )
|
|
625 |
{
|
|
626 |
setSeparatorToNext = ETrue;
|
|
627 |
}
|
|
628 |
}
|
|
629 |
|
|
630 |
// updates listbox after calling RemoveAttachmentL.
|
|
631 |
CMsgViewAttachmentsDialog::ProcessCommandL( EMsgViewAttachmentCmdRemove );
|
|
632 |
|
|
633 |
if ( removingLastOfSlide )
|
|
634 |
{
|
|
635 |
//removing the last object of the slide
|
|
636 |
CUniObjectsModel& objModel =
|
|
637 |
static_cast<CUniObjectsModel&>( iAttachmentModel );
|
|
638 |
|
|
639 |
CUniObjectsInfo* info = objModel.AddEmptySlideL(
|
|
640 |
iDataModel.DataUtils().EmptyPageString(),
|
|
641 |
aIndex );
|
|
642 |
if ( aIndex )
|
|
643 |
{
|
|
644 |
info->SetSeparator( ETrue );
|
|
645 |
}
|
|
646 |
ItemAddedL( aIndex );
|
|
647 |
}
|
|
648 |
else if ( setSeparatorToNext )
|
|
649 |
{
|
|
650 |
CUniObjectsInfo& object2 = static_cast<CUniObjectsInfo&>
|
|
651 |
( iAttachmentModel.AttachmentInfoAt( aIndex ) );
|
|
652 |
object2.SetSeparator( ETrue );
|
|
653 |
}
|
|
654 |
}
|
|
655 |
}
|
|
656 |
}
|
|
657 |
|
|
658 |
// ---------------------------------------------------------
|
|
659 |
// CUniObjectsViewDialog::ProcessCommandSendL
|
|
660 |
// ---------------------------------------------------------
|
|
661 |
//
|
|
662 |
void CUniObjectsViewDialog::ProcessCommandSendL( CMessageData& aMsgData,
|
|
663 |
TInt aIndex,
|
|
664 |
TUid aServiceId,
|
|
665 |
TUid aBioUid )
|
|
666 |
{
|
|
667 |
CUniObjectsInfo& selectedObject = static_cast<CUniObjectsInfo&>
|
|
668 |
( iAttachmentModel.AttachmentInfoAt( aIndex ) );
|
|
669 |
CUniObject* obj = selectedObject.Object();
|
|
670 |
|
|
671 |
TFileName fileName;
|
|
672 |
CRichText* text = NULL;
|
|
673 |
CFileMan* fileManager = NULL;
|
|
674 |
TSendingCapabilities serviceCapabilities;
|
|
675 |
iSendUi->ServiceCapabilitiesL( aServiceId,
|
|
676 |
serviceCapabilities);
|
|
677 |
TInt supportsBodyText( serviceCapabilities.iFlags & TSendingCapabilities::ESupportsBodyText );
|
|
678 |
|
|
679 |
if ( // send as body text
|
|
680 |
( obj->MediaType() == EMsgMediaText
|
|
681 |
&& supportsBodyText )
|
|
682 |
// send as atta
|
|
683 |
|| ( obj->MediaType() == EMsgMediaText &&
|
|
684 |
obj->MimeInfo()->Charset() != KCharacterSetMIBEnumUTF16BE &&
|
|
685 |
obj->MimeInfo()->Charset() != KCharacterSetMIBEnumUTF16LE &&
|
|
686 |
obj->MimeInfo()->Charset() != KCharacterSetMIBEnumUTF16 ) )
|
|
687 |
{
|
|
688 |
aMsgData.ClearAttachmentArray();
|
|
689 |
|
|
690 |
fileManager = CFileMan::NewL( iEikonEnv->FsSession() );
|
|
691 |
// CSa2
|
|
692 |
CleanupStack::PushL( fileManager );
|
|
693 |
CreateTempTextFileL( obj, fileName );
|
|
694 |
if ( supportsBodyText )
|
|
695 |
{
|
|
696 |
// send as body
|
|
697 |
text = CRichText::NewL( iEikonEnv->SystemParaFormatLayerL(),
|
|
698 |
iEikonEnv->SystemCharFormatLayerL(),
|
|
699 |
CEditableText::EFlatStorage );
|
|
700 |
// CSa3
|
|
701 |
CleanupStack::PushL(text);
|
|
702 |
text->ImportTextFileL(0,fileName,CPlainText::EOrganiseByParagraph);
|
|
703 |
|
|
704 |
// does not take ownership
|
|
705 |
aMsgData.SetBodyTextL( text );
|
|
706 |
}
|
|
707 |
else
|
|
708 |
{
|
|
709 |
aMsgData.AppendAttachmentL( fileName );
|
|
710 |
}
|
|
711 |
}
|
|
712 |
// else - aMsgData has already the needed handle
|
|
713 |
|
|
714 |
TRAPD( err, iSendUi->CreateAndSendMessageL( aServiceId, &aMsgData, aBioUid ) );
|
|
715 |
if ( text )
|
|
716 |
{
|
|
717 |
CleanupStack::PopAndDestroy( text );
|
|
718 |
}
|
|
719 |
if ( fileManager )
|
|
720 |
{
|
|
721 |
// Remove temp file & dir
|
|
722 |
fileManager->Delete( fileName );
|
|
723 |
fileManager->RmDir( fileName ); // remove directory
|
|
724 |
CleanupStack::PopAndDestroy( fileManager );
|
|
725 |
}
|
|
726 |
User::LeaveIfError( err );
|
|
727 |
}
|
|
728 |
|
|
729 |
// ---------------------------------------------------------
|
|
730 |
// CUniObjectsViewDialog::CreateTempTextFileL
|
|
731 |
// ---------------------------------------------------------
|
|
732 |
//
|
|
733 |
void CUniObjectsViewDialog::CreateTempTextFileL( CUniObject* aObject, TFileName& aTempFileName )
|
|
734 |
{
|
|
735 |
CreateTempPathL( aObject->MediaInfo()->FullFilePath(), aTempFileName );
|
|
736 |
|
|
737 |
TUint mibCharset = aObject->MimeInfo()->Charset();
|
|
738 |
if ( !mibCharset )
|
|
739 |
{
|
|
740 |
//assume US-ASCII - mandated by RFC 2046
|
|
741 |
mibCharset = KCharacterSetMIBEnumUsAscii;
|
|
742 |
}
|
|
743 |
TUint charconvCharsetID = iDataModel.DataUtils().MibIdToCharconvIdL( mibCharset );
|
|
744 |
|
|
745 |
// Import text
|
|
746 |
CPlainText* text = CPlainText::NewL();
|
|
747 |
CleanupStack::PushL( text );
|
|
748 |
|
|
749 |
RFile file = CUniDataUtils::GetAttachmentFileL( iDataModel.Mtm(), aObject->AttachmentId() );
|
|
750 |
CleanupClosePushL( file );
|
|
751 |
|
|
752 |
RFileReadStream input_stream( file );
|
|
753 |
CleanupClosePushL( input_stream );
|
|
754 |
|
|
755 |
CPlainText::TImportExportParam param;
|
|
756 |
param.iForeignEncoding = charconvCharsetID;
|
|
757 |
CPlainText::TImportExportResult result;
|
|
758 |
text->ImportTextL( 0, input_stream, param, result );
|
|
759 |
|
|
760 |
CleanupStack::PopAndDestroy( 2 ); // input_stream, file
|
|
761 |
|
|
762 |
// Export text as UCS-2
|
|
763 |
text->ExportAsTextL( aTempFileName, CPlainText::EOrganiseByParagraph, 0 );
|
|
764 |
CleanupStack::PopAndDestroy(); //text
|
|
765 |
}
|
|
766 |
|
|
767 |
// ---------------------------------------------------------
|
|
768 |
// CUniObjectsViewDialog::CreateTempPathL
|
|
769 |
// ---------------------------------------------------------
|
|
770 |
//
|
|
771 |
void CUniObjectsViewDialog::CreateTempPathL( const TDesC& aFileName, TFileName& aTempFileName )
|
|
772 |
{
|
|
773 |
// Create temp path
|
|
774 |
TParsePtrC parser( aFileName );
|
|
775 |
MsgAttachmentUtils::GetMsgEditorTempPath( aTempFileName );
|
|
776 |
aTempFileName.Append( KMmsFormatTwoDigits );
|
|
777 |
TTime time;
|
|
778 |
time.UniversalTime();
|
|
779 |
TBuf<KMaxFileName> tempDir;
|
|
780 |
tempDir.Format( aTempFileName, I64HIGH( time.Int64() ), I64LOW( time.Int64() ) );
|
|
781 |
iEikonEnv->FsSession().MkDir( tempDir );
|
|
782 |
aTempFileName = tempDir;
|
|
783 |
aTempFileName.Append( parser.NameAndExt() );
|
|
784 |
}
|
|
785 |
|
|
786 |
// ---------------------------------------------------------
|
|
787 |
// CUniObjectsViewDialog::OfferKeyEventL
|
|
788 |
//
|
|
789 |
// Handles key events.
|
|
790 |
// ---------------------------------------------------------
|
|
791 |
//
|
|
792 |
TKeyResponse CUniObjectsViewDialog::OfferKeyEventL( const TKeyEvent& aKeyEvent,
|
|
793 |
TEventCode aType )
|
|
794 |
{
|
|
795 |
if ( aType == EEventKey && !MenuShowing() )
|
|
796 |
{
|
|
797 |
CUniObjectsInfo& selectedObject = static_cast<CUniObjectsInfo&>
|
|
798 |
( iAttachmentModel.AttachmentInfoAt( CurrentListItemIndex() ) );
|
|
799 |
|
|
800 |
TBool emptySlide = ( selectedObject.Flags() & CUniObjectsInfo::EMmsSlide );
|
|
801 |
switch ( aKeyEvent.iCode )
|
|
802 |
{
|
|
803 |
case EKeyEnter:
|
|
804 |
case EKeyOK:
|
|
805 |
if ( !emptySlide )
|
|
806 |
{
|
|
807 |
ProcessCommandL(EMsgViewAttachmentCmdOpen);
|
|
808 |
}
|
|
809 |
return EKeyWasConsumed;
|
|
810 |
|
|
811 |
default:
|
|
812 |
break;
|
|
813 |
}
|
|
814 |
|
|
815 |
switch ( aKeyEvent.iScanCode )
|
|
816 |
{
|
|
817 |
case EStdKeyBackspace:
|
|
818 |
case EStdKeyDelete:
|
|
819 |
{
|
|
820 |
if ( ( iDialogType == EEditor &&
|
|
821 |
!emptySlide ) ||
|
|
822 |
( iDialogType == EForward &&
|
|
823 |
iDataModel.AttachmentList().Count() != 0 &&
|
|
824 |
SlideNumber( CurrentListItemIndex() == SlideNumber( iAttachmentModel.NumberOfItems() - 1 ) ) ) )
|
|
825 |
{
|
|
826 |
// Delete object if in editor mode and something else that empty slide is focuse.
|
|
827 |
// On forward mode deleting is enabled when attachment is focused.
|
|
828 |
ProcessCommandL(EMsgViewAttachmentCmdRemove);
|
|
829 |
}
|
|
830 |
// else - No operation
|
|
831 |
return EKeyWasConsumed;
|
|
832 |
}
|
|
833 |
case EStdKeyYes:
|
|
834 |
case EStdKeyNo:
|
|
835 |
{
|
|
836 |
// No operation
|
|
837 |
return EKeyWasConsumed;
|
|
838 |
}
|
|
839 |
default:
|
|
840 |
{
|
|
841 |
// No operation by default
|
|
842 |
break;
|
|
843 |
}
|
|
844 |
}
|
|
845 |
}
|
|
846 |
|
|
847 |
return CMsgViewAttachmentsDialog::OfferKeyEventL(aKeyEvent, aType);
|
|
848 |
}
|
|
849 |
|
|
850 |
// ---------------------------------------------------------
|
|
851 |
// CUniObjectsViewDialog::DynInitMenuPaneL
|
|
852 |
// ---------------------------------------------------------
|
|
853 |
//
|
|
854 |
void CUniObjectsViewDialog::DynInitMenuPaneL( TInt aMenuId,
|
|
855 |
CEikMenuPane* aMenuPane)
|
|
856 |
{
|
|
857 |
CMsgViewAttachmentsDialog::DynInitMenuPaneL( aMenuId, aMenuPane );
|
|
858 |
|
|
859 |
TInt index = CurrentListItemIndex();
|
|
860 |
TInt currentSlide = SlideNumber( index );
|
|
861 |
|
|
862 |
if ( !(iSupportedFeatures & EUniFeatureHelp) )
|
|
863 |
{
|
|
864 |
aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue );
|
|
865 |
}
|
|
866 |
|
|
867 |
switch ( aMenuId )
|
|
868 |
{
|
|
869 |
case R_MEB_ATTACHMENTS_MENUPANE:
|
|
870 |
if ( index == -1 || ! iAttachmentModel.NumberOfItems() )
|
|
871 |
{
|
|
872 |
// no selection or empty list.
|
|
873 |
|
|
874 |
aMenuPane->SetItemDimmed( EMsgViewAttachmentCmdOpen, ETrue );
|
|
875 |
|
|
876 |
if ( iDialogType == EEditor )
|
|
877 |
{
|
|
878 |
aMenuPane->SetItemDimmed( EMsgViewAttachmentCmdRemove, ETrue );
|
|
879 |
}
|
|
880 |
else if ( iDialogType == EViewer )
|
|
881 |
{
|
|
882 |
aMenuPane->SetItemDimmed( EMsgViewAttachmentCmdSave, ETrue );
|
|
883 |
}
|
|
884 |
}
|
|
885 |
else
|
|
886 |
{
|
|
887 |
CUniObjectsInfo& selectedObject = static_cast<CUniObjectsInfo&>
|
|
888 |
( iAttachmentModel.AttachmentInfoAt( index ) );
|
|
889 |
|
|
890 |
if ( iDialogType == EEditor )
|
|
891 |
{
|
|
892 |
if ( selectedObject.Flags() & CUniObjectsInfo::EMmsSlide )
|
|
893 |
{
|
|
894 |
aMenuPane->SetItemDimmed( EMsgViewAttachmentCmdOpen, ETrue );
|
|
895 |
aMenuPane->SetItemDimmed( EMsgViewAttachmentCmdRemove, ETrue );
|
|
896 |
}
|
|
897 |
TUniLayout layout = iDataModel.SmilModel().Layout();
|
|
898 |
if ( layout == EUniTextFirst )
|
|
899 |
{
|
|
900 |
aMenuPane->SetItemDimmed( EMmsObjectsTextFirst, ETrue );
|
|
901 |
}
|
|
902 |
else if ( layout == EUniImageFirst )
|
|
903 |
{
|
|
904 |
aMenuPane->SetItemDimmed( EMmsObjectsTextSecond, ETrue );
|
|
905 |
}
|
|
906 |
|
|
907 |
// either image or text object present but no both: no order menus.
|
|
908 |
// Not shown on Japanese variant ever.
|
|
909 |
if ( !IsImageAndTextPresent() ||
|
|
910 |
iSupportedFeatures & EUniFeatureJapanese )
|
|
911 |
{
|
|
912 |
aMenuPane->SetItemDimmed( EMmsObjectsTextFirst, ETrue );
|
|
913 |
aMenuPane->SetItemDimmed( EMmsObjectsTextSecond, ETrue );
|
|
914 |
}
|
|
915 |
}
|
|
916 |
else if ( iDialogType == EViewer )
|
|
917 |
{
|
|
918 |
CUniObject* obj = selectedObject.Object();
|
|
919 |
TBool showSendMenu = ETrue;
|
|
920 |
|
|
921 |
if ( selectedObject.Flags() & CUniObjectsInfo::EMmsSlide )
|
|
922 |
{
|
|
923 |
aMenuPane->SetItemDimmed( EMsgViewAttachmentCmdOpen, ETrue );
|
|
924 |
aMenuPane->SetItemDimmed( EMsgViewAttachmentCmdSave, ETrue );
|
|
925 |
showSendMenu = EFalse;
|
|
926 |
}
|
|
927 |
if ( index != -1 && !iBusy)
|
|
928 |
{
|
|
929 |
// Catch this leave. If something peculiar coming in msg headers
|
|
930 |
// and atta not natively handled by viewer CanSave might leave.
|
|
931 |
// ETC. application/x-epocinstall
|
|
932 |
TBool canSave = EFalse;
|
|
933 |
TRAPD( err, canSave = iDocHandler->CanSaveL( selectedObject.DataType() ) );
|
|
934 |
if ( err )
|
|
935 |
{
|
|
936 |
canSave = EFalse;
|
|
937 |
}
|
|
938 |
if ( !canSave )
|
|
939 |
{
|
|
940 |
aMenuPane->SetItemDimmed( EMsgViewAttachmentCmdSave, ETrue );
|
|
941 |
}
|
|
942 |
|
|
943 |
// Send menu if full OMA DRM and mime type does not belong to CCL
|
|
944 |
if ( !obj ||
|
|
945 |
( ! ( iSupportedFeatures & EUniFeatureDrmFull ) &&
|
|
946 |
obj->MediaInfo()->Protection() != EFileProtNoProtection )
|
|
947 |
// SD closed content objects can be forwarded.
|
|
948 |
// UI spec allows FL items to be sent from objects view,
|
|
949 |
// however, Send UI blocks sending.
|
|
950 |
|| ( iSupportedFeatures & EUniFeatureDrmFull &&
|
|
951 |
obj->MediaInfo()->Protection() == EFileProtClosedContent ) )
|
|
952 |
{
|
|
953 |
showSendMenu = EFalse;
|
|
954 |
}
|
|
955 |
}
|
|
956 |
|
|
957 |
if ( iSendUi && showSendMenu )
|
|
958 |
{
|
|
959 |
TInt pos = 0;
|
|
960 |
aMenuPane->ItemAndPos( EAknCmdExit, pos );
|
|
961 |
|
|
962 |
if ( iSupportedFeatures & EUniFeatureHelp )
|
|
963 |
{
|
|
964 |
pos -= 1;
|
|
965 |
}
|
|
966 |
// TSendingCapabilities::ESupportsAttachments is enough
|
|
967 |
// although bio and body text are possible but they are
|
|
968 |
// subset of attachment support
|
|
969 |
iSendUi->AddSendMenuItemL(
|
|
970 |
*aMenuPane,
|
|
971 |
pos,
|
|
972 |
EMmsObjectsSendVia,
|
|
973 |
TSendingCapabilities(
|
|
974 |
0,
|
|
975 |
0,
|
|
976 |
TSendingCapabilities::ESupportsAttachments )
|
|
977 |
);
|
|
978 |
aMenuPane->SetItemSpecific( EMmsObjectsSendVia, ETrue );
|
|
979 |
}
|
|
980 |
}
|
|
981 |
else if ( iDialogType == EForward )
|
|
982 |
{
|
|
983 |
// show remove for attachments...
|
|
984 |
if ( !( iDataModel.AttachmentList().Count() &&
|
|
985 |
currentSlide == SlideNumber( iAttachmentModel.NumberOfItems() - 1 ) ) )
|
|
986 |
{
|
|
987 |
// the attachments are in the last "slide"
|
|
988 |
aMenuPane->SetItemDimmed( EMsgViewAttachmentCmdRemove, ETrue );
|
|
989 |
}
|
|
990 |
}
|
|
991 |
}
|
|
992 |
break;
|
|
993 |
|
|
994 |
default:
|
|
995 |
break;
|
|
996 |
}
|
|
997 |
}
|
|
998 |
|
|
999 |
// ---------------------------------------------------------
|
|
1000 |
// CUniObjectsViewDialog::HandleServerAppExit
|
|
1001 |
// ---------------------------------------------------------
|
|
1002 |
//
|
|
1003 |
void CUniObjectsViewDialog::HandleServerAppExit( TInt aReason )
|
|
1004 |
{
|
|
1005 |
CMsgViewAttachmentsDialog::HandleServerAppExit( aReason );
|
|
1006 |
|
|
1007 |
TInt currentIndex( CurrentListItemIndex() );
|
|
1008 |
|
|
1009 |
CUniObjectsInfo& selectedObject =
|
|
1010 |
static_cast<CUniObjectsInfo&>( iAttachmentModel.AttachmentInfoAt( currentIndex ) );
|
|
1011 |
CUniObject* obj = selectedObject.Object();
|
|
1012 |
|
|
1013 |
CMsgAttachmentInfo::TDRMDataType drmType = CMsgAttachmentInfo::ENoLimitations;
|
|
1014 |
TRAPD( error, drmType = static_cast<CMsgAttachmentInfo::TDRMDataType>( GetObjectsInfoDRMTypeL( *obj ) ) );
|
|
1015 |
|
|
1016 |
if ( error == KErrNone &&
|
|
1017 |
drmType != selectedObject.DRMDataType() )
|
|
1018 |
{
|
|
1019 |
selectedObject.SetDRMDataType( drmType );
|
|
1020 |
UpdateIcon( currentIndex );
|
|
1021 |
}
|
|
1022 |
}
|
|
1023 |
|
|
1024 |
// ---------------------------------------------------------
|
|
1025 |
// CUniObjectsViewDialog::SlideNumber
|
|
1026 |
// ---------------------------------------------------------
|
|
1027 |
//
|
|
1028 |
TInt CUniObjectsViewDialog::SlideNumber( TInt aIndex )
|
|
1029 |
{
|
|
1030 |
TInt currentSlide = 0;
|
|
1031 |
for ( TInt i = 0; i <= aIndex; i++ )
|
|
1032 |
{
|
|
1033 |
CUniObjectsInfo& object = static_cast<CUniObjectsInfo&>
|
|
1034 |
( iAttachmentModel.AttachmentInfoAt( i ) );
|
|
1035 |
if ( object.IsSeparator() )
|
|
1036 |
{
|
|
1037 |
currentSlide++;
|
|
1038 |
}
|
|
1039 |
}
|
|
1040 |
return currentSlide;
|
|
1041 |
}
|
|
1042 |
|
|
1043 |
// ---------------------------------------------------------
|
|
1044 |
// CUniObjectsViewDialog::IsImageAndTextPresent
|
|
1045 |
// ---------------------------------------------------------
|
|
1046 |
//
|
|
1047 |
TBool CUniObjectsViewDialog::IsImageAndTextPresent()
|
|
1048 |
{
|
|
1049 |
TBool textFound = EFalse;
|
|
1050 |
TBool imageFound = EFalse;
|
|
1051 |
TInt slides = iDataModel.SmilModel().SlideCount();
|
|
1052 |
for ( TInt i = 0; i < slides && !( textFound && imageFound ); i++ )
|
|
1053 |
{
|
|
1054 |
if ( !textFound && iDataModel.SmilModel().GetObject( i, EUniRegionText ) )
|
|
1055 |
{
|
|
1056 |
textFound = ETrue;
|
|
1057 |
}
|
|
1058 |
if ( !imageFound && iDataModel.SmilModel().GetObject( i, EUniRegionImage ) )
|
|
1059 |
{
|
|
1060 |
imageFound = ETrue;
|
|
1061 |
}
|
|
1062 |
}
|
|
1063 |
return ( textFound && imageFound );
|
|
1064 |
}
|
|
1065 |
|
|
1066 |
|
|
1067 |
// ---------------------------------------------------------
|
|
1068 |
// CUniObjectsViewDialog::RemoveAttachmentL
|
|
1069 |
// ---------------------------------------------------------
|
|
1070 |
//
|
|
1071 |
void CUniObjectsViewDialog::RemoveAttachmentL( TInt aIndex )
|
|
1072 |
{
|
|
1073 |
CUniObjectsModel& objModel = static_cast<CUniObjectsModel&>( iAttachmentModel );
|
|
1074 |
|
|
1075 |
// delete item from attachment model (notifies its observer about deletion).
|
|
1076 |
objModel.DeleteObjectL( aIndex, ETrue );
|
|
1077 |
}
|
|
1078 |
|
|
1079 |
// ---------------------------------------------------------
|
|
1080 |
// CUniObjectsViewDialog::ChangeOrderL
|
|
1081 |
// ---------------------------------------------------------
|
|
1082 |
//
|
|
1083 |
void CUniObjectsViewDialog::ChangeOrderL( TInt aCommandId,
|
|
1084 |
TInt /*aNewPosition*/ )
|
|
1085 |
{
|
|
1086 |
CUniObjectsModel& objModel = static_cast<CUniObjectsModel&>( iAttachmentModel );
|
|
1087 |
|
|
1088 |
TInt count = iAttachmentModel.NumberOfItems();
|
|
1089 |
TInt currentSlide = 0;
|
|
1090 |
TInt i = 0;
|
|
1091 |
|
|
1092 |
while ( i < count )
|
|
1093 |
{
|
|
1094 |
CUniObjectsInfo& firstObject = static_cast<CUniObjectsInfo&>
|
|
1095 |
( iAttachmentModel.AttachmentInfoAt( i ) );
|
|
1096 |
i++;
|
|
1097 |
if ( i < count )
|
|
1098 |
{
|
|
1099 |
if ( currentSlide == SlideNumber( i ) )
|
|
1100 |
{
|
|
1101 |
CUniObjectsInfo& secondObject = static_cast<CUniObjectsInfo&>
|
|
1102 |
( iAttachmentModel.AttachmentInfoAt( i ) );
|
|
1103 |
if ( secondObject.Type() != MsgAttachmentUtils::EAudio )
|
|
1104 |
{
|
|
1105 |
if ( firstObject.IsSeparator() )
|
|
1106 |
{
|
|
1107 |
firstObject.SetSeparator( EFalse );
|
|
1108 |
secondObject.SetSeparator( ETrue );
|
|
1109 |
}
|
|
1110 |
objModel.ChangeOrderL( i, i - 1 );
|
|
1111 |
iListBox->HandleItemAdditionL();
|
|
1112 |
i++;
|
|
1113 |
if ( i < count )
|
|
1114 |
{
|
|
1115 |
if ( currentSlide == SlideNumber( i ) )
|
|
1116 |
{
|
|
1117 |
// there was 3rd object on the same slide
|
|
1118 |
i++;
|
|
1119 |
}
|
|
1120 |
}
|
|
1121 |
}
|
|
1122 |
else
|
|
1123 |
{
|
|
1124 |
// second object was audio
|
|
1125 |
// its always the last object of the slide
|
|
1126 |
i++;
|
|
1127 |
}
|
|
1128 |
}
|
|
1129 |
}
|
|
1130 |
currentSlide++;
|
|
1131 |
}
|
|
1132 |
|
|
1133 |
TUniLayout layout( EUniTextFirst );
|
|
1134 |
if ( aCommandId == EMmsObjectsTextSecond )
|
|
1135 |
{
|
|
1136 |
layout = EUniImageFirst;
|
|
1137 |
}
|
|
1138 |
objModel.NotifyChangeOrderL( layout );
|
|
1139 |
}
|
|
1140 |
|
|
1141 |
// ----------------------------------------------------
|
|
1142 |
// CUniObjectsViewDialog::LaunchHelpL
|
|
1143 |
// launch help using context
|
|
1144 |
// ----------------------------------------------------
|
|
1145 |
//
|
|
1146 |
void CUniObjectsViewDialog::LaunchHelpL()
|
|
1147 |
{
|
|
1148 |
if ( iSupportedFeatures & EUniFeatureHelp )
|
|
1149 |
{
|
|
1150 |
CCoeAppUi* editorAppUi = static_cast<CCoeAppUi*>( ControlEnv()->AppUi() );
|
|
1151 |
|
|
1152 |
CArrayFix<TCoeHelpContext>* helpContext = editorAppUi->AppHelpContextL();
|
|
1153 |
HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), helpContext );
|
|
1154 |
}
|
|
1155 |
}
|
|
1156 |
|
|
1157 |
// ----------------------------------------------------
|
|
1158 |
// CUniObjectsViewDialog::GetHelpContext
|
|
1159 |
// returns helpcontext as aContext
|
|
1160 |
// ----------------------------------------------------
|
|
1161 |
//
|
|
1162 |
void CUniObjectsViewDialog::GetHelpContext( TCoeHelpContext& aContext ) const
|
|
1163 |
{
|
|
1164 |
if ( iSupportedFeatures & EUniFeatureHelp )
|
|
1165 |
{
|
|
1166 |
if ( iDialogType == EViewer )
|
|
1167 |
{
|
|
1168 |
aContext.iContext = KMMS_HLP_OBJECTS_VIEW_VIEWER;
|
|
1169 |
aContext.iMajor = KUidMmsViewer;
|
|
1170 |
}
|
|
1171 |
else
|
|
1172 |
{
|
|
1173 |
aContext.iContext = KUNIFIED_HLP_ED_OBJECTS;
|
|
1174 |
aContext.iMajor = KUniEditorAppId;
|
|
1175 |
}
|
|
1176 |
}
|
|
1177 |
}
|
|
1178 |
|
|
1179 |
// ---------------------------------------------------------
|
|
1180 |
// CUniObjectsViewDialog::BioMessageTypeL
|
|
1181 |
// ---------------------------------------------------------
|
|
1182 |
//
|
|
1183 |
TBool CUniObjectsViewDialog::BioMessageTypeL( TPtrC8 aMimeType,
|
|
1184 |
TUid& aBioUid )
|
|
1185 |
{
|
|
1186 |
// Check bio message type
|
|
1187 |
TBool isBio = EFalse;
|
|
1188 |
HBufC* sample = HBufC::NewLC( aMimeType.Length() );
|
|
1189 |
TPtr samplePtr = sample->Des();
|
|
1190 |
samplePtr.Copy( aMimeType );
|
|
1191 |
|
|
1192 |
// need to create local RFs for BIO otherwise raises exception
|
|
1193 |
RFs& fs( CCoeEnv::Static()->FsSession() );
|
|
1194 |
CBIODatabase* bioDB = CBIODatabase::NewLC( fs );
|
|
1195 |
|
|
1196 |
// IsBioMessageL returns KErrNone if found or KErrNotFound if not found
|
|
1197 |
if ( bioDB->IsBioMessageL( EBioMsgIdIana, samplePtr, NULL, aBioUid ) == KErrNone)
|
|
1198 |
{
|
|
1199 |
isBio = ETrue;
|
|
1200 |
}
|
|
1201 |
CleanupStack::PopAndDestroy( 2, sample ); // + bioDb
|
|
1202 |
|
|
1203 |
return isBio;
|
|
1204 |
}
|
|
1205 |
|
|
1206 |
// ---------------------------------------------------------
|
|
1207 |
// CUniObjectsViewDialog::PopulateAttachmentModelL
|
|
1208 |
//
|
|
1209 |
// Creates new attachment model from smilmodel content for
|
|
1210 |
// objectsview usage
|
|
1211 |
// ---------------------------------------------------------
|
|
1212 |
//
|
|
1213 |
void CUniObjectsViewDialog::PopulateAttachmentModelL( CUniObjectsModel& aObjectsViewModel,
|
|
1214 |
CUniDataModel& aUniDataModel )
|
|
1215 |
{
|
|
1216 |
TInt slideCount = 0;
|
|
1217 |
TUniSmilType smilType( aUniDataModel.SmilType() );
|
|
1218 |
|
|
1219 |
if ( smilType == EMmsSmil ||
|
|
1220 |
smilType == ENoSmil ||
|
|
1221 |
smilType == EMultipleSmil )
|
|
1222 |
{
|
|
1223 |
slideCount = aUniDataModel.SmilModel().SlideCount();
|
|
1224 |
// Populate attamodel from smilmodel
|
|
1225 |
for ( TInt i = 0; i < slideCount; i++ )
|
|
1226 |
{
|
|
1227 |
if ( !aUniDataModel.SmilModel().SlideObjectCount( i ) )
|
|
1228 |
{
|
|
1229 |
CUniObjectsInfo* info = aObjectsViewModel.AddEmptySlideL(
|
|
1230 |
aUniDataModel.DataUtils().EmptyPageString() );
|
|
1231 |
if ( i ) // no separator for first slide
|
|
1232 |
{
|
|
1233 |
info->SetSeparator(ETrue);
|
|
1234 |
}
|
|
1235 |
}
|
|
1236 |
|
|
1237 |
for ( TInt ii = 0; ii < aUniDataModel.SmilModel().SlideObjectCount( i ); ii++ )
|
|
1238 |
{
|
|
1239 |
CUniObjectsInfo* info = CreateObjectsInfoL(
|
|
1240 |
aObjectsViewModel,
|
|
1241 |
*aUniDataModel.SmilModel().GetObjectByIndex( i, ii ),
|
|
1242 |
EFalse,
|
|
1243 |
i );
|
|
1244 |
// Slide separators. Drawn on top of list item -> needs to be drawn for
|
|
1245 |
// first item in slide. Don't draw for the first slide.
|
|
1246 |
if ( info && i > 0 && ii == 0 )
|
|
1247 |
{
|
|
1248 |
info->SetSeparator( ETrue );
|
|
1249 |
}
|
|
1250 |
}
|
|
1251 |
}
|
|
1252 |
}
|
|
1253 |
else
|
|
1254 |
{
|
|
1255 |
slideCount = Max( aUniDataModel.ObjectList().Count(), 1 );
|
|
1256 |
for ( TInt j = 0; j < aUniDataModel.ObjectList().Count(); j++ )
|
|
1257 |
{
|
|
1258 |
CreateObjectsInfoL( aObjectsViewModel,
|
|
1259 |
*aUniDataModel.ObjectList().GetByIndex( j ),
|
|
1260 |
EFalse,
|
|
1261 |
0 );
|
|
1262 |
}
|
|
1263 |
}
|
|
1264 |
|
|
1265 |
//add attachments to the end
|
|
1266 |
for ( TInt k = 0; k < aUniDataModel.AttachmentList().Count(); k++ )
|
|
1267 |
{
|
|
1268 |
CUniObjectsInfo* info = CreateObjectsInfoL( aObjectsViewModel,
|
|
1269 |
*aUniDataModel.AttachmentList().GetByIndex( k ),
|
|
1270 |
ETrue,
|
|
1271 |
-1 );
|
|
1272 |
info->SetSupported( EFalse );
|
|
1273 |
if ( k == 0 && slideCount )
|
|
1274 |
{
|
|
1275 |
info->SetSeparator( ETrue );
|
|
1276 |
}
|
|
1277 |
}
|
|
1278 |
}
|
|
1279 |
|
|
1280 |
// ---------------------------------------------------------
|
|
1281 |
// CUniObjectsViewDialog::CreateObjectsInfoL
|
|
1282 |
//
|
|
1283 |
// Creates CUniObjectsInfo object ands it to objects view
|
|
1284 |
// model. Objects view model has the ownership of the
|
|
1285 |
// new CUniObjectsInfo object.
|
|
1286 |
// ---------------------------------------------------------
|
|
1287 |
//
|
|
1288 |
CUniObjectsInfo* CUniObjectsViewDialog::CreateObjectsInfoL( CUniObjectsModel& aObjectsViewModel,
|
|
1289 |
CUniObject& aObject,
|
|
1290 |
TBool aAttachmentObject,
|
|
1291 |
TInt aSlideNumber )
|
|
1292 |
{
|
|
1293 |
CUniObjectsInfo* info = NULL;
|
|
1294 |
TInt drmType = GetObjectsInfoDRMTypeL( aObject );
|
|
1295 |
info = aObjectsViewModel.AddObjectL( aObject, drmType, aAttachmentObject, aSlideNumber );
|
|
1296 |
|
|
1297 |
TBool supported = ETrue;
|
|
1298 |
switch ( aObject.MediaType() )
|
|
1299 |
{
|
|
1300 |
case EMsgMediaText:
|
|
1301 |
info->SetType( MsgAttachmentUtils::ENote );
|
|
1302 |
break;
|
|
1303 |
case EMsgMediaImage:
|
|
1304 |
info->SetType( MsgAttachmentUtils::EImage );
|
|
1305 |
break;
|
|
1306 |
case EMsgMediaVideo:
|
|
1307 |
info->SetType( MsgAttachmentUtils::EVideo );
|
|
1308 |
break;
|
|
1309 |
case EMsgMediaAudio:
|
|
1310 |
info->SetType( MsgAttachmentUtils::EAudio );
|
|
1311 |
break;
|
|
1312 |
#ifdef RD_SVGT_IN_MESSAGING
|
|
1313 |
case EMsgMediaSvg:
|
|
1314 |
{
|
|
1315 |
info->SetType( MsgAttachmentUtils::ESVG );
|
|
1316 |
break;
|
|
1317 |
}
|
|
1318 |
#endif
|
|
1319 |
default:
|
|
1320 |
info->SetType( MsgAttachmentUtils::EUnknown );
|
|
1321 |
supported = EFalse;
|
|
1322 |
break;
|
|
1323 |
}
|
|
1324 |
info->SetSupported( supported );
|
|
1325 |
return info;
|
|
1326 |
}
|
|
1327 |
|
|
1328 |
// ---------------------------------------------------------
|
|
1329 |
// CUniObjectsViewDialog::GetObjectsInfoDRMTypeL
|
|
1330 |
// ---------------------------------------------------------
|
|
1331 |
//
|
|
1332 |
TInt CUniObjectsViewDialog::GetObjectsInfoDRMTypeL( CUniObject& aObject )
|
|
1333 |
{
|
|
1334 |
if ( aObject.DrmInfo() &&
|
|
1335 |
( aObject.MediaInfo()->Protection() &
|
|
1336 |
( EFileProtForwardLocked | EFileProtSuperDistributable ) ) )
|
|
1337 |
{
|
|
1338 |
// Changed EFalse->ETrue.
|
|
1339 |
// Use case to motivate this: object has not no rights -> Objects view ->
|
|
1340 |
// player launched -> rights are retrieved -> back to objects view ->
|
|
1341 |
// back to viewer -> object view again: in this phase wrong icon
|
|
1342 |
// would be shown unless rights are resolved again
|
|
1343 |
if ( aObject.DrmInfo()->RightsValidL( ETrue ) )
|
|
1344 |
{
|
|
1345 |
if ( aObject.MediaInfo()->Protection() & EFileProtForwardLocked )
|
|
1346 |
{
|
|
1347 |
return CMsgAttachmentInfo::EForwardLockedOrCombinedDelivery;
|
|
1348 |
}
|
|
1349 |
else // EMmsSuperDistributable
|
|
1350 |
{
|
|
1351 |
return CMsgAttachmentInfo::ESeparateDeliveryValidRights;
|
|
1352 |
}
|
|
1353 |
}
|
|
1354 |
else
|
|
1355 |
{
|
|
1356 |
if ( aObject.MediaInfo()->Protection() & EFileProtForwardLocked )
|
|
1357 |
{
|
|
1358 |
return CMsgAttachmentInfo::ECombinedDeliveryInvalidRights;
|
|
1359 |
}
|
|
1360 |
else // EMmsSuperDistributable
|
|
1361 |
{
|
|
1362 |
return CMsgAttachmentInfo::ESeparateDeliveryInvalidRights;
|
|
1363 |
}
|
|
1364 |
}
|
|
1365 |
}
|
|
1366 |
return CMsgAttachmentInfo::ENoLimitations;
|
|
1367 |
}
|
|
1368 |
|
|
1369 |
// ---------------------------------------------------------
|
|
1370 |
// CUniObjectsViewDialog::GetObjectsInfoDRMTypeL
|
|
1371 |
// ---------------------------------------------------------
|
|
1372 |
//
|
|
1373 |
void CUniObjectsViewDialog::HandleUniObjectEvent( CUniObject& aUniObject,
|
|
1374 |
TUniObjectEvent aUniEvent )
|
|
1375 |
{
|
|
1376 |
UNILOGGER_ENTERFN( "CUniObjectsViewDialog::HandleUniObjectEvent" );
|
|
1377 |
if ( aUniEvent == EUniObjectEventDrmRightsChanged
|
|
1378 |
&& aUniObject.DrmInfo()
|
|
1379 |
&& ( ( IsDrmRightsWhenLoaded( aUniObject )
|
|
1380 |
&& !IsRightsNow( aUniObject ) )
|
|
1381 |
|| ( !IsDrmRightsWhenLoaded( aUniObject )
|
|
1382 |
&& IsRightsNow( aUniObject ) )
|
|
1383 |
)
|
|
1384 |
)
|
|
1385 |
{
|
|
1386 |
CMsgAttachmentInfo::TDRMDataType drmType = CMsgAttachmentInfo::ENoLimitations;
|
|
1387 |
if ( IsRightsNow( aUniObject ) )
|
|
1388 |
{
|
|
1389 |
if ( aUniObject.MediaInfo()->Protection() & EFileProtForwardLocked )
|
|
1390 |
{
|
|
1391 |
drmType = CMsgAttachmentInfo::EForwardLockedOrCombinedDelivery;
|
|
1392 |
}
|
|
1393 |
else // EMmsSuperDistributable
|
|
1394 |
{
|
|
1395 |
drmType = CMsgAttachmentInfo::ESeparateDeliveryValidRights;
|
|
1396 |
}
|
|
1397 |
}
|
|
1398 |
else
|
|
1399 |
{
|
|
1400 |
if ( aUniObject.MediaInfo()->Protection() & EFileProtForwardLocked )
|
|
1401 |
{
|
|
1402 |
drmType = CMsgAttachmentInfo::ECombinedDeliveryInvalidRights;
|
|
1403 |
}
|
|
1404 |
else // EMmsSuperDistributable
|
|
1405 |
{
|
|
1406 |
drmType = CMsgAttachmentInfo::ESeparateDeliveryInvalidRights;
|
|
1407 |
}
|
|
1408 |
}
|
|
1409 |
UNILOGGER_WRITEF( _L("CUniObjectsViewDialog::HandleUniObjectEvent: drmType = %d "), drmType );
|
|
1410 |
|
|
1411 |
// when 'DRM rights when loaded info'
|
|
1412 |
aUniObject.SetDrmRightsWhenLoadedObjects( IsRightsNow( aUniObject ) );
|
|
1413 |
|
|
1414 |
// search for the CUniObjectsInfo
|
|
1415 |
CUniObjectsModel& model( static_cast<CUniObjectsModel&>( iAttachmentModel ) );
|
|
1416 |
TInt countObjects = model.NumberOfItems( );
|
|
1417 |
for ( TInt i = 0; i < countObjects; i++ )
|
|
1418 |
{
|
|
1419 |
CUniObjectsInfo& uniObjectInfo =
|
|
1420 |
static_cast<CUniObjectsInfo&>( model.AttachmentInfoAt( i ) );
|
|
1421 |
|
|
1422 |
CUniObject* obj = uniObjectInfo.Object();
|
|
1423 |
if ( obj == &aUniObject )
|
|
1424 |
{
|
|
1425 |
if ( drmType != uniObjectInfo.DRMDataType() )
|
|
1426 |
{
|
|
1427 |
UNILOGGER_WRITE( "CUniObjectsViewDialog::HandleUniObjectEvent setting new icon " );
|
|
1428 |
uniObjectInfo.SetDRMDataType( drmType );
|
|
1429 |
}
|
|
1430 |
}
|
|
1431 |
}
|
|
1432 |
DrawNow( );
|
|
1433 |
}
|
|
1434 |
}
|
|
1435 |
|
|
1436 |
// ---------------------------------------------------------
|
|
1437 |
// IsRightsNow
|
|
1438 |
// ---------------------------------------------------------
|
|
1439 |
//
|
|
1440 |
TBool CUniObjectsViewDialog::IsRightsNow( CUniObject& aObject ) const
|
|
1441 |
{
|
|
1442 |
TBool rightsNow( EFalse );
|
|
1443 |
if ( aObject.DrmInfo( ) )
|
|
1444 |
{
|
|
1445 |
TInt consumed( EFalse );
|
|
1446 |
// KErrNone: rights exist
|
|
1447 |
rightsNow = !aObject.DrmInfo( )->EvaluateRights( consumed );
|
|
1448 |
}
|
|
1449 |
UNILOGGER_WRITEF( _L("CUniObjectsViewDialog::IsRightsNow: rightsNow = %d "), rightsNow );
|
|
1450 |
return rightsNow;
|
|
1451 |
}
|
|
1452 |
|
|
1453 |
// ---------------------------------------------------------
|
|
1454 |
// IsDrmRightsWhenLoaded
|
|
1455 |
// ---------------------------------------------------------
|
|
1456 |
//
|
|
1457 |
TBool CUniObjectsViewDialog::IsDrmRightsWhenLoaded( CUniObject& aObject ) const
|
|
1458 |
{
|
|
1459 |
// Separate function just because of LOG traces
|
|
1460 |
TBool rightsWhenLoaded = aObject.IsDrmRightsWhenLoadedObjects();
|
|
1461 |
UNILOGGER_WRITEF( _L("CUniObjectsViewDialog::IsDrmRightsWhenLoaded: rightsWhenLoaded = %d "), rightsWhenLoaded );
|
|
1462 |
return rightsWhenLoaded;
|
|
1463 |
}
|
|
1464 |
|
|
1465 |
// End of File
|