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 64 | 34937ec34dac |
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: Implementation of list view |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
||
21 |
// INCLUDE FILES |
|
22 |
||
23 |
#include "glxlistviewimp.h" |
|
24 |
#include "glxpreviewthumbnailbinding.h" |
|
25 |
||
26 |
#include <mpxcollectionutility.h> |
|
27 |
#include <mpxcollectionpath.h> |
|
28 |
#include <glxcollectiongeneraldefs.h> |
|
29 |
#include <ganes/HgDoubleGraphicListFlat.h> |
|
30 |
#include <ganes/HgItem.h> |
|
31 |
#include <data_caging_path_literals.hrh> |
|
32 |
#include <glxuistd.h> |
|
33 |
#include <glxicons.mbg> |
|
34 |
#include <gulicon.h> |
|
35 |
#include <AknsBasicBackgroundControlContext.h> |
|
36 |
#include <mglxmedialist.h> //MGlxMediaList |
|
37 |
#include <glxtracer.h> |
|
38 |
#include <glxlog.h> //Glx Logs |
|
39 |
#include <glxlistviewplugin.rsg> |
|
40 |
#include <aknViewAppUi.h> |
|
41 |
#include <StringLoader.h> //StringLoader |
|
42 |
#include <glxsetappstate.h> |
|
43 |
#include <mglxcache.h> |
|
44 |
#include <glxerrormanager.h> // For CGlxErrormanager |
|
45 |
#include <glxthumbnailcontext.h> |
|
46 |
#include <glxthumbnailattributeinfo.h> |
|
47 |
#include <glxcollectionpluginall.hrh> |
|
48 |
#include <glxcollectionpluginalbums.hrh> |
|
49 |
#include <glxcollectionplugintype.hrh> |
|
50 |
#include <glxnavigationalstate.h> |
|
51 |
#include <glxfiltergeneraldefs.h> |
|
52 |
||
53 |
#include <akntranseffect.h> // For transition effects |
|
54 |
#include <gfxtranseffect/gfxtranseffect.h> // For transition effects |
|
55 |
#include "glxgfxtranseffect.h" // For transition effects |
|
56 |
||
57 |
const TInt KListDataWindowSize(8); // Visible page |
|
58 |
const TInt KListNonVisibleDataWindowSize(32); // Visible page + 3 pages |
|
59 |
const TInt KNoOfPages(4); |
|
60 |
||
61 |
// ======== MEMBER FUNCTIONS ======== |
|
62 |
||
63 |
// --------------------------------------------------------------------------- |
|
64 |
// C++ default constructor can NOT contain any code that might leave. |
|
65 |
// --------------------------------------------------------------------------- |
|
66 |
// |
|
67 |
CGlxListViewImp::CGlxListViewImp(TInt aViewUid, |
|
68 |
const TListViewResourceIds& aResourceIds) : |
|
69 |
iViewUid(aViewUid), iResourceIds(aResourceIds), iIsRefreshNeeded(EFalse), |
|
70 |
iBackwardNavigation(EFalse) |
|
71 |
{ |
|
72 |
} |
|
73 |
||
74 |
// --------------------------------------------------------------------------- |
|
75 |
// Two-phased constructor. |
|
76 |
// --------------------------------------------------------------------------- |
|
77 |
// |
|
78 |
CGlxListViewImp* CGlxListViewImp::NewL(MGlxMediaListFactory* aMediaListFactory, |
|
79 |
TInt aViewUid, |
|
80 |
const TListViewResourceIds& aResourceIds, |
|
81 |
const TDesC& aTitle) |
|
82 |
{ |
|
83 |
TRACER("CGlxListViewImp::NewL"); |
|
84 |
||
85 |
CGlxListViewImp* self = CGlxListViewImp::NewLC(aMediaListFactory, aViewUid, |
|
86 |
aResourceIds, aTitle); |
|
87 |
CleanupStack::Pop(self); |
|
88 |
return self; |
|
89 |
} |
|
90 |
||
91 |
// --------------------------------------------------------------------------- |
|
92 |
// Two-phased constructor. |
|
93 |
// --------------------------------------------------------------------------- |
|
94 |
// |
|
95 |
CGlxListViewImp* CGlxListViewImp::NewLC(MGlxMediaListFactory* aMediaListFactory, |
|
96 |
TInt aViewUid, |
|
97 |
const TListViewResourceIds& aResourceIds, |
|
98 |
const TDesC& aTitle) |
|
99 |
{ |
|
100 |
TRACER("CGlxListViewImp::NewLC"); |
|
101 |
||
102 |
CGlxListViewImp* self = new (ELeave) CGlxListViewImp(aViewUid, aResourceIds); |
|
103 |
CleanupStack::PushL(self); |
|
104 |
self->ConstructL(aMediaListFactory, aTitle); |
|
105 |
return self; |
|
106 |
} |
|
107 |
||
108 |
// --------------------------------------------------------------------------- |
|
109 |
// Symbian 2nd phase constructor can leave. |
|
110 |
// --------------------------------------------------------------------------- |
|
111 |
// |
|
112 |
void CGlxListViewImp::ConstructL(MGlxMediaListFactory* aMediaListFactory, |
|
113 |
const TDesC& aTitle) |
|
114 |
{ |
|
115 |
TRACER("CGlxListViewImp::ConsrtuctL"); |
|
116 |
||
117 |
BaseConstructL(iResourceIds.iViewId); |
|
118 |
ViewBaseConstructL(); |
|
119 |
MLViewBaseConstructL(aMediaListFactory, aTitle); |
|
120 |
||
121 |
// Create navigational state |
|
122 |
iNavigationalState = CGlxNavigationalState::InstanceL(); |
|
123 |
iNavigationalState->AddObserverL( *this ); |
|
124 |
||
125 |
CAknToolbar* toolbar = Toolbar(); |
|
126 |
if(toolbar) |
|
127 |
{ |
|
128 |
toolbar->DisableToolbarL(ETrue); |
|
129 |
} |
|
130 |
||
131 |
iGridIconSize = iUiUtility->GetGridIconSize(); |
|
132 |
||
133 |
//Register the view to recieve toolbar events. ViewBase handles the events |
|
134 |
SetToolbarObserver(this); |
|
135 |
} |
|
136 |
||
137 |
// --------------------------------------------------------------------------- |
|
138 |
// Destructor |
|
139 |
// --------------------------------------------------------------------------- |
|
140 |
// |
|
141 |
CGlxListViewImp::~CGlxListViewImp() |
|
142 |
{ |
|
143 |
TRACER("CGlxListViewImp::~CGlxListViewImp"); |
|
144 |
||
145 |
if ( iNavigationalState ) |
|
146 |
{ |
|
147 |
iNavigationalState->RemoveObserver(*this); |
|
148 |
iNavigationalState->Close(); |
|
149 |
} |
|
150 |
||
151 |
delete iTitletext; |
|
152 |
} |
|
153 |
||
154 |
// --------------------------------------------------------------------------- |
|
155 |
// ControlGroupId |
|
156 |
// --------------------------------------------------------------------------- |
|
157 |
// |
|
158 |
TInt CGlxListViewImp::ControlGroupId() const |
|
159 |
{ |
|
160 |
TRACER("CGlxListViewImp::ControlGroupId()"); |
|
161 |
return reinterpret_cast<TInt>(this); |
|
162 |
} |
|
163 |
||
164 |
// --------------------------------------------------------------------------- |
|
165 |
// From CAknView |
|
166 |
// Returns views id. |
|
167 |
// --------------------------------------------------------------------------- |
|
168 |
// |
|
169 |
TUid CGlxListViewImp::Id() const |
|
170 |
{ |
|
171 |
TRACER("CGlxListViewImp::Id()"); |
|
172 |
return TUid::Uid(iViewUid); |
|
173 |
} |
|
174 |
||
175 |
// --------------------------------------------------------------------------- |
|
176 |
// From CAknView |
|
177 |
// Handles a view activation. |
|
178 |
// --------------------------------------------------------------------------- |
|
179 |
// |
|
180 |
void CGlxListViewImp::DoMLViewActivateL(const TVwsViewId& /* aPrevViewId */, |
|
181 |
TUid /* aCustomMessageId */, const TDesC8& /* aCustomMessage */) |
|
182 |
{ |
|
183 |
TRACER("CGlxListViewImp::DoMLViewActivateL"); |
|
184 |
||
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
185 |
TUint transitionID = (iUiUtility->ViewNavigationDirection()== |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
186 |
EGlxNavigationForwards)?KActivateTransitionId:KDeActivateTransitionId; |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
187 |
|
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
188 |
//Do the activate animation only for views other than mainlist view and |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
189 |
//on backward navigation from any other views to main list view, since |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
190 |
//for the app start the animation effect is by default provided. |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
191 |
if (iMediaList->IdSpaceId(0) != KGlxIdSpaceIdRoot || |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
192 |
transitionID == KDeActivateTransitionId) |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
193 |
{ |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
194 |
GfxTransEffect::BeginFullScreen( transitionID, TRect(), |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
195 |
AknTransEffect::EParameterType, |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
196 |
AknTransEffect::GfxTransParam( KPhotosUid, |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
197 |
AknTransEffect::TParameter::EEnableEffects) ); |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
198 |
GfxTransEffect::EndFullScreen(); |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
199 |
} |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
200 |
|
60 | 201 |
iNextViewActivationEnabled = ETrue; |
202 |
if(StatusPane()) |
|
203 |
{ |
|
204 |
StatusPane()->MakeVisible(ETrue); |
|
205 |
CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); |
|
206 |
CAknTitlePane* titlePane = ( CAknTitlePane* )statusPane->ControlL( |
|
207 |
TUid::Uid( EEikStatusPaneUidTitle )); |
|
208 |
const TDesC* titletext = titlePane->Text(); |
|
209 |
HBufC* temptitle = titletext->AllocLC(); |
|
210 |
TPtr titleptr = temptitle->Des(); |
|
211 |
titleptr.Trim(); |
|
212 |
if(!temptitle->Length()) |
|
213 |
{ |
|
214 |
if( iTitletext ) |
|
215 |
{ |
|
216 |
// Set the required Title |
|
217 |
titlePane->SetTextL( *iTitletext ); |
|
218 |
} |
|
219 |
} |
|
220 |
CleanupStack::PopAndDestroy(temptitle); |
|
221 |
} |
|
222 |
||
223 |
GlxSetAppState::SetState(EGlxInListView); |
|
224 |
||
225 |
// Separate contexts so that some attributes are loaded before others |
|
226 |
// No need to fetch the rear pages as we do not support looping |
|
227 |
iThumbnailIterator.SetRangeOffsets(0, KListDataWindowSize); |
|
228 |
||
229 |
iTitleAttributeContext = CGlxDefaultAttributeContext::NewL(); |
|
230 |
iTitleAttributeContext->SetRangeOffsets(0, KMaxTInt); |
|
231 |
iTitleAttributeContext->AddAttributeL(KMPXMediaGeneralTitle); |
|
232 |
||
233 |
iSubtitleAttributeContext = new (ELeave) CGlxAttributeContext( |
|
234 |
&iThumbnailIterator); |
|
235 |
iSubtitleAttributeContext->AddAttributeL( |
|
236 |
KGlxMediaCollectionPluginSpecificSubTitle); |
|
237 |
||
238 |
iMediaList->AddContextL(iTitleAttributeContext, KMaxTInt); |
|
239 |
iMediaList->AddContextL(iSubtitleAttributeContext, KGlxFetchContextPriorityNormal); |
|
240 |
if (iMediaList->IdSpaceId(0) != KGlxIdSpaceIdRoot) |
|
241 |
{ |
|
242 |
iNonVisibleThumbnailIterator.SetRangeOffsets(KListDataWindowSize, |
|
243 |
KListNonVisibleDataWindowSize); |
|
244 |
iNonVisibleSubtitleAttributeContext |
|
245 |
= new (ELeave) CGlxAttributeContext( |
|
246 |
&iNonVisibleThumbnailIterator); |
|
247 |
iNonVisibleSubtitleAttributeContext->AddAttributeL( |
|
248 |
KGlxMediaCollectionPluginSpecificSubTitle); |
|
249 |
iMediaList->AddContextL(iNonVisibleSubtitleAttributeContext, |
|
250 |
KGlxFetchContextPriorityLow); |
|
251 |
||
252 |
CMPXCollectionPath* path = iMediaList->PathLC( |
|
253 |
NGlxListDefs::EPathParent); |
|
254 |
if (path->Id(0) == KGlxCollectionPluginAlbumsImplementationUid) |
|
255 |
{ |
|
256 |
iOtherAttribsContext = new (ELeave) CGlxAttributeContext( |
|
257 |
&iThumbnailIterator); |
|
258 |
iOtherAttribsContext->AddAttributeL(KGlxMediaGeneralSystemItem); |
|
259 |
iOtherAttribsContext->AddAttributeL( |
|
260 |
KGlxMediaGeneralSlideshowableContent); |
|
261 |
iMediaList->AddContextL(iOtherAttribsContext, |
|
262 |
KGlxFetchContextPriorityNormal); |
|
263 |
||
264 |
iNonVisibleOtherAttribsContext = new (ELeave) CGlxAttributeContext( |
|
265 |
&iNonVisibleThumbnailIterator); |
|
266 |
iNonVisibleOtherAttribsContext->AddAttributeL( |
|
267 |
KGlxMediaGeneralSystemItem); |
|
268 |
iNonVisibleOtherAttribsContext->AddAttributeL( |
|
269 |
KGlxMediaGeneralSlideshowableContent); |
|
270 |
iMediaList->AddContextL(iNonVisibleOtherAttribsContext, |
|
271 |
KGlxFetchContextPriorityLow); |
|
272 |
} |
|
273 |
CleanupStack::PopAndDestroy(path); |
|
274 |
||
275 |
iThumbnailContext = new (ELeave) CGlxAttributeContext( |
|
276 |
&iThumbnailIterator); |
|
277 |
TMPXAttribute tnAttr(KGlxMediaIdThumbnail, |
|
278 |
GlxFullThumbnailAttributeId(ETrue, iGridIconSize.iWidth, |
|
279 |
iGridIconSize.iHeight)); |
|
280 |
iThumbnailContext->SetDefaultSpec(iGridIconSize.iWidth, |
|
281 |
iGridIconSize.iHeight); |
|
282 |
iThumbnailContext->AddAttributeL(tnAttr); |
|
283 |
iMediaList->AddContextL(iThumbnailContext, |
|
284 |
KGlxFetchContextPriorityNormal); |
|
285 |
||
286 |
iNonVisibleThumbnailContext = new (ELeave) CGlxAttributeContext( |
|
287 |
&iNonVisibleThumbnailIterator); |
|
288 |
iNonVisibleThumbnailContext->SetDefaultSpec(iGridIconSize.iWidth, |
|
289 |
iGridIconSize.iHeight); |
|
290 |
iNonVisibleThumbnailContext->AddAttributeL(tnAttr); |
|
291 |
iMediaList->AddContextL(iNonVisibleThumbnailContext, |
|
292 |
KGlxFetchContextPriorityLow); |
|
293 |
} |
|
294 |
||
295 |
iMediaList->AddMediaListObserverL(this); |
|
296 |
TRect apRect = iEikonEnv->EikAppUi()->ApplicationRect(); |
|
297 |
iBgContext = CAknsBasicBackgroundControlContext::NewL( |
|
298 |
KAknsIIDQsnBgScreen,apRect,ETrue); |
|
299 |
||
300 |
iBackwardNavigation = (iUiUtility->ViewNavigationDirection() |
|
301 |
== EGlxNavigationBackwards); |
|
302 |
GLX_LOG_INFO1("CGlxListViewImp::DoMLViewActivateL() - " |
|
303 |
"iBackwardNavigation(%d)", iBackwardNavigation); |
|
304 |
||
305 |
iPreviewTNBinding = CGlxPreviewThumbnailBinding::NewL(*this); |
|
306 |
CreateListL(); |
|
307 |
iProgressIndicator = CGlxProgressIndicator::NewL(*this); |
|
308 |
iMMCNotifier = CGlxMMCNotifier::NewL(*this); |
|
309 |
} |
|
310 |
||
311 |
// --------------------------------------------------------------------------- |
|
312 |
// From CAknView |
|
313 |
// View deactivation function. |
|
314 |
// --------------------------------------------------------------------------- |
|
315 |
// |
|
316 |
void CGlxListViewImp::DoMLViewDeactivate() |
|
317 |
{ |
|
318 |
TRACER("CGlxListViewImp::DoMLViewDeactivate"); |
|
319 |
if(StatusPane()) |
|
320 |
{ |
|
321 |
if(iTitletext) |
|
322 |
{ |
|
323 |
delete iTitletext; |
|
324 |
iTitletext = NULL; |
|
325 |
} |
|
326 |
CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); |
|
327 |
TRAP_IGNORE(CAknTitlePane* titlePane = ( CAknTitlePane* )statusPane->ControlL( |
|
328 |
TUid::Uid( EEikStatusPaneUidTitle )); |
|
329 |
iTitletext = titlePane->Text()->AllocL()); |
|
330 |
} |
|
331 |
||
332 |
RemoveContext(); |
|
333 |
iMediaList->RemoveMediaListObserver( this ); |
|
334 |
delete iPreviewTNBinding; |
|
335 |
iPreviewTNBinding = NULL; |
|
336 |
DestroyListViewWidget(); |
|
337 |
if(iProgressIndicator) |
|
338 |
{ |
|
339 |
delete iProgressIndicator; |
|
340 |
iProgressIndicator = NULL; |
|
341 |
} |
|
342 |
||
343 |
delete iMMCNotifier; |
|
344 |
iMMCNotifier = NULL; |
|
345 |
} |
|
346 |
||
347 |
// --------------------------------------------------------------------------- |
|
348 |
// RemoveContext |
|
349 |
// --------------------------------------------------------------------------- |
|
350 |
// |
|
351 |
void CGlxListViewImp::RemoveContext() |
|
352 |
{ |
|
353 |
TRACER("CGlxListViewImp::DoMLViewDeactivate"); |
|
354 |
||
355 |
if (iTitleAttributeContext) |
|
356 |
{ |
|
357 |
iMediaList->RemoveContext(iTitleAttributeContext); |
|
358 |
delete iTitleAttributeContext; |
|
359 |
iTitleAttributeContext = NULL; |
|
360 |
} |
|
361 |
||
362 |
if (iSubtitleAttributeContext) |
|
363 |
{ |
|
364 |
iMediaList->RemoveContext(iSubtitleAttributeContext); |
|
365 |
delete iSubtitleAttributeContext; |
|
366 |
iSubtitleAttributeContext = NULL; |
|
367 |
} |
|
368 |
||
369 |
if (iMediaList->IdSpaceId(0) != KGlxIdSpaceIdRoot) |
|
370 |
{ |
|
371 |
if (iOtherAttribsContext) |
|
372 |
{ |
|
373 |
iMediaList->RemoveContext(iOtherAttribsContext); |
|
374 |
delete iOtherAttribsContext; |
|
375 |
iOtherAttribsContext = NULL; |
|
376 |
} |
|
377 |
||
378 |
if (iThumbnailContext) |
|
379 |
{ |
|
380 |
iMediaList->RemoveContext(iThumbnailContext); |
|
381 |
delete iThumbnailContext; |
|
382 |
iThumbnailContext = NULL; |
|
383 |
} |
|
384 |
||
385 |
if (iNonVisibleSubtitleAttributeContext) |
|
386 |
{ |
|
387 |
iMediaList->RemoveContext(iNonVisibleSubtitleAttributeContext); |
|
388 |
delete iNonVisibleSubtitleAttributeContext; |
|
389 |
iNonVisibleSubtitleAttributeContext = NULL; |
|
390 |
} |
|
391 |
||
392 |
if (iNonVisibleOtherAttribsContext) |
|
393 |
{ |
|
394 |
iMediaList->RemoveContext(iNonVisibleOtherAttribsContext); |
|
395 |
delete iNonVisibleOtherAttribsContext; |
|
396 |
iNonVisibleOtherAttribsContext = NULL; |
|
397 |
} |
|
398 |
||
399 |
if (iNonVisibleThumbnailContext) |
|
400 |
{ |
|
401 |
iMediaList->RemoveContext(iNonVisibleThumbnailContext); |
|
402 |
delete iNonVisibleThumbnailContext; |
|
403 |
iNonVisibleThumbnailContext = NULL; |
|
404 |
} |
|
405 |
} |
|
406 |
} |
|
407 |
||
408 |
// --------------------------------------------------------------------------- |
|
409 |
// Destroys the Widget |
|
410 |
// --------------------------------------------------------------------------- |
|
411 |
// |
|
412 |
void CGlxListViewImp::DestroyListViewWidget() |
|
413 |
{ |
|
414 |
TRACER("CGlxListViewImp::DestroyListViewWidget"); |
|
415 |
||
416 |
if (iList) |
|
417 |
{ |
|
418 |
AppUi()->RemoveFromStack(iList); |
|
419 |
delete iList; |
|
420 |
iList = NULL; |
|
421 |
} |
|
422 |
delete iBgContext; |
|
423 |
iBgContext = NULL; |
|
424 |
if(iBackwardNavigation) |
|
425 |
{ |
|
426 |
iLastFocusedIndex = 0; |
|
427 |
} |
|
428 |
} |
|
429 |
||
430 |
// --------------------------------------------------------------------------- |
|
431 |
// From CGlxViewBase |
|
432 |
// Command handling function. |
|
433 |
// --------------------------------------------------------------------------- |
|
434 |
// |
|
435 |
TBool CGlxListViewImp::HandleViewCommandL(TInt aCommand) |
|
436 |
{ |
|
437 |
TRACER("CGlxListViewImp::HandleViewCommandL"); |
|
438 |
||
439 |
if (aCommand == EAknCmdOpen) |
|
440 |
{ |
|
441 |
//Navigational State to be used |
|
442 |
if( iNextViewActivationEnabled ) |
|
443 |
{ |
|
444 |
iNextViewActivationEnabled = EFalse; |
|
445 |
iUiUtility->SetViewNavigationDirection(EGlxNavigationForwards); |
|
446 |
//Navigate to the next view |
|
447 |
CMPXCollectionPath* path = |
|
448 |
iMediaList->PathLC( NGlxListDefs::EPathFocusOrSelection ); |
|
449 |
iCollectionUtility->Collection().OpenL(*path); |
|
450 |
CleanupStack::PopAndDestroy(path); |
|
451 |
} |
|
452 |
return ETrue; |
|
453 |
} |
|
454 |
else |
|
455 |
{ |
|
456 |
return EFalse; |
|
457 |
} |
|
458 |
} |
|
459 |
||
460 |
// ----------------------------------------------------------------------------- |
|
461 |
// Called by the framework when the application status pane |
|
462 |
// size is changed. Passes the new client rectangle to the |
|
463 |
// AppView |
|
464 |
// ----------------------------------------------------------------------------- |
|
465 |
// |
|
466 |
void CGlxListViewImp::HandleStatusPaneSizeChange ( ) |
|
467 |
{ |
|
468 |
if ( iBgContext ) |
|
469 |
{ |
|
470 |
TRect apRect = iEikonEnv->EikAppUi()->ApplicationRect(); |
|
471 |
iBgContext->SetRect( apRect ); |
|
472 |
} |
|
473 |
||
474 |
if(iList) |
|
475 |
{ |
|
476 |
TRAP_IGNORE (iList->InitScreenL(ClientRect()); ) |
|
477 |
} |
|
478 |
} |
|
479 |
||
480 |
TTypeUid::Ptr CGlxListViewImp::MopSupplyObject(TTypeUid aId) |
|
481 |
{ |
|
482 |
if (iBgContext && aId.iUid == MAknsControlContext::ETypeId) |
|
483 |
{ |
|
484 |
return MAknsControlContext::SupplyMopObject(aId, iBgContext ); |
|
485 |
} |
|
486 |
||
487 |
return CAknView::MopSupplyObject(aId); |
|
488 |
} |
|
489 |
||
490 |
void CGlxListViewImp::Request(TInt aRequestStart, TInt aRequestEnd, |
|
491 |
THgScrollDirection /*aDirection*/) |
|
492 |
{ |
|
493 |
TRACER("CGlxListViewImp::Request"); |
|
494 |
//Doing this to avoid codescanner warning. |
|
495 |
TRAP_IGNORE(RequestL(aRequestStart, aRequestEnd)); |
|
496 |
} |
|
497 |
||
498 |
// --------------------------------------------------------------------------- |
|
499 |
// RequestL |
|
500 |
// --------------------------------------------------------------------------- |
|
501 |
// |
|
502 |
void CGlxListViewImp::RequestL(TInt aRequestStart, TInt aRequestEnd) |
|
503 |
{ |
|
504 |
TRACER("CGlxListViewImp::RequestL()"); |
|
505 |
TInt mediaCount = iMediaList->Count(); |
|
506 |
GLX_LOG_INFO1("CGlxListViewImp::RequestL - mediaCount(%d)", mediaCount); |
|
507 |
if(mediaCount<=0) |
|
508 |
{ |
|
509 |
return; |
|
510 |
} |
|
511 |
||
512 |
TInt visIndex = iList->FirstIndexOnScreen(); |
|
513 |
aRequestStart = (aRequestStart < 0 ? 0 : aRequestStart) ; |
|
514 |
aRequestEnd = (aRequestEnd >= mediaCount ? (mediaCount-1) : aRequestEnd); |
|
515 |
GLX_LOG_INFO3("CGlxListViewImp::RequestL - aRequestStart(%d), " |
|
516 |
"aRequestEnd(%d), visIndex(%d)", aRequestStart, aRequestEnd, visIndex); |
|
517 |
||
518 |
if (visIndex >= mediaCount ) |
|
519 |
{ |
|
520 |
visIndex = mediaCount-1; |
|
521 |
} |
|
522 |
if (visIndex < 0 || mediaCount <= 0) |
|
523 |
{ |
|
524 |
visIndex = 0; |
|
525 |
} |
|
526 |
||
527 |
for (TInt i=aRequestStart; i<= aRequestEnd; i++) |
|
528 |
{ |
|
529 |
const TGlxMedia& item = iMediaList->Item(i); |
|
530 |
iList->ItemL(i).SetTitleL(item.Title()); |
|
531 |
iList->ItemL(i).SetTextL(item.SubTitle()); |
|
532 |
if(iMediaList->IdSpaceId(0) != KGlxIdSpaceIdRoot) |
|
533 |
{ |
|
534 |
UpdatePreviewL(i); |
|
535 |
} |
|
536 |
} |
|
537 |
||
538 |
if (iMediaList->IdSpaceId(0) == KGlxIdSpaceIdRoot && iBackwardNavigation) |
|
539 |
{ |
|
540 |
iMediaList->SetFocusL(NGlxListDefs::EAbsolute, 0); |
|
541 |
CMPXCollectionPath* path = iMediaList->PathLC( |
|
542 |
NGlxListDefs::EPathFocusOrSelection); |
|
543 |
GLX_LOG_INFO("CGlxListViewImp::RequestL() - HandleItemChangedL()"); |
|
544 |
iPreviewTNBinding->HandleItemChangedL(*path, iIsRefreshNeeded, |
|
545 |
iBackwardNavigation); |
|
546 |
CleanupStack::PopAndDestroy(path); |
|
547 |
} |
|
548 |
else |
|
549 |
{ |
|
550 |
iMediaList->SetFocusL(NGlxListDefs::EAbsolute, visIndex); |
|
551 |
} |
|
552 |
} |
|
553 |
||
554 |
void CGlxListViewImp::Release(TInt /*aBufferStart*/, TInt /*aBufferEnd*/) |
|
555 |
{ |
|
556 |
TRACER("CGlxListViewImp::Release"); |
|
557 |
} |
|
558 |
||
559 |
void CGlxListViewImp::HandleSelectL(TInt aIndex) |
|
560 |
{ |
|
561 |
TRACER("CGlxListViewImp::HandleSelectL"); |
|
562 |
if (0 <= aIndex && aIndex < iMediaList->Count()) |
|
563 |
{ |
|
564 |
iMediaList->SetFocusL(NGlxListDefs::EAbsolute, aIndex); |
|
565 |
} |
|
566 |
} |
|
567 |
||
568 |
void CGlxListViewImp::HandleOpenL( TInt aIndex ) |
|
569 |
{ |
|
570 |
TRACER("CGlxListViewImp::HandleOpenL"); |
|
571 |
||
572 |
GLX_LOG_INFO1("CGlxListViewImp RProperty::Get leftVariable %d", |
|
573 |
(iUiUtility->GetItemsLeftCount())); |
|
574 |
||
575 |
if ((iUiUtility->GetItemsLeftCount() == KErrNotReady) |
|
576 |
|| (iUiUtility->GetItemsLeftCount())) |
|
577 |
{ |
|
578 |
if (!iProgressIndicator) |
|
579 |
{ |
|
580 |
iProgressIndicator = CGlxProgressIndicator::NewL(*this); |
|
581 |
} |
|
582 |
iProgressIndicator->ShowProgressbarL(); |
|
583 |
if (iSchedulerWait) |
|
584 |
{ |
|
585 |
delete iSchedulerWait; |
|
586 |
iSchedulerWait = NULL; |
|
587 |
} |
|
588 |
iSchedulerWait = new (ELeave) CActiveSchedulerWait(); |
|
589 |
iSchedulerWait->Start(); |
|
590 |
} |
|
591 |
||
592 |
if (iNextViewActivationEnabled && (aIndex >= 0 && aIndex |
|
593 |
< iMediaList->Count()) && (iUiUtility->GetItemsLeftCount() == 0)) |
|
594 |
{ |
|
595 |
iMediaList->CancelPreviousRequests(); |
|
596 |
//Delete the PreviewTNMBinding as in forward navigation |
|
597 |
//we do not get the medialist callback. |
|
598 |
delete iPreviewTNBinding; |
|
599 |
iPreviewTNBinding = NULL; |
|
600 |
||
601 |
iMediaList->SetFocusL(NGlxListDefs::EAbsolute,aIndex); |
|
602 |
iLastFocusedIndex = iMediaList->FocusIndex(); |
|
603 |
iNextViewActivationEnabled = EFalse; |
|
604 |
||
605 |
//Navigate to the next view |
|
606 |
iUiUtility->SetViewNavigationDirection(EGlxNavigationForwards); |
|
607 |
GLX_LOG_INFO("CGlxListViewImp::HandleOpenL()- EGlxNavigationForwards!"); |
|
608 |
CMPXCollectionPath* path = iMediaList->PathLC( |
|
609 |
NGlxListDefs::EPathFocusOrSelection); |
|
610 |
||
611 |
// When a collection is opened for browsing, |
|
612 |
// there are two queries executed with similar filter. |
|
613 |
// First query to open the collection from list / cloud view. |
|
614 |
// Second one from grid/list view construction. To improve the grid/list |
|
615 |
// opening performance, the first query will be completed with empty Id list. |
|
616 |
RArray<TMPXAttribute> attributeArray; |
|
617 |
CleanupClosePushL(attributeArray); |
|
618 |
attributeArray.AppendL(KGlxFilterGeneralNavigationalStateOnly); |
|
619 |
iCollectionUtility->Collection().OpenL(*path, attributeArray.Array()); |
|
620 |
CleanupStack::PopAndDestroy(&attributeArray); |
|
621 |
CleanupStack::PopAndDestroy(path); |
|
622 |
} |
|
623 |
} |
|
624 |
||
625 |
void CGlxListViewImp::PreviewTNReadyL(CFbsBitmap* aBitmap, CFbsBitmap* |
|
626 |
/*aMask*/) |
|
627 |
{ |
|
628 |
TRACER("CGlxListViewImp::PreviewTNReadyL"); |
|
629 |
||
630 |
iPreviewTNBinding->StopTimer(); |
|
631 |
||
632 |
if (iMediaList->FocusIndex() != EGlxListItemAll || iMediaList->IdSpaceId( |
|
633 |
0) != KGlxIdSpaceIdRoot) |
|
634 |
{ |
|
635 |
GLX_LOG_INFO("CGlxListViewImp::PreviewTNReadyL()- Ignore!"); |
|
636 |
return; |
|
637 |
} |
|
638 |
||
639 |
if (aBitmap) |
|
640 |
{ |
|
641 |
iList->ItemL(EGlxListItemAll).SetIcon(CGulIcon::NewL(aBitmap)); |
|
642 |
} |
|
643 |
else |
|
644 |
{ |
|
645 |
// In main list view, default thumbnails will be set according |
|
646 |
// to the list items. |
|
647 |
//Displays default thumbnail if aBitmap is NULL |
|
648 |
SetDefaultThumbnailL(EGlxListItemAll); |
|
649 |
} |
|
650 |
||
651 |
iList->RefreshScreen(EGlxListItemAll); |
|
652 |
} |
|
653 |
||
654 |
// ---------------------------------------------------------------------------- |
|
655 |
// CreateListL |
|
656 |
// ---------------------------------------------------------------------------- |
|
657 |
// |
|
658 |
void CGlxListViewImp::CreateListL() |
|
659 |
{ |
|
660 |
TRACER("CGlxListViewImp::CreateListL"); |
|
661 |
||
662 |
TInt mediaCount = iMediaList->Count(); |
|
663 |
GLX_DEBUG2("CGlxListViewImp::CreateListL() mediaCount=%d", mediaCount); |
|
664 |
||
665 |
if (!iList) |
|
666 |
{ |
|
667 |
TFileName resFile(KDC_APP_BITMAP_DIR); |
|
668 |
resFile.Append(KGlxIconsFilename); |
|
669 |
||
670 |
CFbsBitmap* bitmap = NULL; |
|
671 |
CFbsBitmap* mask = NULL; |
|
672 |
TInt bitmapId = 0; |
|
673 |
TInt maskId = 0; |
|
674 |
CMPXCollectionPath* path = iMediaList->PathLC( |
|
675 |
NGlxListDefs::EPathParent); |
|
676 |
if (path->Id() == KGlxCollectionPluginAlbumsImplementationUid) |
|
677 |
{ |
|
678 |
bitmapId = EMbmGlxiconsQgn_prop_photo_album_large; |
|
679 |
maskId = EMbmGlxiconsQgn_prop_photo_album_large_mask; |
|
680 |
} |
|
681 |
else |
|
682 |
{ |
|
683 |
bitmapId = EMbmGlxiconsQgn_prop_image_notcreated; |
|
684 |
maskId = EMbmGlxiconsQgn_prop_image_notcreated_mask; |
|
685 |
} |
|
686 |
||
687 |
AknsUtils::CreateIconLC(AknsUtils::SkinInstance(), KAknsIIDNone, |
|
688 |
bitmap, mask, resFile, bitmapId, maskId); |
|
689 |
__ASSERT_DEBUG(bitmap, Panic(EGlxPanicNullPointer)); |
|
690 |
__ASSERT_DEBUG(mask, Panic(EGlxPanicNullPointer)); |
|
691 |
||
692 |
AknIconUtils::SetSize(bitmap, |
|
693 |
CHgDoubleGraphicListFlat::PreferredImageSize(), |
|
694 |
EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
695 |
AknIconUtils::SetSize(mask, |
|
696 |
CHgDoubleGraphicListFlat::PreferredImageSize(), |
|
697 |
EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
698 |
||
699 |
iList = CHgDoubleGraphicListFlat::NewL(ClientRect(), mediaCount, |
|
700 |
CGulIcon::NewL(bitmap, mask)); |
|
701 |
CleanupStack::Pop(mask); |
|
702 |
CleanupStack::Pop(bitmap); |
|
703 |
iList->SetMopParent(this); |
|
704 |
||
705 |
iList->SetSelectionObserver(*this); |
|
706 |
||
707 |
TInt items = iList->ItemsOnScreen(); |
|
708 |
// Enable Buffer support |
|
709 |
iList->EnableScrollBufferL(*this, KNoOfPages * items, items); |
|
710 |
||
711 |
if (iBackwardNavigation) |
|
712 |
{ |
|
713 |
GLX_DEBUG1("CGlxListViewImp::CreateListL() - SetEmptyTextL()"); |
|
714 |
//set the text to be shown if the list is empty. |
|
715 |
HBufC* emptyText = StringLoader::LoadLC(R_LIST_EMPTY_VIEW_TEXT); |
|
716 |
iList->SetEmptyTextL(*emptyText); |
|
717 |
CleanupStack::PopAndDestroy(emptyText); |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
718 |
|
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
719 |
//While coming back to main listview |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
720 |
TGlxIdSpaceId id = iMediaList->IdSpaceId(0); |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
721 |
if((id == KGlxIdSpaceIdRoot) && (mediaCount > 0)) |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
722 |
{ |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
723 |
for (TInt i = 0; i < mediaCount; i++) |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
724 |
{ |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
725 |
SetDefaultThumbnailL(i); |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
726 |
} |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
727 |
} |
60 | 728 |
} |
729 |
||
730 |
//Fix for ESLM-7SAHPT::Clear Flag to Disable QWERTY search input in list view |
|
731 |
iList->ClearFlags(CHgScroller::EHgScrollerSearchWithQWERTY ); |
|
732 |
||
733 |
// Set the scrollbar type for albums list |
|
734 |
if (path->Id() == KGlxCollectionPluginAlbumsImplementationUid) |
|
735 |
{ |
|
736 |
iList->SetScrollBarTypeL(CHgScroller::EHgScrollerLetterStripLite ); |
|
737 |
} |
|
738 |
CleanupStack::PopAndDestroy(path); |
|
739 |
||
740 |
AppUi()->AddToStackL(iList); |
|
741 |
} |
|
742 |
||
743 |
if (mediaCount) |
|
744 |
{ |
|
745 |
for (TInt i=0; i<mediaCount; i++) |
|
746 |
{ |
|
747 |
const TGlxMedia& item = iMediaList->Item(i); |
|
748 |
iList->ItemL(i).SetTitleL(item.Title()); |
|
749 |
iList->ItemL(i).SetTextL(item.SubTitle()); |
|
750 |
} |
|
751 |
GLX_DEBUG3("CGlxListViewImp::CreateListL() Medialist Count = %d, " |
|
752 |
"iLastFocusIndex %d",mediaCount,iLastFocusedIndex); |
|
753 |
if(iLastFocusedIndex >= mediaCount) |
|
754 |
{ |
|
755 |
iLastFocusedIndex = (mediaCount - 1); |
|
756 |
} |
|
757 |
iMediaList->SetFocusL(NGlxListDefs::EAbsolute, iLastFocusedIndex); |
|
758 |
iList->SetSelectedIndex(iLastFocusedIndex); |
|
759 |
} |
|
760 |
} |
|
761 |
||
762 |
// ---------------------------------------------------------------------------- |
|
763 |
// HandleItemAddedL |
|
764 |
// ---------------------------------------------------------------------------- |
|
765 |
// |
|
766 |
void CGlxListViewImp::HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, |
|
767 |
MGlxMediaList* aList ) |
|
768 |
{ |
|
769 |
TRACER("CGlxListViewImp::HandleItemAddedL"); |
|
770 |
||
771 |
if (iList && aList) |
|
772 |
{ |
|
773 |
iList->ResizeL(aList->Count()); |
|
774 |
for (TInt i = aStartIndex; i<= aEndIndex; i++) |
|
775 |
{ |
|
776 |
const TGlxMedia& item = iMediaList->Item(i); |
|
777 |
iList->ItemL(i).SetTitleL(item.Title()); |
|
778 |
iList->ItemL(i).SetTextL(item.SubTitle()); |
|
779 |
if (iMediaList->IdSpaceId(0) == KGlxIdSpaceIdRoot) |
|
780 |
{ |
|
781 |
SetDefaultThumbnailL(i); |
|
782 |
} |
|
783 |
} |
|
784 |
||
785 |
if(aStartIndex == aEndIndex ) |
|
786 |
{ |
|
787 |
iLastFocusedIndex = aStartIndex; |
|
788 |
iMediaList->SetFocusL(NGlxListDefs::EAbsolute, iLastFocusedIndex); |
|
789 |
iList->SetSelectedIndex(iLastFocusedIndex); |
|
790 |
iList->RefreshScreen(iLastFocusedIndex); |
|
791 |
} |
|
792 |
} |
|
793 |
} |
|
794 |
||
795 |
// ---------------------------------------------------------------------------- |
|
796 |
// HandleItemRemoved |
|
797 |
// ---------------------------------------------------------------------------- |
|
798 |
// |
|
799 |
void CGlxListViewImp::HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, |
|
800 |
MGlxMediaList* aList ) |
|
801 |
{ |
|
802 |
TRACER("CGlxListViewImp::HandleItemRemovedL"); |
|
803 |
||
804 |
if(iMediaList == aList) |
|
805 |
{ |
|
806 |
for(TInt i = aEndIndex ;i >= aStartIndex; i-- ) |
|
807 |
{ |
|
808 |
iList->RemoveItem(i); |
|
809 |
} |
|
810 |
||
811 |
if(aEndIndex >= iList->ItemCount()) |
|
812 |
{ |
|
813 |
iList->SetSelectedIndex(iList->ItemCount()-1); |
|
814 |
} |
|
815 |
iList->RefreshScreen(iList->FirstIndexOnScreen()); |
|
816 |
} |
|
817 |
} |
|
818 |
||
819 |
// ---------------------------------------------------------------------------- |
|
820 |
// HandleAttributesAvailableL |
|
821 |
// ---------------------------------------------------------------------------- |
|
822 |
// |
|
823 |
void CGlxListViewImp::HandleAttributesAvailableL( TInt aItemIndex, |
|
824 |
const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* /*aList*/) |
|
825 |
{ |
|
826 |
TRACER("CGlxListViewImp::HandleAttributesAvailableL"); |
|
827 |
||
828 |
TMPXAttribute titleAttrib(KMPXMediaGeneralTitle); |
|
829 |
TMPXAttribute subTitleAttrib(KGlxMediaCollectionPluginSpecificSubTitle); |
|
830 |
TIdentityRelation<TMPXAttribute> match(&TMPXAttribute::Match); |
|
831 |
||
832 |
const TGlxMedia& item = iMediaList->Item(aItemIndex); |
|
833 |
||
834 |
if (KErrNotFound != aAttributes.Find(titleAttrib, match)) |
|
835 |
{ |
|
836 |
iList->ItemL(aItemIndex).SetTitleL(item.Title()); |
|
837 |
if (iMediaList->IdSpaceId(0) != KGlxIdSpaceIdRoot) |
|
838 |
{ |
|
839 |
iList->RefreshScreen(aItemIndex); |
|
840 |
} |
|
841 |
} |
|
842 |
||
843 |
if (KErrNotFound != aAttributes.Find(subTitleAttrib, match)) |
|
844 |
{ |
|
845 |
iList->ItemL(aItemIndex).SetTextL(item.SubTitle()); |
|
846 |
||
847 |
if (iMediaList->IdSpaceId(0) == KGlxIdSpaceIdRoot) |
|
848 |
{ |
|
849 |
RefreshList(aItemIndex); |
|
850 |
} |
|
851 |
else |
|
852 |
{ |
|
853 |
iList->RefreshScreen(aItemIndex); |
|
854 |
} |
|
855 |
||
856 |
// If there is some modified in grid/fullscreen view, |
|
857 |
// HandleAttributesAvailableL will get called. Here we are setting |
|
858 |
// iIsRefreshNeeded flag to ETrue to cleanup once! |
|
859 |
if (!iIsRefreshNeeded && iBackwardNavigation) |
|
860 |
{ |
|
861 |
if (iMediaList->IdSpaceId(0) != KGlxIdSpaceIdRoot) |
|
862 |
{ |
|
863 |
iIsRefreshNeeded = ETrue; |
|
864 |
CleanUpL(); |
|
865 |
} |
|
866 |
} |
|
867 |
// Refresh thumbnail, if subtitle is updated for the All collection |
|
868 |
if (iMediaList->IdSpaceId(0) == KGlxIdSpaceIdRoot && |
|
869 |
iPreviewTNBinding && aItemIndex == 0) |
|
870 |
{ |
|
871 |
if (iBackwardNavigation) |
|
872 |
{ |
|
873 |
iIsRefreshNeeded = ETrue; |
|
874 |
} |
|
875 |
iMediaList->SetFocusL(NGlxListDefs::EAbsolute, 0); |
|
876 |
CMPXCollectionPath* path = iMediaList->PathLC( |
|
877 |
NGlxListDefs::EPathFocusOrSelection); |
|
878 |
GLX_LOG_INFO("CGlxListViewImp::HandleAttributesAvailableL() - HandleItemChangedL()"); |
|
879 |
iPreviewTNBinding->HandleItemChangedL(*path, iIsRefreshNeeded, |
|
880 |
iBackwardNavigation); |
|
881 |
CleanupStack::PopAndDestroy(path); |
|
882 |
} |
|
883 |
} |
|
884 |
||
885 |
if (iMediaList->IdSpaceId(0) != KGlxIdSpaceIdRoot) |
|
886 |
{ |
|
887 |
TMPXAttribute countAttrib(KMPXMediaGeneralCount); |
|
888 |
TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, |
|
889 |
GlxFullThumbnailAttributeId(ETrue, iGridIconSize.iWidth, |
|
890 |
iGridIconSize.iHeight)); |
|
891 |
if (iIsRefreshNeeded && KErrNotFound != aAttributes.Find( |
|
892 |
thumbnailAttribute, match)) |
|
893 |
{ |
|
894 |
iIsRefreshNeeded = EFalse; |
|
895 |
} |
|
896 |
||
897 |
if ((KErrNotFound != aAttributes.Find(thumbnailAttribute, match)) |
|
898 |
|| (KErrNotFound != aAttributes.Find(countAttrib, match))) |
|
899 |
{ |
|
900 |
UpdatePreviewL(aItemIndex); |
|
901 |
} |
|
902 |
} |
|
903 |
} |
|
904 |
||
905 |
// ---------------------------------------------------------------------------- |
|
906 |
// HandleFocusChangedL |
|
907 |
// ---------------------------------------------------------------------------- |
|
908 |
// |
|
909 |
void CGlxListViewImp::HandleFocusChangedL( NGlxListDefs:: |
|
910 |
TFocusChangeType /*aType*/, TInt /*aNewIndex*/, TInt /*aOldIndex*/, |
|
911 |
MGlxMediaList* /*aList*/ ) |
|
912 |
{ |
|
913 |
} |
|
914 |
||
915 |
// ---------------------------------------------------------------------------- |
|
916 |
// HandleItemSelected |
|
917 |
// ---------------------------------------------------------------------------- |
|
918 |
// |
|
919 |
void CGlxListViewImp::HandleItemSelectedL(TInt /*aIndex*/, |
|
920 |
TBool /*aSelected*/, MGlxMediaList* /*aList*/ ) |
|
921 |
{ |
|
922 |
} |
|
923 |
||
924 |
// ---------------------------------------------------------------------------- |
|
925 |
// HandleMessageL |
|
926 |
// ---------------------------------------------------------------------------- |
|
927 |
// |
|
928 |
void CGlxListViewImp::HandleMessageL( const CMPXMessage& /*aMessage*/, |
|
929 |
MGlxMediaList* /*aList*/ ) |
|
930 |
{ |
|
931 |
||
932 |
} |
|
933 |
||
934 |
// ---------------------------------------------------------------------------- |
|
935 |
// HandleError |
|
936 |
// ---------------------------------------------------------------------------- |
|
937 |
// |
|
938 |
void CGlxListViewImp::HandleError( TInt aError ) |
|
939 |
{ |
|
940 |
TRACER( "CGlxListViewImp::HandleError"); |
|
941 |
TRAP_IGNORE( DoHandleErrorL( aError ) ); |
|
942 |
} |
|
943 |
||
944 |
// ---------------------------------------------------------------------------- |
|
945 |
// DoHandleErrorL |
|
946 |
// ---------------------------------------------------------------------------- |
|
947 |
// |
|
948 |
void CGlxListViewImp::DoHandleErrorL(TInt /*aError*/) |
|
949 |
{ |
|
950 |
TRACER( "CGlxListViewImp::DoHandleErrorL"); |
|
951 |
for (TInt i = 0; i < iMediaList->Count(); i++) |
|
952 |
{ |
|
953 |
const TGlxMedia& item = iMediaList->Item(i); |
|
954 |
TInt tnError = GlxErrorManager::HasAttributeErrorL(item.Properties(), |
|
955 |
KGlxMediaIdThumbnail); |
|
956 |
if (tnError != KErrNone) |
|
957 |
{ |
|
958 |
SetDefaultThumbnailL(i); |
|
959 |
} |
|
960 |
} |
|
961 |
} |
|
962 |
||
963 |
// ---------------------------------------------------------------------------- |
|
964 |
// HandleCommandCompleteL |
|
965 |
// ---------------------------------------------------------------------------- |
|
966 |
// |
|
967 |
void CGlxListViewImp::HandleCommandCompleteL( CMPXCommand* /*aCommandResult*/, |
|
968 |
TInt /*aError*/, MGlxMediaList* /*aList*/ ) |
|
969 |
{ |
|
970 |
||
971 |
} |
|
972 |
||
973 |
// ---------------------------------------------------------------------------- |
|
974 |
// HandleMediaL |
|
975 |
// ---------------------------------------------------------------------------- |
|
976 |
// |
|
977 |
void CGlxListViewImp::HandleMediaL( TInt /*aListIndex*/, MGlxMediaList* /*aList*/ ) |
|
978 |
{ |
|
979 |
||
980 |
} |
|
981 |
||
982 |
// ---------------------------------------------------------------------------- |
|
983 |
// HandlePopulatedL |
|
984 |
// ---------------------------------------------------------------------------- |
|
985 |
// |
|
986 |
void CGlxListViewImp::HandlePopulatedL( MGlxMediaList* /*aList*/ ) |
|
987 |
{ |
|
988 |
TRACER("CGlxListViewImp::HandlePopulatedL()"); |
|
989 |
if (iList) |
|
990 |
{ |
|
991 |
//set the text to be shown if the list is empty. |
|
992 |
HBufC* emptyText = StringLoader::LoadLC(R_LIST_EMPTY_VIEW_TEXT); |
|
993 |
iList->SetEmptyTextL(*emptyText); |
|
994 |
CleanupStack::PopAndDestroy(emptyText); |
|
995 |
||
996 |
GLX_DEBUG2("CGlxListViewImp::HandlePopulatedL() MediaList Count()=%d", |
|
997 |
iMediaList->Count()); |
|
998 |
if (iMediaList->Count() <= 0) |
|
999 |
{ |
|
1000 |
GLX_DEBUG1("CGlxListViewImp::HandlePopulatedL() - SetEmptyTextL()"); |
|
1001 |
iList->DrawNow(); |
|
1002 |
} |
|
1003 |
} |
|
1004 |
} |
|
1005 |
||
1006 |
// ---------------------------------------------------------------------------- |
|
1007 |
// HandleItemModifiedL |
|
1008 |
// ---------------------------------------------------------------------------- |
|
1009 |
// |
|
1010 |
void CGlxListViewImp::HandleItemModifiedL( const RArray<TInt>& /*aItemIndexes*/, |
|
1011 |
MGlxMediaList* /*aList*/ ) |
|
1012 |
{ |
|
1013 |
||
1014 |
} |
|
1015 |
||
1016 |
// ---------------------------------------------------------------------------- |
|
1017 |
// SetDefaultThumbnailL |
|
1018 |
// ---------------------------------------------------------------------------- |
|
1019 |
// |
|
1020 |
void CGlxListViewImp::SetDefaultThumbnailL(TInt aIndex) |
|
1021 |
{ |
|
1022 |
TRACER("CGlxListViewImp::SetDefaultThumbnail"); |
|
1023 |
CFbsBitmap* bitmap = NULL; |
|
1024 |
CFbsBitmap* mask = NULL; |
|
1025 |
TInt bitmapId = 0; |
|
1026 |
TInt maskId = 0; |
|
1027 |
||
1028 |
TFileName resFile(KDC_APP_BITMAP_DIR); |
|
1029 |
resFile.Append(KGlxIconsFilename); |
|
1030 |
||
1031 |
TGlxIdSpaceId id = iMediaList->IdSpaceId(0); |
|
1032 |
// In main list view, default thumbnails will be set according |
|
1033 |
// to the list items. |
|
1034 |
if(id == KGlxIdSpaceIdRoot) |
|
1035 |
{ |
|
1036 |
GLX_LOG_INFO1("CGlxListViewImp::SetDefaultThumbnail - For main list view " |
|
1037 |
"aIndex %d",aIndex); |
|
1038 |
// Mapping between switch, index and order of colleciton done on |
|
1039 |
// the base of TGlxCollectionPluginPriority |
|
1040 |
switch(aIndex) |
|
1041 |
{ |
|
1042 |
case EGlxListItemAll: |
|
1043 |
{ |
|
1044 |
bitmapId = EMbmGlxiconsQgn_prop_photo_all_large; |
|
1045 |
maskId = EMbmGlxiconsQgn_prop_photo_all_large_mask; |
|
1046 |
} |
|
1047 |
break; |
|
1048 |
case EGlxListItemAlbum: |
|
1049 |
{ |
|
1050 |
bitmapId = EMbmGlxiconsQgn_prop_photo_album_large; |
|
1051 |
maskId = EMbmGlxiconsQgn_prop_photo_album_large_mask; |
|
1052 |
} |
|
1053 |
break; |
|
1054 |
case EGlxLIstItemTag: |
|
1055 |
{ |
|
1056 |
bitmapId = EMbmGlxiconsQgn_prop_photo_tag_large; |
|
1057 |
maskId = EMbmGlxiconsQgn_prop_photo_tag_large_mask; |
|
1058 |
} |
|
1059 |
break; |
|
1060 |
default: |
|
1061 |
break; |
|
1062 |
} |
|
1063 |
} |
|
1064 |
else |
|
1065 |
{ |
|
1066 |
GLX_LOG_INFO1("CGlxListViewImp::SetDefaultThumbnail - For other list view " |
|
1067 |
"aIndex %d",aIndex); |
|
1068 |
CMPXCollectionPath* path = iMediaList->PathLC( |
|
1069 |
NGlxListDefs::EPathParent); |
|
1070 |
if(path->Id(0) == KGlxCollectionPluginAlbumsImplementationUid) |
|
1071 |
{ |
|
1072 |
bitmapId = EMbmGlxiconsQgn_prop_photo_album_large; |
|
1073 |
maskId = EMbmGlxiconsQgn_prop_photo_album_large_mask; |
|
1074 |
} |
|
1075 |
else |
|
1076 |
{ |
|
1077 |
bitmapId = EMbmGlxiconsQgn_prop_image_notcreated; |
|
1078 |
maskId = EMbmGlxiconsQgn_prop_image_notcreated_mask; |
|
1079 |
} |
|
1080 |
CleanupStack::PopAndDestroy(path); |
|
1081 |
} |
|
1082 |
||
1083 |
AknsUtils::CreateIconLC(AknsUtils::SkinInstance(), KAknsIIDNone, bitmap, |
|
1084 |
mask, resFile, bitmapId, maskId); |
|
1085 |
__ASSERT_DEBUG(bitmap, Panic(EGlxPanicNullPointer)); |
|
1086 |
__ASSERT_DEBUG(mask, Panic(EGlxPanicNullPointer)); |
|
1087 |
||
1088 |
AknIconUtils::SetSize(bitmap, |
|
1089 |
CHgDoubleGraphicListFlat::PreferredImageSize(), |
|
1090 |
EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
1091 |
AknIconUtils::SetSize(mask, |
|
1092 |
CHgDoubleGraphicListFlat::PreferredImageSize(), |
|
1093 |
EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
1094 |
||
1095 |
iList->ItemL(aIndex).SetIcon(CGulIcon::NewL(bitmap, mask)); |
|
1096 |
CleanupStack::Pop(mask); |
|
1097 |
CleanupStack::Pop(bitmap); |
|
1098 |
} |
|
1099 |
||
1100 |
// ---------------------------------------------------------------------------- |
|
1101 |
// HandleDialogDismissedL |
|
1102 |
// ---------------------------------------------------------------------------- |
|
1103 |
// |
|
1104 |
void CGlxListViewImp::HandleDialogDismissedL() |
|
1105 |
{ |
|
1106 |
TRACER("CGlxListViewImp::HandleDialogDismissedL()"); |
|
1107 |
if(iSchedulerWait) |
|
1108 |
{ |
|
1109 |
iSchedulerWait->AsyncStop(); |
|
1110 |
delete iSchedulerWait; |
|
1111 |
iSchedulerWait = NULL; |
|
1112 |
} |
|
1113 |
} |
|
1114 |
||
1115 |
// --------------------------------------------------------------------------- |
|
1116 |
// HandleMMCInsertionL |
|
1117 |
// |
|
1118 |
// --------------------------------------------------------------------------- |
|
1119 |
void CGlxListViewImp::HandleMMCInsertionL() |
|
1120 |
{ |
|
1121 |
TRACER("CGlxListViewImp::HandleMMCInsertionL()"); |
|
1122 |
iMMCState = ETrue; |
|
1123 |
// Set PS key value to KErrNotRready as TNM takes some |
|
1124 |
// time to write the value.Will be overwritten by TNM later. |
|
1125 |
iUiUtility->SetTNMDaemonPSKeyvalue(); |
|
1126 |
NavigateToMainListL(); |
|
1127 |
} |
|
1128 |
||
1129 |
// --------------------------------------------------------------------------- |
|
1130 |
// HandleMMCRemovalL |
|
1131 |
// |
|
1132 |
// --------------------------------------------------------------------------- |
|
1133 |
void CGlxListViewImp::HandleMMCRemovalL() |
|
1134 |
{ |
|
1135 |
TRACER("CGlxListViewImp::HandleMMCRemovalL()"); |
|
1136 |
//Dismiss the dialog before env destruction starts. |
|
1137 |
//Otherwise dialog's ProcessFinishedL() Panics. |
|
1138 |
iProgressIndicator->DismissProgressDialog(); |
|
1139 |
ProcessCommandL(EAknSoftkeyExit); |
|
1140 |
} |
|
1141 |
||
1142 |
// --------------------------------------------------------------------------- |
|
1143 |
// HandleForegroundEventL |
|
1144 |
// |
|
1145 |
// --------------------------------------------------------------------------- |
|
1146 |
void CGlxListViewImp::HandleForegroundEventL(TBool aForeground) |
|
1147 |
{ |
|
1148 |
TRACER("CGlxListViewImp::HandleForegroundEventL()"); |
|
1149 |
GLX_DEBUG2("CGlxListViewImp::HandleForegroundEventL(%d)", aForeground); |
|
1150 |
CAknView::HandleForegroundEventL(aForeground); |
|
1151 |
if (iMMCState) |
|
1152 |
{ |
|
1153 |
iMMCState = EFalse; |
|
1154 |
NavigateToMainListL(); |
|
1155 |
} |
|
1156 |
||
1157 |
TInt leftCount = iUiUtility->GetItemsLeftCount(); |
|
1158 |
if (iProgressIndicator && (leftCount == KErrNotReady || leftCount)) |
|
1159 |
{ |
|
1160 |
if (!iUiUtility->GetKeyguardStatus()) |
|
1161 |
{ |
|
1162 |
iProgressIndicator->ControlTNDaemon(aForeground); |
|
1163 |
} |
|
1164 |
||
1165 |
if (aForeground) |
|
1166 |
{ |
|
1167 |
iProgressIndicator->ShowProgressbarL(); |
|
1168 |
} |
|
1169 |
} |
|
1170 |
} |
|
1171 |
||
1172 |
// --------------------------------------------------------------------------- |
|
1173 |
// NavigateToMainListL |
|
1174 |
// |
|
1175 |
// --------------------------------------------------------------------------- |
|
1176 |
void CGlxListViewImp::NavigateToMainListL() |
|
1177 |
{ |
|
1178 |
TRACER("CGlxListViewImp::NavigateToMainListL()"); |
|
1179 |
ProcessCommandL(EAknSoftkeyClose); |
|
1180 |
} |
|
1181 |
||
1182 |
// ---------------------------------------------------------------------------- |
|
1183 |
// CleanUpL |
|
1184 |
// ---------------------------------------------------------------------------- |
|
1185 |
// |
|
1186 |
void CGlxListViewImp::CleanUpL() |
|
1187 |
{ |
|
1188 |
GLX_LOG_INFO("CGlxListViewImp::CleanUpL()"); |
|
1189 |
MGlxCache* cacheManager = MGlxCache::InstanceL(); |
|
1190 |
for (TInt i = 0; i < iMediaList->Count(); i++) |
|
1191 |
{ |
|
1192 |
cacheManager->ForceCleanupMedia(iMediaList->IdSpaceId(0), |
|
1193 |
iMediaList->Item(i).Id()); |
|
1194 |
} |
|
1195 |
cacheManager->Close(); |
|
1196 |
} |
|
1197 |
||
1198 |
// ---------------------------------------------------------------------------- |
|
1199 |
// UpdatePreviewL |
|
1200 |
// ---------------------------------------------------------------------------- |
|
1201 |
// |
|
1202 |
void CGlxListViewImp::UpdatePreviewL(TInt aIndex) |
|
1203 |
{ |
|
1204 |
TRACER("CGlxListViewImp::UpdatePreviewL()"); |
|
1205 |
if (aIndex >= 0 && aIndex < iMediaList->Count()) |
|
1206 |
{ |
|
1207 |
TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, |
|
1208 |
GlxFullThumbnailAttributeId(ETrue, iGridIconSize.iWidth, |
|
1209 |
iGridIconSize.iHeight)); |
|
1210 |
GLX_LOG_INFO1("CGlxListViewImp::UpdatePreviewL(aIndex = %d)", aIndex); |
|
1211 |
const TGlxMedia& item = iMediaList->Item(aIndex); |
|
1212 |
||
1213 |
TMPXAttribute attrCount(KMPXMediaGeneralCount); |
|
1214 |
TInt usageCount = 0; |
|
1215 |
const CGlxMedia* media = item.Properties(); |
|
1216 |
if (media) |
|
1217 |
{ |
|
1218 |
if (media->IsSupported(attrCount)) |
|
1219 |
{ |
|
1220 |
usageCount = media->ValueTObject<TInt> (attrCount); |
|
1221 |
GLX_LOG_INFO1("CGlxListViewImp::UpdatePreviewL() - UsageCount(%d)", usageCount); |
|
1222 |
} |
|
1223 |
} |
|
1224 |
||
1225 |
const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( |
|
1226 |
thumbnailAttribute); |
|
1227 |
if (usageCount && value) |
|
1228 |
{ |
|
1229 |
CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; |
|
1230 |
CleanupStack::PushL(bitmap); |
|
1231 |
iPreviewTNBinding->ScaleBitmapToListSizeL(value->iBitmap, bitmap); |
|
1232 |
iList->ItemL(aIndex).SetIcon(CGulIcon::NewL(bitmap)); |
|
1233 |
CleanupStack::Pop(bitmap); |
|
1234 |
iList->RefreshScreen(aIndex); |
|
1235 |
} |
|
1236 |
} |
|
1237 |
} |
|
1238 |
||
1239 |
// ---------------------------------------------------------------------------- |
|
1240 |
// RefreshList |
|
1241 |
// ---------------------------------------------------------------------------- |
|
1242 |
// |
|
1243 |
void CGlxListViewImp::RefreshList(TInt aIndex) |
|
1244 |
{ |
|
1245 |
TRACER("CGlxListViewImp::RefreshList()"); |
|
1246 |
GLX_DEBUG2("CGlxListViewImp::RefreshList(%d)", aIndex); |
|
1247 |
__ASSERT_ALWAYS(iList, Panic(EGlxPanicNullPointer)); |
|
1248 |
TInt firstIndex = iList->FirstIndexOnScreen(); |
|
1249 |
TInt itemsOnScreen = iList->ItemsOnScreen(); |
|
1250 |
TInt lastOnScreen = firstIndex + itemsOnScreen - 1; |
|
1251 |
TInt mediaCount = iMediaList->Count(); |
|
1252 |
if (lastOnScreen > (mediaCount - 1)) |
|
1253 |
{ |
|
1254 |
lastOnScreen = mediaCount - 1; |
|
1255 |
} |
|
1256 |
||
1257 |
if (aIndex == lastOnScreen) |
|
1258 |
{ |
|
1259 |
GLX_DEBUG2("CGlxListViewImp::RefreshList() RefreshScreen(%d)", aIndex); |
|
1260 |
iList->RefreshScreen(aIndex); |
|
1261 |
} |
|
1262 |
} |
|
1263 |
// End of File |