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