|
1 /* |
|
2 * Copyright (c) 2009 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: Image viewer metadata dialog implementation |
|
15 */ |
|
16 |
|
17 #include "glximgvwrmetadatacontainer.h" |
|
18 #include "glxustringconverter.h" // converts the symbian types to UString type |
|
19 #include <StringLoader.h> |
|
20 #include <glxmetadatadialog.rsg> |
|
21 #include <glxlog.h> |
|
22 #include <glxtracer.h> |
|
23 #include <glxscreenfurniture.h> |
|
24 #include <glxdetailsmulmodelprovider.h> //Details data provider |
|
25 #include <glxdetailsboundcommand.hrh> |
|
26 #include <mpxcommandgeneraldefs.h> // Content ID identifying general category of content provided |
|
27 #include <glxattributeretriever.h> // CGlxAttributeReteiver |
|
28 #include <glxdrmutility.h> //For launching DRM details pane |
|
29 #include <glxuiutilities.rsg> |
|
30 #include <mpxmediadrmdefs.h> |
|
31 #include <glxfilterfactory.h> |
|
32 #include <glxcollectionpluginimageviewer.hrh> |
|
33 #include <eikfrlb.h> // For marquee |
|
34 #include <eikfrlbd.h> // For marquee |
|
35 |
|
36 const TInt KMediaListId = 0x2000D248; |
|
37 const TInt KMarqueeLoopCount = 3; |
|
38 const TInt KMarqueeScrollAmount = 20; |
|
39 const TInt KMarqueeScrollDelay = 1000000; |
|
40 const TInt KMarqueeScrollInterval = 200000; |
|
41 |
|
42 // ============================ MEMBER FUNCTIONS =============================== |
|
43 |
|
44 // --------------------------------------------------------- |
|
45 // NewL |
|
46 // --------------------------------------------------------- |
|
47 // |
|
48 CGlxImgVwrMetadataContainer* CGlxImgVwrMetadataContainer::NewL( |
|
49 const TRect& aRect, const TDesC& item) |
|
50 { |
|
51 TRACER("CGlxImgVwrMetadataContainer::NewL"); |
|
52 CGlxImgVwrMetadataContainer* self = CGlxImgVwrMetadataContainer::NewLC( |
|
53 aRect, item); |
|
54 CleanupStack::Pop(self); |
|
55 return self; |
|
56 } |
|
57 |
|
58 // --------------------------------------------------------- |
|
59 // NewLC |
|
60 // --------------------------------------------------------- |
|
61 // |
|
62 CGlxImgVwrMetadataContainer* CGlxImgVwrMetadataContainer::NewLC( |
|
63 const TRect& aRect, const TDesC& aUri) |
|
64 { |
|
65 TRACER("CGlxImgVwrMetadataContainer::NewLC"); |
|
66 CGlxImgVwrMetadataContainer* self = |
|
67 new (ELeave) CGlxImgVwrMetadataContainer(aUri); |
|
68 CleanupStack::PushL(self); |
|
69 self->ConstructL(aRect); |
|
70 return self; |
|
71 } |
|
72 |
|
73 // --------------------------------------------------------- |
|
74 // CGlxImgVwrMetadataContainer |
|
75 // --------------------------------------------------------- |
|
76 // |
|
77 CGlxImgVwrMetadataContainer::CGlxImgVwrMetadataContainer( |
|
78 const TDesC& aUri) : iUri(aUri) |
|
79 { |
|
80 // No implementation |
|
81 } |
|
82 |
|
83 // --------------------------------------------------------- |
|
84 // CGlxImgVwrMetadataContainer::ConstructL |
|
85 // --------------------------------------------------------- |
|
86 // |
|
87 void CGlxImgVwrMetadataContainer::ConstructL(const TRect& /*aRect*/) |
|
88 { |
|
89 TRACER("CGlxMetadataContainer::ConstructLL()"); |
|
90 //Creating the RBuf texts for all the items except tags & albums |
|
91 //which would be updated as whne the item is edited |
|
92 iTextSetter.CreateL(KMaxFileName); |
|
93 CreateMediaListForSelectedItemL(); |
|
94 } |
|
95 |
|
96 // --------------------------------------------------------- |
|
97 // ~CGlxImgVwrMetadataContainer |
|
98 // --------------------------------------------------------- |
|
99 // |
|
100 CGlxImgVwrMetadataContainer::~CGlxImgVwrMetadataContainer() |
|
101 { |
|
102 TRACER("CGlxImgVwrMetadataContainer::~CGlxImgVwrMetadataContainer"); |
|
103 if (iItemMediaList) |
|
104 { |
|
105 iItemMediaList->RemoveContext(iMainListAttributecontext); |
|
106 iItemMediaList->RemoveMediaListObserver(this); |
|
107 iItemMediaList->Close(); |
|
108 iItemMediaList = NULL; |
|
109 } |
|
110 if (iMainListAttributecontext) |
|
111 { |
|
112 delete iMainListAttributecontext; |
|
113 iMainListAttributecontext = NULL; |
|
114 } |
|
115 if (IsVisible()) |
|
116 { |
|
117 MakeVisible(EFalse); |
|
118 } |
|
119 iTextSetter.Close(); |
|
120 } |
|
121 |
|
122 //----------------------------------------------------------------------------- |
|
123 // CGlxImgVwrMetadataContainer::MediaList |
|
124 //----------------------------------------------------------------------------- |
|
125 MGlxMediaList& CGlxImgVwrMetadataContainer::MediaList() |
|
126 { |
|
127 TRACER("CGlxMetadataContainer::HandleAttributesAvailableL()"); |
|
128 //returns the active medialist. |
|
129 return *iItemMediaList; |
|
130 } |
|
131 |
|
132 //----------------------------------------------------------------------------- |
|
133 // CGlxImgVwrMetadataContainer::CreateSettingItemL |
|
134 //----------------------------------------------------------------------------- |
|
135 CAknSettingItem* CGlxImgVwrMetadataContainer::CreateSettingItemL( |
|
136 TInt aResourceId) |
|
137 { |
|
138 TRACER("CGlxImgVwrMetadataContainer::CreateSettingItemL"); |
|
139 CAknSettingItem* settingItem = NULL; // No need to push onto cleanup stack |
|
140 iTextSetter.Zero(); |
|
141 |
|
142 //Creating a empty Settings list box which will be populated with metadata in handleattributeavailable |
|
143 switch (aResourceId) |
|
144 { |
|
145 case EImgVwrNameItem: |
|
146 case EImgVwrDateAndTimeItem: |
|
147 case EImgVwrMimeTypeItem: |
|
148 case EImgVwrSizeItem: |
|
149 case EImgVwrResolutionItem: |
|
150 { |
|
151 settingItem = new (ELeave) CAknTextSettingItem(aResourceId, |
|
152 iTextSetter); |
|
153 |
|
154 break; |
|
155 } |
|
156 |
|
157 case EImgVwrlicenseItem: |
|
158 { |
|
159 settingItem = new (ELeave) CAknTextSettingItem(aResourceId, |
|
160 iTextSetter); |
|
161 //Hide the item until we get the attributes |
|
162 //where in we check for the usage rights. |
|
163 settingItem->SetHidden(ETrue); |
|
164 //Required to refresh the listbox when any items visiblity is changed |
|
165 this->HandleChangeInItemArrayOrVisibilityL(); |
|
166 } |
|
167 break; |
|
168 |
|
169 default: |
|
170 { |
|
171 break; |
|
172 } |
|
173 } |
|
174 return settingItem; |
|
175 } |
|
176 |
|
177 //----------------------------------------------------------------------------- |
|
178 // CGlxImgVwrMetadataContainer::HandleListBoxEventL |
|
179 //----------------------------------------------------------------------------- |
|
180 void CGlxImgVwrMetadataContainer::HandleListBoxEventL( |
|
181 CEikListBox* /*aListBox*/, TListBoxEvent aEventType) |
|
182 { |
|
183 TRACER("CGlxImgVwrMetadataContainer::HandleListBoxEventL()"); |
|
184 if (aEventType == EEventItemSingleClicked) |
|
185 { |
|
186 if (iItemMediaList->Count() == 0) |
|
187 { |
|
188 GLX_LOG_INFO("CGlxImgVwrMetadataContainer:: NO Items"); |
|
189 return; |
|
190 } |
|
191 TInt index = ListBox()->CurrentItemIndex(); |
|
192 if (EImgVwrlicenseItem == index) |
|
193 { |
|
194 GLX_LOG_INFO("CGlxImgVwrMetadataContainer::Licence item"); |
|
195 CGlxDRMUtility* drmUtility = CGlxDRMUtility::InstanceL(); |
|
196 CleanupClosePushL(*drmUtility); |
|
197 CreateImageViewerInstanceL(); |
|
198 if (iImageViewerInstance->IsPrivate()) |
|
199 { |
|
200 RFile64& fileHandle = iImageViewerInstance->ImageFileHandle(); |
|
201 // check if rights have expired |
|
202 TBool expired = EFalse; |
|
203 expired = !drmUtility->ItemRightsValidityCheckL(fileHandle, |
|
204 ETrue); |
|
205 |
|
206 if (expired) |
|
207 { |
|
208 drmUtility->ShowRightsInfoL(fileHandle); |
|
209 } |
|
210 else |
|
211 { |
|
212 drmUtility->ShowDRMDetailsPaneL(fileHandle); |
|
213 } |
|
214 } |
|
215 else |
|
216 { |
|
217 const TDesC& uri = iItemMediaList->Item(0).Uri(); |
|
218 // check if rights have expired |
|
219 TBool expired = EFalse; |
|
220 expired = !drmUtility->ItemRightsValidityCheckL(uri, ETrue); |
|
221 |
|
222 if (expired) |
|
223 { |
|
224 drmUtility->ShowRightsInfoL(uri); |
|
225 } |
|
226 else |
|
227 { |
|
228 drmUtility->ShowDRMDetailsPaneL(uri); |
|
229 } |
|
230 } |
|
231 CleanupStack::PopAndDestroy(drmUtility); |
|
232 DeleteImageViewerInstance(); |
|
233 } |
|
234 } |
|
235 } |
|
236 |
|
237 //Medialist callbacks. |
|
238 // ---------------------------------------------------------------------------- |
|
239 // CGlxImgVwrMetadataContainer::HandleAttributesAvailableL |
|
240 // ---------------------------------------------------------------------------- |
|
241 // |
|
242 void CGlxImgVwrMetadataContainer::HandleAttributesAvailableL( |
|
243 TInt /*aItemIndex*/, const RArray<TMPXAttribute>& aAttributes, |
|
244 MGlxMediaList* aList) |
|
245 { |
|
246 TRACER("CGlxMetadataContainer::HandleAttributesAvailableL()"); |
|
247 //generic medialist for the item for all the attributes required other than tags and albums. |
|
248 TInt x = aAttributes.Count(); |
|
249 if (aList == iItemMediaList) |
|
250 { |
|
251 // Loop untill it checks for all the avialable attributes |
|
252 for (TInt i = aAttributes.Count() - 1; i >= 0; i--) |
|
253 { |
|
254 //set attributes to the items in the container |
|
255 SetAttributesL(aAttributes[i]); |
|
256 } |
|
257 } |
|
258 } |
|
259 |
|
260 // ---------------------------------------------------------------------------- |
|
261 // HandleItemAddedL |
|
262 // ---------------------------------------------------------------------------- |
|
263 // |
|
264 void CGlxImgVwrMetadataContainer::HandleItemAddedL(TInt /*aStartIndex*/, |
|
265 TInt /*aEndIndex*/, MGlxMediaList* aList) |
|
266 { |
|
267 TRACER("CGlxMetadataContainer::HandleItemAddedL()"); |
|
268 if (!iMarquee) |
|
269 { |
|
270 EnableMarqueingL(); |
|
271 } |
|
272 SetLicenseItemVisibilityL(); |
|
273 if (aList == iItemMediaList) |
|
274 { |
|
275 if (iItemMediaList->Count()) |
|
276 { |
|
277 TGlxMedia item = iItemMediaList->Item(0); |
|
278 CGlxUStringConverter* stringConverter = |
|
279 CGlxUStringConverter::NewL(); |
|
280 CleanupStack::PushL(stringConverter); |
|
281 for (TInt index = 0; index <= EImgVwrlicenseItem; index++) |
|
282 { |
|
283 HBufC* string = NULL; |
|
284 iTextSetter.Zero(); |
|
285 |
|
286 if (index == EImgVwrSizeItem) |
|
287 { |
|
288 stringConverter->AsStringL(item, KMPXMediaGeneralSize, 0, |
|
289 string); |
|
290 } |
|
291 else if (index == EImgVwrNameItem) |
|
292 { |
|
293 stringConverter->AsStringL(item, KMPXMediaGeneralTitle, |
|
294 0, string); |
|
295 } |
|
296 else if (index == EImgVwrDateAndTimeItem) |
|
297 { |
|
298 stringConverter->AsStringL(item, |
|
299 KGlxMediaGeneralLastModifiedDate, |
|
300 R_QTN_DATE_USUAL_WITH_ZERO, string); |
|
301 } |
|
302 else if (index == EImgVwrMimeTypeItem) |
|
303 { |
|
304 stringConverter->AsStringL(item, |
|
305 KMPXMediaGeneralMimeType, 0, string); |
|
306 } |
|
307 else if (index == EImgVwrResolutionItem) |
|
308 { |
|
309 stringConverter->AsStringL(item, |
|
310 KGlxMediaGeneralDimensions, 0, string); |
|
311 } |
|
312 else if (index == EImgVwrlicenseItem) |
|
313 { |
|
314 // If an item is DRM protected, License field in details |
|
315 // should display "View Details" |
|
316 string = StringLoader::LoadL( |
|
317 R_GLX_METADATA_VIEW_OPTIONS_VIEW); |
|
318 } |
|
319 else |
|
320 { |
|
321 //no implementation |
|
322 } |
|
323 if (string) |
|
324 { |
|
325 iTextSetter.Zero(); |
|
326 iTextSetter.Append(*string); |
|
327 } |
|
328 CleanupStack::PushL(string); |
|
329 EditItemL(index, EFalse); |
|
330 CleanupStack::PopAndDestroy(string); |
|
331 } |
|
332 CleanupStack::PopAndDestroy(stringConverter); |
|
333 } |
|
334 } |
|
335 } |
|
336 |
|
337 // ---------------------------------------------------------------------------- |
|
338 // EnableMarqueingL |
|
339 // ---------------------------------------------------------------------------- |
|
340 // |
|
341 void CGlxImgVwrMetadataContainer::EnableMarqueingL() |
|
342 { |
|
343 TRACER("CGlxImgVwrMetadataContainer::EnableMarqueingL()"); |
|
344 iMarquee = ETrue; |
|
345 ListBox()->UseLogicalToVisualConversion(ETrue); |
|
346 ListBox()->ItemDrawer()->ColumnData()->SetMarqueeParams( |
|
347 KMarqueeLoopCount, KMarqueeScrollAmount, KMarqueeScrollDelay, |
|
348 KMarqueeScrollInterval); |
|
349 ListBox()->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue); |
|
350 } |
|
351 |
|
352 // ---------------------------------------------------------------------------- |
|
353 // HandleCommandCompleteL |
|
354 // ---------------------------------------------------------------------------- |
|
355 // |
|
356 void CGlxImgVwrMetadataContainer::HandleCommandCompleteL( |
|
357 TAny* /*aSessionId*/, CMPXCommand* /*aCommandResult*/, |
|
358 TInt /*aError*/, MGlxMediaList* /*aList*/) |
|
359 { |
|
360 TRACER("CGlxImgVwrMetadataContainer::HandleCommandCompleteL()"); |
|
361 } |
|
362 |
|
363 // ---------------------------------------------------------------------------- |
|
364 // HandleItemRemoved |
|
365 // ---------------------------------------------------------------------------- |
|
366 // |
|
367 void CGlxImgVwrMetadataContainer::HandleItemRemovedL(TInt /*aStartIndex*/, |
|
368 TInt /*aEndIndex*/, MGlxMediaList* /*aList*/) |
|
369 { |
|
370 TRACER("CGlxImgVwrMetadataContainer::HandleItemRemovedL()"); |
|
371 } |
|
372 |
|
373 // ---------------------------------------------------------------------------- |
|
374 // HandleFocusChangedL |
|
375 // ---------------------------------------------------------------------------- |
|
376 // |
|
377 void CGlxImgVwrMetadataContainer::HandleFocusChangedL( |
|
378 NGlxListDefs::TFocusChangeType /*aType*/, TInt /*aNewIndex*/, |
|
379 TInt /*aOldIndex*/, MGlxMediaList* /*aList*/) |
|
380 { |
|
381 TRACER("CGlxImgVwrMetadataContainer::HandleFocusChangedL()"); |
|
382 } |
|
383 |
|
384 // ---------------------------------------------------------------------------- |
|
385 // HandleItemSelected |
|
386 // ---------------------------------------------------------------------------- |
|
387 // |
|
388 void CGlxImgVwrMetadataContainer::HandleItemSelectedL(TInt /*aIndex*/, |
|
389 TBool /*aSelected*/, MGlxMediaList* /*aList*/) |
|
390 { |
|
391 TRACER("CGlxImgVwrMetadataContainer::HandleItemSelectedL"); |
|
392 } |
|
393 |
|
394 // ---------------------------------------------------------------------------- |
|
395 // HandleMessageL |
|
396 // ---------------------------------------------------------------------------- |
|
397 // |
|
398 void CGlxImgVwrMetadataContainer::HandleMessageL( |
|
399 const CMPXMessage& /*aMessage*/, MGlxMediaList* /*aList*/) |
|
400 { |
|
401 TRACER("CGlxImgVwrMetadataContainer::HandleMessageL()"); |
|
402 } |
|
403 |
|
404 // ---------------------------------------------------------------------------- |
|
405 // HandleError |
|
406 // ---------------------------------------------------------------------------- |
|
407 // |
|
408 void CGlxImgVwrMetadataContainer::HandleError(TInt /*aError*/) |
|
409 { |
|
410 TRACER("CGlxImgVwrMetadataContainer::HandleError()"); |
|
411 } |
|
412 |
|
413 // ---------------------------------------------------------------------------- |
|
414 // HandleCommandCompleteL |
|
415 // ---------------------------------------------------------------------------- |
|
416 // |
|
417 void CGlxImgVwrMetadataContainer::HandleCommandCompleteL( |
|
418 CMPXCommand* /*aCommandResult*/, TInt /*aError*/, MGlxMediaList* /*aList*/) |
|
419 { |
|
420 TRACER("CGlxImgVwrMetadataContainer::HandleCommandCompleteL()"); |
|
421 } |
|
422 |
|
423 // ---------------------------------------------------------------------------- |
|
424 // HandleMediaL |
|
425 // ---------------------------------------------------------------------------- |
|
426 // |
|
427 void CGlxImgVwrMetadataContainer::HandleMediaL(TInt /*aListIndex*/, |
|
428 MGlxMediaList* /*aList*/) |
|
429 { |
|
430 TRACER("CGlxImgVwrMetadataContainer::HandleMediaL()"); |
|
431 } |
|
432 |
|
433 // ---------------------------------------------------------------------------- |
|
434 // HandleItemModifiedL |
|
435 // ---------------------------------------------------------------------------- |
|
436 // |
|
437 void CGlxImgVwrMetadataContainer::HandleItemModifiedL( |
|
438 const RArray<TInt>& /*aItemIndexes*/, MGlxMediaList* /*aList*/) |
|
439 { |
|
440 TRACER("CGlxImgVwrMetadataContainer::HandleItemModifiedL()"); |
|
441 } |
|
442 |
|
443 // ---------------------------------------------------------------------------- |
|
444 // ChangeMskL |
|
445 // ---------------------------------------------------------------------------- |
|
446 void CGlxImgVwrMetadataContainer::ChangeMskL() |
|
447 { |
|
448 TRACER("CGlxImgVwrMetadataContainer::ChangeMskL()"); |
|
449 CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); |
|
450 CleanupClosePushL(*uiUtility); |
|
451 switch (ListBox()->CurrentItemIndex()) |
|
452 { |
|
453 case EImgVwrNameItem: |
|
454 case EImgVwrMimeTypeItem: |
|
455 case EImgVwrDateAndTimeItem: |
|
456 case EImgVwrSizeItem: |
|
457 case EImgVwrResolutionItem: |
|
458 case EImgVwrlicenseItem: |
|
459 { |
|
460 uiUtility->ScreenFurniture()->ModifySoftkeyIdL( |
|
461 CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
|
462 EAknSoftkeyEdit, R_GLX_METADATA_MSK_BLANK); |
|
463 } |
|
464 break; |
|
465 default: |
|
466 { |
|
467 break; |
|
468 } |
|
469 } |
|
470 CleanupStack::PopAndDestroy(uiUtility); |
|
471 } |
|
472 |
|
473 //----------------------------------------------------------------------------- |
|
474 // CGlxImgVwrMetadataContainer::CreateMediaListForSelectedItemL |
|
475 //----------------------------------------------------------------------------- |
|
476 void CGlxImgVwrMetadataContainer::CreateMediaListForSelectedItemL() |
|
477 { |
|
478 TRACER("CGlxMetadataContainer::CreateMediaListForSelectedItemL"); |
|
479 |
|
480 //create the collection path for the medialist to be created |
|
481 CMPXCollectionPath* path = CMPXCollectionPath::NewL(); |
|
482 CleanupStack::PushL(path); |
|
483 // Set the Image viewer collection path as the details dialog |
|
484 // can be launched from private or user data path |
|
485 path->AppendL(KGlxCollectionPluginImageViewerImplementationUid); |
|
486 //create the filter with the URI |
|
487 CMPXFilter* filter = TGlxFilterFactory::CreateURIFilterL(iUri); |
|
488 CleanupStack::PushL(filter); |
|
489 //create the medialist |
|
490 iItemMediaList = MGlxMediaList::InstanceL(*path, TGlxHierarchyId( |
|
491 KMediaListId), filter); |
|
492 |
|
493 //Add the attributes which are required to be displayed. |
|
494 iMainListAttributecontext = new (ELeave) CGlxAttributeContext( |
|
495 &iSelectionIterator); |
|
496 iMainListAttributecontext->AddAttributeL(KMPXMediaDrmProtected); |
|
497 iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralSize); |
|
498 iMainListAttributecontext->AddAttributeL(KGlxMediaGeneralDimensions); |
|
499 iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralTitle); |
|
500 iMainListAttributecontext->AddAttributeL(KGlxMediaGeneralLastModifiedDate); |
|
501 iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralMimeType); |
|
502 |
|
503 //Add Context so that we get the handleattributes call once the medialist is populated with above mentioned attributes. |
|
504 iItemMediaList->AddContextL(iMainListAttributecontext, |
|
505 KGlxFetchContextPriorityBlocking); |
|
506 |
|
507 //add to observer for callbacks. |
|
508 iItemMediaList->AddMediaListObserverL(this); |
|
509 |
|
510 CleanupStack::PopAndDestroy(filter); |
|
511 CleanupStack::PopAndDestroy(path); |
|
512 } |
|
513 |
|
514 // ---------------------------------------------------------------------------- |
|
515 // CGlxImgVwrMetadataContainer::SetAttributesL |
|
516 // ---------------------------------------------------------------------------- |
|
517 // |
|
518 void CGlxImgVwrMetadataContainer::SetAttributesL(TMPXAttribute attribute) |
|
519 { |
|
520 TRACER("CGlxImgVwrMetadataContainer::SetAttributesL"); |
|
521 |
|
522 if (!iSetVisible) |
|
523 { |
|
524 iSetVisible = ETrue; |
|
525 SetLicenseItemVisibilityL(); |
|
526 } |
|
527 TGlxMedia item = iItemMediaList->Item(0); |
|
528 //Create the string convertor instance |
|
529 //String convertor class with provide the specific format for date,location and duration and size. |
|
530 CGlxUStringConverter* stringConverter = CGlxUStringConverter::NewL(); |
|
531 CleanupStack::PushL(stringConverter); |
|
532 HBufC* string = NULL; |
|
533 |
|
534 //if attribute is date and time we need to pass the format it as R_QTN_DATE_USUAL_WITH_ZERO else null |
|
535 if (attribute == KGlxMediaGeneralLastModifiedDate) |
|
536 { |
|
537 stringConverter->AsStringL(item, attribute, |
|
538 R_QTN_DATE_USUAL_WITH_ZERO, string); |
|
539 } |
|
540 else |
|
541 { |
|
542 stringConverter->AsStringL(item, attribute, 0, string); |
|
543 } |
|
544 //get the settings item based on the attribute and set the text. |
|
545 if (string) |
|
546 { |
|
547 iTextSetter.Zero(); |
|
548 iTextSetter.Append(*string); |
|
549 if (attribute == KMPXMediaGeneralSize) |
|
550 { |
|
551 EditItemL(EImgVwrSizeItem, EFalse); |
|
552 } |
|
553 else if (attribute == KMPXMediaGeneralTitle) |
|
554 { |
|
555 EditItemL(EImgVwrNameItem, EFalse); |
|
556 } |
|
557 else if (attribute == KGlxMediaGeneralLastModifiedDate) |
|
558 { |
|
559 EditItemL(EImgVwrDateAndTimeItem, EFalse); |
|
560 } |
|
561 else if (attribute == KMPXMediaGeneralMimeType) |
|
562 { |
|
563 EditItemL(EImgVwrMimeTypeItem, EFalse); |
|
564 } |
|
565 else if (attribute == KGlxMediaGeneralDimensions) |
|
566 { |
|
567 EditItemL(EImgVwrResolutionItem, EFalse); |
|
568 } |
|
569 else if(attribute == KMPXMediaDrmProtected) |
|
570 { |
|
571 EditItemL(EImgVwrlicenseItem, EFalse); |
|
572 } |
|
573 else |
|
574 { |
|
575 //no implementation |
|
576 } |
|
577 delete string; |
|
578 string = NULL; |
|
579 } |
|
580 CleanupStack::PopAndDestroy(stringConverter); |
|
581 } |
|
582 |
|
583 // ---------------------------------------------------------------------------- |
|
584 // CGlxMetadataContainer::EditItemL |
|
585 // ---------------------------------------------------------------------------- |
|
586 // |
|
587 void CGlxImgVwrMetadataContainer::EditItemL(TInt aIndex, TBool /*aCalledFromMenu*/) |
|
588 { |
|
589 TRACER("CGlxImgVwrMetadataContainer::EditItemL"); |
|
590 CAknSettingItem* settingsitem = NULL; |
|
591 settingsitem = (*SettingItemArray())[aIndex]; |
|
592 settingsitem->LoadL(); |
|
593 settingsitem->UpdateListBoxTextL(); |
|
594 settingsitem->StoreL(); |
|
595 ListBox()->DrawNow(); |
|
596 } |
|
597 |
|
598 // ---------------------------------------------------------------------------- |
|
599 // CGlxImgVwrMetadataContainer::SetLicenseItemVisibilityL() |
|
600 // ---------------------------------------------------------------------------- |
|
601 void CGlxImgVwrMetadataContainer::SetLicenseItemVisibilityL() |
|
602 { |
|
603 TRACER("CGlxMetadataContainer::SetLicenseItemVisibilityL()"); |
|
604 //get the media item. |
|
605 const TGlxMedia& item = iItemMediaList->Item(0); |
|
606 const CGlxMedia* media = item.Properties(); |
|
607 |
|
608 // Check for DRM protection |
|
609 if (media && media->IsSupported(KMPXMediaDrmProtected)) |
|
610 { |
|
611 if (item.IsDrmProtected()) |
|
612 { |
|
613 CAknSettingItem* hiddenItem = |
|
614 (*SettingItemArray())[EImgVwrlicenseItem]; |
|
615 //Set the License item visible |
|
616 hiddenItem->SetHidden(EFalse); |
|
617 //Refresh the listbox when any items visiblity is changed |
|
618 this->HandleChangeInItemArrayOrVisibilityL(); |
|
619 } |
|
620 } |
|
621 } |
|
622 |
|
623 // ----------------------------------------------------------------------------- |
|
624 // CreateImageViewerInstanceL |
|
625 // ----------------------------------------------------------------------------- |
|
626 // |
|
627 void CGlxImgVwrMetadataContainer::CreateImageViewerInstanceL() |
|
628 { |
|
629 TRACER("CGlxImgVwrMetadataContainer::CreateImageViewerInstanceL"); |
|
630 iImageViewerInstance = CGlxImageViewerManager::InstanceL(); |
|
631 __ASSERT_ALWAYS(iImageViewerInstance, Panic(EGlxPanicNullPointer)); |
|
632 } |
|
633 |
|
634 // ----------------------------------------------------------------------------- |
|
635 // DeleteImageViewerInstance |
|
636 // ----------------------------------------------------------------------------- |
|
637 // |
|
638 void CGlxImgVwrMetadataContainer::DeleteImageViewerInstance() |
|
639 { |
|
640 TRACER("CGlxImgVwrMetadataContainer::DeleteImageViewerInstance"); |
|
641 if (iImageViewerInstance) |
|
642 { |
|
643 iImageViewerInstance->DeleteInstance(); |
|
644 } |
|
645 } |
|
646 |
|
647 //End of file |