|
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: |
|
15 * |
|
16 */ |
|
17 /* |
|
18 * glximgvwrmetadatacontainer.cpp |
|
19 * |
|
20 * Created on: Oct 22, 2009 |
|
21 * Author: sourbasu |
|
22 */ |
|
23 |
|
24 |
|
25 #include "glximgvwrmetadatacontainer.h" |
|
26 #include "glxustringconverter.h" // converts the symbian types to UString type |
|
27 #include <AknUtils.h> |
|
28 #include <StringLoader.h> |
|
29 #include <glxmetadatadialog.rsg> |
|
30 #include <glxviewbase.rsg> |
|
31 #include <glxlog.h> |
|
32 #include <glxtracer.h> |
|
33 #include <glxscreenfurniture.h> |
|
34 #include <glxdetailsmulmodelprovider.h> //Details data provider |
|
35 #include <glxdetailsboundcommand.hrh> |
|
36 #include <glxcommandhandleraddtocontainer.h> // For CGlxCommandHandlerAddToContainer |
|
37 #include <glxcommandhandlers.hrh> // for command handler id |
|
38 #include <glxcommandfactory.h> //for command factory |
|
39 #include <mpxcommandgeneraldefs.h> // Content ID identifying general category of content provided |
|
40 |
|
41 #include <glxtextentrypopup.h> |
|
42 #include <glxcollectionpluginall.hrh> |
|
43 #include <glxuistd.h> |
|
44 #include <glxcollectionplugintags.hrh> // tag collection plugin uid |
|
45 #include <glxthumbnailattributeinfo.h> // KGlxMediaIdThumbnail |
|
46 #include <glxattributeretriever.h> // CGlxAttributeReteiver |
|
47 #include <aknQueryControl.h> |
|
48 #include <glxdrmutility.h> //For launching DRM details pane |
|
49 #include <glxgeneraluiutilities.h> // General utilties class definition |
|
50 #include <ExifModify.h> |
|
51 #include <glxuiutilities.rsg> //For CExifModify |
|
52 #include <mpxmediadrmdefs.h> |
|
53 #include <glxfilterfactory.h> |
|
54 #include <glxcollectionpluginimageviewer.hrh> |
|
55 |
|
56 //marquee |
|
57 |
|
58 #include <eikfrlb.h> |
|
59 #include <eikfrlbd.h> |
|
60 const TInt KMaxMediaPopupTitleLength = 0x100; |
|
61 const TInt KMediaListId = 0x2000D248; |
|
62 const TInt KMarqueeLoopCount = 3; |
|
63 const TInt KMarqueeScrollAmount = 20; |
|
64 const TInt KMarqueeScrollDelay = 1000000; |
|
65 const TInt KMarqueeScrollInterval = 200000; |
|
66 _LIT( KGlxTextSetter, ""); |
|
67 |
|
68 // ============================ MEMBER FUNCTIONS =============================== |
|
69 |
|
70 // --------------------------------------------------------- |
|
71 // NewL |
|
72 // --------------------------------------------------------- |
|
73 // |
|
74 CGlxImgVwrMetadataContainer* CGlxImgVwrMetadataContainer::NewL( const TRect& aRect,const TDesC& item) |
|
75 { |
|
76 TRACER("CGlxImgVwrMetadataContainer::NewL"); |
|
77 CGlxImgVwrMetadataContainer* self = CGlxImgVwrMetadataContainer::NewLC( aRect,item); |
|
78 CleanupStack::Pop(self); |
|
79 return self; |
|
80 } |
|
81 |
|
82 // --------------------------------------------------------- |
|
83 // NewLC |
|
84 // --------------------------------------------------------- |
|
85 // |
|
86 CGlxImgVwrMetadataContainer* CGlxImgVwrMetadataContainer::NewLC( const TRect& aRect,const TDesC& aUri) |
|
87 { |
|
88 TRACER("CGlxImgVwrMetadataContainer::NewLC"); |
|
89 CGlxImgVwrMetadataContainer* self = new(ELeave) CGlxImgVwrMetadataContainer(aUri); |
|
90 CleanupStack::PushL(self); |
|
91 self->ConstructL( aRect); |
|
92 return self; |
|
93 } |
|
94 |
|
95 // --------------------------------------------------------- |
|
96 // CGlxImgVwrMetadataContainer |
|
97 // --------------------------------------------------------- |
|
98 // |
|
99 CGlxImgVwrMetadataContainer::CGlxImgVwrMetadataContainer(const TDesC& aUri) |
|
100 :iUri(aUri) |
|
101 { |
|
102 // No implementation |
|
103 } |
|
104 |
|
105 // --------------------------------------------------------- |
|
106 // CGlxImgVwrMetadataContainer::ConstructL |
|
107 // --------------------------------------------------------- |
|
108 // |
|
109 void CGlxImgVwrMetadataContainer::ConstructL( const TRect& /*aRect*/ ) |
|
110 { |
|
111 //Creating the RBuf texts for all the items except tags & albums |
|
112 //which would be updated as whne the item is edited |
|
113 iTextSetter.CreateL(KMaxFileName); |
|
114 CreateMediaListForSelectedItemL(); |
|
115 } |
|
116 |
|
117 // --------------------------------------------------------- |
|
118 // ~CGlxImgVwrMetadataContainer |
|
119 // --------------------------------------------------------- |
|
120 // |
|
121 CGlxImgVwrMetadataContainer::~CGlxImgVwrMetadataContainer() |
|
122 { |
|
123 TRACER("CGlxImgVwrMetadataContainer::~CGlxImgVwrMetadataContainer"); |
|
124 if( iItemMediaList ) |
|
125 { |
|
126 iItemMediaList->RemoveContext(iMainListAttributecontext); |
|
127 iItemMediaList->RemoveMediaListObserver(this); |
|
128 iItemMediaList->Close(); |
|
129 iItemMediaList = NULL; |
|
130 } |
|
131 if( iMainListAttributecontext ) |
|
132 { |
|
133 delete iMainListAttributecontext; |
|
134 iMainListAttributecontext = NULL; |
|
135 } |
|
136 if( IsVisible() ) |
|
137 { |
|
138 MakeVisible(EFalse); |
|
139 } |
|
140 iTextSetter.Close(); |
|
141 } |
|
142 |
|
143 //----------------------------------------------------------------------------- |
|
144 // CGlxImgVwrMetadataContainer::MediaList |
|
145 //----------------------------------------------------------------------------- |
|
146 MGlxMediaList& CGlxImgVwrMetadataContainer::MediaList() |
|
147 { |
|
148 //returns the active medialist. |
|
149 return *iItemMediaList; |
|
150 } |
|
151 |
|
152 //----------------------------------------------------------------------------- |
|
153 // CGlxImgVwrMetadataContainer::CreateSettingItemL |
|
154 //----------------------------------------------------------------------------- |
|
155 CAknSettingItem* CGlxImgVwrMetadataContainer::CreateSettingItemL(TInt aResourceId) |
|
156 { |
|
157 TRACER("CGlxImgVwrMetadataContainer::CreateSettingItemL"); |
|
158 CAknSettingItem* settingItem = NULL; // No need to push onto cleanup stack |
|
159 iTextSetter.Copy(KGlxTextSetter); |
|
160 |
|
161 //Creating a empty Settings list box which will be populated with metadata in handleattributeavailable |
|
162 |
|
163 switch(aResourceId) |
|
164 { |
|
165 case EImgVwrNameItem: |
|
166 case EImgVwrDateAndTimeItem: |
|
167 case EImgVwrDescriptionItem: |
|
168 { |
|
169 settingItem = new (ELeave) CAknTextSettingItem( |
|
170 aResourceId, iTextSetter ); |
|
171 |
|
172 break; |
|
173 } |
|
174 case EImgVwrSizeItem: |
|
175 case EImgVwrResolutionItem: |
|
176 { |
|
177 settingItem = new (ELeave) CAknTextSettingItem( |
|
178 aResourceId, iTextSetter ); |
|
179 |
|
180 break; |
|
181 } |
|
182 |
|
183 case EImgVwrlicenseItem: |
|
184 { |
|
185 settingItem = new (ELeave) CAknTextSettingItem( |
|
186 aResourceId, iTextSetter ); |
|
187 //Hide the item until we get the attributes |
|
188 //where in we check for the usage rights. |
|
189 settingItem->SetHidden(ETrue); |
|
190 //Required to refresh the listbox when any items visiblity is changed |
|
191 this->HandleChangeInItemArrayOrVisibilityL(); |
|
192 } |
|
193 break; |
|
194 |
|
195 default: |
|
196 { |
|
197 break; |
|
198 } |
|
199 } |
|
200 return settingItem; |
|
201 } |
|
202 //----------------------------------------------------------------------------- |
|
203 // CGlxImgVwrMetadataContainer::IsItemModifiable |
|
204 //----------------------------------------------------------------------------- |
|
205 TBool CGlxImgVwrMetadataContainer::IsItemModifiable() |
|
206 { |
|
207 //Only items like name , description, tag and albums are modifiable |
|
208 //The check is for the items from ENameItem(0) tille ETagsItem(4) |
|
209 if(ListBox()->CurrentItemIndex()<=ETagsItem) |
|
210 { |
|
211 return EFalse; |
|
212 } |
|
213 //return ETrue to dim the item |
|
214 return ETrue; |
|
215 |
|
216 } |
|
217 |
|
218 //----------------------------------------------------------------------------- |
|
219 // CGlxImgVwrMetadataContainer::HandleListBoxEventL |
|
220 //----------------------------------------------------------------------------- |
|
221 void CGlxImgVwrMetadataContainer::HandleListBoxEventL(CEikListBox* /*aListBox*/, |
|
222 TListBoxEvent aEventType) |
|
223 { |
|
224 GLX_LOG_INFO("CGlxImgVwrMetadataContainer::HandleListBoxEventL"); |
|
225 if ((aEventType == EEventEnterKeyPressed) || |
|
226 (aEventType == EEventEditingStarted) || |
|
227 (aEventType == EEventItemDoubleClicked)) |
|
228 { |
|
229 //handle edit functionality if items when useer selects via touch |
|
230 HandleListboxChangesL(); |
|
231 } |
|
232 } |
|
233 //----------------------------------------------------------------------------- |
|
234 // CGlxImgVwrMetadataContainer::HandleListboxChangesL |
|
235 //----------------------------------------------------------------------------- |
|
236 void CGlxImgVwrMetadataContainer::HandleListboxChangesL() |
|
237 { |
|
238 |
|
239 TInt index = ListBox()->CurrentItemIndex(); |
|
240 |
|
241 switch(index) |
|
242 { |
|
243 case EImgVwrNameItem: |
|
244 case EImgVwrDescriptionItem: |
|
245 { |
|
246 SetNameDescriptionL(index); |
|
247 break; |
|
248 } |
|
249 |
|
250 case EImgVwrlicenseItem: |
|
251 { |
|
252 |
|
253 //Create DRM utility |
|
254 CGlxDRMUtility* drmUtility = CGlxDRMUtility::InstanceL(); |
|
255 CleanupClosePushL(*drmUtility); |
|
256 drmUtility->ShowDRMDetailsPaneL(iItemMediaList->Item(0).Uri()/*iUri*/); |
|
257 CleanupStack::PopAndDestroy(drmUtility); |
|
258 } |
|
259 break; |
|
260 default: |
|
261 { |
|
262 break; |
|
263 } |
|
264 } |
|
265 |
|
266 } |
|
267 |
|
268 |
|
269 // ---------------------------------------------------------------------------- |
|
270 // CGlxImgVwrMetadataContainer::ViewDynInitMenuPaneL |
|
271 // ---------------------------------------------------------------------------- |
|
272 // |
|
273 void CGlxImgVwrMetadataContainer::ViewDynInitMenuPaneL(TInt aMenuId, CEikMenuPane* aMenuPane) |
|
274 { |
|
275 if( aMenuId == R_METADATA_MENU ) |
|
276 { |
|
277 //Set dim the options based on the utem selected |
|
278 //Viewdetails option will be availble only for the license item |
|
279 aMenuPane->SetItemDimmed(KGlxViewBoundMenuCommandId,IsLicenseItem()); |
|
280 } |
|
281 } |
|
282 |
|
283 //Medialist callbacks. |
|
284 // ---------------------------------------------------------------------------- |
|
285 // CGlxImgVwrMetadataContainer::HandleAttributesAvailableL |
|
286 // ---------------------------------------------------------------------------- |
|
287 // |
|
288 void CGlxImgVwrMetadataContainer::HandleAttributesAvailableL( TInt /*aItemIndex*/, |
|
289 const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* aList ) |
|
290 { |
|
291 |
|
292 TRACER("CGlxMetadataContainer::HandleAttributesAvailableL()"); |
|
293 //generic medialist for the item for all the attributes required other than tags and albums. |
|
294 TInt x = aAttributes.Count(); |
|
295 if(aList == iItemMediaList) |
|
296 { |
|
297 // Loop untill it checks for all the avialable attributes |
|
298 for (TInt i = aAttributes.Count() - 1; i >= 0 ; i--) |
|
299 { |
|
300 //set attributes to the items in the container |
|
301 SetAttributesL(aAttributes[i]); |
|
302 } |
|
303 } |
|
304 |
|
305 } |
|
306 |
|
307 // ---------------------------------------------------------------------------- |
|
308 // HandleItemAddedL |
|
309 // ---------------------------------------------------------------------------- |
|
310 // |
|
311 void CGlxImgVwrMetadataContainer::HandleItemAddedL( TInt /*aStartIndex*/, TInt /*aEndIndex*/, |
|
312 MGlxMediaList* aList ) |
|
313 { |
|
314 if(!iMarquee) |
|
315 { |
|
316 EnableMarqueingL(); |
|
317 } |
|
318 SetDurationLIicenseItemVisibilityL(); |
|
319 if(aList == iItemMediaList) |
|
320 { |
|
321 if(iItemMediaList->Count()) |
|
322 { |
|
323 TGlxMedia item = iItemMediaList->Item(0); |
|
324 CGlxUStringConverter* stringConverter = CGlxUStringConverter::NewL(); |
|
325 CleanupStack::PushL(stringConverter ); |
|
326 for(TInt index = 0; index <= 4; index++) |
|
327 { |
|
328 HBufC* string = NULL; |
|
329 |
|
330 if(index == EImgVwrSizeItem) |
|
331 { |
|
332 stringConverter->AsStringL(item, |
|
333 KMPXMediaGeneralSize,0, string ); |
|
334 } |
|
335 else if(index == EImgVwrNameItem) |
|
336 { |
|
337 stringConverter->AsStringL(item, |
|
338 KMPXMediaGeneralTitle,0, string ); |
|
339 } |
|
340 else if(index == EImgVwrDateAndTimeItem) |
|
341 { |
|
342 stringConverter->AsStringL( item, |
|
343 KMPXMediaGeneralDate, |
|
344 R_QTN_DATE_USUAL_WITH_ZERO,string ); |
|
345 } |
|
346 else if(index == EImgVwrDescriptionItem) |
|
347 { |
|
348 stringConverter->AsStringL(item, |
|
349 KMPXMediaGeneralComment,0, string ); |
|
350 } |
|
351 else if(index == EImgVwrResolutionItem) |
|
352 { |
|
353 stringConverter->AsStringL(item, |
|
354 KGlxMediaGeneralDimensions,0, string ); |
|
355 } |
|
356 else |
|
357 { |
|
358 //no implementation |
|
359 } |
|
360 if(string) |
|
361 { |
|
362 iTextSetter.Copy(KGlxTextSetter); |
|
363 iTextSetter.Append(*string); |
|
364 } |
|
365 EditItemL(index,EFalse); |
|
366 delete string; |
|
367 string = NULL; |
|
368 } |
|
369 CleanupStack::PopAndDestroy(stringConverter ); |
|
370 } |
|
371 } |
|
372 |
|
373 |
|
374 } |
|
375 // ---------------------------------------------------------------------------- |
|
376 // EnableMarqueingL |
|
377 // ---------------------------------------------------------------------------- |
|
378 // |
|
379 void CGlxImgVwrMetadataContainer::EnableMarqueingL() |
|
380 { |
|
381 TRACER("CGlxImgVwrMetadataContainer::EnableMarqueingL()"); |
|
382 iMarquee = ETrue; |
|
383 ListBox()->UseLogicalToVisualConversion(ETrue); |
|
384 ListBox()->ItemDrawer()->ColumnData()->SetMarqueeParams (KMarqueeLoopCount, |
|
385 KMarqueeScrollAmount, KMarqueeScrollDelay, KMarqueeScrollInterval); |
|
386 ListBox()->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue); |
|
387 } |
|
388 // ---------------------------------------------------------------------------- |
|
389 // HandleCommandCompleteL |
|
390 // ---------------------------------------------------------------------------- |
|
391 // |
|
392 void CGlxImgVwrMetadataContainer::HandleCommandCompleteL(TAny* aSessionId, |
|
393 CMPXCommand* /*aCommandResult*/, TInt aError, MGlxMediaList* aList) |
|
394 { |
|
395 TRACER("CGlxImgVwrMetadataContainer::HandleCommandCompleteL()"); |
|
396 } |
|
397 |
|
398 // ---------------------------------------------------------------------------- |
|
399 // HandleItemRemoved |
|
400 // ---------------------------------------------------------------------------- |
|
401 // |
|
402 void CGlxImgVwrMetadataContainer::HandleItemRemovedL( TInt /*aStartIndex*/, TInt /*aEndIndex*/, |
|
403 MGlxMediaList* /*aList*/ ) |
|
404 { |
|
405 TRACER("CGlxImgVwrMetadataContainer::HandleItemRemovedL()"); |
|
406 } |
|
407 // ---------------------------------------------------------------------------- |
|
408 // HandleFocusChangedL |
|
409 // ---------------------------------------------------------------------------- |
|
410 // |
|
411 void CGlxImgVwrMetadataContainer::HandleFocusChangedL( NGlxListDefs:: |
|
412 TFocusChangeType /*aType*/, TInt /*aNewIndex*/, TInt /*aOldIndex*/, |
|
413 MGlxMediaList* /*aList*/ ) |
|
414 { |
|
415 TRACER("CGlxImgVwrMetadataContainer::HandleFocusChangedL()"); |
|
416 } |
|
417 // ---------------------------------------------------------------------------- |
|
418 // HandleItemSelected |
|
419 // ---------------------------------------------------------------------------- |
|
420 // |
|
421 void CGlxImgVwrMetadataContainer::HandleItemSelectedL(TInt /*aIndex*/, |
|
422 TBool /*aSelected*/, MGlxMediaList* /*aList*/ ) |
|
423 { |
|
424 TRACER("CGlxImgVwrMetadataContainer::HandleItemSelectedL"); |
|
425 } |
|
426 // ---------------------------------------------------------------------------- |
|
427 // HandleMessageL |
|
428 // ---------------------------------------------------------------------------- |
|
429 // |
|
430 void CGlxImgVwrMetadataContainer::HandleMessageL( const CMPXMessage& /*aMessage*/, |
|
431 MGlxMediaList* /*aList*/ ) |
|
432 { |
|
433 TRACER("CGlxImgVwrMetadataContainer::HandleMessageL()"); |
|
434 } |
|
435 // ---------------------------------------------------------------------------- |
|
436 // HandleError |
|
437 // ---------------------------------------------------------------------------- |
|
438 // |
|
439 void CGlxImgVwrMetadataContainer::HandleError( TInt /*aError*/ ) |
|
440 { |
|
441 TRACER("CGlxImgVwrMetadataContainer::HandleError()"); |
|
442 TRAP_IGNORE(HandleErrorL()); |
|
443 } |
|
444 |
|
445 // ---------------------------------------------------------------------------- |
|
446 // HandleErrorL |
|
447 // ---------------------------------------------------------------------------- |
|
448 // |
|
449 void CGlxImgVwrMetadataContainer::HandleErrorL() |
|
450 { |
|
451 TRACER("CGlxImgVwrMetadataContainer::HandleErrorL()"); |
|
452 } |
|
453 // ---------------------------------------------------------------------------- |
|
454 // HandleCommandCompleteL |
|
455 // ---------------------------------------------------------------------------- |
|
456 // |
|
457 void CGlxImgVwrMetadataContainer::HandleCommandCompleteL( CMPXCommand* /*aCommandResult*/, |
|
458 TInt /*aError*/, MGlxMediaList* /*aList*/ ) |
|
459 { |
|
460 TRACER("CGlxImgVwrMetadataContainer::HandleCommandCompleteL()"); |
|
461 } |
|
462 |
|
463 // ---------------------------------------------------------------------------- |
|
464 // HandleMediaL |
|
465 // ---------------------------------------------------------------------------- |
|
466 // |
|
467 void CGlxImgVwrMetadataContainer::HandleMediaL( TInt /*aListIndex*/, MGlxMediaList* /*aList*/ ) |
|
468 { |
|
469 TRACER("CGlxImgVwrMetadataContainer::HandleMediaL()"); |
|
470 } |
|
471 |
|
472 // ---------------------------------------------------------------------------- |
|
473 // HandleItemModifiedL |
|
474 // ---------------------------------------------------------------------------- |
|
475 // |
|
476 void CGlxImgVwrMetadataContainer::HandleItemModifiedL( const RArray<TInt>& /*aItemIndexes*/, |
|
477 MGlxMediaList* /*aList*/ ) |
|
478 { |
|
479 TRACER("CGlxImgVwrMetadataContainer::HandleItemModifiedL()"); |
|
480 } |
|
481 // ---------------------------------------------------------------------------- |
|
482 // ChangeMskL |
|
483 // ---------------------------------------------------------------------------- |
|
484 // |
|
485 void CGlxImgVwrMetadataContainer::ChangeMskL() |
|
486 { |
|
487 TRACER("CGlxImgVwrMetadataContainer::ChangeMsk()"); |
|
488 TInt index = ListBox()->CurrentItemIndex(); |
|
489 CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); |
|
490 switch(index) |
|
491 { |
|
492 case EImgVwrNameItem: |
|
493 case EImgVwrDescriptionItem: |
|
494 |
|
495 { |
|
496 uiUtility->ScreenFurniture()->ModifySoftkeyIdL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
|
497 EAknSoftkeyEdit,R_GLX_METADATA_MSK_EDIT); |
|
498 } |
|
499 break; |
|
500 case EImgVwrDateAndTimeItem: |
|
501 case EImgVwrSizeItem: |
|
502 case EImgVwrResolutionItem: |
|
503 case EImgVwrlicenseItem: |
|
504 { |
|
505 uiUtility->ScreenFurniture()->ModifySoftkeyIdL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
|
506 EAknSoftkeyEdit,R_GLX_METADATA_MSK_BLANK); |
|
507 } |
|
508 break; |
|
509 default: |
|
510 { |
|
511 break; |
|
512 } |
|
513 } |
|
514 |
|
515 if ( uiUtility ) |
|
516 { |
|
517 uiUtility->Close(); |
|
518 } |
|
519 } |
|
520 |
|
521 //----------------------------------------------------------------------------- |
|
522 // CGlxImgVwrMetadataContainer::CreateMediaListForSelectedItemL |
|
523 //----------------------------------------------------------------------------- |
|
524 void CGlxImgVwrMetadataContainer::CreateMediaListForSelectedItemL() |
|
525 { |
|
526 TRACER("CGlxMetadataContainer::CreateMediaListL"); |
|
527 |
|
528 //create the collection path for the medialist to be created |
|
529 CMPXCollectionPath* path = CMPXCollectionPath::NewL(); |
|
530 CleanupStack::PushL( path ); |
|
531 //set the all collection path as the details dialog can be launched from any of the grid views and filter with URI |
|
532 path->AppendL(/*KGlxCollectionPluginAllImplementationUid*/KGlxCollectionPluginImageViewerImplementationUid); |
|
533 //create the filter with the URI |
|
534 CMPXFilter* filter = TGlxFilterFactory::CreateURIFilterL(iUri); |
|
535 CleanupStack::PushL( filter ); |
|
536 //create the medialist |
|
537 iItemMediaList = MGlxMediaList::InstanceL(*path,TGlxHierarchyId(KMediaListId),filter); |
|
538 |
|
539 //Add the attributes which are required to be displayed. |
|
540 iMainListAttributecontext = new (ELeave) CGlxAttributeContext(&iSelectionIterator); |
|
541 iMainListAttributecontext->AddAttributeL(KMPXMediaDrmProtected); |
|
542 iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralSize); |
|
543 iMainListAttributecontext->AddAttributeL(KGlxMediaGeneralDimensions); |
|
544 iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralTitle); |
|
545 iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralDate); |
|
546 iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralComment); |
|
547 |
|
548 //Add Context so that we get the handleattributes call once the medialist is populated with above mentioned attributes. |
|
549 iItemMediaList->AddContextL( iMainListAttributecontext, |
|
550 KGlxFetchContextPriorityBlocking ); |
|
551 |
|
552 //add to observer for callbacks. |
|
553 iItemMediaList->AddMediaListObserverL(this); |
|
554 |
|
555 CleanupStack::PopAndDestroy( filter ); |
|
556 CleanupStack::PopAndDestroy( path ); |
|
557 } |
|
558 // ---------------------------------------------------------------------------- |
|
559 // CGlxImgVwrMetadataContainer::SetAttributes |
|
560 // ---------------------------------------------------------------------------- |
|
561 // |
|
562 void CGlxImgVwrMetadataContainer::SetAttributesL(TMPXAttribute attribute) |
|
563 { |
|
564 TRACER("CGlxImgVwrMetadataContainer::SetAttributesL"); |
|
565 |
|
566 if(!iSetVisible) |
|
567 { |
|
568 iSetVisible = ETrue; |
|
569 SetDurationLIicenseItemVisibilityL(); |
|
570 } |
|
571 TGlxMedia item = iItemMediaList->Item(0); |
|
572 //Create the string convertor instance |
|
573 //String convertor class with provide the specific format for date,location and duration and size. |
|
574 CGlxUStringConverter* stringConverter = CGlxUStringConverter::NewL(); |
|
575 CleanupStack::PushL(stringConverter ); |
|
576 HBufC* string = NULL; |
|
577 |
|
578 //if attribute is date and time we need to pass the format it as R_QTN_DATE_USUAL_WITH_ZERO else null |
|
579 if(attribute == KMPXMediaGeneralDate) |
|
580 { |
|
581 stringConverter->AsStringL(item, |
|
582 attribute, |
|
583 R_QTN_DATE_USUAL_WITH_ZERO, string ); |
|
584 } |
|
585 else |
|
586 { |
|
587 stringConverter->AsStringL(item, |
|
588 attribute,0, string ); |
|
589 } |
|
590 //get the settings item based on the attribute and set the text. |
|
591 if ( string ) |
|
592 { |
|
593 iTextSetter.Copy(KGlxTextSetter); |
|
594 iTextSetter.Append(*string); |
|
595 if(attribute == KMPXMediaGeneralSize) |
|
596 { |
|
597 EditItemL(EImgVwrSizeItem,EFalse); |
|
598 } |
|
599 else if(attribute == KMPXMediaGeneralTitle) |
|
600 { |
|
601 EditItemL(EImgVwrNameItem,EFalse); |
|
602 } |
|
603 else if(attribute == KMPXMediaGeneralDate) |
|
604 { |
|
605 EditItemL(EImgVwrDateAndTimeItem,EFalse); |
|
606 } |
|
607 else if(attribute == KMPXMediaGeneralComment) |
|
608 { |
|
609 EditItemL(EImgVwrDescriptionItem,EFalse); |
|
610 } |
|
611 else if(attribute == KGlxMediaGeneralDimensions) |
|
612 { |
|
613 EditItemL(EImgVwrResolutionItem,EFalse); |
|
614 }/* |
|
615 else if(attribute == KMPXMediaDrmProtected) |
|
616 { |
|
617 EditItemL(EImgVwrlicenseItem,EFalse); |
|
618 }*/ |
|
619 else |
|
620 { |
|
621 |
|
622 } |
|
623 delete string; |
|
624 string = NULL; |
|
625 } |
|
626 CleanupStack::PopAndDestroy(stringConverter ); |
|
627 } |
|
628 |
|
629 // ---------------------------------------------------------------------------- |
|
630 // CGlxMetadataContainer::EditItemL |
|
631 // ---------------------------------------------------------------------------- |
|
632 // |
|
633 void CGlxImgVwrMetadataContainer::EditItemL(TInt aIndex, TBool /*aCalledFromMenu*/) |
|
634 { |
|
635 TRACER("CGlxImgVwrMetadataContainer::EditItemL"); |
|
636 CAknSettingItem* settingsitem = NULL; |
|
637 settingsitem = (*SettingItemArray())[aIndex]; |
|
638 settingsitem->LoadL(); |
|
639 settingsitem->UpdateListBoxTextL(); |
|
640 settingsitem->StoreL(); |
|
641 ListBox()->DrawNow(); |
|
642 } |
|
643 |
|
644 |
|
645 |
|
646 // ---------------------------------------------------------------------------- |
|
647 // CGlxMetadataContainer::SetAttributes |
|
648 // ---------------------------------------------------------------------------- |
|
649 // |
|
650 void CGlxImgVwrMetadataContainer::SetNameDescriptionL(TInt aItem) |
|
651 { |
|
652 TRACER("CGlxImgVwrMetadataContainer::SetNameDescriptionL"); |
|
653 //This function is commn for updatng both name and description once modified |
|
654 //get the item handle to be modified |
|
655 CAknSettingItem* settingsitem = (*SettingItemArray())[aItem]; |
|
656 HBufC* textBuf = HBufC::NewLC( KMaxMediaPopupTitleLength ); |
|
657 (textBuf->Des()).Copy((settingsitem->SettingTextL())); |
|
658 TPtr textPtr = textBuf->Des(); |
|
659 TBuf<KMaxMediaPopupTitleLength> titleText(*textBuf); |
|
660 HBufC *buf = NULL; |
|
661 if(aItem == ENameItem) |
|
662 { |
|
663 buf = StringLoader::LoadLC(R_GLX_METADATA_VIEW_TITLE_NSERIES); |
|
664 } |
|
665 else |
|
666 { |
|
667 buf = StringLoader::LoadLC(R_GLX_METADATA_VIEW_DESCRIPTION_NSERIES); |
|
668 } |
|
669 |
|
670 //Launch the text entry editor. |
|
671 CGlxTextEntryPopup* popup = CGlxTextEntryPopup::NewL( *buf, textPtr ); |
|
672 CleanupStack::PopAndDestroy(buf); |
|
673 |
|
674 //action upon selecting ok from the editor |
|
675 if ( popup->ExecuteLD() == EEikBidOk ) |
|
676 { |
|
677 if(0 != (titleText.Compare(*textBuf))) |
|
678 { |
|
679 //Modify the MDS and setting list only if the entry is different from previous Item value |
|
680 iTextSetter.Copy(*textBuf); |
|
681 EditItemL(aItem,EFalse); |
|
682 if( iItemMediaList->Count() > 0 ) |
|
683 { |
|
684 iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute,0);//set focus to first item |
|
685 CMPXCollectionPath* path = iItemMediaList->PathLC(); |
|
686 CMPXCommand* command = NULL; |
|
687 //Create the glx command based on the item |
|
688 if(aItem == ENameItem) |
|
689 { |
|
690 command = TGlxCommandFactory::RenameCommandLC(settingsitem->SettingTextL(), |
|
691 *path); |
|
692 } |
|
693 else |
|
694 { |
|
695 command = TGlxCommandFactory::SetDescriptionCommandLC(settingsitem->SettingTextL(), |
|
696 *path); |
|
697 } |
|
698 command->SetTObjectValueL<TAny*>(KMPXCommandGeneralSessionId, static_cast<TAny*>(this)); |
|
699 //issue command to the medialist which further calls data source to update MDS |
|
700 iItemMediaList->CommandL(*command); |
|
701 CleanupStack::PopAndDestroy(command); |
|
702 CleanupStack::PopAndDestroy(path); |
|
703 } |
|
704 } |
|
705 } |
|
706 CleanupStack::PopAndDestroy( textBuf ); |
|
707 |
|
708 } |
|
709 // ---------------------------------------------------------------------------- |
|
710 // CGlxImgVwrMetadataContainer::SetDurationLIicenseItemVisibilityL() |
|
711 // ---------------------------------------------------------------------------- |
|
712 // |
|
713 void CGlxImgVwrMetadataContainer::SetDurationLIicenseItemVisibilityL() |
|
714 { |
|
715 //get the media item. |
|
716 const TGlxMedia& item = iItemMediaList->Item(0); |
|
717 const CGlxMedia* media = item.Properties(); |
|
718 |
|
719 //in order to check for video category and drm rights |
|
720 |
|
721 CAknSettingItem* hiddenItem = NULL; |
|
722 |
|
723 if( media && media->IsSupported(KMPXMediaDrmProtected)) |
|
724 { |
|
725 if(item.IsDrmProtected()) |
|
726 { |
|
727 hiddenItem = (*SettingItemArray())[EImgVwrlicenseItem]; |
|
728 //Set the License item visible |
|
729 hiddenItem->SetHidden(EFalse); |
|
730 //Required to refresh the listbox when any items visiblity is changed |
|
731 this->HandleChangeInItemArrayOrVisibilityL(); |
|
732 } |
|
733 } |
|
734 } |
|
735 //----------------------------------------------------------------------------- |
|
736 // CGlxImgVwrMetadataContainer::IsLicenseItem |
|
737 //----------------------------------------------------------------------------- |
|
738 TBool CGlxImgVwrMetadataContainer::IsLicenseItem() |
|
739 { |
|
740 //Checks the item for DRMProtection. |
|
741 if((ListBox()->CurrentItemIndex()== EImgVwrlicenseItem)) |
|
742 { |
|
743 return EFalse; |
|
744 } |
|
745 return ETrue; |
|
746 } |
|
747 |
|
748 |
|
749 //End of file |