author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 21:19:17 +0300 | |
branch | RCL_3 |
changeset 27 | 34937ec34dac |
parent 26 | 5b3385a43d68 |
permissions | -rw-r--r-- |
26 | 1 |
/* |
2 |
* Copyright (c) 2008-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: Implementation of Metadata dialog |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#include "glxmetadatacontainer.h" |
|
19 |
#include "glxustringconverter.h" // converts the symbian types to UString type |
|
20 |
#include "mglxmetadatadialogobserver.h" |
|
21 |
||
22 |
#include <StringLoader.h> |
|
23 |
#include <caf/manager.h> // For Filesystem |
|
24 |
#include <ExifModify.h> // For CExifModify |
|
25 |
#include <mpxcommandgeneraldefs.h> // Content ID identifying general category of content provided |
|
26 |
#include <mpxmediadrmdefs.h> |
|
27 |
#include <eikfrlb.h> // For marquee |
|
28 |
#include <eikfrlbd.h> // For marquee |
|
29 |
||
30 |
#include <glxmetadatadialog.rsg> |
|
31 |
#include <glxscreenfurniture.h> |
|
32 |
#include <glxdetailsboundcommand.hrh> |
|
33 |
#include <glxcommandhandleraddtocontainer.h> // For CGlxCommandHandlerAddToContainer |
|
34 |
#include <glxcommandhandlers.hrh> // for command handler id |
|
35 |
#include <glxcommandfactory.h> // for command factory |
|
36 |
#include <glxtextentrypopup.h> |
|
37 |
#include <glxuistd.h> |
|
38 |
#include <glxcollectionplugintags.hrh> // tag collection plugin uid |
|
39 |
#include <glxattributeretriever.h> // CGlxAttributeReteiver |
|
40 |
#include <glxdrmutility.h> // For launching DRM details pane |
|
41 |
#include <glxgeneraluiutilities.h> // General utilties class definition |
|
42 |
#include <glxuiutilities.rsg> |
|
43 |
#include <glxfilterfactory.h> |
|
44 |
#include <glxlog.h> |
|
45 |
#include <glxtracer.h> |
|
46 |
#include <glxgeneraluiutilities.h> |
|
47 |
||
48 |
const TInt KMediaListId = 0x2000D248; |
|
49 |
const TInt KOffsets = 50; |
|
50 |
const TInt KMarqueeLoopCount = 3; |
|
51 |
const TInt KMarqueeScrollAmount = 20; |
|
52 |
const TInt KMarqueeScrollDelay = 1000000; |
|
53 |
const TInt KMarqueeScrollInterval = 200000; |
|
54 |
||
55 |
_LIT( KGlxComma, ","); |
|
56 |
||
57 |
// ============================ MEMBER FUNCTIONS =============================== |
|
58 |
||
59 |
// --------------------------------------------------------- |
|
60 |
// NewL |
|
61 |
// --------------------------------------------------------- |
|
62 |
// |
|
63 |
CGlxMetadataContainer* CGlxMetadataContainer::NewL(const TRect& aRect, |
|
64 |
MGlxMetadataDialogObserver& aDialogObserver, const TDesC& item, |
|
65 |
MToolbarResetObserver& aResetToolbarObs) |
|
66 |
{ |
|
67 |
TRACER("CGlxMetadataContainer::NewL"); |
|
68 |
CGlxMetadataContainer* self = CGlxMetadataContainer::NewLC(aRect, |
|
69 |
aDialogObserver, item, aResetToolbarObs); |
|
70 |
CleanupStack::Pop(self); |
|
71 |
return self; |
|
72 |
} |
|
73 |
||
74 |
// --------------------------------------------------------- |
|
75 |
// NewLC |
|
76 |
// --------------------------------------------------------- |
|
77 |
// |
|
78 |
CGlxMetadataContainer* CGlxMetadataContainer::NewLC(const TRect& aRect, |
|
79 |
MGlxMetadataDialogObserver& aDialogObserver, const TDesC& aUri, |
|
80 |
MToolbarResetObserver& aResetToolbarObs) |
|
81 |
{ |
|
82 |
TRACER("CGlxMetadataContainer::NewLC"); |
|
83 |
CGlxMetadataContainer* self = new (ELeave) CGlxMetadataContainer( |
|
84 |
aDialogObserver, aResetToolbarObs); |
|
85 |
CleanupStack::PushL(self); |
|
86 |
self->ConstructL(aRect, aUri); |
|
87 |
return self; |
|
88 |
} |
|
89 |
||
90 |
// --------------------------------------------------------- |
|
91 |
// CGlxMetadataContainer |
|
92 |
// --------------------------------------------------------- |
|
93 |
// |
|
94 |
CGlxMetadataContainer::CGlxMetadataContainer( |
|
95 |
MGlxMetadataDialogObserver& aDialogObserver, |
|
96 |
MToolbarResetObserver& aResetToolbarObs) : |
|
97 |
iDialogObesrver(aDialogObserver), iResetToolbarObs(aResetToolbarObs) |
|
98 |
{ |
|
99 |
// No implementation |
|
100 |
} |
|
101 |
||
102 |
// --------------------------------------------------------- |
|
103 |
// CGlxMetadataContainer::ConstructL |
|
104 |
// --------------------------------------------------------- |
|
105 |
// |
|
106 |
void CGlxMetadataContainer::ConstructL(const TRect& /*aRect*/, |
|
107 |
const TDesC& aUri) |
|
108 |
{ |
|
109 |
TRACER("CGlxMetadataContainer::ConstructL"); |
|
110 |
||
111 |
//media's uri |
|
112 |
iUri = aUri.AllocL(); |
|
113 |
||
114 |
//Creating the RBuf texts for all the items except tags & albums |
|
115 |
//which would be updated as whne the item is edited |
|
116 |
iTextSetter.CreateL(KMaxFileName); |
|
117 |
||
118 |
//RBuf text which would be updated as when a tag is edited for the item. |
|
119 |
iTagSetter.CreateL(KMaxFileName); |
|
120 |
||
121 |
//RBuf text which would be updated as when a album is edited for the item. |
|
122 |
iAlbumSetter.CreateL(KMaxFileName); |
|
123 |
||
124 |
//Create medialist filtered by uri - iUri |
|
125 |
CreateMediaListForSelectedItemL(); |
|
126 |
||
127 |
//Setting the iVideo flag to EFalse initially |
|
128 |
iVideo = EFalse; |
|
129 |
||
130 |
//Setting the iMarquee flag to EFalse initially |
|
131 |
iMarquee = EFalse; |
|
132 |
||
133 |
//check when Remove location information is selected. |
|
134 |
iLocationinfo = EFalse; |
|
135 |
||
136 |
//Flag to indicate rename command is started |
|
137 |
iRenameStarted = EFalse; |
|
27
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
138 |
|
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
139 |
// Flag to indicate text entry popup display status |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
140 |
iIsPopupShown = EFalse; |
26 | 141 |
} |
142 |
||
143 |
// --------------------------------------------------------- |
|
144 |
// ~CGlxMetadataContainer |
|
145 |
// --------------------------------------------------------- |
|
146 |
// |
|
147 |
CGlxMetadataContainer::~CGlxMetadataContainer() |
|
148 |
{ |
|
149 |
TRACER("CGlxMetadataContainer::~CGlxMetadataContainer"); |
|
150 |
if( iItemMediaList ) |
|
151 |
{ |
|
152 |
iItemMediaList->RemoveContext(iMainListAttributecontext); |
|
153 |
iItemMediaList->RemoveMediaListObserver(this); |
|
154 |
iItemMediaList->Close(); |
|
155 |
iItemMediaList = NULL; |
|
156 |
} |
|
157 |
if ( iTagMediaList ) |
|
158 |
{ |
|
159 |
iTagMediaList->RemoveContext(iTagContext); |
|
160 |
iTagMediaList->RemoveMediaListObserver(this); |
|
161 |
iTagMediaList->Close(); |
|
162 |
iTagMediaList = NULL; |
|
163 |
} |
|
164 |
if ( iAlbumMediaList ) |
|
165 |
{ |
|
166 |
iAlbumMediaList->RemoveContext(iAlbumContext); |
|
167 |
iAlbumMediaList->RemoveMediaListObserver(this); |
|
168 |
iAlbumMediaList->Close(); |
|
169 |
iAlbumMediaList = NULL; |
|
170 |
} |
|
171 |
if( iTagContext ) |
|
172 |
{ |
|
173 |
delete iTagContext; |
|
174 |
iTagContext = NULL; |
|
175 |
} |
|
176 |
if( iAlbumContext ) |
|
177 |
{ |
|
178 |
delete iAlbumContext; |
|
179 |
iAlbumContext = NULL; |
|
180 |
} |
|
181 |
if( iMainListAttributecontext ) |
|
182 |
{ |
|
183 |
delete iMainListAttributecontext; |
|
184 |
iMainListAttributecontext = NULL; |
|
185 |
} |
|
186 |
if( IsVisible() ) |
|
187 |
{ |
|
188 |
MakeVisible(EFalse); |
|
189 |
} |
|
190 |
iTextSetter.Close(); |
|
191 |
iTagSetter.Close(); |
|
192 |
iAlbumSetter.Close(); |
|
193 |
||
194 |
if(iUri) |
|
195 |
{ |
|
196 |
delete iUri; |
|
197 |
iUri = NULL; |
|
198 |
} |
|
199 |
} |
|
200 |
||
201 |
//----------------------------------------------------------------------------- |
|
202 |
// CGlxMetadataContainer::MediaList |
|
203 |
//----------------------------------------------------------------------------- |
|
204 |
MGlxMediaList& CGlxMetadataContainer::MediaList() |
|
205 |
{ |
|
206 |
//returns the active medialist. |
|
207 |
return *iItemMediaList; |
|
208 |
} |
|
209 |
||
210 |
//----------------------------------------------------------------------------- |
|
211 |
// CGlxMetadataContainer::CreateSettingItemL |
|
212 |
//----------------------------------------------------------------------------- |
|
213 |
CAknSettingItem* CGlxMetadataContainer::CreateSettingItemL(TInt aResourceId) |
|
214 |
{ |
|
215 |
TRACER("CGlxMetadataContainer::CreateSettingItemL"); |
|
216 |
CAknSettingItem* settingItem = NULL; // No need to push onto cleanup stack |
|
217 |
iTextSetter.Zero(); |
|
218 |
||
219 |
// Creating a empty Settings list box which will be populated |
|
220 |
// with metadata in handleattributeavailable |
|
221 |
switch (aResourceId) |
|
222 |
{ |
|
223 |
case ENameItem: |
|
224 |
case EDateAndTimeItem: |
|
225 |
case EDescriptionItem: |
|
226 |
{ |
|
227 |
settingItem = new (ELeave) CAknTextSettingItem(aResourceId, |
|
228 |
iTextSetter); |
|
229 |
||
230 |
break; |
|
231 |
} |
|
232 |
case ETagsItem: |
|
233 |
{ |
|
234 |
settingItem = new (ELeave) CAknTextSettingItem(aResourceId, |
|
235 |
iTagSetter); |
|
236 |
break; |
|
237 |
} |
|
238 |
case EAlbumsItem: |
|
239 |
{ |
|
240 |
settingItem = new (ELeave) CAknTextSettingItem(aResourceId, |
|
241 |
iAlbumSetter); |
|
242 |
break; |
|
243 |
} |
|
244 |
case ELocationItem: |
|
245 |
case ESizeItem: |
|
246 |
case EResolutionItem: |
|
247 |
{ |
|
248 |
settingItem = new (ELeave) CAknTextSettingItem(aResourceId, |
|
249 |
iTextSetter); |
|
250 |
||
251 |
break; |
|
252 |
} |
|
253 |
case EDurationItem: |
|
254 |
case ElicenseItem: |
|
255 |
{ |
|
256 |
settingItem = new (ELeave) CAknTextSettingItem(aResourceId, |
|
257 |
iTextSetter); |
|
258 |
//Hide the item until we get the attributes |
|
259 |
//where in we check for the usage rights. |
|
260 |
settingItem->SetHidden(ETrue); |
|
261 |
//Required to refresh the listbox when any items visiblity is changed |
|
262 |
this->HandleChangeInItemArrayOrVisibilityL(); |
|
263 |
} |
|
264 |
break; |
|
265 |
||
266 |
default: |
|
267 |
{ |
|
268 |
break; |
|
269 |
} |
|
270 |
} |
|
271 |
return settingItem; |
|
272 |
} |
|
273 |
||
274 |
//----------------------------------------------------------------------------- |
|
275 |
// CGlxMetadataContainer::IsItemModifiable |
|
276 |
//----------------------------------------------------------------------------- |
|
277 |
TBool CGlxMetadataContainer::IsItemModifiable() |
|
278 |
{ |
|
279 |
TRACER("CGlxMetadataContainer::IsItemModifiable"); |
|
280 |
//Only items like name , description, tag and albums are modifiable |
|
281 |
//The check is for the items from ENameItem(0) tille ETagsItem(4) |
|
282 |
if(ListBox()->CurrentItemIndex()<=ETagsItem) |
|
283 |
{ |
|
284 |
return EFalse; |
|
285 |
} |
|
286 |
//return ETrue to dim the item |
|
287 |
return ETrue; |
|
288 |
} |
|
289 |
||
290 |
//----------------------------------------------------------------------------- |
|
291 |
// CGlxMetadataContainer::IsLocationItem |
|
292 |
//----------------------------------------------------------------------------- |
|
293 |
TBool CGlxMetadataContainer::IsLocationItem() |
|
294 |
{ |
|
295 |
TRACER("CGlxMetadataContainer::IsLocationItem"); |
|
296 |
//if its location item - enable the delete option |
|
297 |
if (iItemMediaList->Count() && ListBox()->CurrentItemIndex() |
|
298 |
== ELocationItem) |
|
299 |
{ |
|
300 |
const TGlxMedia& item = iItemMediaList->Item(0); |
|
301 |
TCoordinate coordinate; |
|
302 |
if (item.GetCoordinate(coordinate)) |
|
303 |
{ |
|
304 |
return EFalse; |
|
305 |
} |
|
306 |
return ETrue; |
|
307 |
} |
|
308 |
//return ETrue to dim the item |
|
309 |
return ETrue; |
|
310 |
} |
|
311 |
||
312 |
//----------------------------------------------------------------------------- |
|
313 |
// CGlxMetadataContainer::HandleListBoxEventL |
|
314 |
//----------------------------------------------------------------------------- |
|
315 |
void CGlxMetadataContainer::HandleListBoxEventL(CEikListBox* /*aListBox*/, |
|
316 |
TListBoxEvent aEventType) |
|
317 |
{ |
|
318 |
GLX_LOG_INFO("CGlxMetadataContainer::HandleListBoxEventL"); |
|
319 |
if ((aEventType == EEventEnterKeyPressed) || |
|
320 |
(aEventType == EEventEditingStarted) || |
|
321 |
(aEventType == EEventItemSingleClicked)) |
|
322 |
{ |
|
323 |
//handle edit functionality if items when useer selects via touch |
|
324 |
HandleListboxChangesL(); |
|
325 |
} |
|
326 |
} |
|
327 |
//----------------------------------------------------------------------------- |
|
328 |
// CGlxMetadataContainer::HandleListboxChangesL |
|
329 |
//----------------------------------------------------------------------------- |
|
330 |
void CGlxMetadataContainer::HandleListboxChangesL() |
|
331 |
{ |
|
332 |
TRACER("CGlxMetadataContainer::HandleListboxChangesL"); |
|
333 |
||
334 |
//dont Edit Item's details if medialist is empty |
|
335 |
//OR Rename command is in progress |
|
336 |
if (iItemMediaList->Count() == 0 || iRenameStarted) |
|
337 |
{ |
|
338 |
GLX_LOG_INFO("MediaList empty or Rename command started"); |
|
339 |
return; |
|
340 |
} |
|
341 |
||
342 |
TInt index = ListBox()->CurrentItemIndex(); |
|
343 |
||
344 |
switch (index) |
|
345 |
{ |
|
346 |
case ENameItem: |
|
347 |
case EDescriptionItem: |
|
348 |
{ |
|
349 |
SetNameDescriptionL(index); |
|
350 |
break; |
|
351 |
} |
|
352 |
case ETagsItem: |
|
353 |
{ |
|
354 |
//Set the focus of the item |
|
355 |
iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute, 0); |
|
356 |
//Launch add to container commandhandler via dialog observer. |
|
357 |
iDialogObesrver.AddTagL(); |
|
358 |
break; |
|
359 |
} |
|
360 |
case EAlbumsItem: |
|
361 |
{ |
|
362 |
//Set the focus of the item |
|
363 |
iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute, 0); |
|
364 |
//Launch add to container commandhandler via dialog observer. |
|
365 |
iDialogObesrver.AddAlbumL(); |
|
366 |
break; |
|
367 |
} |
|
368 |
case ELocationItem: |
|
369 |
{ |
|
370 |
// Get the Media Item |
|
371 |
const TGlxMedia& media = iItemMediaList->Item(0); |
|
372 |
// Test to see if the Coordinate is Present |
|
373 |
TCoordinate coordinate; |
|
374 |
if (!media.GetCoordinate(coordinate)) |
|
375 |
{ |
|
376 |
HBufC *noLocationBuf = StringLoader::LoadLC( |
|
377 |
R_GLX_METADATA_NOTE_INFO_NO_LOCATION); |
|
378 |
GlxGeneralUiUtilities::ShowInfoNoteL(*noLocationBuf, ETrue); |
|
379 |
CleanupStack::PopAndDestroy(noLocationBuf); |
|
380 |
} |
|
381 |
else |
|
382 |
{ |
|
383 |
CAknSettingItem* settingsitem = (*SettingItemArray())[index]; |
|
384 |
GlxGeneralUiUtilities::ShowInfoNoteL(settingsitem->SettingTextL(),ETrue); |
|
385 |
} |
|
386 |
break; |
|
387 |
} |
|
388 |
case EDurationItem: |
|
389 |
{ |
|
390 |
//This is condition is useful when the license item is selected for a image file |
|
391 |
if (iVideo) |
|
392 |
{ |
|
393 |
break; |
|
394 |
} |
|
395 |
} |
|
396 |
case EResolutionItem: |
|
397 |
{ |
|
398 |
//This is condition is useful when the license item is selected for a DRM Video file |
|
399 |
if (!iVideo || !iItemMediaList->Item(0).IsDrmProtected()) |
|
400 |
{ |
|
401 |
break; |
|
402 |
} |
|
403 |
} |
|
404 |
case ElicenseItem: |
|
405 |
{ |
|
406 |
const TGlxMedia& item = iItemMediaList->Item(0); |
|
407 |
if (item.IsDrmProtected()) |
|
408 |
{ |
|
409 |
//Create DRM utility |
|
410 |
CGlxDRMUtility* drmUtility = CGlxDRMUtility::InstanceL(); |
|
411 |
CleanupClosePushL(*drmUtility); |
|
412 |
||
413 |
// check if rights have expired |
|
414 |
TBool expired = EFalse; |
|
415 |
expired = !drmUtility->ItemRightsValidityCheckL(item.Uri(), |
|
416 |
EMPXImage == item.Category()); |
|
417 |
||
418 |
if (expired) |
|
419 |
{ |
|
420 |
drmUtility->ShowRightsInfoL(item.Uri()); |
|
421 |
} |
|
422 |
else |
|
423 |
{ |
|
424 |
drmUtility->ShowDRMDetailsPaneL(item.Uri()); |
|
425 |
} |
|
426 |
CleanupStack::PopAndDestroy(drmUtility); |
|
427 |
} |
|
428 |
} |
|
429 |
break; |
|
430 |
default: |
|
431 |
{ |
|
432 |
break; |
|
433 |
} |
|
434 |
} |
|
435 |
} |
|
436 |
//----------------------------------------------------------------------------- |
|
437 |
// CGlxMetadataContainer::CreateMediaListForSelectedItemL |
|
438 |
//----------------------------------------------------------------------------- |
|
439 |
void CGlxMetadataContainer::CreateMediaListForSelectedItemL( ) |
|
440 |
{ |
|
441 |
TRACER("CGlxMetadataContainer::CreateMediaListForSelectedItemL"); |
|
442 |
||
443 |
//create the collection path for the medialist to be created |
|
444 |
CMPXCollectionPath* path = CMPXCollectionPath::NewL(); |
|
445 |
CleanupStack::PushL(path); |
|
446 |
//set the all collection path as the details dialog can be launched from any of the grid views and filter with URI |
|
447 |
path->AppendL(KGlxCollectionPluginAllImplementationUid); |
|
448 |
//create the filter with the URI |
|
449 |
CMPXFilter* filter = TGlxFilterFactory::CreateURIFilterL(*iUri); |
|
450 |
CleanupStack::PushL(filter); |
|
451 |
//create the medialist |
|
452 |
iItemMediaList = MGlxMediaList::InstanceL(*path, TGlxHierarchyId( |
|
453 |
KMediaListId), filter); |
|
454 |
||
455 |
//Add the attributes which are required to be displayed. |
|
456 |
iMainListAttributecontext = new (ELeave) CGlxAttributeContext( |
|
457 |
&iSelectionIterator); |
|
458 |
iMainListAttributecontext->AddAttributeL(KMPXMediaDrmProtected); |
|
459 |
iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralCategory); |
|
460 |
iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralSize); |
|
461 |
iMainListAttributecontext->AddAttributeL(KGlxMediaGeneralDimensions); |
|
462 |
iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralTitle); |
|
463 |
iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralDate); |
|
464 |
iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralComment); |
|
465 |
iMainListAttributecontext->AddAttributeL(KGlxMediaGeneralLocation); |
|
466 |
iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralDuration); |
|
467 |
iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralUri); |
|
468 |
||
469 |
//Add Context so that we get the handleattributes call once the medialist is populated with above mentioned attributes. |
|
470 |
iItemMediaList->AddContextL(iMainListAttributecontext, |
|
471 |
KGlxFetchContextPriorityBlocking); |
|
472 |
||
473 |
//add to observer for callbacks. |
|
474 |
iItemMediaList->AddMediaListObserverL(this); |
|
475 |
||
476 |
CleanupStack::PopAndDestroy(filter); |
|
477 |
CleanupStack::PopAndDestroy(path); |
|
478 |
} |
|
479 |
||
480 |
//----------------------------------------------------------------------------- |
|
481 |
// CGlxMetadataContainer::CreateTagsMediaList |
|
482 |
//----------------------------------------------------------------------------- |
|
483 |
void CGlxMetadataContainer::CreateTagsMediaListL() |
|
484 |
{ |
|
485 |
TRACER("CGlxMetadataContainer::CreateTagsMediaListL"); |
|
486 |
//create the collection path for the medialist to be created |
|
487 |
CMPXCollectionPath* path = CMPXCollectionPath::NewL(); |
|
488 |
CleanupStack::PushL(path); |
|
489 |
//Set the Tags collection for the particular item |
|
490 |
path->AppendL(KGlxTagCollectionPluginImplementationUid); |
|
491 |
//get the media item for which we require the tags collection |
|
492 |
TGlxMedia item = iItemMediaList->Item(0); |
|
493 |
//create the medialist filter with media ID |
|
494 |
CMPXFilter* filter1 = |
|
495 |
TGlxFilterFactory::CreateExcludeContainersWithoutItemFilterL( |
|
496 |
item.Id()); |
|
497 |
CleanupStack::PushL(filter1); |
|
498 |
//set the array order as required, here its alphabetical |
|
499 |
TGlxFilterProperties filterProperty; |
|
500 |
filterProperty.iSortOrder = EGlxFilterSortOrderAlphabetical; |
|
501 |
filterProperty.iSortDirection = EGlxFilterSortDirectionAscending; |
|
502 |
//combine the filter with filterProperty |
|
503 |
CMPXFilter* filter = TGlxFilterFactory::CreateCombinedFilterL( |
|
504 |
filterProperty, filter1, EFalse); |
|
505 |
CleanupStack::PushL(filter); |
|
506 |
||
507 |
//create the medialist to get the tags array. |
|
508 |
iTagMediaList = MGlxMediaList::InstanceL(*path, TGlxHierarchyId( |
|
509 |
KMediaListId), filter); |
|
510 |
||
511 |
//add the attribute KMPXMediaGeneralTitle to the context to get the tag name |
|
512 |
iTagContext = CGlxDefaultAttributeContext::NewL(); |
|
513 |
iTagContext->AddAttributeL(KMPXMediaGeneralTitle); |
|
514 |
iTagContext->SetRangeOffsets(KOffsets, KOffsets); |
|
515 |
||
516 |
//Add Context so that we get the handleattributes call once the medialist is populated with tags. |
|
517 |
iTagMediaList->AddContextL(iTagContext, |
|
518 |
KGlxFetchContextPriorityUMPViewTagPane); |
|
519 |
||
520 |
//add to observer for callbacks. |
|
521 |
iTagMediaList->AddMediaListObserverL(this); |
|
522 |
||
523 |
CleanupStack::PopAndDestroy(filter); |
|
524 |
CleanupStack::PopAndDestroy(filter1); |
|
525 |
CleanupStack::PopAndDestroy(path); |
|
526 |
} |
|
527 |
||
528 |
//----------------------------------------------------------------------------- |
|
529 |
// CGlxMetadataContainer::CreateAlbumsMediaListL |
|
530 |
//----------------------------------------------------------------------------- |
|
531 |
void CGlxMetadataContainer::CreateAlbumsMediaListL() |
|
532 |
{ |
|
533 |
TRACER("CGlxMetadataContainer::CreateAlbumsMediaListL"); |
|
534 |
//create the collection path for the medialist to be created |
|
535 |
CMPXCollectionPath* path = CMPXCollectionPath::NewL(); |
|
536 |
CleanupStack::PushL(path); |
|
537 |
//Set the albums collection for the particular item |
|
538 |
path->AppendL(KGlxCollectionPluginAlbumsImplementationUid); |
|
539 |
//get the media item for which we require the tags collection |
|
540 |
TGlxMedia item = iItemMediaList->Item(0); |
|
541 |
//create the medialist filter with media ID |
|
542 |
CMPXFilter* filter = |
|
543 |
TGlxFilterFactory::CreateExcludeContainersWithoutItemFilterL( |
|
544 |
item.Id()); |
|
545 |
CleanupStack::PushL(filter); |
|
546 |
//create the albums medialist. |
|
547 |
iAlbumMediaList = MGlxMediaList::InstanceL(*path, TGlxHierarchyId( |
|
548 |
KMediaListId), filter); |
|
549 |
||
550 |
//add the attribute KMPXMediaGeneralTitle to the context to get the album name |
|
551 |
iAlbumContext = CGlxDefaultAttributeContext::NewL(); |
|
552 |
iAlbumContext->AddAttributeL(KMPXMediaGeneralTitle); |
|
553 |
iAlbumContext->SetRangeOffsets(KOffsets, KOffsets); |
|
554 |
//Add Context to the medialist so that we get the handleattributes call once the medialist is populated with albums. |
|
555 |
iAlbumMediaList->AddContextL(iAlbumContext, |
|
556 |
KGlxFetchContextPriorityUMPViewAlbumPane); |
|
557 |
||
558 |
//add to observer for callbacks. |
|
559 |
iAlbumMediaList->AddMediaListObserverL(this); |
|
560 |
||
561 |
CleanupStack::PopAndDestroy(filter); |
|
562 |
CleanupStack::PopAndDestroy(path); |
|
563 |
} |
|
564 |
||
565 |
// ---------------------------------------------------------------------------- |
|
566 |
// CGlxMetadataContainer::ViewDynInitMenuPaneL |
|
567 |
// ---------------------------------------------------------------------------- |
|
568 |
// |
|
569 |
void CGlxMetadataContainer::ViewDynInitMenuPaneL(TInt aMenuId, |
|
570 |
CEikMenuPane* aMenuPane) |
|
571 |
{ |
|
572 |
if (aMenuId == R_METADATA_MENU) |
|
573 |
{ |
|
574 |
//Set dim the options based on the item selected |
|
575 |
//location info will be enabled if the item has a location info |
|
576 |
aMenuPane->SetItemDimmed(KGlxDeleteBoundMenuCommandId, |
|
577 |
IsLocationItem()); |
|
578 |
} |
|
579 |
} |
|
580 |
||
581 |
// ---------------------------------------------------------------------------- |
|
582 |
// CGlxMetadataContainer::RemoveLocationL |
|
583 |
// ---------------------------------------------------------------------------- |
|
584 |
// |
|
585 |
void CGlxMetadataContainer::RemoveLocationL() |
|
586 |
{ |
|
587 |
TRACER("CGlxMetadataContainer::RemoveLocationL"); |
|
588 |
||
589 |
iLocationinfo = ETrue; |
|
590 |
// get the media item |
|
591 |
const TGlxMedia& media = iItemMediaList->Item(0); |
|
592 |
// Test to see if the coordinate is present |
|
593 |
TCoordinate coordinate; |
|
594 |
TBool isSupported = media.GetCoordinate(coordinate); |
|
595 |
if (!isSupported) |
|
596 |
{ |
|
597 |
HBufC *buf = StringLoader::LoadLC( |
|
598 |
R_GLX_METADATA_NOTE_INFO_NO_LOCATION); |
|
599 |
GlxGeneralUiUtilities::ShowInfoNoteL(*buf, ETrue); |
|
600 |
CleanupStack::PopAndDestroy(buf); |
|
601 |
} |
|
602 |
else |
|
603 |
{ |
|
604 |
HBufC *buf = |
|
605 |
StringLoader::LoadLC(R_GLX_METADATA_NOTE_DELETE_LOCATION); |
|
606 |
TBool response = GlxGeneralUiUtilities::ConfirmQueryL( |
|
607 |
R_GLX_QUERY_YES_NO, *buf); |
|
608 |
CleanupStack::PopAndDestroy(buf); |
|
609 |
||
610 |
if (response) |
|
611 |
{ |
|
612 |
//user selected yes, so delete location |
|
613 |
//send command for delete location after successfull removal of command remove this pane |
|
614 |
if (iItemMediaList->Count() > 0) |
|
615 |
{ |
|
616 |
//set focus to first item |
|
617 |
iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute, 0); |
|
618 |
||
619 |
// Deleting location information from image file |
|
620 |
RFs rFs; |
|
621 |
User::LeaveIfError(rFs.Connect()); |
|
622 |
CleanupClosePushL(rFs); |
|
623 |
RFile rFile; |
|
624 |
User::LeaveIfError(rFile.Open(rFs, |
|
625 |
iItemMediaList->Item(0).Uri(), EFileWrite)); |
|
626 |
CleanupClosePushL(rFile); |
|
627 |
||
628 |
TInt imageFileSize = 0; // Image File Size |
|
629 |
User::LeaveIfError(rFile.Size(imageFileSize)); |
|
630 |
HBufC8* imageData = HBufC8::NewL(imageFileSize); //Actual Image Data |
|
631 |
CleanupStack::PushL(imageData); |
|
632 |
||
633 |
TPtr8 myImagePtr = imageData->Des(); |
|
634 |
TInt readError = rFile.Read(myImagePtr); |
|
635 |
if (readError != KErrNone) |
|
636 |
{ |
|
637 |
User::Leave(KErrGeneral); |
|
638 |
} |
|
639 |
||
640 |
//CExifModify Interface class for modifying existing Exif v2.2 (or prior) |
|
641 |
//file format or creating Exif v2.2 file format using valid Jpeg image |
|
642 |
CExifModify* exifWriter = NULL; |
|
643 |
TRAPD(err,exifWriter = CExifModify::NewL( imageData->Des())); |
|
644 |
CleanupStack::PushL(exifWriter); |
|
645 |
if (err == KErrNone) |
|
646 |
{ |
|
647 |
//Removes the specified IFD structure and all its tags from the Exif data |
|
648 |
exifWriter->DeleteIfd(EIfdGps); |
|
649 |
||
650 |
HBufC8* modifiedExif = exifWriter->WriteDataL( |
|
651 |
imageData->Des()); //Modified Image Data |
|
652 |
CleanupStack::PushL(modifiedExif); |
|
653 |
||
654 |
const TUint32 fileSize = modifiedExif->Des().Length(); //Size of Modified File |
|
655 |
TInt oldSize; |
|
656 |
rFile.Size(oldSize); |
|
657 |
// set position to begin of file & write the Modified data (Without Location Information) |
|
658 |
TInt pos = 0; |
|
659 |
User::LeaveIfError(rFile.Seek(ESeekStart, pos)); |
|
660 |
User::LeaveIfError(rFile.Write(modifiedExif->Des(), |
|
661 |
fileSize)); |
|
662 |
||
663 |
TTime lastModified; |
|
664 |
lastModified.UniversalTime(); |
|
665 |
User::LeaveIfError(rFile.SetModified(lastModified)); //Change the Modified Time |
|
666 |
||
667 |
CleanupStack::PopAndDestroy(modifiedExif); |
|
668 |
} |
|
669 |
CleanupStack::PopAndDestroy(exifWriter); |
|
670 |
CleanupStack::PopAndDestroy(imageData); |
|
671 |
CleanupStack::PopAndDestroy(&rFile); |
|
672 |
CleanupStack::PopAndDestroy(&rFs); |
|
673 |
||
674 |
//Deleting location information from MDS database |
|
675 |
CMPXCollectionPath* path = iItemMediaList->PathLC(); |
|
676 |
CMPXCommand* command = |
|
677 |
TGlxCommandFactory::DeleteLocationCommandLC(*path); |
|
678 |
||
679 |
command->SetTObjectValueL<TAny*> ( |
|
680 |
KMPXCommandGeneralSessionId, |
|
681 |
static_cast<TAny*> (this)); |
|
682 |
||
683 |
iItemMediaList->CommandL(*command); |
|
684 |
CleanupStack::PopAndDestroy(command); |
|
685 |
CleanupStack::PopAndDestroy(path); |
|
686 |
} |
|
687 |
} |
|
688 |
} |
|
689 |
} |
|
690 |
// ---------------------------------------------------------------------------- |
|
691 |
// CGlxMetadataContainer::EditItemL |
|
692 |
// ---------------------------------------------------------------------------- |
|
693 |
// |
|
694 |
void CGlxMetadataContainer::EditItemL(TInt aIndex, TBool /*aCalledFromMenu*/) |
|
695 |
{ |
|
696 |
TRACER("CGlxMetadataContainer::EditItemL"); |
|
697 |
CAknSettingItem* settingsitem = NULL; |
|
698 |
settingsitem = (*SettingItemArray())[aIndex]; |
|
699 |
settingsitem->LoadL(); |
|
700 |
settingsitem->UpdateListBoxTextL(); |
|
701 |
settingsitem->StoreL(); |
|
702 |
ListBox()->DrawNow(); |
|
703 |
} |
|
704 |
// ---------------------------------------------------------------------------- |
|
705 |
// CGlxMetadataContainer::SetAttributesL |
|
706 |
// ---------------------------------------------------------------------------- |
|
707 |
// |
|
708 |
void CGlxMetadataContainer::SetAttributesL(TMPXAttribute attribute) |
|
709 |
{ |
|
710 |
TRACER("CGlxMetadataContainer::SetAttributesL"); |
|
711 |
||
712 |
//create the tags and albums medialist once the item medialist is populated |
|
713 |
//Tags and albums medialist can be created only with media ID. |
|
714 |
if (!iTagMediaList) |
|
715 |
{ |
|
716 |
CreateTagsMediaListL(); |
|
717 |
} |
|
718 |
if (!iAlbumMediaList) |
|
719 |
{ |
|
720 |
CreateAlbumsMediaListL(); |
|
721 |
} |
|
722 |
if (!iSetVisible) |
|
723 |
{ |
|
724 |
iSetVisible = ETrue; |
|
725 |
SetDurationLIicenseItemVisibilityL(); |
|
726 |
} |
|
727 |
TGlxMedia item = iItemMediaList->Item(0); |
|
728 |
//Create the string convertor instance |
|
729 |
//String convertor class with provide the specific format for date,location and duration and size. |
|
730 |
CGlxUStringConverter* stringConverter = CGlxUStringConverter::NewL(); |
|
731 |
CleanupStack::PushL(stringConverter); |
|
732 |
HBufC* string = NULL; |
|
733 |
||
734 |
//if attribute is date and time we need to pass the format it as R_QTN_DATE_USUAL_WITH_ZERO else null |
|
735 |
if (attribute == KMPXMediaGeneralDate) |
|
736 |
{ |
|
737 |
stringConverter->AsStringL(item, attribute, |
|
738 |
R_QTN_DATE_USUAL_WITH_ZERO, string); |
|
739 |
} |
|
740 |
else |
|
741 |
{ |
|
742 |
stringConverter->AsStringL(item, attribute, 0, string); |
|
743 |
} |
|
744 |
//get the settings item based on the attribute and set the text. |
|
745 |
if (string) |
|
746 |
{ |
|
747 |
iTextSetter.Zero(); |
|
748 |
iTextSetter.Append(*string); |
|
749 |
if (attribute == KMPXMediaGeneralSize) |
|
750 |
{ |
|
751 |
EditItemL(ESizeItem, EFalse); |
|
752 |
} |
|
753 |
else if (attribute == KMPXMediaGeneralDuration) |
|
754 |
{ |
|
755 |
EditItemL(EDurationItem, EFalse); |
|
756 |
} |
|
757 |
else if (attribute == KMPXMediaGeneralTitle) |
|
758 |
{ |
|
759 |
EditItemL(ENameItem, EFalse); |
|
760 |
} |
|
761 |
else if (attribute == KMPXMediaGeneralDate) |
|
762 |
{ |
|
763 |
EditItemL(EDateAndTimeItem, EFalse); |
|
764 |
} |
|
765 |
else if (attribute == KMPXMediaGeneralComment) |
|
766 |
{ |
|
767 |
EditItemL(EDescriptionItem, EFalse); |
|
768 |
} |
|
769 |
else if (attribute == KGlxMediaGeneralLocation) |
|
770 |
{ |
|
771 |
EditItemL(ELocationItem, EFalse); |
|
772 |
} |
|
773 |
else if (attribute == KGlxMediaGeneralDimensions) |
|
774 |
{ |
|
775 |
EditItemL(EResolutionItem, EFalse); |
|
776 |
} |
|
777 |
else |
|
778 |
{ |
|
779 |
} |
|
780 |
delete string; |
|
781 |
string = NULL; |
|
782 |
} |
|
783 |
CleanupStack::PopAndDestroy(stringConverter); |
|
784 |
} |
|
785 |
||
786 |
// ---------------------------------------------------------------------------- |
|
787 |
// CGlxMetadataContainer::SetNameDescriptionL |
|
788 |
// ---------------------------------------------------------------------------- |
|
789 |
// |
|
790 |
void CGlxMetadataContainer::SetNameDescriptionL(TInt aItem) |
|
791 |
{ |
|
792 |
TRACER("CGlxMetadataContainer::SetNameDescriptionL"); |
|
793 |
//This functions i commn for updatng both name and description once modified |
|
794 |
//get the item handcle to be modified |
|
795 |
CAknSettingItem* settingsitem = (*SettingItemArray())[aItem]; |
|
796 |
HBufC* textBuf = HBufC::NewLC(KMaxMediaPopupTextLength); |
|
797 |
const TDesC& popupText = settingsitem->SettingTextL(); |
|
798 |
(textBuf->Des()).Copy(popupText.Left(KMaxMediaPopupTextLength)); |
|
799 |
TPtr textPtr = textBuf->Des(); |
|
800 |
//Remove preceeding & trailing spaces |
|
801 |
textPtr.Trim(); |
|
802 |
HBufC* buf = NULL; |
|
803 |
||
804 |
if(aItem == ENameItem) |
|
805 |
{ |
|
806 |
buf = StringLoader::LoadLC(R_GLX_METADATA_VIEW_TITLE_NSERIES); |
|
807 |
} |
|
808 |
else |
|
809 |
{ |
|
810 |
buf = StringLoader::LoadLC(R_GLX_METADATA_VIEW_DESCRIPTION_NSERIES); |
|
811 |
} |
|
812 |
||
813 |
//Launch the text entry editor. |
|
814 |
CGlxTextEntryPopup* popup = CGlxTextEntryPopup::NewL(*buf, textPtr); |
|
815 |
CleanupStack::PopAndDestroy(buf); |
|
816 |
if (aItem == EDescriptionItem) |
|
817 |
{ |
|
818 |
popup->SetLeftSoftKeyL(ETrue); |
|
819 |
} |
|
27
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
820 |
iIsPopupShown = ETrue; |
26 | 821 |
|
822 |
//action upon selecting ok from the editor |
|
823 |
if (popup->ExecuteLD() == EEikBidOk) |
|
824 |
{ |
|
27
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
825 |
iIsPopupShown = EFalse; |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
826 |
if (iItemMediaList->Count() && 0 != (popupText.Compare(*textBuf))) |
26 | 827 |
{ |
828 |
TFileName fileName = ParseFileName(*textBuf); |
|
829 |
//check If filename already exists |
|
830 |
if ((aItem == ENameItem) && (BaflUtils::FileExists( |
|
831 |
ControlEnv()->FsSession(), fileName))) |
|
832 |
{ |
|
833 |
//if changed title is same as existing one then showing the already use popup to user |
|
834 |
HBufC* info = StringLoader::LoadLC(R_GLX_NAME_ALREADY_USED, |
|
835 |
*textBuf); |
|
836 |
GlxGeneralUiUtilities::ShowInfoNoteL(*info, ETrue); |
|
837 |
CleanupStack::PopAndDestroy(info); |
|
838 |
} |
|
839 |
// Check if the filename is valid |
|
840 |
else if ((aItem == ENameItem) |
|
841 |
&& (!ControlEnv()->FsSession().IsValidName(*textBuf))) |
|
842 |
{ |
|
843 |
//Show illegal characters error note |
|
844 |
HBufC* info = StringLoader::LoadLC( |
|
845 |
R_GLX_QTN_FLDR_ILLEGAL_CHARACTERS); |
|
846 |
GlxGeneralUiUtilities::ShowInfoNoteL(*info, ETrue); |
|
847 |
CleanupStack::PopAndDestroy(info); |
|
848 |
} |
|
849 |
else |
|
850 |
{ |
|
851 |
//Modify the MDS and setting list only if the entry is different from previous Item value |
|
852 |
iTextSetter.Zero(); |
|
853 |
iTextSetter.Copy(*textBuf); |
|
854 |
EditItemL(aItem, EFalse); |
|
855 |
iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute, 0);//set focus to first item |
|
856 |
||
857 |
if (aItem == ENameItem) |
|
858 |
{ |
|
859 |
//indicate Rename command is started |
|
860 |
iRenameStarted = ETrue; |
|
861 |
//set Setting List Box to Dimmed status |
|
862 |
SetDimmed(iRenameStarted); |
|
863 |
||
864 |
const TGlxMedia& media = iItemMediaList->Item(0); |
|
865 |
ContentAccess::CManager *manager = |
|
866 |
ContentAccess::CManager::NewL(); |
|
867 |
CleanupStack::PushL(manager); |
|
868 |
HBufC* modifiedName = fileName.AllocLC(); |
|
869 |
||
870 |
//rename the media |
|
871 |
TInt error = manager->RenameFile(media.Uri(), |
|
872 |
*modifiedName); |
|
873 |
if (KErrNone == error) |
|
874 |
{ |
|
875 |
//Redundant call But needed in case FileSystem is too slow |
|
876 |
//to notify MDS for updating title. |
|
877 |
//Create the glx command for updating Title in MDS |
|
878 |
CMPXCollectionPath* path = iItemMediaList->PathLC(); |
|
879 |
CMPXCommand* command = |
|
880 |
TGlxCommandFactory::RenameCommandLC( |
|
881 |
settingsitem->SettingTextL(), *path); |
|
882 |
command->SetTObjectValueL<TAny*> ( |
|
883 |
KMPXCommandGeneralSessionId, |
|
884 |
static_cast<TAny*> (this)); |
|
885 |
//issue command to the medialist which further |
|
886 |
//calls data source to update MDS |
|
887 |
iItemMediaList->CommandL(*command); |
|
888 |
CleanupStack::PopAndDestroy(command); |
|
889 |
CleanupStack::PopAndDestroy(path); |
|
890 |
} |
|
891 |
else |
|
892 |
{ |
|
893 |
//Renaming commmand failed |
|
894 |
iRenameStarted = EFalse; |
|
895 |
//reset Setting Items to undim status |
|
896 |
SetDimmed(iRenameStarted); |
|
897 |
//Reset the EName Settings field |
|
898 |
iTextSetter.Zero(); |
|
899 |
iTextSetter.Copy(media.Title()); |
|
900 |
EditItemL(ENameItem, EFalse); |
|
901 |
GlxGeneralUiUtilities::ShowErrorNoteL(error); |
|
902 |
} |
|
903 |
CleanupStack::PopAndDestroy(modifiedName); |
|
904 |
CleanupStack::PopAndDestroy(manager); |
|
905 |
} |
|
906 |
else |
|
907 |
{ |
|
908 |
//Create the glx command for changing description |
|
909 |
CMPXCollectionPath* path = iItemMediaList->PathLC(); |
|
910 |
CMPXCommand* command = |
|
911 |
TGlxCommandFactory::SetDescriptionCommandLC( |
|
912 |
settingsitem->SettingTextL(), *path); |
|
913 |
command->SetTObjectValueL<TAny*> ( |
|
914 |
KMPXCommandGeneralSessionId, |
|
915 |
static_cast<TAny*> (this)); |
|
916 |
//issue command to the medialist which further |
|
917 |
//calls data source to update MDS |
|
918 |
iItemMediaList->CommandL(*command); |
|
919 |
CleanupStack::PopAndDestroy(command); |
|
920 |
CleanupStack::PopAndDestroy(path); |
|
921 |
} |
|
922 |
} |
|
923 |
} |
|
924 |
} |
|
925 |
CleanupStack::PopAndDestroy(textBuf); |
|
926 |
||
927 |
//notify observer that some operation has happened. So refresh the toolbar area.. |
|
928 |
iResetToolbarObs.HandleToolbarResetting(EFalse); |
|
27
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
929 |
if (!iItemMediaList->Count()) |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
930 |
{ |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
931 |
iDialogObesrver.HandleItemRemovedL(); |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
932 |
} |
26 | 933 |
} |
934 |
||
935 |
// ---------------------------------------------------------------------------- |
|
936 |
// CGlxMetadataContainer::UpdateTagsL() |
|
937 |
// ---------------------------------------------------------------------------- |
|
938 |
// |
|
939 |
void CGlxMetadataContainer::UpdateTagsL() |
|
940 |
{ |
|
941 |
TRACER("CGlxMetadataContainer::UpdateTagsL"); |
|
942 |
//Get the tag setting item handle to set the text |
|
943 |
CAknSettingItem* settingsitem = (*SettingItemArray())[ETagsItem]; |
|
944 |
||
945 |
//Set the tag setter to empty string before filling in the data. |
|
946 |
iTagSetter.Zero(); |
|
947 |
||
948 |
//Loop to appened all the tags to the iTagSetter. |
|
949 |
for (TInt index = 0; index < iTagMediaList->Count(); index++) |
|
950 |
{ |
|
951 |
if (iTagSetter.Length()) |
|
952 |
{ |
|
953 |
iTagSetter.Append(KGlxComma); |
|
954 |
} |
|
955 |
const TGlxMedia& item = iTagMediaList->Item(index); |
|
956 |
const TDesC& title = item.Title(); |
|
957 |
iTagSetter.Append(title); |
|
958 |
} |
|
959 |
EditItemL(ETagsItem, EFalse); |
|
960 |
} |
|
961 |
||
962 |
// ---------------------------------------------------------------------------- |
|
963 |
// CGlxMetadataContainer::UpdateAlbumsL() |
|
964 |
// ---------------------------------------------------------------------------- |
|
965 |
// |
|
966 |
void CGlxMetadataContainer::UpdateAlbumsL() |
|
967 |
{ |
|
968 |
TRACER("CGlxMetadataContainer::UpdateAlbumsL"); |
|
969 |
//Get the tag setting item handle to set the text |
|
970 |
CAknSettingItem* settingsitem = (*SettingItemArray())[EAlbumsItem]; |
|
971 |
||
972 |
//Set the tag setter to empty string before filling in the data. |
|
973 |
iAlbumSetter.Zero(); |
|
974 |
||
975 |
//Loop to appened all the tags to the iAlbumSetter. |
|
976 |
for( TInt index = 0 ; index < iAlbumMediaList->Count() ; index++ ) |
|
977 |
{ |
|
978 |
if(iAlbumSetter.Length()) |
|
979 |
{ |
|
980 |
iAlbumSetter.Append(KGlxComma); |
|
981 |
} |
|
982 |
const TGlxMedia& item = iAlbumMediaList->Item( index ); |
|
983 |
const TDesC& title = item.Title(); |
|
984 |
iAlbumSetter.Append(title); |
|
985 |
} |
|
986 |
EditItemL(EAlbumsItem,EFalse); |
|
987 |
} |
|
988 |
||
989 |
// ---------------------------------------------------------------------------- |
|
990 |
// CGlxMetadataContainer::SetDurationLIicenseItemVisibilityL() |
|
991 |
// ---------------------------------------------------------------------------- |
|
992 |
// |
|
993 |
void CGlxMetadataContainer::SetDurationLIicenseItemVisibilityL() |
|
994 |
{ |
|
995 |
TRACER("CGlxMetadataContainer::SetDurationLIicenseItemVisibilityL"); |
|
996 |
//get the media item. |
|
997 |
const TGlxMedia& item = iItemMediaList->Item(0); |
|
998 |
const CGlxMedia* media = item.Properties(); |
|
999 |
||
1000 |
//in order to check for video category and drm rights |
|
1001 |
||
1002 |
CAknSettingItem* hiddenItem = NULL; |
|
1003 |
if (item.Category() == EMPXVideo) |
|
1004 |
{ |
|
1005 |
if (!item.IsDrmProtected()) |
|
1006 |
{ |
|
1007 |
hiddenItem = (*SettingItemArray())[EDurationItem]; |
|
1008 |
//Set the duration item visible |
|
1009 |
hiddenItem->SetHidden(EFalse); |
|
1010 |
} |
|
1011 |
else |
|
1012 |
{ |
|
1013 |
hiddenItem = (*SettingItemArray())[EResolutionItem]; |
|
1014 |
//Set the Resolution item in-visible for DRM protected Video |
|
1015 |
hiddenItem->SetHidden(ETrue); |
|
1016 |
} |
|
1017 |
//set the video flag which would be used to enable/disable the view details option. |
|
1018 |
this->HandleChangeInItemArrayOrVisibilityL(); |
|
1019 |
iVideo = ETrue; |
|
1020 |
} |
|
1021 |
if (media && media->IsSupported(KMPXMediaDrmProtected)) |
|
1022 |
{ |
|
1023 |
if (item.IsDrmProtected()) |
|
1024 |
{ |
|
1025 |
hiddenItem = (*SettingItemArray())[ElicenseItem]; |
|
1026 |
//Set the License item visible |
|
1027 |
hiddenItem->SetHidden(EFalse); |
|
1028 |
//Required to refresh the listbox when any items visiblity is changed |
|
1029 |
this->HandleChangeInItemArrayOrVisibilityL(); |
|
1030 |
} |
|
1031 |
} |
|
1032 |
} |
|
1033 |
||
1034 |
//Medialist callbacks. |
|
1035 |
// ---------------------------------------------------------------------------- |
|
1036 |
// CGlxMetadataContainer::HandleAttributesAvailableL |
|
1037 |
// ---------------------------------------------------------------------------- |
|
1038 |
// |
|
1039 |
void CGlxMetadataContainer::HandleAttributesAvailableL(TInt /*aItemIndex*/, |
|
1040 |
const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* aList) |
|
1041 |
{ |
|
1042 |
TRACER("CGlxMetadataContainer::HandleAttributesAvailableL()"); |
|
1043 |
//generic medialist for the item for all the attributes required other than tags and albums. |
|
1044 |
if (aList == iItemMediaList) |
|
1045 |
{ |
|
1046 |
// Loop untill it checks for all the avialable attributes |
|
1047 |
for (TInt i = aAttributes.Count() - 1; i >= 0; i--) |
|
1048 |
{ |
|
1049 |
//set attributes to the items in the container |
|
1050 |
SetAttributesL(aAttributes[i]); |
|
1051 |
} |
|
1052 |
||
1053 |
//Here following 2 cases are handled:- |
|
1054 |
//1) Rename from Photos application or Post-Capture view |
|
1055 |
//- HandleAttributeavailable - new title & new uri at same time. |
|
1056 |
//May come twice here since Redundant Rename CMD sent to MDS. |
|
1057 |
//2) Rename from Filemanager. |
|
1058 |
//- HandleAttributeavailable - new title & new uri at same time. |
|
1059 |
//Check if media's uri(i.e 'aModifiedUri') is different from 'iUri' |
|
1060 |
//i.e media is Renamed then Refesh Media list. |
|
1061 |
TMPXAttribute uriAttrib(KMPXMediaGeneralUri); |
|
1062 |
TIdentityRelation<TMPXAttribute> match(&TMPXAttribute::Match); |
|
1063 |
TInt index = aAttributes.Find(uriAttrib, match); |
|
1064 |
if (KErrNotFound != index) |
|
1065 |
{ |
|
1066 |
HBufC* modifiedUri = NULL; |
|
1067 |
TGlxMedia item = iItemMediaList->Item(0); |
|
1068 |
//Create the string convertor instance |
|
1069 |
CGlxUStringConverter* stringConverter = |
|
1070 |
CGlxUStringConverter::NewL(); |
|
1071 |
CleanupStack::PushL(stringConverter); |
|
27
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1072 |
//fetch media uri |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1073 |
stringConverter->AsStringL(item, aAttributes[index], 0, modifiedUri); |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1074 |
if (modifiedUri) |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1075 |
{ |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1076 |
CleanupStack::PushL(modifiedUri); |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1077 |
//Check if media item was renamed |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1078 |
if (modifiedUri->Compare(*iUri) != 0) |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1079 |
{ |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1080 |
//Set rename command as started since |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1081 |
//Rename is also possible from File Manager |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1082 |
iRenameStarted = ETrue; |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1083 |
RefreshMediaListL(*modifiedUri); |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1084 |
} |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1085 |
CleanupStack::PopAndDestroy(modifiedUri); |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1086 |
} |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1087 |
CleanupStack::PopAndDestroy(stringConverter); |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1088 |
} |
26 | 1089 |
|
1090 |
} |
|
1091 |
||
1092 |
TMPXAttribute titleAttrib(KMPXMediaGeneralTitle); |
|
1093 |
TIdentityRelation<TMPXAttribute> match(&TMPXAttribute::Match); |
|
1094 |
||
1095 |
if (KErrNotFound != aAttributes.Find(titleAttrib, match)) |
|
1096 |
{ |
|
1097 |
if (aList == iTagMediaList) |
|
1098 |
{ |
|
1099 |
UpdateTagsL(); |
|
1100 |
} |
|
1101 |
else if (aList == iAlbumMediaList) |
|
1102 |
{ |
|
1103 |
UpdateAlbumsL(); |
|
1104 |
} |
|
1105 |
} |
|
1106 |
} |
|
1107 |
||
1108 |
// ---------------------------------------------------------------------------- |
|
1109 |
// HandleItemAddedL |
|
1110 |
// ---------------------------------------------------------------------------- |
|
1111 |
// |
|
1112 |
void CGlxMetadataContainer::HandleItemAddedL(TInt /*aStartIndex*/, |
|
1113 |
TInt /*aEndIndex*/, MGlxMediaList* aList) |
|
1114 |
{ |
|
1115 |
TRACER("CGlxMetadataContainer::HandleItemAddedL()"); |
|
1116 |
||
1117 |
if (!iTagMediaList) |
|
1118 |
{ |
|
1119 |
CreateTagsMediaListL(); |
|
1120 |
} |
|
1121 |
if (!iAlbumMediaList) |
|
1122 |
{ |
|
1123 |
CreateAlbumsMediaListL(); |
|
1124 |
} |
|
1125 |
if (!iMarquee) |
|
1126 |
{ |
|
1127 |
EnableMarqueingL(); |
|
1128 |
} |
|
1129 |
SetDurationLIicenseItemVisibilityL(); |
|
1130 |
if (aList == iTagMediaList) |
|
1131 |
{ |
|
1132 |
UpdateTagsL(); |
|
1133 |
} |
|
1134 |
else if (aList == iAlbumMediaList) |
|
1135 |
{ |
|
1136 |
UpdateAlbumsL(); |
|
1137 |
} |
|
1138 |
if (aList == iItemMediaList) |
|
1139 |
{ |
|
1140 |
if (iItemMediaList->Count()) |
|
1141 |
{ |
|
1142 |
TGlxMedia item = iItemMediaList->Item(0); |
|
1143 |
CGlxUStringConverter* stringConverter = |
|
1144 |
CGlxUStringConverter::NewL(); |
|
1145 |
CleanupStack::PushL(stringConverter); |
|
1146 |
for (TInt index = 0; index <= EDurationItem; index++) |
|
1147 |
{ |
|
1148 |
HBufC* string = NULL; |
|
1149 |
iTextSetter.Zero(); |
|
1150 |
||
1151 |
if (index == ESizeItem) |
|
1152 |
{ |
|
1153 |
stringConverter->AsStringL(item, KMPXMediaGeneralSize, 0, |
|
1154 |
string); |
|
1155 |
} |
|
1156 |
else if (index == EDurationItem) |
|
1157 |
{ |
|
1158 |
stringConverter->AsStringL(item, |
|
1159 |
KMPXMediaGeneralDuration, 0, string); |
|
1160 |
} |
|
1161 |
else if (index == ENameItem) |
|
1162 |
{ |
|
1163 |
stringConverter->AsStringL(item, KMPXMediaGeneralTitle, |
|
1164 |
0, string); |
|
1165 |
} |
|
1166 |
else if (index == EDateAndTimeItem) |
|
1167 |
{ |
|
1168 |
stringConverter->AsStringL(item, KMPXMediaGeneralDate, |
|
1169 |
R_QTN_DATE_USUAL_WITH_ZERO, string); |
|
1170 |
} |
|
1171 |
else if (index == EDescriptionItem) |
|
1172 |
{ |
|
1173 |
stringConverter->AsStringL(item, KMPXMediaGeneralComment, |
|
1174 |
0, string); |
|
1175 |
} |
|
1176 |
else if (index == ELocationItem) |
|
1177 |
{ |
|
1178 |
stringConverter->AsStringL(item, |
|
1179 |
KGlxMediaGeneralLocation, 0, string); |
|
1180 |
} |
|
1181 |
else if (index == EResolutionItem) |
|
1182 |
{ |
|
1183 |
stringConverter->AsStringL(item, |
|
1184 |
KGlxMediaGeneralDimensions, 0, string); |
|
1185 |
} |
|
1186 |
else if (index == ElicenseItem) |
|
1187 |
{ |
|
1188 |
// If an item is DRM protected, License field in details |
|
1189 |
// should display "View Details" |
|
1190 |
string = StringLoader::LoadL( |
|
1191 |
R_GLX_METADATA_VIEW_OPTIONS_VIEW); |
|
1192 |
} |
|
1193 |
else |
|
1194 |
{ |
|
1195 |
//no implementation |
|
1196 |
} |
|
1197 |
if (string) |
|
1198 |
{ |
|
1199 |
iTextSetter.Append(*string); |
|
1200 |
} |
|
1201 |
CleanupStack::PushL(string); |
|
1202 |
EditItemL(index, EFalse); |
|
1203 |
CleanupStack::PopAndDestroy(string); |
|
1204 |
} |
|
1205 |
CleanupStack::PopAndDestroy(stringConverter); |
|
1206 |
||
1207 |
//Reopening Media list is completed |
|
1208 |
//& Rename Command is also completed |
|
1209 |
if (iRenameStarted) |
|
1210 |
{ |
|
1211 |
iRenameStarted = EFalse; |
|
1212 |
//reset Setting Items to undimmed status |
|
1213 |
SetDimmed(iRenameStarted); |
|
1214 |
iAvkonAppUi->ProcessCommandL(EGlxCmdRenameCompleted); |
|
1215 |
} |
|
1216 |
} |
|
1217 |
} |
|
1218 |
} |
|
1219 |
// ---------------------------------------------------------------------------- |
|
1220 |
// EnableMarqueingL |
|
1221 |
// ---------------------------------------------------------------------------- |
|
1222 |
// |
|
1223 |
void CGlxMetadataContainer::EnableMarqueingL() |
|
1224 |
{ |
|
1225 |
TRACER("CGlxMetadataContainer::EnableMarqueingL()"); |
|
1226 |
iMarquee = ETrue; |
|
1227 |
ListBox()->UseLogicalToVisualConversion(ETrue); |
|
1228 |
ListBox()->ItemDrawer()->ColumnData()->SetMarqueeParams( |
|
1229 |
KMarqueeLoopCount, KMarqueeScrollAmount, KMarqueeScrollDelay, |
|
1230 |
KMarqueeScrollInterval); |
|
1231 |
ListBox()->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue); |
|
1232 |
||
1233 |
//Fetch the current item index |
|
1234 |
TInt index = ListBox()->CurrentItemIndex(); |
|
1235 |
||
1236 |
//Reset the disable marquee flag, so that marquee effect can continue (this is normally reset by |
|
1237 |
//base class of glxmetaDatadialog::HandlePointerEventL() |
|
1238 |
ListBox()->ItemDrawer()->ClearFlags(CListItemDrawer::EDisableMarquee); |
|
1239 |
||
1240 |
//This is the function which actually starts marquee effect. It is anyway being called from base |
|
1241 |
//implementation of OfferKeyEventL(), but for pointer event, we have to call |
|
1242 |
//this function |
|
1243 |
ListBox()->DrawItem(index); |
|
1244 |
} |
|
1245 |
||
1246 |
// ---------------------------------------------------------------------------- |
|
1247 |
// HandleCommandCompleteL |
|
1248 |
// ---------------------------------------------------------------------------- |
|
1249 |
// |
|
1250 |
void CGlxMetadataContainer::HandleCommandCompleteL(TAny* aSessionId, |
|
1251 |
CMPXCommand* aCommandResult, TInt aError, MGlxMediaList* aList) |
|
1252 |
{ |
|
1253 |
TRACER("CGlxMetadataContainer::HandleCommandCompleteL()"); |
|
1254 |
||
1255 |
//Callback from MDS when rename the Title |
|
1256 |
if (aError == KErrNone) |
|
1257 |
{ |
|
1258 |
if (aList == iItemMediaList && aCommandResult->IsSupported( |
|
1259 |
KMPXMediaGeneralTitle)) |
|
1260 |
{ |
|
1261 |
GLX_LOG_INFO("RenameCMD to MDS completed"); |
|
1262 |
//Since RenameCommand to MDS is redundant and FileSystem has |
|
1263 |
//already renamed the file, so there is no need to do anything here |
|
1264 |
} |
|
1265 |
} |
|
1266 |
||
1267 |
//To update the location information once the delete operation is successful. |
|
1268 |
if (aList == iItemMediaList && iLocationinfo && static_cast<TAny*> (this) |
|
1269 |
== aSessionId) |
|
1270 |
{ |
|
1271 |
TGlxMedia media = iItemMediaList->Item(0); |
|
1272 |
media.DeleteLocationAttribute(); |
|
1273 |
iLocationinfo = EFalse; |
|
1274 |
if (aError == KErrNone) |
|
1275 |
{ |
|
1276 |
iTextSetter.Zero(); |
|
1277 |
EditItemL(ELocationItem, EFalse); |
|
1278 |
} |
|
1279 |
} |
|
1280 |
} |
|
1281 |
||
1282 |
// ---------------------------------------------------------------------------- |
|
1283 |
// HandleItemRemovedL |
|
1284 |
// ---------------------------------------------------------------------------- |
|
1285 |
// |
|
1286 |
void CGlxMetadataContainer::HandleItemRemovedL(TInt /*aStartIndex*/, |
|
1287 |
TInt /*aEndIndex*/, MGlxMediaList* /*aList*/) |
|
1288 |
{ |
|
1289 |
TRACER("CGlxMetadataContainer::HandleItemRemovedL()"); |
|
27
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1290 |
if (!iItemMediaList->Count() && !iIsPopupShown) |
26 | 1291 |
{ |
1292 |
iDialogObesrver.HandleItemRemovedL(); |
|
1293 |
} |
|
1294 |
} |
|
1295 |
||
1296 |
// ---------------------------------------------------------------------------- |
|
1297 |
// HandleFocusChangedL |
|
1298 |
// ---------------------------------------------------------------------------- |
|
1299 |
// |
|
1300 |
void CGlxMetadataContainer::HandleFocusChangedL( |
|
1301 |
NGlxListDefs::TFocusChangeType /*aType*/, TInt /*aNewIndex*/, |
|
1302 |
TInt /*aOldIndex*/, MGlxMediaList* /*aList*/) |
|
1303 |
{ |
|
1304 |
TRACER("CGlxMetadataContainer::HandleFocusChangedL()"); |
|
1305 |
} |
|
1306 |
||
1307 |
// ---------------------------------------------------------------------------- |
|
1308 |
// HandleItemSelectedL |
|
1309 |
// ---------------------------------------------------------------------------- |
|
1310 |
// |
|
1311 |
void CGlxMetadataContainer::HandleItemSelectedL(TInt /*aIndex*/, |
|
1312 |
TBool /*aSelected*/, MGlxMediaList* /*aList*/) |
|
1313 |
{ |
|
1314 |
TRACER("CGlxMetadataContainer::HandleItemSelectedL"); |
|
1315 |
} |
|
1316 |
||
1317 |
// ---------------------------------------------------------------------------- |
|
1318 |
// HandleMessageL |
|
1319 |
// ---------------------------------------------------------------------------- |
|
1320 |
// |
|
1321 |
void CGlxMetadataContainer::HandleMessageL(const CMPXMessage& /*aMessage*/, |
|
1322 |
MGlxMediaList* /*aList*/) |
|
1323 |
{ |
|
1324 |
TRACER("CGlxMetadataContainer::HandleMessageL()"); |
|
1325 |
} |
|
1326 |
||
1327 |
// ---------------------------------------------------------------------------- |
|
1328 |
// HandleError |
|
1329 |
// ---------------------------------------------------------------------------- |
|
1330 |
// |
|
1331 |
void CGlxMetadataContainer::HandleError(TInt /*aError*/) |
|
1332 |
{ |
|
1333 |
TRACER("CGlxMetadataContainer::HandleError()"); |
|
1334 |
TRAP_IGNORE(HandleErrorL()); |
|
1335 |
} |
|
1336 |
||
1337 |
// ---------------------------------------------------------------------------- |
|
1338 |
// HandleErrorL |
|
1339 |
// ---------------------------------------------------------------------------- |
|
1340 |
// |
|
1341 |
void CGlxMetadataContainer::HandleErrorL() |
|
1342 |
{ |
|
1343 |
TRACER("CGlxMetadataContainer::HandleErrorL()"); |
|
1344 |
} |
|
1345 |
||
1346 |
// ---------------------------------------------------------------------------- |
|
1347 |
// HandleCommandCompleteL |
|
1348 |
// ---------------------------------------------------------------------------- |
|
1349 |
// |
|
1350 |
void CGlxMetadataContainer::HandleCommandCompleteL( |
|
1351 |
CMPXCommand* /*aCommandResult*/, TInt /*aError*/, MGlxMediaList* /*aList*/) |
|
1352 |
{ |
|
1353 |
TRACER("CGlxMetadataContainer::HandleCommandCompleteL()"); |
|
1354 |
} |
|
1355 |
||
1356 |
// ---------------------------------------------------------------------------- |
|
1357 |
// HandleMediaL |
|
1358 |
// ---------------------------------------------------------------------------- |
|
1359 |
// |
|
1360 |
void CGlxMetadataContainer::HandleMediaL(TInt /*aListIndex*/, MGlxMediaList* /*aList*/) |
|
1361 |
{ |
|
1362 |
TRACER("CGlxMetadataContainer::HandleMediaL()"); |
|
1363 |
} |
|
1364 |
||
1365 |
// ---------------------------------------------------------------------------- |
|
1366 |
// HandleItemModifiedL |
|
1367 |
// ---------------------------------------------------------------------------- |
|
1368 |
// |
|
1369 |
void CGlxMetadataContainer::HandleItemModifiedL( |
|
1370 |
const RArray<TInt>& /*aItemIndexes*/, MGlxMediaList* /*aList*/) |
|
1371 |
{ |
|
1372 |
TRACER("CGlxMetadataContainer::HandleItemModifiedL()"); |
|
1373 |
} |
|
1374 |
||
1375 |
// ---------------------------------------------------------------------------- |
|
1376 |
// ChangeMskL |
|
1377 |
// ---------------------------------------------------------------------------- |
|
1378 |
// |
|
1379 |
void CGlxMetadataContainer::ChangeMskL() |
|
1380 |
{ |
|
1381 |
TRACER("CGlxMetadataContainer::ChangeMskL()"); |
|
1382 |
CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); |
|
1383 |
CleanupClosePushL(*uiUtility); |
|
1384 |
switch (ListBox()->CurrentItemIndex()) |
|
1385 |
{ |
|
1386 |
case ENameItem: |
|
1387 |
case EDescriptionItem: |
|
1388 |
case ETagsItem: |
|
1389 |
case EAlbumsItem: |
|
1390 |
{ |
|
1391 |
uiUtility->ScreenFurniture()->ModifySoftkeyIdL( |
|
1392 |
CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
|
1393 |
EAknSoftkeyEdit, R_GLX_METADATA_MSK_EDIT); |
|
1394 |
} |
|
1395 |
break; |
|
1396 |
case EDateAndTimeItem: |
|
1397 |
case ELocationItem: |
|
1398 |
case ESizeItem: |
|
1399 |
case EDurationItem: |
|
1400 |
case ElicenseItem: |
|
1401 |
case EResolutionItem: |
|
1402 |
{ |
|
1403 |
uiUtility->ScreenFurniture()->ModifySoftkeyIdL( |
|
1404 |
CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
|
1405 |
EAknSoftkeyEdit, R_GLX_METADATA_MSK_BLANK); |
|
1406 |
} |
|
1407 |
break; |
|
1408 |
default: |
|
1409 |
{ |
|
1410 |
break; |
|
1411 |
} |
|
1412 |
} |
|
1413 |
||
1414 |
CleanupStack::PopAndDestroy(uiUtility); |
|
1415 |
} |
|
1416 |
||
1417 |
// --------------------------------------------------------------------------- |
|
1418 |
// Parse the drive, path & extension from the old uri, |
|
1419 |
// And return the modified uri by appending the new title |
|
1420 |
// --------------------------------------------------------------------------- |
|
1421 |
TFileName CGlxMetadataContainer::ParseFileName(const TDesC& aTitleText) |
|
1422 |
{ |
|
1423 |
TRACER("CGlxMetadataContainer::ParseFileName()"); |
|
1424 |
const TGlxMedia& media = iItemMediaList->Item(0); |
|
1425 |
TParsePtrC parsePtr(media.Uri()); |
|
1426 |
||
1427 |
TFileName destinationFileName; |
|
1428 |
destinationFileName.Append(parsePtr.DriveAndPath()); |
|
1429 |
destinationFileName.Append(aTitleText); |
|
1430 |
destinationFileName.Append(parsePtr.Ext()); |
|
1431 |
||
1432 |
return destinationFileName; |
|
1433 |
} |
|
1434 |
||
1435 |
// --------------------------------------------------------------------------- |
|
1436 |
// Refresh MediaList with modified FileName. |
|
1437 |
// --------------------------------------------------------------------------- |
|
1438 |
void CGlxMetadataContainer::RefreshMediaListL(const TDesC& aModifiedUri) |
|
1439 |
{ |
|
1440 |
//Refresh media list since media is renamed |
|
1441 |
TRACER("CGlxMetadataContainer::RefreshMediaListL()"); |
|
1442 |
GLX_LOG_URI("CGlxMetadataContainer::RefreshMediaListL(%S)", &aModifiedUri); |
|
1443 |
if (iUri) |
|
1444 |
{ |
|
1445 |
delete iUri; |
|
1446 |
iUri = NULL; |
|
1447 |
} |
|
1448 |
//always points to current media name |
|
1449 |
iUri = aModifiedUri.AllocL(); |
|
1450 |
CMPXFilter* filter = TGlxFilterFactory::CreateURIFilterL(*iUri); |
|
1451 |
CleanupStack::PushL(filter); |
|
1452 |
||
1453 |
//Update media list's filter |
|
1454 |
iItemMediaList->SetFilterL(filter); |
|
1455 |
CleanupStack::PopAndDestroy(filter); |
|
1456 |
} |
|
1457 |
||
1458 |
//End of file |