author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 21:55:16 +0300 | |
branch | RCL_3 |
changeset 31 | 8baec10861af |
parent 30 | a5a39a295112 |
permissions | -rw-r--r-- |
30 | 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: Application list for settings listbox |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#include <aistrcnv.h> |
|
19 |
#include <mcsmenuitem.h> |
|
20 |
#include <mcsmenufilter.h> |
|
21 |
||
22 |
#include "mcspluginsettingsapplist.h" |
|
23 |
#include "mcspluginsettingsmodel.h" // For TSettingItem |
|
24 |
||
25 |
_LIT( KMyMenuData, "matrixmenudata" ); |
|
26 |
_LIT( KMenuTypeShortcut, "menu:shortcut" ); |
|
27 |
_LIT( KMenuTypeMailbox, "menu:mailbox" ); |
|
28 |
_LIT( KMenuAttrParameter, "param" ); |
|
29 |
_LIT( KMenuAttrLocked, "locked" ); |
|
30 |
_LIT8( KItemLocked, "locked"); |
|
31 |
_LIT8( KProperValueFolder, "folder" ); |
|
32 |
_LIT( KMenuAttrUndefUid, "0x99999991" ); |
|
31
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
33 |
_LIT( KMenuAttrInvokeSettingsUid, "0x99999990" ); |
30 | 34 |
_LIT( KMenuItemLongName, "long_name" ); |
35 |
||
36 |
#define KMCSCmailMtmUidValue 0x2001F406 |
|
37 |
||
38 |
// ======== MEMBER FUNCTIONS ======== |
|
39 |
||
40 |
// --------------------------------------------------------------------------- |
|
41 |
// First-phase construction |
|
42 |
// --------------------------------------------------------------------------- |
|
43 |
// |
|
44 |
CMCSPluginSettingsAppList::CMCSPluginSettingsAppList() |
|
45 |
{ |
|
46 |
} |
|
47 |
||
48 |
// --------------------------------------------------------------------------- |
|
49 |
// Second-phase construction |
|
50 |
// --------------------------------------------------------------------------- |
|
51 |
// |
|
52 |
void CMCSPluginSettingsAppList::ConstructL() |
|
53 |
{ |
|
54 |
iMsvSession = CMsvSession::OpenAsObserverL(*this); |
|
55 |
||
56 |
iMenu.OpenL( KMyMenuData ); |
|
57 |
||
31
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
58 |
iUndefinedText = MenuItemTextL( KMenuAttrUndefUid ); |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
59 |
iEmptyText = MenuItemTextL( KMenuAttrInvokeSettingsUid ); |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
60 |
} |
30 | 61 |
|
62 |
||
63 |
// --------------------------------------------------------------------------- |
|
64 |
// Two-phased constructor |
|
65 |
// --------------------------------------------------------------------------- |
|
66 |
// |
|
67 |
CMCSPluginSettingsAppList* CMCSPluginSettingsAppList::NewL() |
|
68 |
{ |
|
69 |
CMCSPluginSettingsAppList* self = new (ELeave) CMCSPluginSettingsAppList(); |
|
70 |
CleanupStack::PushL(self); |
|
71 |
self->ConstructL(); |
|
72 |
CleanupStack::Pop(self); |
|
73 |
return self; |
|
74 |
} |
|
75 |
||
76 |
// --------------------------------------------------------------------------- |
|
77 |
// Destructor |
|
78 |
// --------------------------------------------------------------------------- |
|
79 |
// |
|
80 |
CMCSPluginSettingsAppList::~CMCSPluginSettingsAppList() |
|
81 |
{ |
|
82 |
delete iMsvSession; |
|
83 |
||
84 |
iListItems.ResetAndDestroy(); |
|
85 |
iMenu.Close(); |
|
86 |
||
87 |
delete iUndefinedText; |
|
31
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
88 |
delete iEmptyText; |
30 | 89 |
} |
90 |
||
91 |
// --------------------------------------------------------------------------- |
|
92 |
// From MDesCArray |
|
93 |
// Returns the number of descriptor elements in a descriptor array. |
|
94 |
// --------------------------------------------------------------------------- |
|
95 |
// |
|
96 |
TInt CMCSPluginSettingsAppList::MdcaCount() const |
|
97 |
{ |
|
98 |
return iListItems.Count(); |
|
99 |
} |
|
100 |
||
101 |
// --------------------------------------------------------------------------- |
|
102 |
// From MDesCArray |
|
103 |
// Indexes into a descriptor array. |
|
104 |
// --------------------------------------------------------------------------- |
|
105 |
// |
|
106 |
TPtrC CMCSPluginSettingsAppList::MdcaPoint( TInt aIndex ) const |
|
107 |
{ |
|
108 |
if ( aIndex < 0 || aIndex >= iListItems.Count() ) |
|
109 |
{ |
|
110 |
TPtrC ret( KNullDesC ); |
|
111 |
return ret; |
|
112 |
} |
|
113 |
CMenuItem* item = iListItems[ aIndex ]; |
|
114 |
||
115 |
TBool attrExists; |
|
116 |
TPtrC itm( KNullDesC ); |
|
117 |
TRAP_IGNORE( |
|
118 |
itm.Set( item->GetAttributeL( KMenuAttrLongName, attrExists ) ); |
|
119 |
) |
|
120 |
||
121 |
return itm; |
|
122 |
} |
|
123 |
||
124 |
// --------------------------------------------------------------------------- |
|
125 |
// From class MMsvSessionObserver. |
|
126 |
// Handles an event from the message server. |
|
127 |
// --------------------------------------------------------------------------- |
|
128 |
// |
|
129 |
void CMCSPluginSettingsAppList::HandleSessionEventL( |
|
130 |
TMsvSessionEvent /*aEvent*/, |
|
131 |
TAny* /*aArg1*/, |
|
132 |
TAny* /*aArg2*/, |
|
133 |
TAny* /*aArg3*/ ) |
|
134 |
{ |
|
135 |
||
136 |
} |
|
137 |
||
138 |
// --------------------------------------------------------------------------- |
|
139 |
// Starts the asynchronous application list initialization. |
|
140 |
// --------------------------------------------------------------------------- |
|
141 |
// |
|
142 |
void CMCSPluginSettingsAppList::StartL() |
|
143 |
{ |
|
144 |
iListItems.ResetAndDestroy(); |
|
145 |
AddMailboxesL(); |
|
146 |
AddStaticItemsL(); |
|
147 |
} |
|
148 |
||
149 |
// --------------------------------------------------------------------------- |
|
150 |
// Iterates thru the application list and tries to find a menuitem which |
|
151 |
// matches given property map from HSPS |
|
152 |
// --------------------------------------------------------------------------- |
|
153 |
// |
|
154 |
TSettingItem CMCSPluginSettingsAppList::FindItemL( |
|
155 |
RPointerArray<HSPluginSettingsIf::CPropertyMap>& aProperties ) |
|
156 |
{ |
|
157 |
TBool attrExists( EFalse ); |
|
31
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
158 |
TSettingItem settingItem = { KErrNotFound, EApplication, EFalse, EFalse }; |
30 | 159 |
TBool isFolder = EFalse; |
160 |
||
161 |
// check if the item is folder |
|
162 |
for ( TInt j = 0; j < aProperties.Count(); j++ ) |
|
163 |
{ |
|
164 |
if( aProperties[j]->Name() == KType ) |
|
165 |
{ |
|
166 |
if ( aProperties[j]->Value() == KProperValueFolder ) |
|
167 |
{ |
|
168 |
isFolder = ETrue; |
|
169 |
} |
|
170 |
break; |
|
171 |
} |
|
172 |
} |
|
173 |
||
174 |
TBool itemFound( EFalse ); |
|
175 |
||
176 |
// compare name/value pairs with every menu item in the list |
|
177 |
for ( TInt i = 0; i < iListItems.Count() && !itemFound; i++ ) |
|
178 |
{ |
|
179 |
TBool match( ETrue ); |
|
180 |
CMenuItem* item = iListItems[ i ]; |
|
181 |
for ( TInt j = 0; j < aProperties.Count() && match; j++ ) |
|
182 |
{ |
|
183 |
// type and locked properties skipped |
|
184 |
if ( aProperties[j]->Name() != KType && |
|
185 |
aProperties[j]->Name() != KItemLocked ) |
|
186 |
{ |
|
187 |
HBufC* attrName( NULL ); |
|
188 |
attrName = AiUtility::CopyToBufferL( attrName, |
|
189 |
aProperties[j]->Name()); |
|
190 |
CleanupStack::PushL( attrName ); |
|
191 |
TPtrC attr = item->GetAttributeL( *attrName, attrExists ); |
|
192 |
||
193 |
HBufC* attrValue( NULL ); |
|
194 |
attrValue = AiUtility::CopyToBufferL( attrValue, |
|
195 |
aProperties[j]->Value()); |
|
196 |
CleanupStack::PushL( attrValue ); |
|
197 |
||
198 |
// in case of folder, we just have to compare id |
|
199 |
// which is stored in param attribute |
|
200 |
if ( isFolder && *attrName == KMenuAttrParameter ) |
|
201 |
{ |
|
202 |
// convert id to integer |
|
203 |
TInt id; |
|
204 |
TLex16 lextmp( attrValue->Ptr() ); |
|
205 |
lextmp.Val( id ); |
|
206 |
||
207 |
if ( item->Id() != id ) |
|
208 |
{ |
|
209 |
match = EFalse; |
|
210 |
} |
|
211 |
CleanupStack::PopAndDestroy( attrValue ); |
|
212 |
CleanupStack::PopAndDestroy( attrName ); |
|
213 |
break; |
|
214 |
} |
|
215 |
||
216 |
// otherwise, compare attributes from HSPS and from menuitem |
|
217 |
// if there is no match, move to the next item in the list |
|
218 |
if ( attr != *attrValue ) |
|
219 |
{ |
|
220 |
match = EFalse; |
|
221 |
} |
|
222 |
CleanupStack::PopAndDestroy( attrValue ); |
|
223 |
CleanupStack::PopAndDestroy( attrName ); |
|
224 |
} |
|
225 |
} |
|
226 |
||
227 |
if ( match ) |
|
228 |
{ |
|
229 |
settingItem.id = i; |
|
230 |
settingItem.type = EApplication; |
|
231 |
itemFound = ETrue; |
|
232 |
} |
|
233 |
} |
|
234 |
return settingItem; |
|
235 |
} |
|
236 |
||
237 |
// --------------------------------------------------------------------------- |
|
238 |
// Returns menuitems at given index. |
|
239 |
// --------------------------------------------------------------------------- |
|
240 |
// |
|
241 |
CMenuItem* CMCSPluginSettingsAppList::ItemL( const TInt& aIndex ) |
|
242 |
{ |
|
243 |
CMenuItem* menuItem( NULL ); |
|
244 |
// check if index is within the list boundaries |
|
245 |
if ( aIndex >= 0 && aIndex < iListItems.Count() ) |
|
246 |
{ |
|
247 |
menuItem = iListItems[ aIndex ]; |
|
248 |
} |
|
249 |
return menuItem; |
|
250 |
} |
|
251 |
||
252 |
// --------------------------------------------------------------------------- |
|
253 |
// Helper method for comparing names of two menuitems. Used to sort the list |
|
254 |
// of items. |
|
255 |
// --------------------------------------------------------------------------- |
|
256 |
// |
|
257 |
TInt CMCSPluginSettingsAppList::CompareNameL( const CMenuItem& aFirst, |
|
258 |
const CMenuItem& aSecond ) |
|
259 |
{ |
|
260 |
TBool exists( EFalse ); |
|
261 |
CMenuItem& first = const_cast<CMenuItem&>(aFirst); |
|
262 |
CMenuItem& second = const_cast<CMenuItem&>(aSecond); |
|
263 |
||
264 |
TPtrC name1 = first.GetAttributeL( KMenuAttrLongName, exists ); |
|
265 |
TPtrC name2 = second.GetAttributeL( KMenuAttrLongName, exists ); |
|
266 |
||
267 |
return name1.CompareC( name2 ); |
|
268 |
} |
|
269 |
||
270 |
// --------------------------------------------------------------------------- |
|
271 |
// Adds the static list items to the application list. |
|
272 |
// --------------------------------------------------------------------------- |
|
273 |
// |
|
274 |
void CMCSPluginSettingsAppList::AddStaticItemsL() |
|
275 |
{ |
|
276 |
TLinearOrder<CMenuItem> sortMethod( CMCSPluginSettingsAppList::CompareNameL ); |
|
277 |
||
278 |
CMenuFilter* filter = CMenuFilter::NewL(); |
|
279 |
CleanupStack::PushL( filter ); |
|
280 |
||
281 |
// skip locked items |
|
282 |
filter->DoNotHaveAttributeL( KMenuAttrLocked ); |
|
283 |
const TInt rootId = iMenu.RootFolderL(); |
|
284 |
RArray<TMenuItem> itemArray; |
|
285 |
CleanupClosePushL( itemArray ); |
|
286 |
iMenu.GetItemsL( itemArray, rootId, filter, ETrue ); |
|
287 |
||
288 |
TInt count( itemArray.Count() ); |
|
289 |
||
290 |
for ( TInt i = 0; i < count; i++ ) |
|
291 |
{ |
|
292 |
TPtrC type = itemArray[ i ].Type(); |
|
293 |
||
294 |
// we add applications, shortcuts and folders to the list |
|
295 |
if ( type == KMenuTypeApp || |
|
296 |
type == KMenuTypeShortcut || |
|
297 |
type == KMenuTypeFolder ) |
|
298 |
{ |
|
299 |
CMenuItem* menuItem = CMenuItem::OpenL( iMenu, itemArray[ i ] ); |
|
300 |
CleanupStack::PushL( menuItem ); |
|
301 |
||
302 |
// only non-hidden and non-missing items should be offered to the user |
|
303 |
if ( ( menuItem->Flags() & TMenuItem::EHidden ) == 0 && |
|
304 |
( menuItem->Flags() & TMenuItem::EMissing ) == 0 ) |
|
305 |
{ |
|
306 |
User::LeaveIfError( iListItems.InsertInOrderAllowRepeats( menuItem, sortMethod ) ); |
|
307 |
CleanupStack::Pop( menuItem ); |
|
308 |
} |
|
309 |
else |
|
310 |
{ |
|
311 |
CleanupStack::PopAndDestroy( menuItem ); |
|
312 |
} |
|
313 |
menuItem = NULL; |
|
314 |
} |
|
315 |
} |
|
316 |
||
317 |
CleanupStack::PopAndDestroy( &itemArray ); |
|
318 |
CleanupStack::PopAndDestroy( filter ); |
|
319 |
} |
|
320 |
||
321 |
||
322 |
// --------------------------------------------------------------------------- |
|
323 |
// Returns the root entry containing mailboxes. |
|
324 |
// --------------------------------------------------------------------------- |
|
325 |
// |
|
326 |
CMsvEntry* CMCSPluginSettingsAppList::GetRootEntryL() |
|
327 |
{ |
|
328 |
return iMsvSession->GetEntryL( KMsvRootIndexEntryIdValue ); |
|
329 |
} |
|
330 |
||
331 |
// --------------------------------------------------------------------------- |
|
332 |
// Adds remote mailboxes to the application list. |
|
333 |
// --------------------------------------------------------------------------- |
|
334 |
// |
|
335 |
void CMCSPluginSettingsAppList::AddMailboxesL() |
|
336 |
{ |
|
337 |
CMsvEntry* rootEntry = GetRootEntryL(); |
|
338 |
CleanupStack::PushL(rootEntry); |
|
339 |
TBuf<255> mailboxId; |
|
340 |
||
341 |
TInt cnt = rootEntry->Count(); |
|
342 |
if ( cnt > 0 ) |
|
343 |
{ |
|
344 |
rootEntry->SetSortTypeL( TMsvSelectionOrdering( |
|
345 |
KMsvGroupByType | KMsvGroupByStandardFolders, |
|
346 |
EMsvSortByDetailsReverse, ETrue ) ); |
|
347 |
||
348 |
for ( TInt i = rootEntry->Count(); --i >= 0; ) |
|
349 |
{ |
|
350 |
const TMsvEntry& tentry = (*rootEntry)[i]; |
|
351 |
||
352 |
if (tentry.iMtm.iUid == KMCSCmailMtmUidValue ) |
|
353 |
{ |
|
354 |
mailboxId.Num( tentry.Id() ); |
|
355 |
AddMailboxL( tentry.iDetails, mailboxId ); |
|
356 |
} |
|
357 |
} |
|
358 |
} |
|
359 |
CleanupStack::PopAndDestroy(rootEntry); |
|
360 |
} |
|
361 |
||
362 |
// --------------------------------------------------------------------------- |
|
363 |
// Adds a mailbox to the list. |
|
364 |
// --------------------------------------------------------------------------- |
|
365 |
// |
|
366 |
void CMCSPluginSettingsAppList::AddMailboxL( const TDesC& aMailbox, |
|
367 |
const TDesC& aMailboxId ) |
|
368 |
{ |
|
369 |
TLinearOrder<CMenuItem> sortMethod( CMCSPluginSettingsAppList::CompareNameL ); |
|
370 |
CMenuItem* newItem = CMenuItem::CreateL( iMenu, KMenuTypeMailbox, 0, 0 ); |
|
371 |
CleanupStack::PushL( newItem ); |
|
372 |
||
373 |
// mailbox is a shortcut item with "mailbox:mailboxID" parameter |
|
374 |
newItem->SetAttributeL( KMenuAttrUid, aMailboxId ); |
|
375 |
newItem->SetAttributeL( KMenuAttrLongName, aMailbox ); |
|
376 |
// Mailbox name is saved to settings into param field. |
|
377 |
newItem->SetAttributeL( KMenuAttrParameter, aMailbox ); |
|
378 |
||
379 |
// append the item into iListItems lists |
|
380 |
User::LeaveIfError( iListItems.InsertInOrderAllowRepeats( newItem, sortMethod ) ); |
|
381 |
CleanupStack::Pop( newItem ); |
|
382 |
} |
|
383 |
||
31
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
384 |
// --------------------------------------------------------------------------- |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
385 |
// Gets specified menu item text |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
386 |
// --------------------------------------------------------------------------- |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
387 |
// |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
388 |
HBufC* CMCSPluginSettingsAppList::MenuItemTextL( const TDesC& aUid ) |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
389 |
{ |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
390 |
HBufC* text = NULL; |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
391 |
|
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
392 |
// Get specified icon and text |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
393 |
CMenuFilter* filter = CMenuFilter::NewL(); |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
394 |
CleanupStack::PushL( filter ); |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
395 |
|
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
396 |
// Filter specified item |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
397 |
filter->HaveAttributeL( KMenuAttrUid, aUid ); |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
398 |
|
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
399 |
const TInt root = iMenu.RootFolderL(); |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
400 |
RArray<TMenuItem> items; |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
401 |
CleanupClosePushL( items ); |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
402 |
iMenu.GetItemsL( items, root, filter, ETrue ); |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
403 |
|
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
404 |
CMenuItem* item = NULL; |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
405 |
|
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
406 |
if ( items.Count() > 0 ) |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
407 |
{ |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
408 |
item = CMenuItem::OpenL( iMenu, items[ 0 ] ); |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
409 |
|
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
410 |
if ( item ) |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
411 |
{ |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
412 |
TBool exists( KErrNotFound ); |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
413 |
TPtrC itemName = item->GetAttributeL( KMenuItemLongName, exists ); |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
414 |
|
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
415 |
if ( exists ) |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
416 |
{ |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
417 |
text = HBufC::NewMaxL( itemName.Length() ); |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
418 |
text->Des().Copy( itemName ); |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
419 |
} |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
420 |
delete item; |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
421 |
} |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
422 |
} |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
423 |
|
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
424 |
if( !text ) |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
425 |
{ |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
426 |
text = KNullDesC().Alloc(); |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
427 |
} |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
428 |
|
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
429 |
CleanupStack::PopAndDestroy( &items ); |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
430 |
CleanupStack::PopAndDestroy( filter ); |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
431 |
|
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
432 |
return text; |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
433 |
} |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
434 |
|
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
435 |
|
30 | 436 |
// End of File. |