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 |
/* |
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: Container for Fecther Dialog |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
||
21 |
// System includes |
|
22 |
#include <avkon.rsg> |
|
23 |
#include <AknUtils.h> // For AknLayoutUtils to calculate rect |
|
24 |
#include <data_caging_path_literals.hrh> // KDC_APP_RESOURCE_DIR |
|
25 |
#include <StringLoader.h> // For Empty text reading from resource |
|
26 |
#include <akntitle.h> // Title Pane |
|
27 |
||
28 |
#include <mpxcollectionutility.h> // Mpx Collection path for medialist craetion |
|
29 |
#include <gulicon.h> // Gul Icon |
|
30 |
#include <ganes/HgItem.h> // HG Item |
|
31 |
#include <ganes/HgGrid.h> // Hg Grid Widget |
|
32 |
#include <AknsBasicBackgroundControlContext.h> // Background Context |
|
33 |
||
34 |
#include <glxuistd.h> // KGlxFetchontextPriorityNormal and KGlxIconsFilename |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
35 |
#include <glxcollectionpluginall.hrh> // All item collection plugin id |
60 | 36 |
#include <glxfilterfactory.h> // For Filters required in Medilaits |
37 |
#include <glxresourceutilities.h> // for CGlxResourceUtilities |
|
38 |
#include <glxfetcherdialog.rsg> // FOR GETTING Dialog ID AND RESOURCE ID |
|
39 |
#include <glxattributecontext.h> // TMPXAttribute |
|
40 |
#include <glxattributeretriever.h> // CGlxAttributeRetriever |
|
41 |
#include <glxfetchcontextremover.h> // TGlxfetchContextRemover |
|
42 |
#include <glxuiutility.h> // AknIconUtils and EikStatusPane |
|
43 |
#include <glxtracer.h> // For Tracer logs |
|
44 |
#include <glxlog.h> // Glx Logger |
|
45 |
#include <glxgridviewmlobserver.h> // Medialistobserver for HgGrid |
|
46 |
#include <glxthumbnailcontext.h> // Thumbnailcontext for HgGrid |
|
47 |
#include <glxicons.mbg> // Glx Icons for HgGrid |
|
48 |
#include <mglxmedialist.h> // MGlxMediaList, CMPXCollectionPath |
|
49 |
#include <glxcommandhandlers.hrh> // For EGlxCmdEndMultiplemarking and EGlxCmdStartMultiplemarking |
|
50 |
#include <glxthumbnailattributeinfo.h> // KGlxMediaIdThumbnail |
|
51 |
#include <glxerrormanager.h> |
|
52 |
#include <glxdrmutility.h> // DRM utility class to provide DRM-related functionality |
|
53 |
||
54 |
// User includes |
|
55 |
#include "glxfetchercontainer.h" |
|
56 |
#include "mglxeventobserver.h" |
|
57 |
#include "glxfetcher.hrh" |
|
58 |
#include "glxfetchercommandhandler.h" |
|
59 |
||
60 |
const TInt KPadding(7); |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
61 |
const TInt KNoOfPages(4); |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
62 |
const TInt KBufferTreshold(1); |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
63 |
const TInt KItemsPerPage(18); |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
64 |
const TInt KBufferSize(KNoOfPages * KItemsPerPage); |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
65 |
const TInt KBufferTresholdSize(KBufferTreshold * KItemsPerPage); |
60 | 66 |
|
67 |
//----------------------------------------------------------------------------- |
|
68 |
// Two-phased constructor. |
|
69 |
//----------------------------------------------------------------------------- |
|
70 |
CGlxFetcherContainer* CGlxFetcherContainer::NewL( |
|
71 |
TGlxFilterItemType aFilterType, const TDesC& aTitle, |
|
72 |
MGlxEventObserver& aEventObserver, TBool aMultiSelectionEnabled ) |
|
73 |
{ |
|
74 |
TRACER("CGlxFetcherContainer::NewL"); |
|
75 |
CGlxFetcherContainer* self = |
|
76 |
new( ELeave ) CGlxFetcherContainer( aFilterType ,aTitle, |
|
77 |
aEventObserver, aMultiSelectionEnabled); |
|
78 |
CleanupStack::PushL( self ); |
|
79 |
self->ConstructL(); |
|
80 |
CleanupStack::Pop( self ); |
|
81 |
return self; |
|
82 |
} |
|
83 |
||
84 |
//----------------------------------------------------------------------------- |
|
85 |
// C++ default constructor. |
|
86 |
//----------------------------------------------------------------------------- |
|
87 |
CGlxFetcherContainer::CGlxFetcherContainer( |
|
88 |
TGlxFilterItemType aFilterType ,const TDesC& aTitle, |
|
89 |
MGlxEventObserver& aEventObserver, TBool aMultiSelectionEnabled ) |
|
90 |
: iFilterType( aFilterType ), |
|
91 |
iTitle( aTitle ),iEventObserver(aEventObserver), |
|
92 |
iMultiSelectionEnabled(aMultiSelectionEnabled) |
|
93 |
{ |
|
94 |
TRACER("CGlxFetcherContainer::CGlxFetcherContainer"); |
|
95 |
// No implementation required |
|
96 |
} |
|
97 |
||
98 |
// --------------------------------------------------------------------------- |
|
99 |
// ConstructL() |
|
100 |
// --------------------------------------------------------------------------- |
|
101 |
void CGlxFetcherContainer::ConstructL() |
|
102 |
{ |
|
103 |
TRACER("CGlxFetcherContainer::ConstructL"); |
|
104 |
iBgContext = CAknsBasicBackgroundControlContext::NewL( |
|
105 |
KAknsIIDQsnBgAreaMain, Rect(), EFalse ); |
|
106 |
iUiUtility = CGlxUiUtility::UtilityL(); |
|
107 |
iGridIconSize = iUiUtility->GetGridIconSize(); |
|
108 |
||
109 |
// For DRM Utility |
|
110 |
iDRMUtility = CGlxDRMUtility::InstanceL(); |
|
111 |
SetFileAttached(EFalse); |
|
112 |
} |
|
113 |
||
114 |
//----------------------------------------------------------------------------- |
|
115 |
// Destructor |
|
116 |
//----------------------------------------------------------------------------- |
|
117 |
CGlxFetcherContainer::~CGlxFetcherContainer() |
|
118 |
{ |
|
119 |
TRACER("CGlxFetcherContainer::~CGlxFetcherContainer"); |
|
120 |
if (iDRMUtility) |
|
121 |
{ |
|
122 |
iDRMUtility->Close(); |
|
123 |
} |
|
124 |
delete iBgContext; |
|
125 |
delete iPreviousTitle; |
|
126 |
delete iFetcherCommandHandler; |
|
127 |
delete iGlxGridMLObserver; |
|
128 |
if (iHgGrid) |
|
129 |
{ |
|
130 |
iHgGrid->SetFocus(EFalse); |
|
131 |
delete iHgGrid; |
|
132 |
iHgGrid = NULL; |
|
133 |
} |
|
134 |
if (iMediaList) |
|
135 |
{ |
|
136 |
iMediaList->RemoveContext(iThumbnailContext); |
|
137 |
delete iThumbnailContext; |
|
138 |
iMediaList->Close(); |
|
139 |
} |
|
140 |
if (iUiUtility) |
|
141 |
{ |
|
142 |
iUiUtility->Close() ; |
|
143 |
} |
|
144 |
} |
|
145 |
||
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
146 |
|
60 | 147 |
// --------------------------------------------------------------------------- |
148 |
// CreateAndDisplayGridL |
|
149 |
// --------------------------------------------------------------------------- |
|
150 |
// |
|
151 |
void CGlxFetcherContainer::CreateAndDisplayGridL() |
|
152 |
{ |
|
153 |
TRACER("CGlxFetcherContainer::CreateAndDisplayGridL"); |
|
154 |
//Create Medialist |
|
155 |
CreateMediaListL(); |
|
156 |
||
157 |
// Create the control here |
|
158 |
CreateHgGridWidgetL(); |
|
159 |
||
160 |
CreateGridMediaListObserverL(); |
|
161 |
||
162 |
// If multiple image selection is allowed, then set marking flag on grid widget. |
|
163 |
if(iMultiSelectionEnabled) |
|
164 |
{ |
|
165 |
// Fetcher CommandHandler must be created after creating the medialist |
|
166 |
iFetcherCommandHandler = CGlxFetcherCommandHandler::NewL( this , this ); |
|
167 |
||
168 |
iHgGrid->SetFlags( CHgScroller::EHgScrollerSelectionMode ); |
|
169 |
iMultipleMarkNotStarted = EFalse; |
|
170 |
} |
|
171 |
} |
|
172 |
// --------------------------------------------------------------------------- |
|
173 |
// CreateMediaListL() |
|
174 |
// Creates a collection path |
|
175 |
// Create a filter as requested filtertype |
|
176 |
// Creates the medialist |
|
177 |
// --------------------------------------------------------------------------- |
|
178 |
void CGlxFetcherContainer::CreateMediaListL() |
|
179 |
{ |
|
180 |
TRACER("CGlxFetcherContainer::CreateMediaListL"); |
|
181 |
||
182 |
// Create path to the list of images and videos |
|
183 |
CMPXCollectionPath* path = CMPXCollectionPath::NewL(); |
|
184 |
CleanupStack::PushL( path ); |
|
185 |
path->AppendL(KGlxCollectionPluginAllImplementationUid); // All item collection plugin |
|
186 |
||
187 |
// Create filter to filter out either images or videos |
|
188 |
GLX_LOG_INFO1("CGlxFetcherContainer::MediaListL - Filter Type = %d",iFilterType); |
|
189 |
CMPXFilter* filter = TGlxFilterFactory::CreateItemTypeFilterL(iFilterType); |
|
190 |
CleanupStack::PushL(filter); |
|
191 |
||
192 |
// Create the media list |
|
193 |
iMediaList = MGlxMediaList::InstanceL( *path, |
|
194 |
TGlxHierarchyId(KGlxFetcherDllUid), filter ); |
|
195 |
CleanupStack::PopAndDestroy( filter ); |
|
196 |
||
197 |
GLX_LOG_INFO1("CGlxFetcherContainer::MediaListL - Path level = %d", |
|
198 |
path->Levels()); |
|
199 |
||
200 |
CleanupStack::PopAndDestroy( path ); |
|
201 |
} |
|
202 |
// --------------------------------------------------------------------------- |
|
203 |
// CreateHgGridWidgetL |
|
204 |
// --------------------------------------------------------------------------- |
|
205 |
// |
|
206 |
void CGlxFetcherContainer::CreateHgGridWidgetL() |
|
207 |
{ |
|
208 |
TRACER("CGlxFetcherContainer::CreateHgGridWidgetL"); |
|
209 |
//Setting the Title |
|
210 |
SetTitleL( iTitle); |
|
211 |
||
212 |
iThumbnailContext = CGlxThumbnailContext::NewL( &iBlockyIterator ); // set the thumbnail context |
|
213 |
iThumbnailContext->SetDefaultSpec( iUiUtility->GetGridIconSize().iWidth, |
|
214 |
iUiUtility->GetGridIconSize().iHeight ); |
|
215 |
||
216 |
iMediaList->AddContextL(iThumbnailContext, KGlxFetchContextPriorityNormal ); |
|
217 |
||
218 |
if (!iHgGrid) |
|
219 |
{ |
|
220 |
TRect rect; |
|
221 |
AknLayoutUtils::LayoutMetricsRect (AknLayoutUtils::EMainPane, rect); |
|
222 |
TSize iconSize (iUiUtility->GetGridIconSize().iWidth - (2*KPadding), |
|
223 |
iUiUtility->GetGridIconSize().iHeight -(2*KPadding)); |
|
224 |
TFileName resFile(KDC_APP_BITMAP_DIR); |
|
225 |
resFile.Append(KGlxIconsFilename); |
|
226 |
CFbsBitmap* bitmap = NULL; |
|
227 |
CFbsBitmap* mask = NULL; |
|
228 |
AknsUtils::CreateIconLC(AknsUtils::SkinInstance(), KAknsIIDNone, |
|
229 |
bitmap, mask, resFile, EMbmGlxiconsQgn_prop_image_notcreated, |
|
230 |
EMbmGlxiconsQgn_prop_image_notcreated_mask); |
|
231 |
__ASSERT_DEBUG(bitmap, Panic(EGlxPanicNullPointer)); |
|
232 |
__ASSERT_DEBUG(mask, Panic(EGlxPanicNullPointer)); |
|
233 |
||
234 |
AknIconUtils::SetSize(bitmap, CHgGrid::PreferredImageSize(), |
|
235 |
EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
236 |
AknIconUtils::SetSize(mask, CHgGrid::PreferredImageSize(), |
|
237 |
EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
238 |
||
239 |
// Create Hg grid object |
|
240 |
iHgGrid = CHgGrid::NewL(rect, iMediaList->Count(), CGulIcon::NewL( |
|
241 |
bitmap, mask)); |
|
242 |
CleanupStack::Pop(mask); |
|
243 |
CleanupStack::Pop(bitmap); |
|
244 |
} |
|
245 |
||
246 |
// Set the grid to use different layout for landscape mode in fetcher |
|
247 |
iHgGrid->SetToolbarVisibility(EFalse); |
|
248 |
// Setting to MopParent to update background skin |
|
249 |
iHgGrid->SetMopParent(this); |
|
250 |
// Setting Selction observer for getting callback on key event change |
|
251 |
iHgGrid->SetSelectionObserver(*this); |
|
252 |
// This Displays the scrollbar at the opening of the Grid view |
|
253 |
iHgGrid->SetScrollBarTypeL(CHgScroller::EHgScrollerTimeStrip ); |
|
254 |
// Enable Buffer support |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
255 |
iHgGrid->EnableScrollBufferL(*this, KBufferSize, KBufferTresholdSize); |
60 | 256 |
// Enable Marking support |
257 |
iHgGrid->SetMarkingObserver(*this); |
|
258 |
||
259 |
iHgGrid->SetFocus(ETrue); |
|
260 |
} |
|
261 |
||
262 |
// --------------------------------------------------------------------------- |
|
263 |
// CreateGridMediaListObserverL |
|
264 |
// --------------------------------------------------------------------------- |
|
265 |
// |
|
266 |
void CGlxFetcherContainer::CreateGridMediaListObserverL() |
|
267 |
{ |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
268 |
iGlxGridMLObserver = CGlxGridViewMLObserver::NewL(*iMediaList, iHgGrid, |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
269 |
iFilterType); |
60 | 270 |
} |
271 |
||
272 |
// --------------------------------------------------------------------------- |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
273 |
// BufferPositionChanged |
60 | 274 |
// --------------------------------------------------------------------------- |
275 |
// |
|
276 |
void CGlxFetcherContainer::Request(TInt aRequestStart, TInt aRequestEnd, |
|
277 |
THgScrollDirection /*aDirection*/) |
|
278 |
{ |
|
279 |
TRACER("CGlxFetcherContainer::Request()"); |
|
280 |
TRAP_IGNORE(RequestL( aRequestStart, aRequestEnd )); |
|
281 |
} |
|
282 |
// --------------------------------------------------------------------------- |
|
283 |
// RequestL |
|
284 |
// --------------------------------------------------------------------------- |
|
285 |
// |
|
286 |
void CGlxFetcherContainer::RequestL(TInt aRequestStart, TInt aRequestEnd) |
|
287 |
{ |
|
288 |
TRACER("CGlxFetcherContainer::RequestL()"); |
|
289 |
TInt mediaCount = iMediaList->Count(); |
|
290 |
||
291 |
aRequestStart = (aRequestStart<0 ? 0 : aRequestStart) ; |
|
292 |
aRequestEnd = (aRequestEnd>=mediaCount? (mediaCount -1): aRequestEnd); |
|
293 |
||
294 |
if (aRequestEnd - aRequestStart) |
|
295 |
{ |
|
296 |
TInt visIndex = iHgGrid->FirstIndexOnScreen(); |
|
297 |
if(visIndex >= mediaCount ) |
|
298 |
{ |
|
299 |
visIndex = mediaCount-1; |
|
300 |
} |
|
301 |
if(visIndex<0 || mediaCount<=0) |
|
302 |
{ |
|
303 |
visIndex = 0; |
|
304 |
} |
|
305 |
||
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
306 |
GLX_LOG_INFO1("CGlxGridViewImp::Request - SetVisibleWindowIndex " |
60 | 307 |
"visIndex(%d)", visIndex); |
308 |
iMediaList->SetVisibleWindowIndexL(visIndex); |
|
309 |
} |
|
310 |
for (TInt i=aRequestStart; i<= aRequestEnd; i++) |
|
311 |
{ |
|
312 |
SetIconsL(i); |
|
313 |
TInt firstIndex = iHgGrid->FirstIndexOnScreen(); |
|
314 |
TInt lastOnScreen = firstIndex + iHgGrid->ItemsOnScreen() - 1; |
|
315 |
if (i >= firstIndex && i <= lastOnScreen) |
|
316 |
{ |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
317 |
GLX_LOG_INFO1("CGlxGridViewImp::Request - RefreshScreen i(%d)", i); |
60 | 318 |
iHgGrid->RefreshScreen(i); |
319 |
} |
|
320 |
} |
|
321 |
} |
|
322 |
// --------------------------------------------------------------------------- |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
323 |
// SetIcons |
60 | 324 |
// --------------------------------------------------------------------------- |
325 |
// |
|
326 |
void CGlxFetcherContainer::SetIconsL(TInt aIndex) |
|
327 |
{ |
|
328 |
TRACER("CGlxFetcherContainer::SetIconsL()"); |
|
329 |
const TGlxMedia& item = iMediaList->Item(aIndex); |
|
330 |
TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, |
|
331 |
GlxFullThumbnailAttributeId( ETrue, iGridIconSize.iWidth, |
|
332 |
iGridIconSize.iHeight ) ); |
|
333 |
||
334 |
TFileName resFile(KDC_APP_BITMAP_DIR); |
|
335 |
resFile.Append(KGlxIconsFilename); |
|
336 |
TIconInfo icon; |
|
337 |
TInt tnError = GlxErrorManager::HasAttributeErrorL( |
|
338 |
item.Properties(), KGlxMediaIdThumbnail ); |
|
339 |
||
340 |
const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( thumbnailAttribute ); |
|
341 |
if (value) |
|
342 |
{ |
|
343 |
CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; |
|
344 |
bitmap->Duplicate( value->iBitmap->Handle()); |
|
345 |
iHgGrid->ItemL(aIndex).SetIcon(CGulIcon::NewL(bitmap)); |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
346 |
GLX_LOG_INFO1("### CGlxGridViewImp::Request value-Index is %d",aIndex); |
60 | 347 |
} |
348 |
else if (item.GetIconInfo(icon)) |
|
349 |
{ |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
350 |
GLX_LOG_INFO1("CGlxGridViewImp::Request - icon(%d)", aIndex); |
60 | 351 |
CFbsBitmap* bitmap = NULL; |
352 |
CFbsBitmap* mask = NULL; |
|
353 |
AknsUtils::CreateIconLC(AknsUtils::SkinInstance(), KAknsIIDNone, |
|
354 |
bitmap, mask, icon.bmpfile, icon.bitmapId, icon.maskId); |
|
355 |
__ASSERT_DEBUG(bitmap, Panic(EGlxPanicNullPointer)); |
|
356 |
__ASSERT_DEBUG(mask, Panic(EGlxPanicNullPointer)); |
|
357 |
||
358 |
AknIconUtils::SetSize(bitmap, CHgGrid::PreferredImageSize(), |
|
359 |
EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
360 |
AknIconUtils::SetSize(mask, CHgGrid::PreferredImageSize(), |
|
361 |
EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
362 |
||
363 |
iHgGrid->ItemL(aIndex).SetIcon(CGulIcon::NewL(bitmap, mask)); |
|
364 |
CleanupStack::Pop(mask); |
|
365 |
CleanupStack::Pop(bitmap); |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
366 |
GLX_LOG_INFO1("### CGlxGridViewImp::Request GetIconInfo-Index is %d", |
60 | 367 |
aIndex); |
368 |
} |
|
369 |
else if (KErrNone != tnError && KErrNotSupported != tnError) |
|
370 |
{ |
|
371 |
GLX_LOG_INFO2( |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
372 |
"CGlxGridViewImp::Request - image_corrupted tnError(%d), " |
60 | 373 |
"i(%d)", tnError, aIndex); |
374 |
||
375 |
CFbsBitmap* bitmap = NULL; |
|
376 |
CFbsBitmap* mask = NULL; |
|
377 |
AknsUtils::CreateIconLC(AknsUtils::SkinInstance(), KAknsIIDNone, |
|
378 |
bitmap, mask, resFile, EMbmGlxiconsQgn_prop_image_corrupted, |
|
379 |
EMbmGlxiconsQgn_prop_image_corrupted_mask); |
|
380 |
__ASSERT_DEBUG(bitmap, Panic(EGlxPanicNullPointer)); |
|
381 |
__ASSERT_DEBUG(mask, Panic(EGlxPanicNullPointer)); |
|
382 |
||
383 |
AknIconUtils::SetSize(bitmap, CHgGrid::PreferredImageSize(), |
|
384 |
EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
385 |
AknIconUtils::SetSize(mask, CHgGrid::PreferredImageSize(), |
|
386 |
EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
387 |
||
388 |
iHgGrid->ItemL(aIndex).SetIcon(CGulIcon::NewL(bitmap, mask)); |
|
389 |
CleanupStack::Pop(mask); |
|
390 |
CleanupStack::Pop(bitmap); |
|
391 |
} |
|
392 |
||
393 |
if (item.IsDrmProtected()) |
|
394 |
{ |
|
395 |
const TDesC& uri = item.Uri(); |
|
396 |
if( uri.Length() > 0) |
|
397 |
{ |
|
398 |
if(iDRMUtility->IsForwardLockedL(uri)) |
|
399 |
{ |
|
400 |
iHgGrid->ItemL(aIndex).SetFlags( |
|
401 |
CHgItem::EHgItemFlagsDrmRightsValid); |
|
402 |
} |
|
403 |
else |
|
404 |
{ |
|
405 |
TMPXGeneralCategory cat = item.Category(); |
|
406 |
TBool checkViewRights = (cat==EMPXImage); |
|
407 |
||
408 |
if(iDRMUtility->ItemRightsValidityCheckL(uri, checkViewRights)) |
|
409 |
{ |
|
410 |
iHgGrid->ItemL(aIndex).SetFlags( |
|
411 |
CHgItem::EHgItemFlagsDrmRightsValid); |
|
412 |
} |
|
413 |
else |
|
414 |
{ |
|
415 |
iHgGrid->ItemL(aIndex).SetFlags( |
|
416 |
CHgItem::EHgItemFlagsDrmRightsExpired); |
|
417 |
} |
|
418 |
} |
|
419 |
} |
|
420 |
} |
|
421 |
TTime time(0); |
|
422 |
if (item.GetDate(time)) |
|
423 |
{ |
|
424 |
iHgGrid->ItemL(aIndex).SetTime(time); |
|
425 |
} |
|
426 |
||
427 |
if (item.Category() == EMPXVideo) |
|
428 |
{ |
|
429 |
iHgGrid->ItemL(aIndex).SetFlags(CHgItem::EHgItemFlagsVideo); |
|
430 |
} |
|
431 |
} |
|
432 |
||
433 |
// --------------------------------------------------------------------------- |
|
434 |
// Release |
|
435 |
// --------------------------------------------------------------------------- |
|
436 |
// |
|
437 |
void CGlxFetcherContainer::Release(TInt /*aReleaseStart*/, TInt /*aReleaseEnd*/) |
|
438 |
{ |
|
439 |
TRACER("CGlxFetcherContainer::Release()"); |
|
440 |
// This has to do nothing on default |
|
441 |
} |
|
442 |
||
443 |
// --------------------------------------------------------------------------- |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
444 |
// HandleSelect |
60 | 445 |
// --------------------------------------------------------------------------- |
446 |
// |
|
447 |
void CGlxFetcherContainer::HandleSelectL( TInt aIndex ) |
|
448 |
{ |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
449 |
TRACER("CGlxGridViewImp::HandleSelect()"); |
60 | 450 |
// Make sure that the Selection Index is inside medialist count |
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
451 |
if (aIndex <iMediaList->Count() && aIndex >=0) |
60 | 452 |
{ |
453 |
// Setting the focus of the medialist |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
454 |
iMediaList->SetFocusL(NGlxListDefs::EAbsolute, aIndex); |
60 | 455 |
} |
456 |
} |
|
457 |
||
458 |
// --------------------------------------------------------------------------- |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
459 |
// HandleOpen |
60 | 460 |
// --------------------------------------------------------------------------- |
461 |
// |
|
462 |
void CGlxFetcherContainer::HandleOpenL( TInt aIndex ) |
|
463 |
{ |
|
464 |
TRACER("CGlxFetcherContainer::HandleOpenL()"); |
|
465 |
GLX_LOG_INFO1("CGlxFetcherContainer::HandleOpenL(%d)", aIndex); |
|
466 |
||
467 |
// Make sure that the Selection Index is inside medialist count |
|
468 |
if (aIndex <iMediaList->Count() && aIndex >=0) |
|
469 |
{ |
|
470 |
//ignore multiple tap events for single selection cases |
|
471 |
//if file has already been selected |
|
472 |
if(!iMultiSelectionEnabled && !iIsFileAttached) |
|
473 |
{ |
|
474 |
iEventObserver.HandleDoubleTapEventL(EAknSoftkeySelect); |
|
475 |
} |
|
476 |
} |
|
477 |
} |
|
478 |
||
479 |
// --------------------------------------------------------------------------- |
|
480 |
// HandleMarkingL |
|
481 |
// --------------------------------------------------------------------------- |
|
482 |
// |
|
483 |
void CGlxFetcherContainer::HandleMarkingL( TInt aIndex, TBool/* aMarked*/ ) |
|
484 |
{ |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
485 |
TRACER("CGlxGridViewImp::HandleMarkingL()"); |
60 | 486 |
HandleMultipleMarkingL(aIndex); |
487 |
iEventObserver.HandleMarkEventL(); |
|
488 |
} |
|
489 |
||
490 |
// --------------------------------------------------------------------------- |
|
491 |
// HandleMultipleMarkingL |
|
492 |
// --------------------------------------------------------------------------- |
|
493 |
// |
|
494 |
void CGlxFetcherContainer::HandleMultipleMarkingL(TInt aIndex ) |
|
495 |
{ |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
496 |
TRACER("CGlxGridViewImp::HandleMultipleMarkingL()"); |
60 | 497 |
if(iMediaList->IsSelected(aIndex)) |
498 |
{ |
|
499 |
if(iHgGrid) |
|
500 |
{ |
|
501 |
if(iMultiSelectionEnabled) |
|
502 |
{ |
|
503 |
iFetcherCommandHandler->DoExecuteL(EAknCmdUnmark, MediaList()); |
|
504 |
} |
|
505 |
} |
|
506 |
} |
|
507 |
else |
|
508 |
{ |
|
509 |
if(iHgGrid) |
|
510 |
{ |
|
511 |
if(iUiUtility->IsPenSupported()) |
|
512 |
{ |
|
513 |
//This is required for the touch because here when we select |
|
514 |
//we do not get the event for mark in processcommandL |
|
515 |
//of FetcherDialog. So we explicitly send the event to ourselves |
|
516 |
//to mark the item. |
|
517 |
if (!iMultipleMarkNotStarted) |
|
518 |
{ |
|
519 |
DoExecuteL(EAknCmdMark); |
|
520 |
} |
|
521 |
} |
|
522 |
if(iMultiSelectionEnabled) |
|
523 |
{ |
|
524 |
iFetcherCommandHandler->DoExecuteL(EAknCmdMark, MediaList()); |
|
525 |
} |
|
526 |
} |
|
527 |
} |
|
528 |
} |
|
529 |
||
530 |
// --------------------------------------------------------------------------- |
|
531 |
// DoExecuteL() |
|
532 |
// --------------------------------------------------------------------------- |
|
533 |
TBool CGlxFetcherContainer::DoExecuteL(TInt aCommandId) |
|
534 |
{ |
|
535 |
TRACER("CGlxFetcherContainer::DoExecuteL"); |
|
536 |
||
537 |
TBool retVal = EFalse; |
|
538 |
/* |
|
539 |
* fix for EBYU-7UV4MW-- when user presses selection key |
|
540 |
* very fast that time if hggrid is not created and we are trying to |
|
541 |
* access hghgrid for marking it is giving crash. So need to chk if |
|
542 |
* hggrid id created or not.same will also happen if media list is |
|
543 |
* not created |
|
544 |
*/ |
|
545 |
if(!iHgGrid || !iMediaList) |
|
546 |
{ |
|
547 |
return retVal; |
|
548 |
} |
|
549 |
||
550 |
TInt focusIndex = iMediaList->FocusIndex(); |
|
551 |
||
552 |
switch(aCommandId) |
|
553 |
{ |
|
554 |
case EAknCmdMark: |
|
555 |
case EAknMarkAll: |
|
556 |
case EGlxCmdStartMultipleMarking: |
|
557 |
{ |
|
558 |
//@ fix for ELWU-7RA7NX |
|
559 |
if (iMultiSelectionEnabled ) |
|
560 |
{ |
|
561 |
if (!iMultipleMarkNotStarted) |
|
562 |
{ |
|
563 |
//This will start multiple marking and not mark any items |
|
564 |
iFetcherCommandHandler->DoExecuteL(EAknCmdMark, MediaList()); |
|
565 |
iMultipleMarkNotStarted = ETrue ; |
|
566 |
} |
|
567 |
//@ Mark in HG Grid |
|
568 |
iHgGrid->Mark(focusIndex); |
|
569 |
iHgGrid->RefreshScreen(focusIndex); |
|
570 |
||
571 |
} |
|
572 |
retVal = ETrue; |
|
573 |
break; |
|
574 |
} |
|
575 |
case EAknCmdUnmark: |
|
576 |
case EAknUnmarkAll: |
|
577 |
{ |
|
578 |
//@ fix for ELWU-7RA7NX |
|
579 |
if (iMultiSelectionEnabled) |
|
580 |
{ |
|
581 |
//@ UnMark in HG Grid |
|
582 |
iHgGrid->UnMark(focusIndex); |
|
583 |
iHgGrid->RefreshScreen(focusIndex); |
|
584 |
} |
|
585 |
||
586 |
if( iMediaList->SelectionCount() <= 0 ) |
|
587 |
{ |
|
588 |
iMultipleMarkNotStarted = EFalse; |
|
589 |
} |
|
590 |
retVal = ETrue; |
|
591 |
break; |
|
592 |
} |
|
593 |
case EGlxCmdEndMultipleMarking: |
|
594 |
{ |
|
595 |
iHgGrid->ClearFlags( CHgScroller::EHgScrollerSelectionMode ); |
|
596 |
iFetcherCommandHandler->DoExecuteL(aCommandId, MediaList()); |
|
597 |
} |
|
598 |
retVal = ETrue; |
|
599 |
break; |
|
600 |
default: |
|
601 |
break; |
|
602 |
} |
|
603 |
return retVal; |
|
604 |
} |
|
605 |
||
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
606 |
|
60 | 607 |
// ----------------------------------------------------------------------------- |
608 |
// Retrieve Uris |
|
609 |
// ----------------------------------------------------------------------------- |
|
610 |
TBool CGlxFetcherContainer::RetrieveUrisL( CDesCArray& aSelectedFiles, TBool& aFetchUri) |
|
611 |
{ |
|
612 |
TRACER("CGlxFetcherContainer::RetrieveUrisL"); |
|
613 |
// check that the medialist is really constructed |
|
614 |
// we can get this call while MGlxMediaList::InstanceL has not yet returned |
|
615 |
// as it starts a new asynch wait loop and during that it is possible |
|
616 |
// to send key events to the dialog. |
|
617 |
if( !iMediaList || !iHgGrid ) |
|
618 |
{ |
|
619 |
aFetchUri = EFalse; |
|
620 |
SetFileAttached(EFalse); |
|
621 |
return iIsFileAttached; |
|
622 |
} |
|
623 |
//To Block call to HandleDoubleTapEventL() when control is in RetrieveUrisL() |
|
624 |
SetFileAttached(ETrue); |
|
625 |
GLX_LOG_INFO1("CGlxFetcherContainer::RetrieveUrisL() Medialist count is %d", |
|
626 |
iMediaList->Count()); |
|
627 |
TGlxSelectionIterator iterator; |
|
628 |
CGlxAttributeContext* context = new (ELeave) CGlxAttributeContext( &iterator ); |
|
629 |
CleanupStack::PushL( context ); |
|
630 |
||
631 |
// Configure the context to retrieve the URI attribute |
|
632 |
context->AddAttributeL( KMPXMediaGeneralUri ); |
|
633 |
||
634 |
iMediaList->AddContextL( context, KGlxFetchContextPriorityBlocking ); |
|
635 |
||
636 |
// Create remover object to remove the context from the list |
|
637 |
// even if a leave occurs |
|
638 |
TGlxFetchContextRemover remover( context, *iMediaList ); |
|
639 |
// put to cleanupstack as cleanupstack is emptied before stack objects |
|
640 |
// are deleted |
|
641 |
CleanupClosePushL( remover ); |
|
642 |
// block until all content retrieved (shows progress note) |
|
643 |
TInt error = GlxAttributeRetriever::RetrieveL( *context, |
|
644 |
*iMediaList, ETrue ) ; |
|
645 |
GLX_LOG_INFO1("CGlxFetcherContainer::RetrieveUrisL() Error %d", error); |
|
646 |
// context off the list |
|
647 |
CleanupStack::PopAndDestroy( &remover ); |
|
648 |
GLX_LOG_INFO1("CGlxFetcherContainer::RetrieveUrisL() Medialist count after GlxAttributeRetriever is %d", |
|
649 |
iMediaList->Count()); |
|
650 |
||
651 |
// if error or if medialist count is 0 then do not proceed further with the iterator. |
|
652 |
if (error == KErrNone && iMediaList->Count() !=0) |
|
653 |
{ |
|
654 |
GLX_LOG_INFO1("CGlxFetcherContainer::RetrieveUrisL() inside loop and medialist count is %d", |
|
655 |
iMediaList->Count()); |
|
656 |
// Add all selected items to client's array |
|
657 |
iterator.SetToFirst( iMediaList ); |
|
658 |
TInt index = KErrNotFound; |
|
659 |
while ( KErrNotFound != (index = iterator++) ) |
|
660 |
{ |
|
661 |
const TDesC& uri = iMediaList->Item( index ).Uri(); |
|
662 |
if( uri != KNullDesC ) |
|
663 |
{ |
|
664 |
aSelectedFiles.AppendL( uri ); |
|
665 |
SetFileAttached(ETrue); |
|
666 |
} |
|
667 |
else |
|
668 |
{ |
|
669 |
SetFileAttached(EFalse); |
|
670 |
} |
|
671 |
} |
|
672 |
} |
|
673 |
CleanupStack::PopAndDestroy( context ); |
|
674 |
// Set the Fetch uri value as false, as it could be a drm image and calling |
|
675 |
// application might not allow that to be selected, thus fetcher could be launched again. |
|
676 |
aFetchUri = EFalse; |
|
677 |
return iIsFileAttached; |
|
678 |
} |
|
679 |
||
680 |
//----------------------------------------------------------------------------- |
|
681 |
// CGlxFetcherContainer::OfferKeyEventL |
|
682 |
//----------------------------------------------------------------------------- |
|
683 |
TKeyResponse CGlxFetcherContainer::OfferKeyEventL( |
|
684 |
const TKeyEvent& aKeyEvent,TEventCode aType ) |
|
685 |
{ |
|
686 |
TRACER("CGlxFetcherContainer::OfferKeyEventL"); |
|
687 |
return iHgGrid->OfferKeyEventL(aKeyEvent,aType); |
|
688 |
} |
|
689 |
||
690 |
// --------------------------------------------------------------------------- |
|
691 |
// SetTitleL() |
|
692 |
// --------------------------------------------------------------------------- |
|
693 |
void CGlxFetcherContainer::SetTitleL(const TDesC& aTitleText) |
|
694 |
{ |
|
695 |
TRACER("CGlxFetcherContainer::SetTitleL"); |
|
696 |
CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); |
|
697 |
CleanupStack::PushL(statusPane); |
|
698 |
CAknTitlePane* titlePane = ( CAknTitlePane* )statusPane->ControlL( |
|
699 |
TUid::Uid( EEikStatusPaneUidTitle )); |
|
700 |
CleanupStack::PushL(titlePane); |
|
701 |
// To Store Title and to make sure, Previous Title is only stored once |
|
702 |
if (!iPreviousTitle) |
|
703 |
{ |
|
704 |
iPreviousTitle = titlePane->Text()->AllocL(); |
|
705 |
} |
|
706 |
||
707 |
// Set the required Title |
|
708 |
titlePane->SetTextL( aTitleText ); |
|
709 |
CleanupStack::Pop(titlePane); |
|
710 |
CleanupStack::Pop(statusPane); |
|
711 |
} |
|
712 |
||
713 |
// --------------------------------------------------------------------------- |
|
714 |
// SetPreviousTitleL() |
|
715 |
// --------------------------------------------------------------------------- |
|
716 |
void CGlxFetcherContainer::SetPreviousTitleL() |
|
717 |
{ |
|
718 |
TRACER("CGlxFetcherContainer::SetPreviousTitleL"); |
|
719 |
CEikStatusPane* prevStatusPane = iEikonEnv->AppUiFactory()->StatusPane(); |
|
720 |
CleanupStack::PushL(prevStatusPane); |
|
721 |
CAknTitlePane* prevTitlePane = ( CAknTitlePane* )prevStatusPane->ControlL( |
|
722 |
TUid::Uid( EEikStatusPaneUidTitle )); |
|
723 |
CleanupStack::PushL(prevTitlePane); |
|
724 |
||
725 |
// Restore the Title back of the Calling Application |
|
726 |
prevTitlePane->SetTextL( *iPreviousTitle ); |
|
727 |
CleanupStack::Pop(prevTitlePane); |
|
728 |
CleanupStack::Pop(prevStatusPane); |
|
729 |
} |
|
730 |
||
731 |
// ----------------------------------------------------------------------------- |
|
732 |
// UpdateTitle |
|
733 |
// ----------------------------------------------------------------------------- |
|
734 |
// |
|
735 |
void CGlxFetcherContainer::UpdateTitleL() |
|
736 |
{ |
|
737 |
TRACER("CGlxFetcherContainer::UpdateTitleL"); |
|
738 |
SetTitleL( iTitle); |
|
739 |
} |
|
740 |
||
741 |
// ----------------------------------------------------------------------------- |
|
742 |
// MediaList |
|
743 |
// ----------------------------------------------------------------------------- |
|
744 |
// |
|
745 |
MGlxMediaList& CGlxFetcherContainer::MediaList() |
|
746 |
{ |
|
747 |
TRACER("CGlxFetcherContainer::MediaList"); |
|
748 |
return *iMediaList; |
|
749 |
} |
|
750 |
||
751 |
// ----------------------------------------------------------------------------- |
|
752 |
// HandleSizeChange |
|
753 |
// ----------------------------------------------------------------------------- |
|
754 |
// |
|
755 |
void CGlxFetcherContainer::HandleSizeChangeL ( ) |
|
756 |
{ |
|
757 |
TRACER("CGlxFetcherContainer::HandleSizeChangeL"); |
|
758 |
SetTitleL(iTitle); |
|
759 |
TRect rect; |
|
760 |
if(iHgGrid) |
|
761 |
{ |
|
762 |
AknLayoutUtils::LayoutMetricsRect (AknLayoutUtils::EMainPane, rect); |
|
763 |
iHgGrid->InitScreenL(rect); |
|
764 |
} |
|
765 |
if ( iBgContext ) |
|
766 |
{ |
|
767 |
AknLayoutUtils::LayoutMetricsRect (AknLayoutUtils::EApplicationWindow, rect); |
|
768 |
iBgContext->SetRect( rect ); |
|
769 |
} |
|
770 |
} |
|
771 |
||
772 |
// ----------------------------------------------------------------------------- |
|
773 |
// MopSupplyObject |
|
774 |
// ----------------------------------------------------------------------------- |
|
775 |
// |
|
776 |
TTypeUid::Ptr CGlxFetcherContainer::MopSupplyObject(TTypeUid aId) |
|
777 |
{ |
|
778 |
TRACER("CGlxFetcherContainer::MopSupplyObject"); |
|
779 |
if (iBgContext) |
|
780 |
{ |
|
781 |
return MAknsControlContext::SupplyMopObject(aId, iBgContext ); |
|
782 |
} |
|
783 |
return CCoeControl::MopSupplyObject(aId); |
|
784 |
} |
|
785 |
||
786 |
// ----------------------------------------------------------------------------- |
|
787 |
// SetFileAttached |
|
788 |
// ----------------------------------------------------------------------------- |
|
789 |
// |
|
790 |
void CGlxFetcherContainer::SetFileAttached(TBool aIsFileAttached) |
|
791 |
{ |
|
792 |
iIsFileAttached = aIsFileAttached; |
|
793 |
} |
|
794 |
||
795 |
//END OF FILE |