29
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 - 2010 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 |
#include <mcsmenuitem.h>
|
|
18 |
#include <mcsmenufilter.h>
|
|
19 |
#include <itemmap.h>
|
|
20 |
#include <aistrcnv.h>
|
|
21 |
|
|
22 |
#include "carouselplugindata.h"
|
|
23 |
#include "carouselpluginengine.h"
|
|
24 |
|
|
25 |
using namespace HSPluginSettingsIf;
|
|
26 |
|
|
27 |
_LIT( KMenuAttrParam, "param" );
|
|
28 |
_LIT( KMenuAttrLocked, "locked" );
|
|
29 |
_LIT8( KProperNameType, "type" );
|
|
30 |
_LIT8( KProperNameParam, "param" );
|
|
31 |
_LIT8( KProperNameUid, "uid" );
|
|
32 |
_LIT8( KProperNameView, "view" );
|
|
33 |
_LIT8( KProperNameLocked, "locked" );
|
|
34 |
_LIT8( KProperValueFolder, "folder" );
|
|
35 |
_LIT8( KProperValueBookmark, "bookmark" );
|
|
36 |
_LIT8( KProperValueAppl, "application" );
|
|
37 |
_LIT8( KProperValueMailbox, "mailbox" );
|
|
38 |
_LIT8( KMenuAttrUndefUid, "0x99999991" );
|
|
39 |
|
|
40 |
_LIT( KMyMenuData, "matrixmenudata" );
|
|
41 |
_LIT( KMenuTypeMailbox, "menu:mailbox" );
|
|
42 |
|
|
43 |
|
|
44 |
#define KMCSCmailMtmUidValue 0x2001F406
|
|
45 |
|
|
46 |
// ======== LOCAL FUNCTIONS ========
|
|
47 |
|
|
48 |
// ----------------------------------------------------------------------------
|
|
49 |
// CleanupResetAndDestroy()
|
|
50 |
// ----------------------------------------------------------------------------
|
|
51 |
//
|
|
52 |
template<class T>
|
|
53 |
static void CleanupResetAndDestroy( TAny* aObj )
|
|
54 |
{
|
|
55 |
if( aObj )
|
|
56 |
{
|
|
57 |
static_cast<T*>( aObj )->ResetAndDestroy();
|
|
58 |
}
|
|
59 |
}
|
|
60 |
|
|
61 |
// ----------------------------------------------------------------------------
|
|
62 |
// CleanupResetAndDestroyPushL
|
|
63 |
// ----------------------------------------------------------------------------
|
|
64 |
//
|
|
65 |
template<class T>
|
|
66 |
static void CleanupResetAndDestroyPushL(T& aArray)
|
|
67 |
{
|
|
68 |
CleanupStack::PushL( TCleanupItem( &CleanupResetAndDestroy<T>, &aArray ) );
|
|
69 |
}
|
|
70 |
|
|
71 |
// ======== MEMBER FUNCTIONS ========
|
|
72 |
|
|
73 |
// ---------------------------------------------------------------------------
|
|
74 |
// Default constructor
|
|
75 |
// ---------------------------------------------------------------------------
|
|
76 |
//
|
|
77 |
CCarouselData::CCarouselData()
|
|
78 |
:iDirty( ETrue )
|
|
79 |
{
|
|
80 |
}
|
|
81 |
|
|
82 |
// ---------------------------------------------------------------------------
|
|
83 |
// Destructor
|
|
84 |
// ---------------------------------------------------------------------------
|
|
85 |
//
|
|
86 |
CCarouselData::~CCarouselData()
|
|
87 |
{
|
|
88 |
delete iName;
|
|
89 |
delete iValue;
|
|
90 |
}
|
|
91 |
|
|
92 |
// ---------------------------------------------------------------------------
|
|
93 |
//
|
|
94 |
// ---------------------------------------------------------------------------
|
|
95 |
//
|
|
96 |
void CCarouselData::SetMenuItem( TMenuItem& aMenuItem )
|
|
97 |
{
|
|
98 |
iMenuItem = aMenuItem;
|
|
99 |
}
|
|
100 |
|
|
101 |
// ---------------------------------------------------------------------------
|
|
102 |
//
|
|
103 |
// ---------------------------------------------------------------------------
|
|
104 |
//
|
|
105 |
TMenuItem& CCarouselData::MenuItem()
|
|
106 |
{
|
|
107 |
return iMenuItem;
|
|
108 |
}
|
|
109 |
|
|
110 |
// ---------------------------------------------------------------------------
|
|
111 |
//
|
|
112 |
// ---------------------------------------------------------------------------
|
|
113 |
//
|
|
114 |
TDesC& CCarouselData::Name()
|
|
115 |
{
|
|
116 |
return *iName;
|
|
117 |
}
|
|
118 |
|
|
119 |
// ---------------------------------------------------------------------------
|
|
120 |
//
|
|
121 |
// ---------------------------------------------------------------------------
|
|
122 |
//
|
|
123 |
void CCarouselData::SetNameL( const TDesC& aName )
|
|
124 |
{
|
|
125 |
delete iName;
|
|
126 |
iName = NULL;
|
|
127 |
iName = aName.AllocL();
|
|
128 |
}
|
|
129 |
|
|
130 |
// ---------------------------------------------------------------------------
|
|
131 |
//
|
|
132 |
// ---------------------------------------------------------------------------
|
|
133 |
//
|
|
134 |
TDesC& CCarouselData::Value()
|
|
135 |
{
|
|
136 |
return *iValue;
|
|
137 |
}
|
|
138 |
|
|
139 |
// ---------------------------------------------------------------------------
|
|
140 |
//
|
|
141 |
// ---------------------------------------------------------------------------
|
|
142 |
//
|
|
143 |
void CCarouselData::SetValueL( const TDesC& aValue )
|
|
144 |
{
|
|
145 |
delete iValue;
|
|
146 |
iValue = NULL;
|
|
147 |
iValue = aValue.AllocL();
|
|
148 |
}
|
|
149 |
|
|
150 |
// ---------------------------------------------------------------------------
|
|
151 |
//
|
|
152 |
// ---------------------------------------------------------------------------
|
|
153 |
//
|
|
154 |
void CCarouselData::SetDirty( TBool aDirty )
|
|
155 |
{
|
|
156 |
iDirty = aDirty;
|
|
157 |
}
|
|
158 |
|
|
159 |
// ---------------------------------------------------------------------------
|
|
160 |
//
|
|
161 |
// ---------------------------------------------------------------------------
|
|
162 |
//
|
|
163 |
TBool CCarouselData::IsDirty() const
|
|
164 |
{
|
|
165 |
return iDirty;
|
|
166 |
}
|
|
167 |
|
|
168 |
|
|
169 |
// ---------------------------------------------------------------------------
|
|
170 |
// Symbian 2nd phase constructor can leave
|
|
171 |
// ---------------------------------------------------------------------------
|
|
172 |
//
|
|
173 |
CCarouselPluginData* CCarouselPluginData::NewL( CCarouselPluginEngine& aEngine, const TDesC8& aInstanceUid )
|
|
174 |
{
|
|
175 |
CCarouselPluginData* self = new (ELeave) CCarouselPluginData( aEngine, aInstanceUid );
|
|
176 |
CleanupStack::PushL( self );
|
|
177 |
self->ConstructL();
|
|
178 |
CleanupStack::Pop( self );
|
|
179 |
|
|
180 |
return self;
|
|
181 |
}
|
|
182 |
|
|
183 |
// ---------------------------------------------------------------------------
|
|
184 |
// Default constructor
|
|
185 |
// ---------------------------------------------------------------------------
|
|
186 |
//
|
|
187 |
CCarouselPluginData::CCarouselPluginData( CCarouselPluginEngine& aEngine, const TDesC8& aInstanceUid )
|
|
188 |
: iEngine( aEngine ), iInstanceUid( aInstanceUid )
|
|
189 |
{
|
|
190 |
}
|
|
191 |
|
|
192 |
// ---------------------------------------------------------------------------
|
|
193 |
// Symbian 2nd phase constructor can leave
|
|
194 |
// ---------------------------------------------------------------------------
|
|
195 |
//
|
|
196 |
void CCarouselPluginData::ConstructL()
|
|
197 |
{
|
|
198 |
iPluginSettings = CHomescreenSettings::Instance();
|
|
199 |
if( iPluginSettings == NULL )
|
|
200 |
{
|
|
201 |
User::Leave( KErrUnknown );
|
|
202 |
}
|
|
203 |
iPluginSettings->AddObserverL( this );
|
|
204 |
|
|
205 |
iMenu.OpenL( KMyMenuData );
|
|
206 |
|
|
207 |
UpdateDataL();
|
|
208 |
}
|
|
209 |
|
|
210 |
// ---------------------------------------------------------------------------
|
|
211 |
// Destructor
|
|
212 |
// ---------------------------------------------------------------------------
|
|
213 |
//
|
|
214 |
CCarouselPluginData::~CCarouselPluginData()
|
|
215 |
{
|
|
216 |
if( iPluginSettings )
|
|
217 |
{
|
|
218 |
iPluginSettings->RemoveObserver( this );
|
|
219 |
}
|
|
220 |
iData.ResetAndDestroy();
|
|
221 |
iMenu.Close();
|
|
222 |
}
|
|
223 |
|
|
224 |
// ---------------------------------------------------------------------------
|
|
225 |
// Gets the instance specific settings from HSPS and creates data items
|
|
226 |
// ---------------------------------------------------------------------------
|
|
227 |
//
|
|
228 |
void CCarouselPluginData::UpdateDataL()
|
|
229 |
{
|
|
230 |
RPointerArray<CItemMap> settings;
|
|
231 |
CleanupResetAndDestroyPushL( settings );
|
|
232 |
|
|
233 |
User::LeaveIfError( iPluginSettings->GetSettingsL( iInstanceUid, settings ) );
|
|
234 |
if ( settings.Count() <= 0 )
|
|
235 |
{
|
|
236 |
User::Leave( KErrNotFound );
|
|
237 |
}
|
|
238 |
|
|
239 |
TBool wasEmpty = !iData.Count();
|
|
240 |
|
|
241 |
for ( TInt i = 0; i < settings.Count(); i++ )
|
|
242 |
{
|
|
243 |
CItemMap* itemMap = settings[ i ];
|
|
244 |
|
|
245 |
// get properties
|
|
246 |
RPointerArray<HSPluginSettingsIf::CPropertyMap>& properties
|
|
247 |
= itemMap->Properties();
|
|
248 |
|
|
249 |
CCarouselData* data = GetMenuDataL( properties );
|
|
250 |
CleanupStack::PushL( data );
|
|
251 |
if ( wasEmpty )
|
|
252 |
{
|
|
253 |
// list of shortcut slot was empty
|
|
254 |
// we append the shortcut data slots one-by-one to the list
|
|
255 |
data->SetDirty( ETrue );
|
|
256 |
iData.AppendL( data );
|
|
257 |
CleanupStack::Pop( data );
|
|
258 |
}
|
|
259 |
else
|
|
260 |
{
|
|
261 |
// check for updates in existing shortcut data slot
|
|
262 |
// if menuitem id has changed, replace the item and
|
|
263 |
// set as dirty
|
|
264 |
TInt id( iData[ i ]->MenuItem().Id() );
|
|
265 |
|
|
266 |
// id of all bookmarks is zero so name has to be check
|
|
267 |
// in case of bookmark has changed
|
|
268 |
if ( id >= 0 && ( data->MenuItem().Id() != id ||
|
|
269 |
( id == 0 && data->Name().CompareF(
|
|
270 |
iData[ i ]->Name() ) != 0 ) ) )
|
|
271 |
{
|
|
272 |
data->SetDirty( ETrue );
|
|
273 |
CCarouselData* oldData = iData[i];
|
|
274 |
iData.Remove( i );
|
|
275 |
delete oldData;
|
|
276 |
|
|
277 |
iData.InsertL( data, i );
|
|
278 |
CleanupStack::Pop( data );
|
|
279 |
}
|
|
280 |
else
|
|
281 |
{
|
|
282 |
CleanupStack::PopAndDestroy( data );
|
|
283 |
}
|
|
284 |
}
|
|
285 |
}
|
|
286 |
|
|
287 |
// Leave if there isn't any data filled into array as there isn't
|
|
288 |
// anything shortcut to publish on homescreen.
|
|
289 |
if ( iData.Count() <= 0 )
|
|
290 |
{
|
|
291 |
User::Leave( KErrNotFound );
|
|
292 |
}
|
|
293 |
|
|
294 |
// Cleanup.
|
|
295 |
CleanupStack::PopAndDestroy(); // settings
|
|
296 |
}
|
|
297 |
|
|
298 |
// ---------------------------------------------------------------------------
|
|
299 |
// Removes obsolete data and saves 'Undefined' item to HSPS
|
|
300 |
// Used when active mailbox is deleted from system.
|
|
301 |
// ---------------------------------------------------------------------------
|
|
302 |
//
|
|
303 |
void CCarouselPluginData::RemoveDataL( TInt aId )
|
|
304 |
{
|
|
305 |
TInt count = iData.Count();
|
|
306 |
for( TInt i = 0; i < count; i++ )
|
|
307 |
{
|
|
308 |
CCarouselData* data = iData[i];
|
|
309 |
if( data->MenuItem().Type() == KMenuTypeMailbox &&
|
|
310 |
data->MenuItem().Id() == aId )
|
|
311 |
{
|
|
312 |
iData[i]->MenuItem().SetId( KErrNotFound );
|
|
313 |
iData[i]->SetDirty( ETrue );
|
|
314 |
SaveUndefinedItemL( i );
|
|
315 |
}
|
|
316 |
}
|
|
317 |
}
|
|
318 |
|
|
319 |
// ---------------------------------------------------------------------------
|
|
320 |
// Call back from Homescreen settings
|
|
321 |
// ---------------------------------------------------------------------------
|
|
322 |
//
|
|
323 |
void CCarouselPluginData::SettingsChangedL( const TDesC8& /*aEvent*/, const TDesC8& /*aPluginName*/,
|
|
324 |
const TDesC8& /*aPluginUid*/, const TDesC8& aPluginId )
|
|
325 |
{
|
|
326 |
if( aPluginId.CompareF( iInstanceUid ) == 0 )
|
|
327 |
{
|
|
328 |
UpdateDataL();
|
|
329 |
}
|
|
330 |
}
|
|
331 |
|
|
332 |
// ---------------------------------------------------------------------------
|
|
333 |
// Gets the menu item from engine using the setting properties as filter
|
|
334 |
// ---------------------------------------------------------------------------
|
|
335 |
//
|
|
336 |
CCarouselData* CCarouselPluginData::GetMenuDataL(
|
|
337 |
RPointerArray<HSPluginSettingsIf::CPropertyMap>& aProperties )
|
|
338 |
{
|
|
339 |
if ( aProperties.Count() <= 0 )
|
|
340 |
{
|
|
341 |
User::Leave( KErrArgument );
|
|
342 |
}
|
|
343 |
|
|
344 |
TPtrC8 type;
|
|
345 |
TPtrC8 uid;
|
|
346 |
TPtrC8 view;
|
|
347 |
TPtrC8 param;
|
|
348 |
|
|
349 |
// first we need to check the item type
|
|
350 |
for ( TInt i = 0; i < aProperties.Count(); i++ )
|
|
351 |
{
|
|
352 |
if ( aProperties[i]->Name() == KProperNameType )
|
|
353 |
{
|
|
354 |
type.Set( aProperties[i]->Value());
|
|
355 |
}
|
|
356 |
else if( aProperties[i]->Name() == KProperNameUid)
|
|
357 |
{
|
|
358 |
uid.Set( aProperties[i]->Value());
|
|
359 |
}
|
|
360 |
else if( aProperties[i]->Name() == KProperNameView)
|
|
361 |
{
|
|
362 |
view.Set( aProperties[i]->Value());
|
|
363 |
}
|
|
364 |
else if( aProperties[i]->Name() == KProperNameParam )
|
|
365 |
{
|
|
366 |
param.Set( aProperties[i]->Value());
|
|
367 |
}
|
|
368 |
}
|
|
369 |
CCarouselData* data = new ( ELeave ) CCarouselData();
|
|
370 |
CleanupStack::PushL( data );
|
|
371 |
if( type == KProperValueBookmark )
|
|
372 |
{
|
|
373 |
GetBkmDataL( uid, view, param, *data );
|
|
374 |
}
|
|
375 |
else if( type == KProperValueFolder )
|
|
376 |
{
|
|
377 |
GetFolderData( param, *data );
|
|
378 |
}
|
|
379 |
else if( type == KProperValueMailbox )
|
|
380 |
{
|
|
381 |
GetMailboxDataL( uid, param, *data );
|
|
382 |
}
|
|
383 |
else
|
|
384 |
{
|
|
385 |
GetMCSDataL( aProperties, *data );
|
|
386 |
}
|
|
387 |
CleanupStack::Pop( data );
|
|
388 |
return data;
|
|
389 |
}
|
|
390 |
|
|
391 |
// ---------------------------------------------------------------------------
|
|
392 |
// Creates bookmark data item.
|
|
393 |
// ---------------------------------------------------------------------------
|
|
394 |
//
|
|
395 |
void CCarouselPluginData::GetBkmDataL( const TDesC8& aUid, const TDesC8& aView, const TDesC8& aParam, CCarouselData& aData )
|
|
396 |
{
|
|
397 |
TMenuItem item;
|
|
398 |
|
|
399 |
if( aUid.Length() > 0 )
|
|
400 |
{
|
|
401 |
CMenuFilter* filter = CMenuFilter::NewLC();
|
|
402 |
HBufC* name( NULL );
|
|
403 |
HBufC* value( NULL );
|
|
404 |
name = AiUtility::CopyToBufferL( name, KProperNameUid );
|
|
405 |
CleanupStack::PushL( name );
|
|
406 |
value = AiUtility::CopyToBufferL( value, aUid );
|
|
407 |
CleanupStack::PushL( value );
|
|
408 |
filter->HaveAttributeL( *name, *value );
|
|
409 |
CleanupStack::PopAndDestroy( value );
|
|
410 |
CleanupStack::PopAndDestroy( name );
|
|
411 |
item = iEngine.FindMenuItemL( *filter );
|
|
412 |
CleanupStack::PopAndDestroy( filter );
|
|
413 |
}
|
|
414 |
|
|
415 |
item.SetType( KMenuTypeUrl );
|
|
416 |
aData.SetMenuItem( item );
|
|
417 |
|
|
418 |
HBufC* view( NULL );
|
|
419 |
view = AiUtility::CopyToBufferL( view, aView );
|
|
420 |
CleanupStack::PushL( view );
|
|
421 |
aData.SetValueL( *view );
|
|
422 |
CleanupStack::PopAndDestroy( view );
|
|
423 |
|
|
424 |
HBufC* param( NULL );
|
|
425 |
param = AiUtility::CopyToBufferL( param, aParam );
|
|
426 |
CleanupStack::PushL( param );
|
|
427 |
aData.SetNameL( *param );
|
|
428 |
CleanupStack::PopAndDestroy( param );
|
|
429 |
}
|
|
430 |
|
|
431 |
// ---------------------------------------------------------------------------
|
|
432 |
// Creates folder data item.
|
|
433 |
// ---------------------------------------------------------------------------
|
|
434 |
//
|
|
435 |
void CCarouselPluginData::GetFolderData( const TDesC8& aParam, CCarouselData& aData )
|
|
436 |
{
|
|
437 |
// In folder case, we have to extract id from
|
|
438 |
// param attribute and return item with this id
|
|
439 |
// convert id to integer
|
|
440 |
TInt id;
|
|
441 |
TLex8 lextmp( aParam);
|
|
442 |
lextmp.Val( id );
|
|
443 |
|
|
444 |
TMenuItem item;
|
|
445 |
item.SetType( KMenuTypeFolder );
|
|
446 |
item.SetId( id );
|
|
447 |
aData.SetMenuItem( item );
|
|
448 |
}
|
|
449 |
|
|
450 |
// ---------------------------------------------------------------------------
|
|
451 |
// Creates mailbox data item.
|
|
452 |
// ---------------------------------------------------------------------------
|
|
453 |
//
|
|
454 |
void CCarouselPluginData::GetMailboxDataL( const TDesC8& aUid, const TDesC8& aParam, CCarouselData& aData )
|
|
455 |
{
|
|
456 |
TInt id( KErrNotFound );
|
|
457 |
TLex8 lextmp( aUid);
|
|
458 |
lextmp.Val( id );
|
|
459 |
|
|
460 |
TMenuItem item;
|
|
461 |
item.SetType( KMenuTypeMailbox );
|
|
462 |
item.SetId( id );
|
|
463 |
aData.SetMenuItem( item );
|
|
464 |
|
|
465 |
HBufC* param( NULL );
|
|
466 |
param = AiUtility::CopyToBufferL( param, aParam );
|
|
467 |
CleanupStack::PushL( param );
|
|
468 |
|
|
469 |
aData.SetNameL( *param );
|
|
470 |
|
|
471 |
CleanupStack::PopAndDestroy( param );
|
|
472 |
}
|
|
473 |
|
|
474 |
// ---------------------------------------------------------------------------
|
|
475 |
// Gets data item from MCS
|
|
476 |
// ---------------------------------------------------------------------------
|
|
477 |
//
|
|
478 |
void CCarouselPluginData::GetMCSDataL( RPointerArray<HSPluginSettingsIf::CPropertyMap>& aProperties,
|
|
479 |
CCarouselData& aData)
|
|
480 |
{
|
|
481 |
CMenuFilter* filter = CMenuFilter::NewLC();
|
|
482 |
|
|
483 |
// Exclude 'view' and 'param' attributes from search criteria by default
|
|
484 |
// Criterias will be added to filter if setting defines them
|
|
485 |
filter->DoNotHaveAttributeL( KMenuAttrView );
|
|
486 |
filter->DoNotHaveAttributeL( KMenuAttrParam );
|
|
487 |
|
|
488 |
// then add all property/value pairs to the filter
|
|
489 |
for ( TInt i = 0; i < aProperties.Count(); i++ )
|
|
490 |
{
|
|
491 |
// skip the type property
|
|
492 |
if( aProperties[i]->Name() == KProperNameType )
|
|
493 |
{
|
|
494 |
continue;
|
|
495 |
}
|
|
496 |
|
|
497 |
HBufC* name( NULL );
|
|
498 |
HBufC* value( NULL );
|
|
499 |
name = AiUtility::CopyToBufferL( name, aProperties[i]->Name() );
|
|
500 |
CleanupStack::PushL( name );
|
|
501 |
value = AiUtility::CopyToBufferL( value, aProperties[i]->Value() );
|
|
502 |
CleanupStack::PushL( value );
|
|
503 |
|
|
504 |
if ( value->Length() != 0 )
|
|
505 |
{
|
|
506 |
filter->HaveAttributeL( *name, *value );
|
|
507 |
}
|
|
508 |
CleanupStack::PopAndDestroy( value );
|
|
509 |
CleanupStack::PopAndDestroy( name );
|
|
510 |
}
|
|
511 |
|
|
512 |
// locked property excluded from search pattern
|
|
513 |
filter->DoNotHaveAttributeL( KMenuAttrLocked );
|
|
514 |
|
|
515 |
TMenuItem item = iEngine.FindMenuItemL( *filter );
|
|
516 |
CleanupStack::PopAndDestroy( filter );
|
|
517 |
aData.SetMenuItem( item );
|
|
518 |
}
|
|
519 |
|
|
520 |
// ---------------------------------------------------------------------------
|
|
521 |
// Returns menu item for given index
|
|
522 |
// ---------------------------------------------------------------------------
|
|
523 |
//
|
|
524 |
CCarouselData& CCarouselPluginData::DataItemL( TInt aIndex )
|
|
525 |
{
|
|
526 |
if( aIndex < 0 || aIndex >= iData.Count())
|
|
527 |
{
|
|
528 |
User::Leave( KErrArgument );
|
|
529 |
}
|
|
530 |
return *iData[aIndex];
|
|
531 |
}
|
|
532 |
|
|
533 |
// ---------------------------------------------------------------------------
|
|
534 |
// Save the undefined item.
|
|
535 |
// ---------------------------------------------------------------------------
|
|
536 |
//
|
|
537 |
void CCarouselPluginData::SaveUndefinedItemL( const TInt& aIndex )
|
|
538 |
{
|
|
539 |
RPointerArray<CItemMap> settingItems;
|
|
540 |
CleanupResetAndDestroyPushL( settingItems );
|
|
541 |
|
|
542 |
iPluginSettings->GetSettingsL( iInstanceUid, settingItems );
|
|
543 |
if ( aIndex >= 0 && aIndex < settingItems.Count() )
|
|
544 |
{
|
|
545 |
CItemMap* itemMap = settingItems[ aIndex ];
|
|
546 |
|
|
547 |
// get properties
|
|
548 |
RPointerArray<HSPluginSettingsIf::CPropertyMap>& properties
|
|
549 |
= itemMap->Properties();
|
|
550 |
|
|
551 |
for ( TInt i = 0; i < properties.Count(); i++ )
|
|
552 |
{
|
|
553 |
if ( properties[ i ]->Name() == KProperNameType )
|
|
554 |
{
|
|
555 |
properties[ i ]->SetValueL( KProperValueAppl );
|
|
556 |
}
|
|
557 |
else if ( properties[ i ]->Name() == KProperNameUid )
|
|
558 |
{
|
|
559 |
properties[ i ]->SetValueL( KMenuAttrUndefUid );
|
|
560 |
}
|
|
561 |
else if ( properties[ i ]->Name() == KProperNameView )
|
|
562 |
{
|
|
563 |
properties[ i ]->SetValueL( KNullDesC8 );
|
|
564 |
}
|
|
565 |
else if ( properties[ i ]->Name() == KProperNameParam )
|
|
566 |
{
|
|
567 |
properties[ i ]->SetValueL( KNullDesC8 );
|
|
568 |
}
|
|
569 |
else if ( properties[ i ]->Name() == KProperNameLocked )
|
|
570 |
{
|
|
571 |
properties[i]->SetValueL( KNullDesC8 );
|
|
572 |
}
|
|
573 |
}
|
|
574 |
}
|
|
575 |
// ETrue tells that modified settings are stored also to plugin reference
|
|
576 |
iPluginSettings->SetSettingsL( iInstanceUid, settingItems, ETrue );
|
|
577 |
CleanupStack::PopAndDestroy(); // settingItems
|
|
578 |
}
|
|
579 |
|
|
580 |
// End of file
|