author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:32:09 +0300 | |
branch | RCL_3 |
changeset 75 | 01504893d9cb |
parent 60 | 5b3385a43d68 |
permissions | -rw-r--r-- |
60 | 1 |
/* |
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
2 |
* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
60 | 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 : Grid view Observers |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
// INCLUDE FILES |
|
20 |
||
21 |
// Ganes Headers |
|
22 |
#include <ganes/HgItem.h> |
|
23 |
#include <ganes/HgGrid.h> //Hg Grid Widget |
|
24 |
#include <gulicon.h> |
|
25 |
||
26 |
//Photos Headers |
|
27 |
#include <glxtracer.h> // For Tracer |
|
28 |
#include <glxlog.h> // For Glx Logging |
|
29 |
#include <glxuiutility.h> // For UiUtility instance |
|
30 |
#include <glxicons.mbg> // For Corrupted and not created icons |
|
31 |
#include <glxerrormanager.h> // For CGlxErrormanager |
|
32 |
#include <glxuistd.h> |
|
33 |
#include <mglxmedialist.h> // CGlxMedialist |
|
34 |
#include <glxthumbnailattributeinfo.h> // KGlxMediaIdThumbnail |
|
35 |
#include <glxdrmutility.h> // DRM utility class to provide DRM-related functionality |
|
36 |
#include <mpxmediadrmdefs.h> // KMPXMediaDrmProtected |
|
37 |
#include <glxgridviewdata.rsg> // Gridview resource |
|
38 |
#include <glxgeneraluiutilities.h> |
|
39 |
||
40 |
// Framework |
|
41 |
#include <data_caging_path_literals.hrh> |
|
42 |
#include <StringLoader.h> |
|
43 |
#include <bldvariant.hrh> // For feature constants |
|
44 |
#include <featmgr.h> // Feature Manager |
|
45 |
#include <caf/caferr.h> |
|
46 |
#include <AknUtils.h> |
|
47 |
||
48 |
#include "glxgridviewmlobserver.h" |
|
49 |
||
50 |
const TInt KRecreateGridSize(5); //minimum no of items added to trigger recreate grid |
|
51 |
// ======== MEMBER FUNCTIONS ======== |
|
52 |
||
53 |
// --------------------------------------------------------------------------- |
|
54 |
// Two-phased constructor. |
|
55 |
// --------------------------------------------------------------------------- |
|
56 |
// |
|
57 |
EXPORT_C CGlxGridViewMLObserver* CGlxGridViewMLObserver::NewL( |
|
58 |
MGlxMediaList& aMediaList, CHgGrid* aHgGrid, |
|
59 |
TGlxFilterItemType aFilterType) |
|
60 |
{ |
|
61 |
TRACER("CGlxGridViewMLObserver::NewL()"); |
|
62 |
CGlxGridViewMLObserver* self = new (ELeave) CGlxGridViewMLObserver( |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
63 |
aMediaList, aHgGrid, aFilterType); |
60 | 64 |
CleanupStack::PushL(self); |
65 |
self->ConstructL(); |
|
66 |
CleanupStack::Pop(self); |
|
67 |
return self; |
|
68 |
} |
|
69 |
// --------------------------------------------------------------------------- |
|
70 |
// C++ default constructor can NOT contain any code, that |
|
71 |
// might leave. |
|
72 |
// --------------------------------------------------------------------------- |
|
73 |
// |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
74 |
CGlxGridViewMLObserver::CGlxGridViewMLObserver(MGlxMediaList& aMediaList, |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
75 |
CHgGrid* aHgGrid, TGlxFilterItemType aFilterType) : |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
76 |
iMediaList(aMediaList), iHgGrid(aHgGrid), iFilterType(aFilterType) |
60 | 77 |
{ |
78 |
TRACER("CGlxGridViewMLObserver::CGlxGridViewMLObserver()"); |
|
79 |
} |
|
80 |
||
81 |
// --------------------------------------------------------------------------- |
|
82 |
// Symbian 2nd phase constructor can leave. |
|
83 |
// --------------------------------------------------------------------------- |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
84 |
// |
60 | 85 |
void CGlxGridViewMLObserver::ConstructL() |
86 |
{ |
|
87 |
TRACER("CGlxGridViewMLObserver::ConstructL()"); |
|
88 |
iMediaList.AddMediaListObserverL(this); |
|
89 |
// For DRm Utility |
|
90 |
iDRMUtility = CGlxDRMUtility::InstanceL(); |
|
91 |
||
92 |
CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); |
|
93 |
CleanupClosePushL(*uiUtility); |
|
94 |
iGridIconSize = uiUtility->GetGridIconSize(); |
|
95 |
iItemsPerPage = uiUtility->VisibleItemsInPageGranularityL(); |
|
96 |
CleanupStack::PopAndDestroy(uiUtility); |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
97 |
|
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
98 |
iQualityTnAttrib = TMPXAttribute (KGlxMediaIdThumbnail, |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
99 |
GlxFullThumbnailAttributeId( ETrue, iGridIconSize.iWidth, |
60 | 100 |
iGridIconSize.iHeight ) ); |
101 |
||
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
102 |
iSpeedTnAttrib = TMPXAttribute (KGlxMediaIdThumbnail, |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
103 |
GlxFullThumbnailAttributeId( EFalse, iGridIconSize.iWidth, |
60 | 104 |
iGridIconSize.iHeight ) ); |
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
105 |
|
60 | 106 |
iIconsFileName.Append(KDC_APP_BITMAP_DIR); |
107 |
iIconsFileName.Append(KGlxIconsFilename); |
|
108 |
iIsDefaultIconSet = EFalse; |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
109 |
|
60 | 110 |
iDiskErrorIntimated = EFalse; |
111 |
} |
|
112 |
||
113 |
// --------------------------------------------------------------------------- |
|
114 |
// Destructor |
|
115 |
// --------------------------------------------------------------------------- |
|
116 |
// |
|
117 |
CGlxGridViewMLObserver::~CGlxGridViewMLObserver() |
|
118 |
{ |
|
119 |
TRACER("CGlxGridViewMLObserver::~CGlxGridViewMLObserver()"); |
|
120 |
iMediaList.RemoveMediaListObserver( this ); |
|
121 |
if (iDRMUtility) |
|
122 |
{ |
|
123 |
iDRMUtility->Close(); |
|
124 |
} |
|
125 |
iModifiedIndexes.Reset(); |
|
126 |
} |
|
127 |
||
128 |
// ---------------------------------------------------------------------------- |
|
129 |
// HandleItemAddedL |
|
130 |
// ---------------------------------------------------------------------------- |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
131 |
// |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
132 |
void CGlxGridViewMLObserver::HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, |
60 | 133 |
MGlxMediaList* aList ) |
134 |
{ |
|
135 |
TRACER("CGlxGridViewMLObserver::HandleItemAddedL()"); |
|
136 |
GLX_DEBUG3("CGlxGridViewMLObserver::HandleItemAddedL() aStartIndex(%d)," |
|
137 |
" aEndIndex(%d)", aStartIndex, aEndIndex); |
|
138 |
||
139 |
if (!iHgGrid) |
|
140 |
{ |
|
141 |
return; |
|
142 |
} |
|
143 |
||
144 |
if ((aEndIndex - aStartIndex) > KRecreateGridSize) |
|
145 |
{ |
|
146 |
#ifdef _DEBUG |
|
147 |
TTime startTime; |
|
148 |
GLX_LOG_INFO("CGlxGridViewMLObserver::HandleItemAddedL - ResizeL(+)"); |
|
149 |
startTime.HomeTime(); |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
150 |
#endif |
60 | 151 |
iHgGrid->ResizeL(aList->Count()); |
152 |
#ifdef _DEBUG |
|
153 |
TTime stopTime; |
|
154 |
stopTime.HomeTime(); |
|
155 |
GLX_DEBUG2("CGlxGridViewMLObserver::HandleItemAddedL - ResizeL(-) took <%d> us", |
|
156 |
(TInt)stopTime.MicroSecondsFrom(startTime).Int64()); |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
157 |
#endif |
60 | 158 |
} |
159 |
else |
|
160 |
{ |
|
161 |
for (TInt i = aStartIndex; i <= aEndIndex; i++) |
|
162 |
{ |
|
163 |
iHgGrid->InsertItem(CHgItem::NewL(), i); |
|
164 |
} |
|
165 |
} |
|
166 |
} |
|
167 |
||
168 |
// ---------------------------------------------------------------------------- |
|
169 |
// HandleItemRemoved |
|
170 |
// ---------------------------------------------------------------------------- |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
171 |
// |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
172 |
void CGlxGridViewMLObserver::HandleItemRemovedL( TInt aStartIndex, |
60 | 173 |
TInt aEndIndex, MGlxMediaList* aList ) |
174 |
{ |
|
175 |
TRACER("CGlxGridViewMLObserver::HandleItemRemovedL()"); |
|
176 |
if (iHgGrid) |
|
177 |
{ |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
178 |
TInt mediaCount = aList->Count(); |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
179 |
|
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
180 |
for (TInt i = aEndIndex; i>= aStartIndex; i--) |
60 | 181 |
{ |
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
182 |
iHgGrid->RemoveItem(i); |
60 | 183 |
} |
184 |
||
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
185 |
// If the last item is also deleted, this refreshes the view |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
186 |
if (mediaCount <=0) |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
187 |
{ |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
188 |
if(iMediaList.VisibleWindowIndex() > iMediaList.Count()) |
60 | 189 |
{ |
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
190 |
iMediaList.SetVisibleWindowIndexL(0); |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
191 |
} |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
192 |
//This is done since the Hg doesnot refresh the screen |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
193 |
//when we remove all the items from the grid |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
194 |
iHgGrid->DrawDeferred(); |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
195 |
iHgGrid->Reset(); |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
196 |
return; |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
197 |
} |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
198 |
else if (iMediaList.VisibleWindowIndex() > iMediaList.Count()) |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
199 |
{ |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
200 |
iMediaList.SetVisibleWindowIndexL(iMediaList.Count()-1); |
60 | 201 |
} |
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
202 |
iHgGrid->RefreshScreen(iHgGrid->FirstIndexOnScreen()); |
60 | 203 |
} |
204 |
} |
|
205 |
||
206 |
// ---------------------------------------------------------------------------- |
|
207 |
// HandleAttributesAvailableL |
|
208 |
// ---------------------------------------------------------------------------- |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
209 |
// |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
210 |
void CGlxGridViewMLObserver::HandleAttributesAvailableL( TInt aItemIndex, |
60 | 211 |
const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* /*aList*/ ) |
212 |
{ |
|
213 |
TRACER("CGlxGridViewMLObserver::HandleAttributesAvailableL()"); |
|
214 |
GLX_LOG_INFO1("CGlxGridViewMLObserver::HandleAttributesAvailableL " |
|
215 |
"aItemIndex(%d)", aItemIndex); |
|
216 |
if (!iHgGrid) |
|
217 |
{ |
|
218 |
return; |
|
219 |
} |
|
220 |
||
221 |
TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match ); |
|
222 |
if (KErrNotFound != aAttributes.Find( iQualityTnAttrib, match ) || |
|
223 |
KErrNotFound != aAttributes.Find( iSpeedTnAttrib, match )) |
|
224 |
{ |
|
225 |
const TGlxMedia& item = iMediaList.Item( aItemIndex ); |
|
226 |
TSize setSize = CHgGrid::PreferredImageSize(); |
|
227 |
||
228 |
const CGlxThumbnailAttribute* qualityTn = item.ThumbnailAttribute( |
|
229 |
iQualityTnAttrib ); |
|
230 |
||
231 |
const CGlxThumbnailAttribute* speedTn = item.ThumbnailAttribute( |
|
232 |
iSpeedTnAttrib ); |
|
233 |
||
234 |
TInt tnError = GlxErrorManager::HasAttributeErrorL( |
|
235 |
item.Properties(), KGlxMediaIdThumbnail ); |
|
236 |
GLX_DEBUG4("GlxGridMLObs::HandleAttributesAvailableL() tnError(%d)" |
|
237 |
"qualityTn(%x) and speedTn(%x)",tnError, qualityTn, speedTn ); |
|
238 |
||
239 |
if (qualityTn) |
|
240 |
{ |
|
241 |
CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; |
|
242 |
bitmap->Duplicate(qualityTn->iBitmap->Handle()); |
|
243 |
iHgGrid->ItemL(aItemIndex).SetIcon(CGulIcon::NewL(bitmap)); |
|
244 |
GLX_LOG_INFO1("### CGlxGridViewMLObserver::HandleAttributesAvailableL" |
|
245 |
" qualityTn-Index is %d",aItemIndex); |
|
246 |
} |
|
247 |
else if (speedTn) |
|
248 |
{ |
|
249 |
CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; |
|
250 |
bitmap->Duplicate(speedTn->iBitmap->Handle()); |
|
251 |
iHgGrid->ItemL(aItemIndex).SetIcon(CGulIcon::NewL(bitmap)); |
|
252 |
GLX_LOG_INFO1("### CGlxGridViewMLObserver::HandleAttributesAvailableL" |
|
253 |
" speedTn-Index is %d",aItemIndex); |
|
254 |
} |
|
255 |
else if (item.Category() == EMPXVideo && KErrNone != tnError) |
|
256 |
{ |
|
257 |
SetIconL(aItemIndex, EMbmGlxiconsQgn_prop_image_notcreated, |
|
258 |
EMbmGlxiconsQgn_prop_image_notcreated_mask, |
|
259 |
CHgItem::EHgItemFlagsVideo); |
|
260 |
} |
|
261 |
else if (KErrNone != tnError && KErrNotSupported != tnError |
|
262 |
&& KErrArgument != tnError) |
|
263 |
{ |
|
264 |
SetIconL(aItemIndex, EMbmGlxiconsQgn_prop_image_corrupted, |
|
265 |
EMbmGlxiconsQgn_prop_image_corrupted_mask, |
|
266 |
CHgItem::EHgItemFlagsNone); |
|
267 |
} |
|
268 |
} |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
269 |
|
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
270 |
//Now Update the items with the DRM/video icon and date/time |
60 | 271 |
UpdateItemsL(aItemIndex,aAttributes); |
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
272 |
|
60 | 273 |
//Now refresh the screen based on the attributes available index |
274 |
RefreshScreenL(aItemIndex,aAttributes); |
|
275 |
} |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
276 |
|
60 | 277 |
// ---------------------------------------------------------------------------- |
278 |
// HandleFocusChangedL |
|
279 |
// ---------------------------------------------------------------------------- |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
280 |
// |
60 | 281 |
void CGlxGridViewMLObserver::HandleFocusChangedL( NGlxListDefs:: |
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
282 |
TFocusChangeType /*aType*/, TInt aNewIndex, TInt aOldIndex, |
60 | 283 |
MGlxMediaList* /*aList*/ ) |
284 |
{ |
|
285 |
TRACER("CGlxGridViewMLObserver::HandleFocusChangedL()"); |
|
286 |
if (aOldIndex != KErrNotFound) |
|
287 |
{ |
|
288 |
iHgGrid->SetSelectedIndex(aNewIndex); |
|
289 |
iHgGrid->RefreshScreen(aNewIndex); |
|
290 |
} |
|
291 |
/* if (aList->Count()) |
|
292 |
{ |
|
293 |
// This us to set the context to HG Teleport |
|
294 |
TGlxMedia item = iMediaList.Item( aNewIndex ); |
|
295 |
iContextUtility->PublishPhotoContextL(item.Uri()); |
|
296 |
}*/ |
|
297 |
} |
|
298 |
||
299 |
// ---------------------------------------------------------------------------- |
|
300 |
// HandleItemSelected |
|
301 |
// ---------------------------------------------------------------------------- |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
302 |
// |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
303 |
void CGlxGridViewMLObserver::HandleItemSelectedL(TInt /*aIndex*/, |
60 | 304 |
TBool /*aSelected*/, MGlxMediaList* /*aList*/ ) |
305 |
{ |
|
306 |
TRACER("CGlxGridViewMLObserver::HandleItemSelectedL()"); |
|
307 |
} |
|
308 |
||
309 |
// ---------------------------------------------------------------------------- |
|
310 |
// HandleMessageL |
|
311 |
// ---------------------------------------------------------------------------- |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
312 |
// |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
313 |
void CGlxGridViewMLObserver::HandleMessageL( const CMPXMessage& /*aMessage*/, |
60 | 314 |
MGlxMediaList* /*aList*/ ) |
315 |
{ |
|
316 |
TRACER("CGlxGridViewMLObserver::HandleMessageL()"); |
|
317 |
} |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
318 |
|
60 | 319 |
// ---------------------------------------------------------------------------- |
320 |
// HandleError |
|
321 |
// ---------------------------------------------------------------------------- |
|
322 |
// |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
323 |
void CGlxGridViewMLObserver::HandleError( TInt /*aError*/ ) |
60 | 324 |
{ |
325 |
TRACER("CGlxGridViewMLObserver::HandleError()"); |
|
326 |
TRAP_IGNORE(HandleErrorL()); |
|
327 |
} |
|
328 |
||
329 |
// ---------------------------------------------------------------------------- |
|
330 |
// HandleErrorL |
|
331 |
// ---------------------------------------------------------------------------- |
|
332 |
// |
|
333 |
void CGlxGridViewMLObserver::HandleErrorL() |
|
334 |
{ |
|
335 |
TRACER("CGlxGridViewMLObserver::HandleErrorL()"); |
|
336 |
||
337 |
TInt bitmapId = EMbmGlxiconsQgn_prop_image_corrupted; |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
338 |
TInt maskId = EMbmGlxiconsQgn_prop_image_corrupted_mask; |
60 | 339 |
TInt flags = CHgItem::EHgItemFlagsNone ; |
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
340 |
|
60 | 341 |
for ( TInt i = 0; i < iMediaList.Count(); i++ ) |
342 |
{ |
|
343 |
const TGlxMedia& item = iMediaList.Item( i ); |
|
344 |
TInt thumbnailError = GlxErrorManager::HasAttributeErrorL( |
|
345 |
item.Properties(), KGlxMediaIdThumbnail ); |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
346 |
|
60 | 347 |
if (KErrNone != thumbnailError) |
348 |
{ |
|
349 |
switch (thumbnailError) |
|
350 |
{ |
|
351 |
case KErrCANoRights:; // Err id = -17452 |
|
352 |
bitmapId = EMbmGlxiconsQgn_prop_image_notcreated; |
|
353 |
maskId = EMbmGlxiconsQgn_prop_image_notcreated_mask; |
|
354 |
flags = CHgItem::EHgItemFlagsDrmRightsExpired; |
|
355 |
break; |
|
356 |
case KErrDiskFull: |
|
357 |
bitmapId = EMbmGlxiconsQgn_prop_image_notcreated; |
|
358 |
maskId = EMbmGlxiconsQgn_prop_image_notcreated_mask; |
|
359 |
flags = CHgItem::EHgItemFlagsNone ; |
|
360 |
if (!iDiskErrorIntimated) |
|
361 |
{ |
|
362 |
DisplayErrorNoteL(KErrDiskFull); |
|
363 |
} |
|
364 |
break; |
|
365 |
default: |
|
366 |
{ |
|
367 |
if (item.Category() == EMPXVideo) |
|
368 |
{ |
|
369 |
bitmapId = EMbmGlxiconsQgn_prop_image_notcreated; |
|
370 |
maskId = EMbmGlxiconsQgn_prop_image_notcreated_mask; |
|
371 |
flags = CHgItem::EHgItemFlagsVideo; |
|
372 |
} |
|
373 |
else |
|
374 |
{ |
|
375 |
bitmapId = EMbmGlxiconsQgn_prop_image_corrupted; |
|
376 |
maskId = EMbmGlxiconsQgn_prop_image_corrupted_mask; |
|
377 |
flags = CHgItem::EHgItemFlagsNone; |
|
378 |
} |
|
379 |
||
380 |
} |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
381 |
break; |
60 | 382 |
} |
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
383 |
|
60 | 384 |
SetIconL(i, bitmapId, maskId, flags); |
385 |
} |
|
386 |
} |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
387 |
iHgGrid->RefreshScreen(iHgGrid->FirstIndexOnScreen()); |
60 | 388 |
} |
389 |
||
390 |
// ---------------------------------------------------------------------------- |
|
391 |
// SetIconL |
|
392 |
// ---------------------------------------------------------------------------- |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
393 |
// |
60 | 394 |
void CGlxGridViewMLObserver::SetIconL(TInt aItemIndex, TInt aBitmapId, |
395 |
TInt aMaskId, TInt aFlags) |
|
396 |
{ |
|
397 |
TRACER("CGlxGridViewMLObserver::SetIconL()"); |
|
398 |
CFbsBitmap* bitmap = NULL; |
|
399 |
CFbsBitmap* mask = NULL; |
|
400 |
TSize setSize = CHgGrid::PreferredImageSize(); |
|
401 |
AknsUtils::CreateIconLC(AknsUtils::SkinInstance(), KAknsIIDNone, bitmap, |
|
402 |
mask, iIconsFileName, aBitmapId, aMaskId); |
|
403 |
__ASSERT_DEBUG(bitmap, Panic(EGlxPanicNullPointer)); |
|
404 |
__ASSERT_DEBUG(mask, Panic(EGlxPanicNullPointer)); |
|
405 |
||
406 |
AknIconUtils::SetSize(bitmap, setSize, |
|
407 |
EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
408 |
AknIconUtils::SetSize(mask, setSize, |
|
409 |
EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
410 |
||
411 |
iHgGrid->ItemL(aItemIndex).SetIcon(CGulIcon::NewL(bitmap, mask), aFlags); |
|
412 |
CleanupStack::Pop(mask); |
|
413 |
CleanupStack::Pop(bitmap); |
|
414 |
} |
|
415 |
||
416 |
// ---------------------------------------------------------------------------- |
|
417 |
// HandleCommandCompleteL |
|
418 |
// ---------------------------------------------------------------------------- |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
419 |
// |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
420 |
void CGlxGridViewMLObserver::HandleCommandCompleteL( CMPXCommand* /*aCommandResult*/, |
60 | 421 |
TInt /*aError*/, MGlxMediaList* /*aList*/ ) |
422 |
{ |
|
423 |
TRACER("CGlxGridViewMLObserver::HandleCommandCompleteL()"); |
|
424 |
} |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
425 |
|
60 | 426 |
// ---------------------------------------------------------------------------- |
427 |
// HandleMediaL |
|
428 |
// ---------------------------------------------------------------------------- |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
429 |
// |
60 | 430 |
void CGlxGridViewMLObserver::HandleMediaL( TInt /*aListIndex*/, MGlxMediaList* /*aList*/ ) |
431 |
{ |
|
432 |
TRACER("CGlxGridViewMLObserver::HandleMediaL()"); |
|
433 |
} |
|
434 |
||
435 |
// ---------------------------------------------------------------------------- |
|
436 |
// HandlePopulatedL |
|
437 |
// ---------------------------------------------------------------------------- |
|
438 |
// |
|
439 |
void CGlxGridViewMLObserver::HandlePopulatedL( MGlxMediaList* /*aList*/ ) |
|
440 |
{ |
|
441 |
TRACER("CGlxGridViewMLObserver::HandlePopulatedL()"); |
|
442 |
if (iHgGrid) |
|
443 |
{ |
|
444 |
// Setting the Empty Text |
|
445 |
if (iFilterType == EGlxFilterImage) |
|
446 |
{ |
|
447 |
HBufC* emptyText = StringLoader::LoadLC( |
|
448 |
R_GRID_EMPTY_VIEW_TEXT_IMAGE); |
|
449 |
iHgGrid->SetEmptyTextL(*emptyText); |
|
450 |
CleanupStack::PopAndDestroy(emptyText); |
|
451 |
} |
|
452 |
else if (iFilterType == EGlxFilterVideo) |
|
453 |
{ |
|
454 |
HBufC* emptyText = StringLoader::LoadLC( |
|
455 |
R_GRID_EMPTY_VIEW_TEXT_VIDEO); |
|
456 |
iHgGrid->SetEmptyTextL(*emptyText); |
|
457 |
CleanupStack::PopAndDestroy(emptyText); |
|
458 |
} |
|
459 |
else |
|
460 |
{ |
|
461 |
HBufC* emptyText = StringLoader::LoadLC(R_GRID_EMPTY_VIEW_TEXT); |
|
462 |
iHgGrid->SetEmptyTextL(*emptyText); |
|
463 |
CleanupStack::PopAndDestroy(emptyText); |
|
464 |
} |
|
465 |
||
466 |
GLX_DEBUG2("GridMLObserver::HandlePopulatedL() iMediaList.Count()=%d", |
|
467 |
iMediaList.Count()); |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
468 |
|
60 | 469 |
if (iMediaList.Count() <= 0) |
470 |
{ |
|
471 |
GLX_DEBUG1("GridMLObserver::HandlePopulatedL() - SetEmptyTextL()"); |
|
472 |
iHgGrid->DrawNow(); |
|
473 |
} |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
474 |
|
60 | 475 |
GLX_DEBUG1("GridMLObserver::HandlePopulatedL() - SetDefaultIconL()"); |
476 |
SetDefaultIconL(ETrue); |
|
477 |
} |
|
478 |
} |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
479 |
|
60 | 480 |
// ---------------------------------------------------------------------------- |
481 |
// HandleItemModifiedL |
|
482 |
// ---------------------------------------------------------------------------- |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
483 |
// |
60 | 484 |
void CGlxGridViewMLObserver::HandleItemModifiedL(const RArray<TInt>& aItemIndexes, |
485 |
MGlxMediaList* /*aList*/) |
|
486 |
{ |
|
487 |
TRACER("CGlxGridViewMLObserver::HandleItemModifiedL()"); |
|
488 |
for(TInt index = 0;index<aItemIndexes.Count();index++) |
|
489 |
{ |
|
490 |
TInt modifiedIndex = aItemIndexes[index]; |
|
491 |
iModifiedIndexes.AppendL(modifiedIndex); |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
492 |
} |
60 | 493 |
} |
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
494 |
|
60 | 495 |
// ---------------------------------------------------------------------------- |
496 |
// HasRelevantThumbnailAttribute |
|
497 |
// ---------------------------------------------------------------------------- |
|
498 |
// |
|
499 |
TBool CGlxGridViewMLObserver::HasRelevantThumbnail(TInt aIndex) |
|
500 |
{ |
|
501 |
TRACER("CGlxGridViewMLObserver::HasRelevantThumbnail()"); |
|
502 |
const TGlxMedia& item = iMediaList.Item( aIndex ); |
|
503 |
const CGlxThumbnailAttribute* qualityTn = item.ThumbnailAttribute( |
|
504 |
iQualityTnAttrib ); |
|
505 |
const CGlxThumbnailAttribute* speedTn = item.ThumbnailAttribute( |
|
506 |
iSpeedTnAttrib ); |
|
507 |
if ( qualityTn || speedTn ) |
|
508 |
{ |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
509 |
GLX_DEBUG1("GridMLObserver::HasRelevantThumbnail() - TN avail"); |
60 | 510 |
return ETrue; |
511 |
} |
|
512 |
return EFalse; |
|
513 |
} |
|
514 |
||
515 |
||
516 |
// ---------------------------------------------------------------------------- |
|
517 |
// RefreshScreenL |
|
518 |
// ---------------------------------------------------------------------------- |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
519 |
// |
60 | 520 |
void CGlxGridViewMLObserver::RefreshScreenL(TInt aItemIndex, |
521 |
const RArray<TMPXAttribute>& aAttributes) |
|
522 |
{ |
|
523 |
TRACER("CGlxGridViewMLObserver::RefreshScreenL()"); |
|
524 |
GLX_DEBUG2("CGlxGridViewMLObserver::RefreshScreenL(%d)", aItemIndex); |
|
525 |
TInt mediaCount = iMediaList.Count(); |
|
526 |
TInt firstIndex = iHgGrid->FirstIndexOnScreen(); |
|
527 |
firstIndex = (firstIndex<0 ? 0 : firstIndex); |
|
528 |
TInt lastOnScreen = firstIndex + iHgGrid->ItemsOnScreen() - 1; |
|
529 |
lastOnScreen = (lastOnScreen >mediaCount-1? mediaCount-1:lastOnScreen); |
|
530 |
if (mediaCount < iItemsPerPage || aItemIndex == firstIndex) |
|
531 |
{ |
|
532 |
if (aItemIndex == firstIndex && HasRelevantThumbnail(firstIndex) |
|
533 |
&& HasRelevantThumbnail(lastOnScreen)) |
|
534 |
{ |
|
535 |
GLX_DEBUG2("## GridMLObserver::HandleAttributesAvailableL()" |
|
536 |
" RefreshScreen - firstIndex(%d)", firstIndex); |
|
537 |
iHgGrid->RefreshScreen(firstIndex); |
|
538 |
} |
|
539 |
else if (aItemIndex > firstIndex && aItemIndex <= lastOnScreen) |
|
540 |
{ |
|
541 |
if (HasRelevantThumbnail(lastOnScreen) && HasRelevantThumbnail( |
|
542 |
firstIndex)) |
|
543 |
{ |
|
544 |
GLX_DEBUG2("GridMLObserver::HandleAttributesAvailableL()" |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
545 |
" RefreshScreen - aItemIndex(%d)", aItemIndex); |
60 | 546 |
iHgGrid->RefreshScreen(aItemIndex); |
547 |
} |
|
548 |
} |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
549 |
|
60 | 550 |
if (!iIsDefaultIconSet) |
551 |
{ |
|
552 |
GLX_DEBUG1("GridMLObserver::HandleAttributesAvailableL()" |
|
553 |
" SetDefaultIconL() - 1"); |
|
554 |
SetDefaultIconL(EFalse); |
|
555 |
} |
|
556 |
} |
|
557 |
else if (aItemIndex > firstIndex && aItemIndex <= lastOnScreen) |
|
558 |
{ |
|
559 |
TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match ); |
|
560 |
if (KErrNotFound != aAttributes.Find(iQualityTnAttrib, match) || |
|
561 |
KErrNotFound != aAttributes.Find(iSpeedTnAttrib, match) ) |
|
562 |
{ |
|
563 |
if ( HasRelevantThumbnail(firstIndex) ) |
|
564 |
{ |
|
565 |
if ( HasRelevantThumbnail(lastOnScreen) ) |
|
566 |
{ |
|
567 |
GLX_DEBUG2("GridMLObserver::HandleAttributesAvailableL()" |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
568 |
" RefreshScreen - aItemIndex(%d)", aItemIndex); |
60 | 569 |
iHgGrid->RefreshScreen(aItemIndex); |
570 |
} |
|
571 |
else if (aItemIndex == lastOnScreen) |
|
572 |
{ |
|
573 |
GLX_DEBUG2("GridMLObserver::HandleAttributesAvailableL()" |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
574 |
" RefreshScreen - lastOnScreen(%d)", lastOnScreen); |
60 | 575 |
iHgGrid->RefreshScreen(lastOnScreen); |
576 |
} |
|
577 |
} |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
578 |
|
60 | 579 |
if (!iIsDefaultIconSet) |
580 |
{ |
|
581 |
GLX_DEBUG1("GridMLObserver::HandleAttributesAvailableL()" |
|
582 |
" SetDefaultIconL() - 2"); |
|
583 |
SetDefaultIconL(EFalse); |
|
584 |
} |
|
585 |
} |
|
586 |
} |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
587 |
|
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
588 |
if (iModifiedIndexes.Count() > 0) |
60 | 589 |
{ |
590 |
for(TInt index = 0;index<iModifiedIndexes.Count();index++) |
|
591 |
{ |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
592 |
if (iModifiedIndexes[index] == aItemIndex && |
60 | 593 |
HasRelevantThumbnail(aItemIndex)) |
594 |
{ |
|
595 |
GLX_DEBUG2("GridMLObserver::HandleAttributesAvailableL()" |
|
596 |
" RefreshScreen - modified index(%d)", aItemIndex); |
|
597 |
iHgGrid->RefreshScreen(aItemIndex); |
|
598 |
iModifiedIndexes.Remove(index); |
|
599 |
iModifiedIndexes.Compress(); |
|
600 |
} |
|
601 |
} |
|
602 |
} |
|
603 |
} |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
604 |
|
60 | 605 |
// ---------------------------------------------------------------------------- |
606 |
// UpdateItemsL |
|
607 |
// ---------------------------------------------------------------------------- |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
608 |
// |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
609 |
void CGlxGridViewMLObserver::UpdateItemsL(TInt aItemIndex, |
60 | 610 |
const RArray<TMPXAttribute>& aAttributes) |
611 |
{ |
|
612 |
TRACER("CGlxGridViewMLObserver::UpdateItemsL()"); |
|
613 |
TInt mediaCount = iMediaList.Count(); |
|
614 |
const TGlxMedia& item = iMediaList.Item( aItemIndex ); |
|
615 |
TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match ); |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
616 |
|
60 | 617 |
if (aAttributes.Find(KMPXMediaDrmProtected, match) != KErrNotFound) |
618 |
{ |
|
619 |
if (item.IsDrmProtected()) |
|
620 |
{ |
|
621 |
const TDesC& uri = item.Uri(); |
|
622 |
if( uri.Length() > 0) |
|
623 |
{ |
|
624 |
if(iDRMUtility->IsForwardLockedL(uri)) |
|
625 |
{ |
|
626 |
/* |
|
627 |
* fix for EABI-7RKHDG |
|
628 |
* to show the invalid DRM icon |
|
629 |
*/ |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
630 |
TMPXGeneralCategory cat = item.Category(); |
60 | 631 |
TBool checkViewRights = (cat==EMPXImage); |
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
632 |
|
60 | 633 |
if(iDRMUtility->ItemRightsValidityCheckL(uri, checkViewRights)) |
634 |
{ |
|
635 |
iHgGrid->ItemL(aItemIndex).SetFlags( |
|
636 |
CHgItem::EHgItemFlagsDrmRightsValid); |
|
637 |
} |
|
638 |
else |
|
639 |
{ |
|
640 |
iHgGrid->ItemL(aItemIndex).SetFlags( |
|
641 |
CHgItem::EHgItemFlagsDrmRightsExpired); |
|
642 |
} |
|
643 |
} |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
644 |
else |
60 | 645 |
{ |
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
646 |
TMPXGeneralCategory cat = item.Category(); |
60 | 647 |
TBool checkViewRights = (cat==EMPXImage); |
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
648 |
|
60 | 649 |
if(iDRMUtility->ItemRightsValidityCheckL(uri, checkViewRights)) |
650 |
{ |
|
651 |
iHgGrid->ItemL(aItemIndex).SetFlags( |
|
652 |
CHgItem::EHgItemFlagsDrmRightsValid); |
|
653 |
} |
|
654 |
else |
|
655 |
{ |
|
656 |
iHgGrid->ItemL(aItemIndex).SetFlags( |
|
657 |
CHgItem::EHgItemFlagsDrmRightsExpired); |
|
658 |
} |
|
659 |
} |
|
660 |
} |
|
661 |
} |
|
662 |
} |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
663 |
|
60 | 664 |
if (aAttributes.Find(KMPXMediaGeneralDate, match) != KErrNotFound) |
665 |
{ |
|
666 |
TTime time(0); |
|
667 |
if (item.GetDate(time)) |
|
668 |
{ |
|
669 |
iHgGrid->ItemL(aItemIndex).SetTime(time); |
|
670 |
} |
|
671 |
} |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
672 |
|
60 | 673 |
if (aAttributes.Find(KMPXMediaGeneralCategory, match) != KErrNotFound) |
674 |
{ |
|
675 |
if (item.Category() == EMPXVideo) |
|
676 |
{ |
|
677 |
iHgGrid->ItemL(aItemIndex).SetFlags(CHgItem::EHgItemFlagsVideo); |
|
678 |
} |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
679 |
} |
60 | 680 |
} |
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
681 |
|
60 | 682 |
// ---------------------------------------------------------------------------- |
683 |
// DisplayErrorNoteL |
|
684 |
// ---------------------------------------------------------------------------- |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
685 |
// |
60 | 686 |
void CGlxGridViewMLObserver::DisplayErrorNoteL(TInt aError) |
687 |
{ |
|
688 |
TRACER("CGlxGridViewMLObserver::DisplayErrorNoteL()"); |
|
689 |
GLX_LOG_INFO1("CGlxGridViewMLObserver::DisplayErrorNoteL() " |
|
690 |
" aError(%d)", aError); |
|
691 |
GlxGeneralUiUtilities::ShowErrorNoteL(aError); |
|
692 |
iDiskErrorIntimated = ETrue; |
|
693 |
return; |
|
694 |
} |
|
695 |
||
696 |
// ---------------------------------------------------------------------------- |
|
697 |
// SetDefaultIconL |
|
698 |
// ---------------------------------------------------------------------------- |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
699 |
// |
60 | 700 |
void CGlxGridViewMLObserver::SetDefaultIconL(TBool aTransparent) |
701 |
{ |
|
702 |
TRACER("CGlxGridViewMLObserver::SetDefaultIconL()"); |
|
703 |
GLX_LOG_INFO1("CGlxGridViewMLObserver::SetDefaultIconL() " |
|
704 |
" aTransparent(%d)", aTransparent); |
|
705 |
if (aTransparent) |
|
706 |
{ |
|
707 |
CFbsBitmap* bitmap = new (ELeave) CFbsBitmap(); |
|
708 |
CleanupStack::PushL(bitmap); |
|
709 |
CFbsBitmap* mask = new (ELeave) CFbsBitmap(); |
|
710 |
CleanupStack::PushL(mask); |
|
711 |
TSize bmpSize = CHgGrid::PreferredImageSize(); |
|
712 |
bitmap->Create(bmpSize, EColor16M); |
|
713 |
mask->Create(bmpSize, EGray256); // Gray mask |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
714 |
const TInt scanlineLength = bmpSize.iWidth; // 1 byte per pixel |
60 | 715 |
RBuf8 maskData; |
716 |
maskData.Create(scanlineLength); |
|
717 |
maskData.FillZ(scanlineLength); // Init with zero |
|
718 |
||
719 |
mask->BeginDataAccess(); |
|
720 |
for (TInt y = 0; y < bmpSize.iHeight; y++) |
|
721 |
{ |
|
722 |
mask->SetScanLine(maskData, y); |
|
723 |
} |
|
724 |
||
725 |
maskData.Close(); |
|
726 |
mask->EndDataAccess(); |
|
727 |
iHgGrid->SetDefaultIconL(CGulIcon::NewL(bitmap, mask)); |
|
728 |
CleanupStack::Pop(mask); |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
729 |
CleanupStack::Pop(bitmap); |
60 | 730 |
} |
731 |
else if (!iIsDefaultIconSet) |
|
732 |
{ |
|
733 |
CFbsBitmap* bitmap = NULL; |
|
734 |
CFbsBitmap* mask = NULL; |
|
735 |
TSize setSize = CHgGrid::PreferredImageSize(); |
|
736 |
||
737 |
AknsUtils::CreateIconLC(AknsUtils::SkinInstance(), KAknsIIDNone, |
|
738 |
bitmap, mask, iIconsFileName, |
|
739 |
EMbmGlxiconsQgn_prop_image_notcreated, |
|
740 |
EMbmGlxiconsQgn_prop_image_notcreated_mask); |
|
741 |
__ASSERT_DEBUG(bitmap, Panic(EGlxPanicNullPointer)); |
|
742 |
__ASSERT_DEBUG(mask, Panic(EGlxPanicNullPointer)); |
|
743 |
||
744 |
AknIconUtils::SetSize(bitmap, setSize, |
|
745 |
EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
746 |
AknIconUtils::SetSize(mask, setSize, |
|
747 |
EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
748 |
||
749 |
iHgGrid->SetDefaultIconL(CGulIcon::NewL(bitmap, mask)); |
|
750 |
CleanupStack::Pop(mask); |
|
751 |
CleanupStack::Pop(bitmap); |
|
752 |
iIsDefaultIconSet = ETrue; |
|
753 |
} |
|
754 |
} |