|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Bookmark list for settings listbox |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <StringLoader.h> |
|
20 #include <ActiveFavouritesDbNotifier.h> // For CActiveFavouritesDbNotifier |
|
21 #include <aistrcnv.h> |
|
22 #include <mcsmenufilter.h> |
|
23 #include <mcsmenuitem.h> |
|
24 #include <mcsmenuoperation.h> |
|
25 #include <mcspluginsettingsres.rsg> |
|
26 |
|
27 #include "mcspluginsettingsmodel.h" |
|
28 #include "mcspluginsettingsapplist.h" |
|
29 #include "mcspluginsettingsbkmlist.h" |
|
30 #include "mcspluginwatcher.h" |
|
31 #include "debug.h" |
|
32 |
|
33 _LIT( KMyMenuData, "matrixmenudata" ); |
|
34 _LIT( KMenuUrl, "menu:url" ); |
|
35 _LIT( KMenuIconFile, "aimcsplugin.mif" ); |
|
36 _LIT( KMenuIconId, "16386" ); |
|
37 _LIT( KMenuMaskId, "16387" ); |
|
38 _LIT( KUrl, "url" ); |
|
39 _LIT8( KUid, "uid" ); |
|
40 _LIT( KMenuAttrRefcount, "ref_count" ); |
|
41 _LIT( KInitialRefCount, "1" ); |
|
42 _LIT( KMCSFolder, "mcsplugin_folder" ); |
|
43 |
|
44 |
|
45 // ======== MEMBER FUNCTIONS ======== |
|
46 |
|
47 |
|
48 // --------------------------------------------------------------------------- |
|
49 // First-phase construction |
|
50 // --------------------------------------------------------------------------- |
|
51 // |
|
52 CMCSPluginSettingsBkmList::CMCSPluginSettingsBkmList() |
|
53 { |
|
54 iMCSPluginFolderId = 0; |
|
55 } |
|
56 |
|
57 // --------------------------------------------------------------------------- |
|
58 // Second-phase construction |
|
59 // --------------------------------------------------------------------------- |
|
60 // |
|
61 void CMCSPluginSettingsBkmList::ConstructL() |
|
62 { |
|
63 User::LeaveIfError(iBookmarkSess.Connect()); |
|
64 User::LeaveIfError(iBookmarkDb.Open(iBookmarkSess, KBrowserBookmarks)); |
|
65 iMenu.OpenL( KMyMenuData ); |
|
66 GetBookmarkListL(); |
|
67 |
|
68 iSaveWatcher = CMCSPluginWatcher::NewL( CMCSPluginWatcher::EOperation ); |
|
69 iUpdateWatcher = CMCSPluginWatcher::NewL( CMCSPluginWatcher::EOperation ); |
|
70 iRemoveWatcher = CMCSPluginWatcher::NewL( CMCSPluginWatcher::EOperation ); |
|
71 } |
|
72 |
|
73 // --------------------------------------------------------------------------- |
|
74 // Two-phased constructor |
|
75 // --------------------------------------------------------------------------- |
|
76 // |
|
77 CMCSPluginSettingsBkmList* CMCSPluginSettingsBkmList::NewL() |
|
78 { |
|
79 CMCSPluginSettingsBkmList* self = new (ELeave) CMCSPluginSettingsBkmList(); |
|
80 CleanupStack::PushL(self); |
|
81 self->ConstructL(); |
|
82 CleanupStack::Pop(self); |
|
83 return self; |
|
84 } |
|
85 |
|
86 // --------------------------------------------------------------------------- |
|
87 // Destructor |
|
88 // --------------------------------------------------------------------------- |
|
89 // |
|
90 CMCSPluginSettingsBkmList::~CMCSPluginSettingsBkmList() |
|
91 { |
|
92 iListItems.ResetAndDestroy(); |
|
93 iMenuItems.ResetAndDestroy(); |
|
94 iBookmarkDb.Close(); |
|
95 iBookmarkSess.Close(); |
|
96 iMenu.Close(); |
|
97 delete iSaveWatcher; |
|
98 delete iUpdateWatcher; |
|
99 delete iRemoveWatcher; |
|
100 } |
|
101 |
|
102 // --------------------------------------------------------------------------- |
|
103 // From MDesCArray |
|
104 // Returns the number of descriptor elements in a descriptor array. |
|
105 // --------------------------------------------------------------------------- |
|
106 // |
|
107 TInt CMCSPluginSettingsBkmList::MdcaCount() const |
|
108 { |
|
109 return iListItems.Count(); |
|
110 } |
|
111 |
|
112 // --------------------------------------------------------------------------- |
|
113 // From MDesCArray |
|
114 // Indexes into a descriptor array. |
|
115 // --------------------------------------------------------------------------- |
|
116 // |
|
117 TPtrC CMCSPluginSettingsBkmList::MdcaPoint(TInt aIndex) const |
|
118 { |
|
119 if (aIndex < 0 || aIndex >= iListItems.Count()) |
|
120 { |
|
121 TPtrC ret(KNullDesC); |
|
122 return ret; |
|
123 } |
|
124 return iListItems[aIndex]->Caption(); |
|
125 } |
|
126 |
|
127 // --------------------------------------------------------------------------- |
|
128 // Iterates thru the bookmark list and tries to find a menuitem which |
|
129 // matches given property map from HSPS |
|
130 // --------------------------------------------------------------------------- |
|
131 // |
|
132 TSettingItem CMCSPluginSettingsBkmList::FindItemL( RPointerArray<HSPluginSettingsIf::CPropertyMap>& aProperties ) |
|
133 { |
|
134 TInt index( KErrNotFound ); |
|
135 TSettingItem settingItem = { KErrNotFound, EBookmark }; |
|
136 for( TInt i= 0; i < aProperties.Count(); i++ ) |
|
137 { |
|
138 if( aProperties[i]->Name() == KUid ) |
|
139 { |
|
140 HBufC* value( NULL ); |
|
141 value = AiUtility::CopyToBufferL( value, aProperties[i]->Value()); |
|
142 for( TInt j = 0; j < iListItems.Count(); j++ ) |
|
143 { |
|
144 TPtrC uid = *iListItems[j]->iUid; |
|
145 if( uid.Compare( *value ) == 0 ) |
|
146 { |
|
147 index = j; |
|
148 break; |
|
149 } |
|
150 } |
|
151 delete value; |
|
152 } |
|
153 if( index != KErrNotFound ) |
|
154 { |
|
155 settingItem.id = index; |
|
156 settingItem.type = EBookmark; |
|
157 break; |
|
158 } |
|
159 } |
|
160 return settingItem; |
|
161 } |
|
162 |
|
163 // --------------------------------------------------------------------------- |
|
164 // Gets bookmark list. |
|
165 // --------------------------------------------------------------------------- |
|
166 // |
|
167 void CMCSPluginSettingsBkmList::GetBookmarkListL() |
|
168 { |
|
169 iListItems.ResetAndDestroy(); |
|
170 |
|
171 GetBookmarksFromFavouritesL(); |
|
172 GetBookmarksFromMCSL(); |
|
173 } |
|
174 |
|
175 // --------------------------------------------------------------------------- |
|
176 // Gets bookmarks from Favourites server's bookmark database. |
|
177 // --------------------------------------------------------------------------- |
|
178 // |
|
179 void CMCSPluginSettingsBkmList::GetBookmarksFromFavouritesL() |
|
180 { |
|
181 CFavouritesItemList* favItems = new (ELeave) CFavouritesItemList(); |
|
182 CleanupStack::PushL( favItems ); |
|
183 TInt err = iBookmarkDb.GetAll( *favItems, KFavouritesNullUid, CFavouritesItem::EItem); |
|
184 if( err != KErrNone ) |
|
185 { |
|
186 ASSERT(0); |
|
187 } |
|
188 TInt count = favItems->Count(); |
|
189 for ( TInt i = count - 1; i >= 0; i-- ) // newest on top |
|
190 { |
|
191 TUid uid = TUid::Uid(favItems->At(i)->Uid()); |
|
192 TPtrC name = favItems->At(i)->Name(); |
|
193 TPtrC url = favItems->At(i)->Url(); |
|
194 AddBookmarkL( uid.Name(), name, url, EFavBookmark ); |
|
195 } |
|
196 CleanupStack::PopAndDestroy( favItems ); |
|
197 } |
|
198 |
|
199 // --------------------------------------------------------------------------- |
|
200 // Gets bookmarks from Menu Content Service. |
|
201 // --------------------------------------------------------------------------- |
|
202 // |
|
203 void CMCSPluginSettingsBkmList::GetBookmarksFromMCSL() |
|
204 { |
|
205 TBool exists( EFalse ); |
|
206 CMenuFilter* filter = CMenuFilter::NewL(); |
|
207 CleanupStack::PushL( filter ); |
|
208 filter->SetType( KMenuUrl ); |
|
209 const TInt rootId = iMenu.RootFolderL(); |
|
210 RArray<TMenuItem> itemArray; |
|
211 CleanupClosePushL( itemArray ); |
|
212 iMenu.GetItemsL( itemArray, rootId, filter, ETrue ); |
|
213 TInt count( itemArray.Count() ); |
|
214 for ( TInt i = 0; i < count; i++ ) |
|
215 { |
|
216 CMenuItem* menuItem = CMenuItem::OpenL( iMenu, itemArray[i] ); |
|
217 CleanupStack::PushL( menuItem ); |
|
218 TPtrC uid = menuItem->GetAttributeL( KMenuAttrUid, exists ); |
|
219 TPtrC name = menuItem->GetAttributeL( KMenuAttrLongName, exists ); |
|
220 TPtrC url = menuItem->GetAttributeL( KUrl, exists ); |
|
221 |
|
222 // Check if bookmark is already present in Bookmark list. |
|
223 // This may happen in case of Favourite Bookmarks that were |
|
224 // previously added to MCS. |
|
225 // If it is, do not add it to Bookmark list anymore. |
|
226 |
|
227 TBool isRuntimeGenerated = EFalse; |
|
228 menuItem->GetAttributeL( KMenuAttrRefcount, isRuntimeGenerated ); |
|
229 |
|
230 // if is not runtime generated and url exists, add it |
|
231 if ( !isRuntimeGenerated && exists ) |
|
232 { |
|
233 AddBookmarkL( uid, name, url, EMCSBookmark ); |
|
234 } |
|
235 |
|
236 CleanupStack::PopAndDestroy( menuItem ); |
|
237 } |
|
238 |
|
239 CleanupStack::PopAndDestroy( &itemArray ); |
|
240 CleanupStack::PopAndDestroy( filter ); |
|
241 |
|
242 } |
|
243 |
|
244 // --------------------------------------------------------------------------- |
|
245 // If bookmark was selected amongst Favourites, new menu item is created into MCS. |
|
246 // If predefined bookmark was selected, MCS menu item is retrieved |
|
247 // --------------------------------------------------------------------------- |
|
248 // |
|
249 CMenuItem& CMCSPluginSettingsBkmList::ItemL( TInt aIndex ) |
|
250 { |
|
251 CMenuItem* menuItem( NULL ); |
|
252 CBkmListItem* listItem = iListItems[aIndex]; |
|
253 if ( listItem->iType == EFavBookmark ) |
|
254 { |
|
255 TPtrC uid = *listItem->iUid; |
|
256 TPtrC name = *listItem->iCaption; |
|
257 TPtrC url = *listItem->iUrl; |
|
258 menuItem = CreateMenuItemL( uid, name, url ); |
|
259 } |
|
260 else |
|
261 { |
|
262 menuItem = MCSMenuItemL( *listItem->iUid, *listItem->iCaption, *listItem->iUrl ); |
|
263 } |
|
264 return *menuItem; |
|
265 } |
|
266 |
|
267 // --------------------------------------------------------------------------- |
|
268 // Removes the menu item from MCS if it was created in runtime i.e. type is EFavBookmark. |
|
269 // Favourite bookmarks have ref_count attribute, which is decremented everytime |
|
270 // the bookmark is removed from some shortcut. When this counter reaches 0, |
|
271 // its MenuItem is removed from MCS. |
|
272 // --------------------------------------------------------------------------- |
|
273 // |
|
274 void CMCSPluginSettingsBkmList::RemoveMenuItemL( TInt aIndex ) |
|
275 { |
|
276 |
|
277 if ( aIndex < 0 || aIndex > iListItems.Count() - 1 ) |
|
278 { |
|
279 return; |
|
280 } |
|
281 |
|
282 CBkmListItem* listItem = iListItems[aIndex]; |
|
283 if( listItem->iType == EFavBookmark ) |
|
284 { |
|
285 CMenuItem* menuItem = MCSMenuItemL( *listItem->iUid, *listItem->iCaption, *listItem->iUrl ); |
|
286 if ( !menuItem ) |
|
287 { |
|
288 return; |
|
289 } |
|
290 // decrement ref_count attribute |
|
291 TInt newRefCount = UpdateMenuItemsRefCountL( menuItem, -1 ); |
|
292 if ( newRefCount > 0 ) |
|
293 { |
|
294 CleanupStack::PushL( menuItem ); |
|
295 CMenuOperation* op = menuItem->SaveL( iUpdateWatcher->iStatus ); |
|
296 CleanupStack::Pop( menuItem ); |
|
297 iUpdateWatcher->Watch( op ); |
|
298 } |
|
299 else if ( newRefCount == 0 ) |
|
300 { |
|
301 // counter reached 0 -> item is not referenced by any shortcut |
|
302 // so remove it from MCS |
|
303 if ( iRemoveWatcher->IsActive() ) |
|
304 { |
|
305 return; |
|
306 } |
|
307 CMenuOperation* op = iMenu.RemoveL( menuItem->Id(), iRemoveWatcher->iStatus ); |
|
308 iRemoveWatcher->Watch( op ); |
|
309 } |
|
310 } |
|
311 } |
|
312 |
|
313 // --------------------------------------------------------------------------- |
|
314 // Tries to find menuitem with given UID, Name and Url in MCS, |
|
315 // If it does not exist, it is created and saved there. |
|
316 // If it exists already, ref_count attribute is incremented. |
|
317 // --------------------------------------------------------------------------- |
|
318 // |
|
319 CMenuItem* CMCSPluginSettingsBkmList::CreateMenuItemL( const TDesC& aUid, |
|
320 const TDesC& aName, |
|
321 const TDesC& aUrl ) |
|
322 { |
|
323 // try to search item in MCS |
|
324 CMenuItem* item = MCSMenuItemL( aUid, aName, aUrl ); |
|
325 |
|
326 if ( item == NULL ) |
|
327 { |
|
328 // Item does not exist in MCS yet. |
|
329 // We will add a new one with reference counter set to 1. |
|
330 CMenuItem* newItem = CMenuItem::CreateL( iMenu, |
|
331 KMenuTypeUrl, |
|
332 GetMCSPluginFolderIdL(), 0 ); |
|
333 CleanupStack::PushL( newItem ); |
|
334 |
|
335 newItem->SetAttributeL( KMenuAttrUid, aUid ); |
|
336 newItem->SetAttributeL( KMenuAttrLongName, aName ); |
|
337 newItem->SetAttributeL( KMenuAttrIconFile, KMenuIconFile ); |
|
338 newItem->SetAttributeL( KMenuAttrIconId, KMenuIconId ); |
|
339 newItem->SetAttributeL( KMenuAttrMaskId, KMenuMaskId ); |
|
340 newItem->SetAttributeL( KMenuAttrRefcount, KInitialRefCount ); |
|
341 newItem->SetAttributeL( KUrl , aUrl ); |
|
342 |
|
343 CMenuOperation* op = newItem->SaveL( iSaveWatcher->iStatus ); |
|
344 iSaveWatcher->Watch( op ); |
|
345 iMenuItems.AppendL( newItem ); |
|
346 CleanupStack::Pop( newItem ); |
|
347 return newItem; |
|
348 } |
|
349 else |
|
350 { |
|
351 // Item already exists in MCS |
|
352 // If it has reference counter, increment it before returning. |
|
353 TInt newRefCount = UpdateMenuItemsRefCountL( item, 1 ); |
|
354 if ( newRefCount > -1 ) |
|
355 { |
|
356 CleanupStack::PushL( item ); |
|
357 CMenuOperation* op = item->SaveL( iSaveWatcher->iStatus ); |
|
358 CleanupStack::Pop( item ); |
|
359 iSaveWatcher->Watch( op ); |
|
360 } |
|
361 } |
|
362 return item; |
|
363 } |
|
364 |
|
365 // --------------------------------------------------------------------------- |
|
366 // Finds menuitem with given UID, Name and URL in MCS and returns it |
|
367 // --------------------------------------------------------------------------- |
|
368 // |
|
369 CMenuItem* CMCSPluginSettingsBkmList::MCSMenuItemL( const TDesC& aUid, |
|
370 const TDesC& aName, |
|
371 const TDesC& aUrl ) |
|
372 { |
|
373 CMenuItem* item( NULL ); |
|
374 CMenuFilter* filter = CMenuFilter::NewL(); |
|
375 CleanupStack::PushL( filter ); |
|
376 |
|
377 filter->SetType( KMenuUrl ); |
|
378 filter->HaveAttributeL( KMenuAttrUid, aUid ); |
|
379 filter->HaveAttributeL( KMenuAttrLongName, aName ); |
|
380 filter->HaveAttributeL( KUrl , aUrl ); |
|
381 const TInt rootId = iMenu.RootFolderL(); |
|
382 RArray<TMenuItem> itemArray; |
|
383 CleanupClosePushL( itemArray ); |
|
384 iMenu.GetItemsL( itemArray, rootId, filter, ETrue ); |
|
385 if( itemArray.Count() > 0 ) |
|
386 { |
|
387 item = CMenuItem::OpenL( iMenu, itemArray[0] ); |
|
388 CleanupStack::PushL( item ); |
|
389 iMenuItems.AppendL( item ); |
|
390 CleanupStack::Pop( item ); |
|
391 } |
|
392 CleanupStack::PopAndDestroy( &itemArray ); |
|
393 CleanupStack::PopAndDestroy( filter ); |
|
394 return item; |
|
395 } |
|
396 |
|
397 // --------------------------------------------------------------------------- |
|
398 // Adds an bookmark to the list. |
|
399 // --------------------------------------------------------------------------- |
|
400 // |
|
401 void CMCSPluginSettingsBkmList::AddBookmarkL( const TDesC& aUid, |
|
402 const TDesC& aCaption, |
|
403 const TDesC& aUrl, |
|
404 TBookmarkType aType ) |
|
405 { |
|
406 CBkmListItem* listItem = CBkmListItem::NewLC(aUid, aCaption); |
|
407 |
|
408 listItem->iType = aType; |
|
409 if( aUrl.Length() > 0 ) |
|
410 { |
|
411 listItem->iUrl = aUrl.AllocL(); |
|
412 } |
|
413 TLinearOrder<CBkmListItem> sortMethod(CBkmListItem::CompareCaption); |
|
414 User::LeaveIfError(iListItems.InsertInOrderAllowRepeats(listItem, sortMethod)); |
|
415 CleanupStack::Pop(listItem); |
|
416 } |
|
417 |
|
418 // --------------------------------------------------------------------------- |
|
419 // Updates the bookmark list. |
|
420 // --------------------------------------------------------------------------- |
|
421 // |
|
422 void CMCSPluginSettingsBkmList::UpdateBkmListL() |
|
423 { |
|
424 GetBookmarkListL(); |
|
425 } |
|
426 |
|
427 // --------------------------------------------------------------------------- |
|
428 //Nested class to store individual bookmark list items |
|
429 // --------------------------------------------------------------------------- |
|
430 // |
|
431 CMCSPluginSettingsBkmList::CBkmListItem::CBkmListItem() |
|
432 { |
|
433 } |
|
434 |
|
435 // --------------------------------------------------------------------------- |
|
436 // Second-phase construction |
|
437 // --------------------------------------------------------------------------- |
|
438 // |
|
439 void CMCSPluginSettingsBkmList::CBkmListItem::ConstructL( const TDesC& aUid, |
|
440 const TDesC& aCaption ) |
|
441 { |
|
442 iUid = aUid.AllocL(); |
|
443 iCaption = aCaption.AllocL(); |
|
444 } |
|
445 |
|
446 // --------------------------------------------------------------------------- |
|
447 // Two-phased constructor |
|
448 // --------------------------------------------------------------------------- |
|
449 // |
|
450 CMCSPluginSettingsBkmList::CBkmListItem* CMCSPluginSettingsBkmList::CBkmListItem::NewLC( |
|
451 const TDesC& aUid, const TDesC& aCaption ) |
|
452 { |
|
453 CBkmListItem* self = new (ELeave) CBkmListItem(); |
|
454 CleanupStack::PushL(self); |
|
455 self->ConstructL( aUid, aCaption ); |
|
456 return self; |
|
457 } |
|
458 |
|
459 // --------------------------------------------------------------------------- |
|
460 // Destructor |
|
461 // --------------------------------------------------------------------------- |
|
462 // |
|
463 CMCSPluginSettingsBkmList::CBkmListItem::~CBkmListItem() |
|
464 { |
|
465 delete iUid; |
|
466 delete iCaption; |
|
467 delete iUrl; |
|
468 } |
|
469 |
|
470 // --------------------------------------------------------------------------- |
|
471 // Compare method used to add the items to the list in sorted order. |
|
472 // --------------------------------------------------------------------------- |
|
473 // |
|
474 TInt CMCSPluginSettingsBkmList::CBkmListItem::CompareCaption( const CBkmListItem& aFirst, |
|
475 const CBkmListItem& aSecond ) |
|
476 { |
|
477 return aFirst.iCaption->Des().CompareC(*aSecond.iCaption); |
|
478 } |
|
479 |
|
480 // --------------------------------------------------------------------------- |
|
481 // Returns the item target bookmark caption. |
|
482 // --------------------------------------------------------------------------- |
|
483 // |
|
484 TPtrC CMCSPluginSettingsBkmList::CBkmListItem::Caption() const |
|
485 { |
|
486 return TPtrC(*iCaption); |
|
487 } |
|
488 |
|
489 // --------------------------------------------------------------------------- |
|
490 // Gets MCS Plugin folder ID. This hidden folder in matrixmenudata.xml is used |
|
491 // for storing run-time generated menuitems |
|
492 // --------------------------------------------------------------------------- |
|
493 // |
|
494 TInt CMCSPluginSettingsBkmList::GetMCSPluginFolderIdL() |
|
495 { |
|
496 if ( iMCSPluginFolderId == 0 ) |
|
497 { |
|
498 CMenuItem* item( NULL ); |
|
499 CMenuFilter* filter = CMenuFilter::NewL(); |
|
500 CleanupStack::PushL( filter ); |
|
501 filter->SetType( KMenuTypeFolder ); |
|
502 filter->HaveAttributeL( KMenuAttrLongName, KMCSFolder ); |
|
503 const TInt rootId = iMenu.RootFolderL(); |
|
504 RArray<TMenuItem> itemArray; |
|
505 CleanupClosePushL( itemArray ); |
|
506 iMenu.GetItemsL( itemArray, rootId, filter, ETrue ); |
|
507 if ( itemArray.Count() > 0 ) |
|
508 { |
|
509 item = CMenuItem::OpenL( iMenu, itemArray[0] ); |
|
510 iMCSPluginFolderId = item->Id(); |
|
511 } |
|
512 else |
|
513 { |
|
514 iMCSPluginFolderId = iMenu.RootFolderL(); |
|
515 } |
|
516 CleanupStack::PopAndDestroy( &itemArray ); |
|
517 CleanupStack::PopAndDestroy( filter ); |
|
518 delete item; |
|
519 } |
|
520 return iMCSPluginFolderId; |
|
521 } |
|
522 |
|
523 // --------------------------------------------------------------------------- |
|
524 // Helper method for updating ref_count attribute of run-time generated |
|
525 // menuitems |
|
526 // --------------------------------------------------------------------------- |
|
527 // |
|
528 TInt CMCSPluginSettingsBkmList::UpdateMenuItemsRefCountL( CMenuItem* aItem, |
|
529 TInt aValueToAdd ) |
|
530 { |
|
531 |
|
532 TBool exists = EFalse; |
|
533 CleanupStack::PushL( aItem ); |
|
534 TPtrC param = aItem->GetAttributeL( KMenuAttrRefcount, exists ); |
|
535 CleanupStack::Pop( aItem ); |
|
536 if ( exists ) |
|
537 { |
|
538 TInt references; |
|
539 TLex16 lextmp( param ); |
|
540 lextmp.Val( references ); |
|
541 references += aValueToAdd; |
|
542 TBuf<128> buf; |
|
543 buf.NumUC( references ); |
|
544 |
|
545 // set new ref_count |
|
546 CleanupStack::PushL( aItem ); |
|
547 aItem->SetAttributeL( KMenuAttrRefcount, buf ); |
|
548 CleanupStack::Pop( aItem ); |
|
549 // return new ref_count |
|
550 return references; |
|
551 } |
|
552 return -1; |
|
553 } |
|
554 |
|
555 // End of File. |