author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 20:58:58 +0300 | |
branch | RCL_3 |
changeset 35 | 3321d3e205b6 |
parent 34 | 5456b4e8b3a8 |
permissions | -rw-r--r-- |
34 | 1 |
/* |
2 |
* Copyright (c) 2007-2008 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: |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
#include <uri8.h> |
|
20 |
#include <mmf/common/mmfcontrollerpluginresolver.h> |
|
21 |
#include <sacls.h> |
|
22 |
#include <apgtask.h> |
|
23 |
#include <centralrepository.h> |
|
24 |
#include <AknUtils.h> |
|
25 |
||
26 |
#include "hnengine.h" |
|
27 |
#include "hnconvutils.h" |
|
28 |
#include "hncontrollerinterface.h" |
|
29 |
#include "hnfilter.h" |
|
30 |
#include "hnsuitemodelcontainer.h" |
|
31 |
#include "hnsuitemodel.h" |
|
32 |
#include "hnserviceglobals.h" |
|
33 |
#include "hnglobals.h" |
|
34 |
#include "hnmdsuite.h" |
|
35 |
#include "hnitemid.h" |
|
36 |
#include "hnliwutils.h" |
|
37 |
#include "hnrepositorymanager.h" |
|
38 |
#include "menudebug.h" |
|
39 |
#include "hnrepositorymanager.h" |
|
40 |
#include "hnsuiteobserver.h" |
|
41 |
#include "hnmdbasekey.h" |
|
42 |
#include "hnitemsorder.h" |
|
43 |
||
44 |
_LIT8( KAnd8, "&" ); |
|
45 |
_LIT8( KEquals8, "=" ); |
|
46 |
||
47 |
// ======== MEMBER FUNCTIONS ======== |
|
48 |
||
49 |
// --------------------------------------------------------------------------- |
|
50 |
// |
|
51 |
// --------------------------------------------------------------------------- |
|
52 |
// |
|
53 |
void CHnEngine::ConstructL() |
|
54 |
{ |
|
55 |
iEEnv = CEikonEnv::Static(); |
|
56 |
iSuiteContainer = CHnSuiteModelContainer::NewL( *this , iControllerInterface ); |
|
57 |
iMetaDataModel = CHnMdModel::NewL( this, iSuiteContainer ); |
|
58 |
iLight = CHWRMLight::NewL(this); |
|
59 |
} |
|
60 |
||
61 |
// --------------------------------------------------------------------------- |
|
62 |
// |
|
63 |
// --------------------------------------------------------------------------- |
|
64 |
// |
|
65 |
EXPORT_C CHnEngine* CHnEngine::NewL( MHnControllerInterface& aController ) |
|
66 |
{ |
|
67 |
CHnEngine* self = CHnEngine::NewLC( aController ); |
|
68 |
CleanupStack::Pop( self ); |
|
69 |
return self; |
|
70 |
} |
|
71 |
||
72 |
// --------------------------------------------------------------------------- |
|
73 |
// |
|
74 |
// --------------------------------------------------------------------------- |
|
75 |
// |
|
76 |
EXPORT_C CHnEngine* CHnEngine::NewLC( MHnControllerInterface& aController ) |
|
77 |
{ |
|
78 |
CHnEngine* self = new( ELeave ) CHnEngine( aController ); |
|
79 |
CleanupStack::PushL( self ); |
|
80 |
self->ConstructL(); |
|
81 |
return self; |
|
82 |
} |
|
83 |
||
84 |
// --------------------------------------------------------------------------- |
|
85 |
// |
|
86 |
// --------------------------------------------------------------------------- |
|
87 |
// |
|
88 |
CHnEngine::CHnEngine( MHnControllerInterface& aController ): |
|
89 |
iControllerInterface( aController ) |
|
90 |
{ |
|
91 |
} |
|
92 |
||
93 |
// --------------------------------------------------------------------------- |
|
94 |
// |
|
95 |
// --------------------------------------------------------------------------- |
|
96 |
// |
|
97 |
CHnEngine::~CHnEngine() |
|
98 |
{ |
|
99 |
delete iLight; |
|
100 |
if( iSuiteContainer ) |
|
101 |
{ |
|
102 |
iSuiteContainer->RemoveLiwObjects(); |
|
103 |
} |
|
104 |
delete iMetaDataModel; |
|
105 |
delete iSuiteContainer; |
|
106 |
} |
|
107 |
||
108 |
// --------------------------------------------------------------------------- |
|
109 |
// |
|
110 |
// --------------------------------------------------------------------------- |
|
111 |
// |
|
112 |
TInt CHnEngine::GetSuiteModelsCountL() |
|
113 |
{ |
|
114 |
return iSuiteContainer->GetSuiteModelCount(); |
|
115 |
} |
|
116 |
||
117 |
// --------------------------------------------------------------------------- |
|
118 |
// |
|
119 |
// --------------------------------------------------------------------------- |
|
120 |
// |
|
121 |
TBool CHnEngine::SuiteModelLoadedL( TInt aId ) |
|
122 |
{ |
|
123 |
TBool ret( EFalse ); |
|
124 |
TInt count( iSuiteContainer->GetSuiteModelCount() ); |
|
125 |
for( int i=0; i<count; i++ ) |
|
126 |
{ |
|
127 |
CHnSuiteModel* suite = iSuiteContainer->GetSuiteModel( i ); |
|
128 |
if( suite->GetItemsOrder()->GetSuiteId() == aId ) |
|
129 |
{ |
|
130 |
ret = ETrue; |
|
131 |
break; |
|
132 |
} |
|
133 |
} |
|
134 |
return ret; |
|
135 |
} |
|
136 |
||
137 |
// --------------------------------------------------------------------------- |
|
138 |
// |
|
139 |
// --------------------------------------------------------------------------- |
|
140 |
// |
|
141 |
CHnSuiteModel* CHnEngine::GetLastSuiteModelL() |
|
142 |
{ |
|
143 |
return iSuiteContainer->GetLastSuiteModel(); |
|
144 |
} |
|
145 |
||
146 |
// --------------------------------------------------------------------------- |
|
147 |
// |
|
148 |
// --------------------------------------------------------------------------- |
|
149 |
// |
|
150 |
CHnSuiteModel* CHnEngine::GetParentSuiteModelL() |
|
151 |
{ |
|
152 |
return iSuiteContainer->GetParentSuiteModel(); |
|
153 |
} |
|
154 |
||
155 |
// --------------------------------------------------------------------------- |
|
156 |
// |
|
157 |
// --------------------------------------------------------------------------- |
|
158 |
// |
|
159 |
EXPORT_C TInt CHnEngine::TriggerHnEventL( const TInt aHnEventId, |
|
160 |
const TInt aRecipientId, CLiwGenericParamList* aEventParameters ) |
|
161 |
{ |
|
162 |
TInt ret = iSuiteContainer->OfferHnEventL( aHnEventId, aRecipientId, |
|
163 |
aEventParameters); |
|
164 |
return ret; |
|
165 |
} |
|
166 |
||
167 |
// --------------------------------------------------------------------------- |
|
168 |
// |
|
169 |
// --------------------------------------------------------------------------- |
|
170 |
// |
|
171 |
void CHnEngine::HighlightPlacementFromUriL( const TDesC8& aUriFragment ) |
|
172 |
{ |
|
173 |
TLex8 lexFrag( aUriFragment ); |
|
174 |
TInt highLight( 0 ); |
|
175 |
if( !( lexFrag.Val( highLight ) ) ) |
|
176 |
{ |
|
177 |
iSuiteContainer->GetLastSuiteModel()->SetSuiteHighlightL( highLight ); |
|
178 |
iControllerInterface.HandleSuiteEventL( ESuiteHighlightChanged, |
|
179 |
iSuiteContainer->GetLastSuiteModel() ); |
|
180 |
} |
|
181 |
} |
|
182 |
||
183 |
// --------------------------------------------------------------------------- |
|
184 |
// |
|
185 |
// --------------------------------------------------------------------------- |
|
186 |
// |
|
187 |
TInt CHnEngine::LoadSuiteFromUriL( const TDesC8& aSuiteName, |
|
188 |
const TDesC8& aUriQuery, const TDesC8& aUriFragment ) |
|
189 |
{ |
|
190 |
TInt error( KErrNone ); |
|
191 |
||
192 |
if( !( aSuiteName.Compare( KRoot8 ) ) ) |
|
193 |
{ |
|
194 |
CLiwGenericParamList* uriParams = |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
195 |
UriQueryToLiwListLC( aUriQuery, aUriFragment, aSuiteName ); |
34 | 196 |
CLiwGenericParamList* params = CLiwGenericParamList::NewLC(); |
197 |
params->AppendL( iMetaDataModel->GetSuiteParameters( 0 ) ); |
|
198 |
params->AppendL( *uriParams ); |
|
199 |
ResetModelsL(); |
|
200 |
iMetaDataModel->QueueForeground( CHnMdModel::EWhenAnySuiteIsEvaluated ); |
|
201 |
error = InitializeL( *params ); |
|
202 |
CleanupStack::PopAndDestroy( params ); |
|
203 |
CleanupStack::PopAndDestroy( uriParams ); |
|
204 |
} |
|
205 |
else |
|
206 |
{ |
|
207 |
CLiwGenericParamList* params = |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
208 |
UriQueryToLiwListLC( aUriQuery, aUriFragment, aSuiteName ); |
34 | 209 |
|
210 |
HBufC* suiteName = HnConvUtils::Str8ToStrLC( aSuiteName ); |
|
211 |
params->AppendL( TLiwGenericParam( KNewSuiteParamNameEn, |
|
212 |
TLiwVariant( *suiteName ) ) ); |
|
213 |
||
214 |
error = HandleNewSuiteLoadedEventL( *params ); |
|
215 |
||
216 |
CleanupStack::PopAndDestroy( suiteName ); |
|
217 |
CleanupStack::PopAndDestroy( params ); |
|
218 |
} |
|
219 |
||
220 |
return error; |
|
221 |
} |
|
222 |
||
223 |
// --------------------------------------------------------------------------- |
|
224 |
// |
|
225 |
// --------------------------------------------------------------------------- |
|
226 |
// |
|
227 |
TBool CHnEngine::SuitesAreTheSameL( const TDesC& aLastSuiteName, |
|
228 |
const TDesC8& aFirstSuiteName ) |
|
229 |
{ |
|
230 |
RBuf8 lastSuiteName; |
|
231 |
CleanupClosePushL( lastSuiteName ); |
|
232 |
lastSuiteName.CreateL( aLastSuiteName.Length() ); |
|
233 |
lastSuiteName.Copy( aLastSuiteName ); |
|
234 |
TBool suitesAreTheSame( !lastSuiteName.Compare( aFirstSuiteName ) ); |
|
235 |
CleanupStack::PopAndDestroy( &lastSuiteName ); |
|
236 |
return suitesAreTheSame; |
|
237 |
} |
|
238 |
||
239 |
// --------------------------------------------------------------------------- |
|
240 |
// |
|
241 |
// --------------------------------------------------------------------------- |
|
242 |
// |
|
243 |
void CHnEngine::HandleTheSameSuitesL( TBool aNextExists, const TDesC8& aParams ) |
|
244 |
{ |
|
245 |
RBuf exitMode; |
|
246 |
CleanupClosePushL( exitMode ); |
|
247 |
CLiwGenericParamList* params = UriQueryToLiwListLC( aParams, KNullDesC8, KNullDesC8 ); |
|
248 |
HnLiwUtils::GetStringL( *params, KExitModeParams, exitMode ); |
|
249 |
||
250 |
if ( !exitMode.Compare( KExitModeHide ) ) |
|
251 |
{ |
|
252 |
// set parameters |
|
253 |
iSuiteContainer->GetLastSuiteModel()->SetExitMode( EExitModeHide ); |
|
254 |
} |
|
255 |
||
256 |
CleanupStack::PopAndDestroy( params ); |
|
257 |
CleanupStack::PopAndDestroy( &exitMode ); |
|
258 |
||
259 |
if ( !aNextExists ) |
|
260 |
{ |
|
261 |
// refresh if necessary |
|
262 |
iControllerInterface.NotifyUiRefreshL( ERefreshSuite ); |
|
263 |
} |
|
264 |
} |
|
265 |
// --------------------------------------------------------------------------- |
|
266 |
// |
|
267 |
// --------------------------------------------------------------------------- |
|
268 |
// |
|
269 |
EXPORT_C void CHnEngine::LoadSuitesFromUriL( const TDesC8& aUri ) |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
270 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
271 |
DEBUG(("_MM_:CHnEngine::LoadSuitesFromUriL IN")); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
272 |
DEBUG8(("_MM_:\tURI: %S",&aUri)); |
34 | 273 |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
274 |
TBool consumed(EFalse); |
34 | 275 |
|
276 |
if ( aUri.Find( KSetFocusWithPref ) != KErrNotFound ) |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
277 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
278 |
LoadFromCrL( aUri ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
279 |
consumed = ETrue; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
280 |
} |
34 | 281 |
|
282 |
if ( !consumed ) |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
283 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
284 |
consumed = HandleActionL( aUri ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
285 |
} |
34 | 286 |
|
287 |
if ( !consumed ) |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
288 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
289 |
LoadSuitesL( aUri ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
290 |
} |
34 | 291 |
|
292 |
DEBUG(("_MM_:CHnEngine::LoadSuitesFromUriL OUT")); |
|
293 |
} |
|
294 |
||
295 |
// --------------------------------------------------------------------------- |
|
296 |
// |
|
297 |
// --------------------------------------------------------------------------- |
|
298 |
// |
|
299 |
TInt CHnEngine::HandleModelEventL( const TDesC& aEventName, |
|
300 |
CLiwGenericParamList& aParams ) |
|
301 |
{ |
|
302 |
TInt ret(KErrNotFound); |
|
303 |
||
304 |
if ( aEventName == KNewSuiteLoadedMdEvent ) |
|
305 |
{ |
|
306 |
// This handles new suite creation, putting its visual model |
|
307 |
// onto the stack eventually. |
|
308 |
ret = HandleNewSuiteLoadedEventL( aParams ); |
|
309 |
} |
|
310 |
else if ( aEventName == KBackMdEvent ) |
|
311 |
{ |
|
312 |
const TDesC& suiteName = iSuiteContainer->GetLastSuiteModel()->SuiteName(); |
|
313 |
ret = HandleBackEventL( suiteName ); |
|
314 |
} |
|
315 |
else if (aEventName == KReevaluateMdEvent ) |
|
316 |
{ |
|
317 |
// This event triggers reevaluate on the model. |
|
318 |
// aParams holds liw packed filter. |
|
319 |
ret = HandleReevaluateEventL( aParams ); |
|
320 |
} |
|
321 |
else if (aEventName == KSwitchWidgetMdEvent ) |
|
322 |
{ |
|
323 |
// Widget change is requested. |
|
324 |
ret = HandleWidgetChangeL( aParams ); |
|
325 |
} |
|
326 |
else if (aEventName == KRefreshUiMdEvent ) |
|
327 |
{ |
|
328 |
// Refresh of the whole of the UI is refreshed |
|
329 |
iControllerInterface.NotifyUiRefreshL( ERefreshSuite ); |
|
330 |
ret = KErrNone; |
|
331 |
} |
|
332 |
else if (aEventName == KRefreshToolbarMdEvent ) |
|
333 |
{ |
|
334 |
// Just the toolbar in UI is refreshed |
|
335 |
iControllerInterface.NotifyUiRefreshL( ERefreshToolbar ); |
|
336 |
ret = KErrNone; |
|
337 |
} |
|
338 |
else if (aEventName == KStartEditModeMdEvent ) |
|
339 |
{ |
|
340 |
// Starting edit mode |
|
341 |
iControllerInterface.NotifyUiRefreshL( EStartEditMode ); |
|
342 |
ret = KErrNone; |
|
343 |
} |
|
344 |
else if (aEventName == KStopEditModeMdEvent ) |
|
345 |
{ |
|
346 |
// Stopping edit mode |
|
347 |
iControllerInterface.NotifyUiRefreshL( EStopEditMode ); |
|
348 |
ret = KErrNone; |
|
349 |
} |
|
350 |
else if (aEventName == KSetFocusEvent ) |
|
351 |
{ |
|
352 |
// SetFocus |
|
353 |
ret = HandleSetFocusEventL( aParams ); |
|
354 |
} |
|
355 |
else if (aEventName == KAppGainForeground ) |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
356 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
357 |
//force matrix gain foreground |
34 | 358 |
DEBUG(("_MM_:CHnEngine::HandleModelEventL EForegroundGain")); |
359 |
iControllerInterface.NotifyUiRefreshL( EForegroundGain ); |
|
360 |
ret = KErrNone; |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
361 |
} |
34 | 362 |
else if (aEventName == KAppGainBackground ) |
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
363 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
364 |
//force matrix gain background |
34 | 365 |
DEBUG(("_MM_:CHnEngine::HandleModelEventL EBackgroundGain")); |
366 |
iControllerInterface.NotifyUiRefreshL( EBackgroundGain ); |
|
367 |
ret = KErrNone; |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
368 |
} |
34 | 369 |
|
370 |
return ret; |
|
371 |
} |
|
372 |
||
373 |
// --------------------------------------------------------------------------- |
|
374 |
// |
|
375 |
// --------------------------------------------------------------------------- |
|
376 |
// |
|
377 |
TInt CHnEngine::HandleWidgetChangeL( |
|
378 |
CLiwGenericParamList& aParams ) |
|
379 |
{ |
|
380 |
THnSuiteWidgetType type = EChangeWidget; |
|
381 |
TInt pos( 0 ); |
|
382 |
const TLiwGenericParam* param = NULL; |
|
383 |
param = aParams.FindFirst( pos, KWidgetTypeAttrName8 ); |
|
384 |
if ( pos != KErrNotFound ) |
|
385 |
{ |
|
386 |
TPtrC widgetType( KNullDesC ); |
|
387 |
param->Value().Get( widgetType ); |
|
388 |
if ( widgetType.Compare( KWidgetTypeList ) == 0 ) |
|
389 |
type = EListWidget; |
|
390 |
else if ( widgetType.Compare( KWidgetTypeGrid ) == 0 ) |
|
391 |
type = EGridWidget; |
|
392 |
else if ( widgetType.Compare( KWidgetTypeCoverFlow ) == 0 ) |
|
393 |
type = ECoverFlowWidget; |
|
394 |
} |
|
395 |
||
396 |
CHnSuiteModel* model = iSuiteContainer->GetLastSuiteModel(); |
|
397 |
return HandleWidgetChangeL( model->SuiteName(), type ); |
|
398 |
} |
|
399 |
||
400 |
// --------------------------------------------------------------------------- |
|
401 |
// |
|
402 |
// --------------------------------------------------------------------------- |
|
403 |
// |
|
404 |
TInt CHnEngine::HandleWidgetChangeL( const TDesC& aSuiteName, |
|
405 |
THnSuiteWidgetType aType ) |
|
406 |
{ |
|
407 |
DEBUG(("_MM_:CMatrixMenuAppUi::HandleWidgetChangeL IN")); |
|
408 |
TInt ret( KErrGeneral ); |
|
409 |
||
410 |
CHnRepositoryManager* rep = CHnRepositoryManager::NewLC(); |
|
411 |
THnSuiteWidgetType type( EUnspecified ); |
|
412 |
TInt err( rep->ReadSuiteWidgetTypeL( aSuiteName, type ) ); |
|
413 |
||
414 |
if( ( !err || err == KErrNotFound ) && type != EUnspecified ) |
|
415 |
{ |
|
416 |
ret = rep->StoreSuiteWidgetTypeL( aSuiteName, aType ); |
|
417 |
} |
|
418 |
CleanupStack::PopAndDestroy( rep ); |
|
419 |
DEBUG(("_MM_:CMatrixMenuAppUi::HandleWidgetChangeL OUT")); |
|
420 |
return ret; |
|
421 |
} |
|
422 |
||
423 |
// --------------------------------------------------------------------------- |
|
424 |
// |
|
425 |
// --------------------------------------------------------------------------- |
|
426 |
// |
|
427 |
TInt CHnEngine::HandleReevaluateEventL( |
|
428 |
CLiwGenericParamList& aParams ) |
|
429 |
{ |
|
430 |
TInt ret(KErrNone); |
|
431 |
// Paths to retrieve filter values |
|
432 |
_LIT8( KGenreGlobalPath, "filter:genre"); |
|
433 |
_LIT8( KIdGlobalPath, "filter:id"); |
|
434 |
_LIT8( KGenrePath, "filter:[%d]/genre"); |
|
435 |
_LIT8( KItemPath, "filter:[%d]/item"); |
|
436 |
||
437 |
CHnFilter* filter = CHnFilter::NewLC(); |
|
438 |
||
439 |
TLiwGenericParam param; |
|
440 |
param.PushL(); |
|
441 |
aParams.AtL(0, param); |
|
442 |
ASSERT( !param.Name().Compare( KFilterElementItem8 ) ); |
|
443 |
||
444 |
TLiwVariant suiteIdVariant; |
|
445 |
suiteIdVariant.PushL(); |
|
446 |
TLiwVariant genreVariant; |
|
447 |
genreVariant.PushL(); |
|
448 |
TInt idFound = |
|
449 |
HnLiwUtils::GetVariantL( aParams, KIdGlobalPath(), suiteIdVariant ); |
|
450 |
TInt found = |
|
451 |
HnLiwUtils::GetVariantL(aParams, KGenreGlobalPath(), genreVariant ); |
|
452 |
if (idFound != KErrNotFound) |
|
453 |
{ |
|
454 |
filter->SetSuiteId( suiteIdVariant.AsTInt32() ); |
|
455 |
filter->SetEvaluateSuiteL( ETrue ); |
|
456 |
} |
|
457 |
else if (found != KErrNotFound && found != KErrBadDescriptor) |
|
458 |
{ |
|
459 |
filter->SetSuiteNameL( genreVariant.AsDes() ); |
|
460 |
filter->SetEvaluateSuiteL( ETrue ); |
|
461 |
} |
|
462 |
else |
|
463 |
{ |
|
464 |
filter->SetEvaluateSuiteL( EFalse ); |
|
465 |
// For each entry in the fitler list.... |
|
466 |
for ( int i=0; i< param.Value().AsList()->Count(); i++ ) |
|
467 |
{ |
|
468 |
RBuf8 path; |
|
469 |
CleanupClosePushL( path ); |
|
470 |
path.CreateL( KGenrePath().Length() ); |
|
471 |
path.Format( KGenrePath, i ); |
|
472 |
TLiwVariant genreVariant; |
|
473 |
HnLiwUtils::GetVariantL(aParams, path, genreVariant ); |
|
474 |
path.Close(); |
|
475 |
path.CreateL( KItemPath().Length() ); |
|
476 |
path.Format( KItemPath, i ); |
|
477 |
TLiwVariant itemVariant; |
|
478 |
HnLiwUtils::GetVariantL(aParams, path, itemVariant ); |
|
479 |
CleanupStack::PopAndDestroy( &path ); |
|
480 |
||
481 |
TPtrC suiteName; |
|
482 |
TPtrC itemId; |
|
483 |
genreVariant.Get(suiteName); |
|
484 |
itemVariant.Get(itemId); |
|
485 |
||
486 |
CHnItemId* itemIdObject = CHnItemId::NewLC(suiteName, itemId); |
|
487 |
filter->AppendItemIdL( itemIdObject ); |
|
488 |
CleanupStack::Pop( itemIdObject ); |
|
489 |
||
490 |
genreVariant.Reset(); |
|
491 |
itemVariant.Reset(); |
|
492 |
} |
|
493 |
} |
|
494 |
CleanupStack::PopAndDestroy( &genreVariant ); |
|
495 |
CleanupStack::PopAndDestroy( &suiteIdVariant ); |
|
496 |
CleanupStack::PopAndDestroy( ¶m ); |
|
497 |
iMetaDataModel->EvaluateL( *filter ); |
|
498 |
CleanupStack::PopAndDestroy( filter ); |
|
499 |
return ret; |
|
500 |
} |
|
501 |
||
502 |
// --------------------------------------------------------------------------- |
|
503 |
// |
|
504 |
// --------------------------------------------------------------------------- |
|
505 |
// |
|
506 |
TInt CHnEngine::HandleBackEventL( const TDesC& aGenre, TInt aIterations ) |
|
507 |
{ |
|
508 |
return iMetaDataModel->HandleBackEventL( |
|
509 |
iSuiteContainer, aGenre, aIterations ); |
|
510 |
} |
|
511 |
||
512 |
// --------------------------------------------------------------------------- |
|
513 |
// |
|
514 |
// --------------------------------------------------------------------------- |
|
515 |
// |
|
516 |
TInt CHnEngine::HandleNewSuiteLoadedEventL( |
|
517 |
CLiwGenericParamList& aParams ) |
|
518 |
{ |
|
519 |
DEBUG(("_MM_:CHnEngine::HandleNewSuiteLoadedEventL IN")); |
|
520 |
TInt err( KErrNone ); |
|
521 |
const TLiwGenericParam* param = |
|
522 |
aParams.FindFirst( err, KNewSuiteParamNameEn ); |
|
523 |
if( err != KErrNotFound ) |
|
524 |
{ |
|
525 |
TPtrC genre; |
|
526 |
param->Value().Get( genre ); |
|
527 |
DEBUG16(("_MM_:\tSuite genre name: %S",&genre)); |
|
528 |
// load and evaluate the suite |
|
529 |
if( genre.Compare( KFolderSuite) ) |
|
530 |
{ |
|
531 |
//only folder suite is supported |
|
532 |
User::Leave( KErrNotSupported ); |
|
533 |
} |
|
534 |
err = iMetaDataModel->LoadSuiteL( genre, &aParams ); |
|
535 |
if ( !err ) |
|
536 |
{ |
|
537 |
GetLastSuiteModelL()->RegisterSuiteObserverL( &iControllerInterface, EPriorityNull ); |
|
538 |
CHnFilter* filter = CHnFilter::NewLC(); |
|
539 |
filter->SetSuiteNameL( genre ); |
|
540 |
filter->SetEvaluateSuiteL( ETrue ); |
|
541 |
if ( iEditMode ) |
|
542 |
{ |
|
543 |
iMetaDataModel->SetModeL( EMdModeEdit ); |
|
544 |
} |
|
545 |
else |
|
546 |
{ |
|
547 |
iMetaDataModel->SetModeL( EMdModeNormal ); |
|
548 |
} |
|
549 |
||
550 |
TRAP( err, iMetaDataModel->EvaluateL( *filter ) ); |
|
551 |
||
552 |
CleanupStack::PopAndDestroy( filter ); |
|
553 |
if ( err ) |
|
554 |
{ |
|
555 |
iMetaDataModel->DeleteLastSuite(); |
|
556 |
iSuiteContainer->PopSuiteModelL( genre ); |
|
557 |
} |
|
558 |
} |
|
559 |
else |
|
560 |
{ |
|
561 |
// show error note to User |
|
562 |
HBufC* message( NULL ); |
|
563 |
switch ( err ) |
|
564 |
{ |
|
565 |
case KErrPathNotFound : |
|
566 |
{ |
|
567 |
message = KDebugNoteDirNotFound().AllocL(); |
|
568 |
} |
|
569 |
break; |
|
570 |
case KErrNotFound : |
|
571 |
{ |
|
572 |
message = KDebugNoteFileNotFound().AllocL(); |
|
573 |
} |
|
574 |
break; |
|
575 |
default : |
|
576 |
{ |
|
577 |
message = HBufC::NewL( KDebugNoteOtherError().Length() + |
|
578 |
KMaxLength ); |
|
579 |
message->Des().AppendFormat( KDebugNoteOtherError, err ); |
|
580 |
} |
|
581 |
break; |
|
582 |
} |
|
583 |
iEEnv->AlertWin( *message ); |
|
584 |
delete message; |
|
585 |
} |
|
586 |
} |
|
587 |
DEBUG(("_MM_:\tReturned error code: %d",err)); |
|
588 |
DEBUG(("_MM_:CHnEngine::HandleNewSuiteLoadedEventL OUT")); |
|
589 |
||
590 |
return err; |
|
591 |
} |
|
592 |
||
593 |
// --------------------------------------------------------------------------- |
|
594 |
// |
|
595 |
// --------------------------------------------------------------------------- |
|
596 |
// |
|
597 |
TInt CHnEngine::HandleSetFocusEventL( const CLiwGenericParamList& aParams ) |
|
598 |
{ |
|
599 |
// Triggering event in hierarchy navigator, specifying |
|
600 |
// that suite given by the name genre has been |
|
601 |
DEBUG(("_MM_:CHnEngine::HandleSetFocusEventL IN")); |
|
602 |
||
603 |
TInt posSuite( 0 ); |
|
604 |
TInt posItem( 0 ); |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
605 |
TInt64 suiteCustomId( KErrNotFound ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
606 |
TInt64 itemCustomId( KErrNotFound ); |
34 | 607 |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
608 |
// Get suite's and item's custom ids. |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
609 |
const TLiwGenericParam* paramSuiteId = aParams.FindFirst( posSuite, KSuiteCustomId8 ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
610 |
const TLiwGenericParam* paramItemId = aParams.FindFirst( posItem, KItemCustomId8 ); |
34 | 611 |
|
612 |
||
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
613 |
if ( posSuite >= 0 && posItem >= 0 ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
614 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
615 |
suiteCustomId = paramSuiteId->Value().AsTInt64(); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
616 |
itemCustomId = paramItemId->Value().AsTInt64(); |
34 | 617 |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
618 |
// Get matching suite. |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
619 |
CHnSuiteModel* suiteModel = iSuiteContainer->GetMatchingSuiteModel( suiteCustomId ); |
34 | 620 |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
621 |
if ( suiteModel ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
622 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
623 |
// If suite is not null, then find matching item model. |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
624 |
TInt index( KErrNotFound ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
625 |
CHnItemModel* itemModel = suiteModel->GetMatchingItemModelL( itemCustomId, index ); |
34 | 626 |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
627 |
if ( itemModel ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
628 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
629 |
// If itemModel is not null then set highlight and set highligh |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
630 |
// on matching item. |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
631 |
suiteModel->SetSuiteHighlightL( index ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
632 |
iControllerInterface.HandleSuiteEventL( ESuiteHighlightChanged, suiteModel ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
633 |
} |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
634 |
else |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
635 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
636 |
suiteModel->QueueFocus( itemCustomId ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
637 |
} |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
638 |
} |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
639 |
} |
34 | 640 |
|
641 |
DEBUG(("_MM_:CHnEngine::HandleSetFocusEventL OUT")); |
|
642 |
return KErrNone; |
|
643 |
} |
|
644 |
||
645 |
// --------------------------------------------------------------------------- |
|
646 |
// |
|
647 |
// --------------------------------------------------------------------------- |
|
648 |
// |
|
649 |
TInt CHnEngine::HandleMoveFocusBeforeDeleteEventL( |
|
650 |
const CLiwGenericParamList& /* aParams */ ) |
|
651 |
{ |
|
652 |
// Triggering event in hierarchy navigator, specifying |
|
653 |
// that suite given by the name genre has been |
|
654 |
DEBUG(("_MM_:CHnEngine::HandleMoveFocusBeforeDeleteEventL IN")); |
|
655 |
||
656 |
TInt currentHighlight( GetLastSuiteModelL()->GetSuiteHighlight() ); |
|
657 |
TInt itemsCount( GetLastSuiteModelL()->GetItemModelsCount() ); |
|
658 |
||
659 |
TInt shift( 0 ); |
|
660 |
if( AknLayoutUtils::PenEnabled() && iEditMode ) |
|
661 |
{ |
|
662 |
// add empty item |
|
663 |
shift = 1; |
|
664 |
} |
|
665 |
if( currentHighlight == itemsCount - shift - 1 ) |
|
666 |
{ |
|
667 |
GetLastSuiteModelL()->SetSuiteHighlightL( currentHighlight - 1 ); |
|
668 |
} |
|
669 |
else |
|
670 |
{ |
|
671 |
GetLastSuiteModelL()->SetSuiteHighlightL( currentHighlight + 1 ); |
|
672 |
} |
|
673 |
iControllerInterface.HandleSuiteEventL( |
|
674 |
ESuiteHighlightChanged, GetLastSuiteModelL() ); |
|
675 |
||
676 |
DEBUG(("_MM_:CHnEngine::HandleMoveFocusBeforeDeleteEventL OUT")); |
|
677 |
return KErrNone; |
|
678 |
} |
|
679 |
||
680 |
// --------------------------------------------------------------------------- |
|
681 |
// |
|
682 |
// --------------------------------------------------------------------------- |
|
683 |
// |
|
684 |
TInt CHnEngine::HandleRefreshIconsEventL( const CLiwGenericParamList& /* aParams */ ) |
|
685 |
{ |
|
686 |
iMetaDataModel->EvaluateL(); |
|
687 |
return KErrNone; |
|
688 |
} |
|
689 |
||
690 |
// --------------------------------------------------------------------------- |
|
691 |
// |
|
692 |
// --------------------------------------------------------------------------- |
|
693 |
// |
|
694 |
TInt CHnEngine::HandleDisableActionsForItemL( const CLiwGenericParamList& aParams ) |
|
695 |
{ |
|
696 |
TInt pos( 0 ); |
|
697 |
aParams.FindFirst( pos, KItemCustomId8 ); |
|
698 |
if ( pos != KErrNotFound ) |
|
699 |
{ |
|
700 |
TInt itemCustomId = aParams[pos].Value().AsTInt32(); |
|
701 |
TInt itemId = 0; |
|
702 |
CHnItemModel* itemModel = |
|
703 |
iSuiteContainer->GetLastSuiteModel()->GetMatchingItemModelL( |
|
704 |
itemCustomId, itemId ); |
|
705 |
if ( itemModel ) |
|
706 |
{ |
|
707 |
itemModel->DeleteAllActionModels(); |
|
708 |
} |
|
709 |
} |
|
710 |
return KErrNone; |
|
711 |
} |
|
712 |
||
713 |
// --------------------------------------------------------------------------- |
|
714 |
// |
|
715 |
// --------------------------------------------------------------------------- |
|
716 |
// |
|
717 |
//void CHnEngine::InstallChangeL( TInt aStatus ) |
|
718 |
// { |
|
719 |
// switch ( aStatus) |
|
720 |
// { |
|
721 |
// case EInstOpNone: |
|
722 |
// { |
|
723 |
// break; |
|
724 |
// } |
|
725 |
// case EInstOpInstall: |
|
726 |
// case EInstOpUninstall: |
|
727 |
// { |
|
728 |
// iMetaDataModel->ReleaseLocalization(); |
|
729 |
// break; |
|
730 |
// } |
|
731 |
// } |
|
732 |
// } |
|
733 |
// --------------------------------------------------------------------------- |
|
734 |
// |
|
735 |
// --------------------------------------------------------------------------- |
|
736 |
// |
|
737 |
EXPORT_C TInt CHnEngine::InitializeL( CLiwGenericParamList& aParam ) |
|
738 |
{ |
|
739 |
DEBUG(("_MM_:CMatrixMenuAppUi::InitializeL IN")); |
|
740 |
User::LeaveIfError( HandleNewSuiteLoadedEventL( aParam ) ); |
|
741 |
DEBUG(("_MM_:CMatrixMenuAppUi::InitializeL OUT")); |
|
742 |
// This is an interface method so some value has to be returned. |
|
743 |
return KErrNone; |
|
744 |
} |
|
745 |
||
746 |
// --------------------------------------------------------------------------- |
|
747 |
// |
|
748 |
// --------------------------------------------------------------------------- |
|
749 |
// |
|
750 |
void CHnEngine::ParseSuiteUriPathL( const TDesC8& aUriPath, |
|
751 |
CDesC8ArrayFlat& aOutput ) |
|
752 |
{ |
|
753 |
DEBUG(("_MM_:CHnEngine::ParseSuiteUriPathL IN")); |
|
754 |
DEBUG(("_MM_:\tURI path: %S",&aUriPath)); |
|
755 |
if ( aUriPath.Length() ) |
|
756 |
{ |
|
757 |
// copy the path so we can freely trim already parsed chunks |
|
758 |
RBuf8 buf( aUriPath.AllocL() ); |
|
759 |
CleanupClosePushL( buf ); |
|
760 |
||
761 |
// get rid of the initial slash |
|
762 |
if ( buf[0] == KSlash8()[0] ) |
|
763 |
{ |
|
764 |
buf.Delete( 0, 1 ); |
|
765 |
DEBUG(("_MM_:\tDeleted leading slash")); |
|
766 |
} |
|
767 |
||
768 |
// get the first chunk |
|
769 |
TInt slashPos = buf.Find( KSlash8 ); |
|
770 |
TPtrC8 chunkPtr; |
|
771 |
if ( slashPos != KErrNotFound ) |
|
772 |
{ |
|
773 |
chunkPtr.Set( buf.Left( slashPos ) ); |
|
774 |
} |
|
775 |
else |
|
776 |
{ |
|
777 |
// no slash - one chunk path |
|
778 |
chunkPtr.Set( buf ); |
|
779 |
} |
|
780 |
||
781 |
while ( chunkPtr.Length() ) |
|
782 |
{ |
|
783 |
aOutput.AppendL( chunkPtr ); |
|
784 |
DEBUG8(( "_MM_:\t\tParsed segment: %S", &chunkPtr )); |
|
785 |
||
786 |
// get rid of the parsed chunk and get a new one |
|
787 |
if ( slashPos != KErrNotFound ) |
|
788 |
{ |
|
789 |
// also remove the trailing slash |
|
790 |
buf.Delete( 0, chunkPtr.Length() + 1 ); |
|
791 |
slashPos = buf.Find( KSlash8 ); |
|
792 |
if ( slashPos != KErrNotFound ) |
|
793 |
{ |
|
794 |
chunkPtr.Set( buf.Left( slashPos ) ); |
|
795 |
} |
|
796 |
else |
|
797 |
{ |
|
798 |
// last chunk |
|
799 |
chunkPtr.Set( buf ); |
|
800 |
} |
|
801 |
} |
|
802 |
else |
|
803 |
{ |
|
804 |
// no slashes found, this was the last one |
|
805 |
break; |
|
806 |
} |
|
807 |
} |
|
808 |
||
809 |
CleanupStack::PopAndDestroy( &buf ); |
|
810 |
} |
|
811 |
DEBUG(("_MM_:CHnEngine::ParseSuiteUriPathL OUT")); |
|
812 |
} |
|
813 |
||
814 |
// --------------------------------------------------------------------------- |
|
815 |
// |
|
816 |
// --------------------------------------------------------------------------- |
|
817 |
// |
|
818 |
EXPORT_C void CHnEngine::ResetModelsL() |
|
819 |
{ |
|
820 |
MMPERF(("CHnEngine::ResetModelsL - START")); |
|
821 |
||
822 |
iControllerInterface.NotifyUiRefreshL( ERemoveLiwObjects ); |
|
823 |
||
824 |
if( iSuiteContainer ) |
|
825 |
{ |
|
826 |
iSuiteContainer->RemoveLiwObjects(); |
|
827 |
} |
|
828 |
delete iMetaDataModel; |
|
829 |
iMetaDataModel = NULL; |
|
830 |
delete iSuiteContainer; |
|
831 |
iSuiteContainer = NULL; |
|
832 |
||
833 |
iSuiteContainer = CHnSuiteModelContainer::NewL( *this , iControllerInterface ); |
|
834 |
MMPERF(("CHnEngine::ResetModelsL - suite container ready")); |
|
835 |
||
836 |
iMetaDataModel = CHnMdModel::NewL( this, iSuiteContainer ); |
|
837 |
||
838 |
MMPERF(("CHnEngine::ResetModelsL - DONE")); |
|
839 |
} |
|
840 |
||
841 |
// --------------------------------------------------------------------------- |
|
842 |
// |
|
843 |
// --------------------------------------------------------------------------- |
|
844 |
// |
|
845 |
CLiwGenericParamList* CHnEngine::UriQueryToLiwListLC( |
|
846 |
const TDesC8& aUriQuery, const TDesC8& aUriFragment, const TDesC8& aSuiteName ) |
|
847 |
{ |
|
848 |
CLiwGenericParamList* list = CLiwGenericParamList::NewLC(); |
|
849 |
||
850 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
851 |
map->PushL(); |
|
852 |
||
853 |
RPointerArray< HBufC8 > params = SplitL( aUriQuery, KAnd8 ); |
|
854 |
||
855 |
for( TInt i = 0; i < params.Count(); i++ ) |
|
856 |
{ |
|
857 |
RPointerArray< HBufC8 > paramValue = SplitL( *params[ i ], KEquals8 ); |
|
858 |
CleanupResetAndDestroyPushL( paramValue ); |
|
859 |
ASSERT( paramValue.Count() == 2 ); |
|
860 |
map->InsertL( *paramValue[ 0 ], TLiwVariant( *paramValue[ 1 ] ) ); |
|
861 |
CleanupStack::PopAndDestroy( ¶mValue ); |
|
862 |
} |
|
863 |
||
864 |
if ( aUriFragment.Length() > 0 && aSuiteName.Length() > 0 ) |
|
865 |
{ |
|
866 |
map->InsertL( KUriHighlight, TLiwVariant( aUriFragment ) ); |
|
867 |
map->InsertL( KUriHighlightSuite, TLiwVariant( aSuiteName ) ); |
|
868 |
} |
|
869 |
||
870 |
list->AppendL( TLiwGenericParam( KParams8, TLiwVariant( map ))); |
|
871 |
||
872 |
params.ResetAndDestroy(); |
|
873 |
CleanupStack::PopAndDestroy( map ); |
|
874 |
||
875 |
return list; |
|
876 |
} |
|
877 |
||
878 |
// --------------------------------------------------------------------------- |
|
879 |
// |
|
880 |
// --------------------------------------------------------------------------- |
|
881 |
// |
|
882 |
RPointerArray< HBufC8 > CHnEngine::SplitL( const TDesC8& aSource, |
|
883 |
const TDesC8& aSeparator ) |
|
884 |
{ |
|
885 |
RPointerArray< HBufC8 > tokens; |
|
886 |
CleanupResetAndDestroyPushL( tokens ); |
|
887 |
||
888 |
if ( aSource.Length() > 0 && aSeparator.Length() > 0 ) |
|
889 |
{ |
|
890 |
TPtrC8 tmpSource = aSource; |
|
891 |
||
892 |
TPtrC8 token( KNullDesC8 ); |
|
893 |
||
894 |
while( ETrue ) |
|
895 |
{ |
|
896 |
TInt length = tmpSource.Find( aSeparator ); |
|
897 |
||
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
898 |
if( aSeparator == HnLogicalRelations::KParamUid8 |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
899 |
&& length != KErrNotFound ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
900 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
901 |
TInt ampPos( KErrNotFound ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
902 |
TInt eqPos( KErrNotFound ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
903 |
do |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
904 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
905 |
ampPos = tmpSource.Mid( |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
906 |
length + HnLogicalRelations::KParamUid8().Length() ). |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
907 |
Find( HnLogicalRelations::KLogicalAnd8 ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
908 |
if( ampPos >= 0 ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
909 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
910 |
length += (ampPos + HnLogicalRelations::KParamUid8().Length()); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
911 |
ampPos = 0; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
912 |
} |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
913 |
else if( (length + HnLogicalRelations::KParamUid8().Length()) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
914 |
== tmpSource.Length()) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
915 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
916 |
length = KErrNotFound; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
917 |
} |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
918 |
}while( !ampPos ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
919 |
} |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
920 |
|
34 | 921 |
if ( length >= 0 ) |
922 |
{ |
|
923 |
token.Set( tmpSource.Mid( 0, length ) ); |
|
924 |
tokens.AppendL( token.AllocL() ); |
|
925 |
tmpSource.Set( tmpSource.Mid( length + 1 ) ); |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
926 |
if( aSeparator == HnLogicalRelations::KLogicalEqual8 ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
927 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
928 |
token.Set( tmpSource ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
929 |
tokens.AppendL( token.AllocL() ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
930 |
break; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
931 |
} |
34 | 932 |
} |
933 |
else |
|
934 |
{ |
|
935 |
token.Set( tmpSource ); |
|
936 |
tokens.AppendL( token.AllocL() ); |
|
937 |
break; |
|
938 |
} |
|
939 |
} |
|
940 |
} |
|
941 |
CleanupStack::Pop( &tokens ); |
|
942 |
return tokens; |
|
943 |
} |
|
944 |
||
945 |
// --------------------------------------------------------------------------- |
|
946 |
// |
|
947 |
// --------------------------------------------------------------------------- |
|
948 |
// |
|
949 |
void CHnEngine::SetEditModeL( TBool aEditMode ) |
|
950 |
{ |
|
951 |
iEditMode = aEditMode; |
|
952 |
if ( aEditMode ) |
|
953 |
{ |
|
954 |
iMetaDataModel->SetModeL( EMdModeEdit ); |
|
955 |
} |
|
956 |
else |
|
957 |
{ |
|
958 |
iMetaDataModel->SetModeL( EMdModeNormal ); |
|
959 |
} |
|
960 |
//The suite on top of the stack is probably displayed. |
|
961 |
//Switching to edit mode has some dramatic ui impact, |
|
962 |
//thus when parts of the suite will get displayed |
|
963 |
//it may look awkward thus the suite on top of the stack |
|
964 |
//is marked as uninitialized, therefore ui will be able to |
|
965 |
//react only to the ready suite model. |
|
966 |
if (AknLayoutUtils::PenEnabled() || (!AknLayoutUtils::PenEnabled() && iEditMode)) |
|
967 |
{ |
|
968 |
GetLastSuiteModelL()->GetItemsOrder()->MarkSuiteUninitialized(); |
|
969 |
iMetaDataModel->EvaluateL(); |
|
970 |
} |
|
971 |
} |
|
972 |
||
973 |
// --------------------------------------------------------------------------- |
|
974 |
// |
|
975 |
// --------------------------------------------------------------------------- |
|
976 |
// |
|
977 |
TBool CHnEngine::IsOnlyRootConfLoaded() |
|
978 |
{ |
|
979 |
return ( iSuiteContainer && |
|
980 |
iSuiteContainer->GetSuiteModelCount() == KModelCountForRoot ); |
|
981 |
} |
|
982 |
||
983 |
// --------------------------------------------------------------------------- |
|
984 |
// |
|
985 |
// --------------------------------------------------------------------------- |
|
986 |
// |
|
987 |
||
988 |
EXPORT_C void CHnEngine::HandleRequestL( const CLiwGenericParamList& aParam, |
|
989 |
CLiwGenericParamList* /*aOutput*/ ) |
|
990 |
{ |
|
991 |
TInt pos( 0 ); |
|
992 |
aParam.FindFirst( pos, KHnRequest ); |
|
993 |
if (pos != KErrNotFound) |
|
994 |
{ |
|
995 |
TPtrC8 command = aParam[pos].Value().AsData(); |
|
996 |
if( command == KSetFocus ) |
|
997 |
{ |
|
998 |
HandleSetFocusEventL( aParam ); |
|
999 |
} |
|
1000 |
else if( command == KMoveFocusBeforeDelete ) |
|
1001 |
{ |
|
1002 |
HandleMoveFocusBeforeDeleteEventL( aParam ); |
|
1003 |
} |
|
1004 |
else if( command == KRefreshIcons ) |
|
1005 |
{ |
|
1006 |
HandleRefreshIconsEventL( aParam ); |
|
1007 |
} |
|
1008 |
else if (command == KEvaluateMdModel) |
|
1009 |
{ |
|
1010 |
GetLastSuiteModelL()->GetItemsOrder()->MarkSuiteUninitialized(); |
|
1011 |
iMetaDataModel->EvaluateL(); |
|
1012 |
} |
|
1013 |
else if ( command == KDisableActionsForItem ) |
|
1014 |
{ |
|
1015 |
HandleDisableActionsForItemL( aParam ); |
|
1016 |
} |
|
1017 |
} |
|
1018 |
} |
|
1019 |
||
1020 |
// --------------------------------------------------------------------------- |
|
1021 |
// |
|
1022 |
// --------------------------------------------------------------------------- |
|
1023 |
// |
|
1024 |
void CHnEngine::LoadFromCrL( const TDesC8& aUri ) |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1025 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1026 |
HBufC8* uriBuf = HBufC8::NewLC( aUri.Length() ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1027 |
uriBuf->Des().Copy( aUri ); |
34 | 1028 |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1029 |
TUriParser8 parser; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1030 |
parser.Parse( *uriBuf ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1031 |
User::LeaveIfError( parser.IsSchemeValid() ? KErrNone : KErrPathNotFound ); |
34 | 1032 |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1033 |
const TDesC8& query = parser.Extract( EUriQuery ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1034 |
RPointerArray< HBufC8 > params = SplitL( query, HnLogicalRelations::KParamUid8); |
34 | 1035 |
|
1036 |
TBuf8<KApaMaxAppGroupName + KTimeStampBufferLength + KUidStringLength + 2> item; |
|
1037 |
||
1038 |
for( TInt i = 0; i < params.Count(); i++ ) |
|
1039 |
{ |
|
1040 |
RPointerArray< HBufC8 > paramValue = SplitL( *params[ i ], HnLogicalRelations::KLogicalEqual8 ); |
|
1041 |
CleanupResetAndDestroyPushL( paramValue ); |
|
1042 |
ASSERT( paramValue.Count() == 2 ); |
|
1043 |
||
1044 |
if ( !paramValue[0]->Compare(KMcsAppGroupName8) ) |
|
1045 |
{ |
|
1046 |
TBuf8<KApaMaxAppGroupName> appgrname; |
|
1047 |
if( paramValue[1]->Length()<=KApaMaxAppGroupName ) |
|
1048 |
{ |
|
1049 |
appgrname.Append( *paramValue[1] ); |
|
1050 |
} |
|
1051 |
||
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1052 |
//get current time |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1053 |
TTime currentTime; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1054 |
currentTime.HomeTime(); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1055 |
TDateTime date(currentTime.DateTime()); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1056 |
item.Format(KCRepTimeFormat, &appgrname , date.Year(), date.Month(), |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1057 |
date.Day(), date.Hour(), date.Minute(), date.Second(), date.MicroSecond()); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1058 |
} |
34 | 1059 |
else if ( !paramValue[0]->Compare( KKeyTypeUid ) ) |
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1060 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1061 |
item.Append( KComma8 ); |
34 | 1062 |
if( paramValue[1]->Length()<=KUidStringLength ) |
1063 |
{ |
|
1064 |
item.Append( *paramValue[1] ); |
|
1065 |
} |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1066 |
} |
34 | 1067 |
CleanupStack::PopAndDestroy( ¶mValue ); |
1068 |
} |
|
1069 |
||
1070 |
TBuf<KApaMaxAppGroupName + KTimeStampBufferLength + KUidStringLength + 2> item1; |
|
1071 |
item1.Copy(item); |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1072 |
CRepository *cenRep = CRepository::NewLC( KCRUidMenu ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1073 |
cenRep->Set(KMenuShowFolder, item1); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1074 |
CleanupStack::PopAndDestroy( cenRep ); |
34 | 1075 |
|
1076 |
params.ResetAndDestroy(); |
|
1077 |
CleanupStack::PopAndDestroy( uriBuf ); |
|
1078 |
||
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1079 |
} |
34 | 1080 |
// --------------------------------------------------------------------------- |
1081 |
// |
|
1082 |
// --------------------------------------------------------------------------- |
|
1083 |
// |
|
1084 |
void CHnEngine::LightStatusChanged(TInt aTarget, |
|
1085 |
CHWRMLight::TLightStatus aStatus) |
|
1086 |
{ |
|
1087 |
DEBUG(("_Mm_:CHnEngine::LightStatusChanged: target %d, status %d - IN", aTarget, aStatus)); |
|
1088 |
if (CHWRMLight::EPrimaryDisplay == aTarget |
|
1089 |
|| CHWRMLight::EPrimaryDisplayAndKeyboard == aTarget) |
|
1090 |
{ |
|
1091 |
switch (aStatus) |
|
1092 |
{ |
|
1093 |
case CHWRMLight::ELightOn: |
|
1094 |
{ |
|
1095 |
TRAP_IGNORE( iControllerInterface.NotifyUiRefreshL(ELightOn) ); |
|
1096 |
break; |
|
1097 |
} |
|
1098 |
case CHWRMLight::ELightOff: |
|
1099 |
{ |
|
1100 |
TRAP_IGNORE( iControllerInterface.NotifyUiRefreshL(ELightOff) ); |
|
1101 |
break; |
|
1102 |
} |
|
1103 |
} |
|
1104 |
} |
|
1105 |
DEBUG(("_Mm_:CMmAppUi::LightStatusChanged - OUT")); |
|
1106 |
} |
|
1107 |
||
1108 |
// --------------------------------------------------------------------------- |
|
1109 |
// |
|
1110 |
// --------------------------------------------------------------------------- |
|
1111 |
// |
|
1112 |
TBool CHnEngine::HandleActionL( const TDesC8& aUri ) |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1113 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1114 |
TBool exitActionConsumed(EFalse); |
34 | 1115 |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1116 |
HBufC8* uriBuf = HBufC8::NewLC( aUri.Length() ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1117 |
uriBuf->Des().Copy( aUri ); |
34 | 1118 |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1119 |
TUriParser8 parser; |
34 | 1120 |
parser.Parse( *uriBuf ); |
1121 |
User::LeaveIfError( parser.IsSchemeValid() ? KErrNone : KErrPathNotFound ); |
|
1122 |
||
1123 |
const TDesC8& host8 = parser.Extract( EUriHost ); |
|
1124 |
const TDesC8& query = parser.Extract( EUriQuery ); |
|
1125 |
||
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1126 |
RBuf action; |
34 | 1127 |
CleanupClosePushL( action ); |
1128 |
CLiwGenericParamList* paramsUri = UriQueryToLiwListLC( query, KNullDesC8, KNullDesC8 ); |
|
1129 |
HnLiwUtils::GetStringL( *paramsUri, KActionParams, action ); |
|
1130 |
||
1131 |
if ( !action.Compare( KActionExit ) ) |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1132 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1133 |
RBuf host; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1134 |
host.CreateL( host8.Length() ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1135 |
CleanupClosePushL( host ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1136 |
host.Copy(host8); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1137 |
CHnSuiteModel* suiteModel = iSuiteContainer->GetSuiteModel( host ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1138 |
TBool exitHideHostNotFound( ETrue ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1139 |
if( suiteModel && suiteModel->ExitMode() == EExitModeHide ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1140 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1141 |
exitHideHostNotFound = EFalse; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1142 |
} |
34 | 1143 |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1144 |
if ( exitHideHostNotFound ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1145 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1146 |
//send to foreground |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1147 |
CLiwGenericParamList* pl = CLiwGenericParamList::NewL(); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1148 |
CleanupStack::PushL( pl ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1149 |
HandleModelEventL( KAppGainForeground, *pl ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1150 |
CleanupStack::PopAndDestroy( pl ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1151 |
} |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1152 |
else |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1153 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1154 |
//send to background |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1155 |
CLiwGenericParamList* pl = CLiwGenericParamList::NewL(); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1156 |
CleanupStack::PushL( pl ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1157 |
HandleModelEventL( KAppGainBackground, *pl ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1158 |
CleanupStack::PopAndDestroy( pl ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1159 |
} |
34 | 1160 |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1161 |
if ( exitHideHostNotFound && iSuiteContainer->GetLastSuiteModel() == suiteModel ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1162 |
{ |
34 | 1163 |
HandleBackEventL( host, 1 ); |
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1164 |
} |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1165 |
else |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1166 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1167 |
//reset to root |
34 | 1168 |
CLiwGenericParamList* params = CLiwGenericParamList::NewLC(); |
1169 |
params->AppendL( iMetaDataModel->GetSuiteParameters( 0 ) ); |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1170 |
ResetModelsL(); |
34 | 1171 |
InitializeL( *params ); |
1172 |
CleanupStack::PopAndDestroy( params ); |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1173 |
} |
34 | 1174 |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1175 |
CleanupStack::PopAndDestroy( &host ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1176 |
exitActionConsumed = ETrue; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1177 |
} |
34 | 1178 |
|
1179 |
CleanupStack::PopAndDestroy( paramsUri ); |
|
1180 |
CleanupStack::PopAndDestroy( &action ); |
|
1181 |
CleanupStack::PopAndDestroy( uriBuf ); |
|
1182 |
return exitActionConsumed; |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1183 |
} |
34 | 1184 |
|
1185 |
// --------------------------------------------------------------------------- |
|
1186 |
// |
|
1187 |
// --------------------------------------------------------------------------- |
|
1188 |
// |
|
1189 |
void CHnEngine::LoadSuitesL( const TDesC8& aUri ) |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1190 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1191 |
TBool sendToForeground(EFalse); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1192 |
HBufC8* uriBuf = HBufC8::NewLC( aUri.Length() ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1193 |
uriBuf->Des().Copy( aUri ); |
34 | 1194 |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1195 |
TUriParser8 parser; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1196 |
parser.Parse( *uriBuf ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1197 |
User::LeaveIfError( parser.IsSchemeValid() ? KErrNone : KErrPathNotFound ); |
34 | 1198 |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1199 |
CDesC8ArrayFlat* suiteNameArray = new( ELeave ) CDesC8ArrayFlat( KDefaultGranularity ) ; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1200 |
CleanupStack::PushL( suiteNameArray ); |
34 | 1201 |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1202 |
const TDesC8& host = parser.Extract( EUriHost ); |
34 | 1203 |
RBuf8 host8; |
1204 |
CleanupClosePushL( host8 ); |
|
1205 |
if (host.Compare( KNullDesC8 )) |
|
1206 |
{ |
|
1207 |
host8.CreateL( host ); |
|
1208 |
host8.LowerCase(); |
|
1209 |
suiteNameArray->AppendL( host8 ); |
|
1210 |
DEBUG8(( "_MM_:\tURI host part: %S", &host8 )); |
|
1211 |
} |
|
1212 |
||
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1213 |
const TDesC8& path = parser.Extract( EUriPath ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1214 |
if (path.Compare( KNullDesC8 )) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1215 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1216 |
HBufC8* path8 = HBufC8::NewLC( path.Length() ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1217 |
path8->Des().Copy( path ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1218 |
path8->Des().LowerCase(); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1219 |
ParseSuiteUriPathL( *path8, *suiteNameArray ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1220 |
CleanupStack::PopAndDestroy( path8 ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1221 |
} |
34 | 1222 |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1223 |
TBool suiteExists( EFalse ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1224 |
iMetaDataModel->IgnoreEvaluations( ETrue ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1225 |
iMetaDataModel->QueueForeground( CHnMdModel::EWhenAnySuiteIsEvaluated ); |
34 | 1226 |
|
1227 |
if( host8.Length() == 0 || ( host8.Length() > 0 && |
|
1228 |
!iMetaDataModel->SuiteModelExistsL( host8 ) ) ) |
|
1229 |
{ |
|
1230 |
suiteNameArray->Reset(); |
|
1231 |
suiteNameArray->AppendL( KRoot8 ); |
|
1232 |
} |
|
1233 |
||
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1234 |
for( TInt i = 0; i < suiteNameArray->Count(); ++i ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1235 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1236 |
suiteExists = iMetaDataModel->SuiteModelExistsL( |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1237 |
( *suiteNameArray )[i] ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1238 |
TBool nextExists = i < suiteNameArray->Count() - 1 && |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1239 |
iMetaDataModel->SuiteModelExistsL( ( *suiteNameArray )[i + 1] ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1240 |
TBool isLast = ( i == ( suiteNameArray->Count() - 1 ) ); |
34 | 1241 |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1242 |
TBool turnOnEvaluation = ( suiteExists && ( !nextExists || isLast ) ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1243 |
if( turnOnEvaluation || !suiteExists ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1244 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1245 |
iMetaDataModel->IgnoreEvaluations( EFalse ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1246 |
} |
34 | 1247 |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1248 |
TInt err( KErrNone ); |
34 | 1249 |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1250 |
// Ignore loading new suite if the last suite in model is the same |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1251 |
// as first one in the uri. |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1252 |
if ( i == 0 ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1253 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1254 |
if ( SuitesAreTheSameL( iMetaDataModel->GetLastSuite()->SuiteName(), (*suiteNameArray)[i] ) ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1255 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1256 |
HandleTheSameSuitesL( nextExists, parser.Extract( EUriQuery ) ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1257 |
sendToForeground = ETrue; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1258 |
continue; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1259 |
} |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1260 |
} |
34 | 1261 |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1262 |
if( suiteExists ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1263 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1264 |
if (!nextExists) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1265 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1266 |
// Tricky: queue foreground so that if the suite is evaluated synchronously |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1267 |
// the foreground will be gained. |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1268 |
iMetaDataModel->QueueForeground( CHnMdModel::EWhenAnySuiteIsEvaluated ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1269 |
} |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1270 |
err = LoadSuiteFromUriL( |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1271 |
( *suiteNameArray )[i], parser.Extract( EUriQuery ), parser.Extract( EUriFragment ) ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1272 |
if ( KErrNone == err && !nextExists && iMetaDataModel->IsForegroundQueued() ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1273 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1274 |
// Tricky: if foreground is still queued it means that the suite is evaluated |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1275 |
// asynchronously. Override the previos foreground queue setting with one |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1276 |
// that will be effective only if the last loaded suite is evaluated. |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1277 |
iMetaDataModel->QueueForeground( CHnMdModel::EWhenCurrentTopSuiteIsEvaluated ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1278 |
} |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1279 |
if ( err != KErrNone ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1280 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1281 |
sendToForeground = ETrue; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1282 |
} |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1283 |
} |
34 | 1284 |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1285 |
if( !suiteExists || err != KErrNone || !nextExists ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1286 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1287 |
CHnFilter* filter = CHnFilter::NewLC(); |
34 | 1288 |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1289 |
filter->SetSuiteId( |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1290 |
iSuiteContainer->GetLastSuiteModel()->CustomId() ); |
34 | 1291 |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1292 |
filter->SetEvaluateSuiteL( ETrue ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1293 |
iMetaDataModel->IgnoreEvaluations( EFalse ); |
34 | 1294 |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1295 |
TRAPD( err, iMetaDataModel->EvaluateL( *filter ) ); |
34 | 1296 |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1297 |
CleanupStack::PopAndDestroy( filter ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1298 |
if( err ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1299 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1300 |
iMetaDataModel->DeleteLastSuite(); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1301 |
iSuiteContainer->PopSuiteModelL( |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1302 |
HnConvUtils::Str8ToStr( ( *suiteNameArray )[i] )->Des() ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1303 |
sendToForeground = ETrue; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1304 |
} |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1305 |
break; |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1306 |
} |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1307 |
} |
34 | 1308 |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1309 |
// set highlight only when path is valid! |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1310 |
if( suiteExists ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1311 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1312 |
HighlightPlacementFromUriL( parser.Extract( EUriFragment ) ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1313 |
} |
34 | 1314 |
|
1315 |
CleanupStack::PopAndDestroy( &host8 ); |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1316 |
CleanupStack::PopAndDestroy( suiteNameArray ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1317 |
CleanupStack::PopAndDestroy( uriBuf ); |
34 | 1318 |
|
1319 |
// send to foreground |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1320 |
if ( sendToForeground ) |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1321 |
{ |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1322 |
CLiwGenericParamList* pl = CLiwGenericParamList::NewL(); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1323 |
CleanupStack::PushL( pl ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1324 |
HandleModelEventL( KAppGainForeground, *pl ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1325 |
CleanupStack::PopAndDestroy( pl ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1326 |
iMetaDataModel->QueueForeground( CHnMdModel::ENever ); |
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1327 |
} |
34 | 1328 |
|
35
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1329 |
} |
34 | 1330 |
|
1331 |
// End of file |