author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 15 Sep 2010 12:32:36 +0300 | |
branch | RCL_3 |
changeset 122 | 6cadd6867c17 |
parent 118 | 8baec10861af |
child 130 | 67f2ed48ad91 |
permissions | -rw-r--r-- |
114 | 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: The engine class of MCS plugin. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
// System includes |
|
19 |
#include <gulicon.h> |
|
20 |
#include <gslauncher.h> |
|
21 |
#include <mcsmenufilter.h> |
|
22 |
#include <mcsmenuoperation.h> |
|
23 |
#include <mcsmenuiconutility.h> |
|
24 |
#include <bautils.h> |
|
25 |
#include <StringLoader.h> |
|
26 |
#include <aknnotedialog.h> |
|
27 |
#include <mcspluginres.rsg> |
|
28 |
#include <apgcli.h> |
|
29 |
#include <apacmdln.h> |
|
30 |
#include <gfxtranseffect/gfxtranseffect.h> |
|
31 |
#include <akntranseffect.h> |
|
32 |
#include <schemehandler.h> |
|
33 |
#include <viewcli.h> // For CVwsSessionWrapper |
|
34 |
#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
35 |
#include <viewclipartner.h> |
|
36 |
#endif |
|
37 |
#include <aisystemuids.hrh> |
|
38 |
||
39 |
// User includes |
|
40 |
#include "mcspluginengine.h" |
|
41 |
#include "mcsplugin.h" |
|
42 |
#include "mcsplugindata.h" |
|
43 |
#include "mcspluginuids.hrh" |
|
44 |
||
45 |
// Constants |
|
46 |
_LIT( KMyMenuData, "matrixmenudata" ); |
|
47 |
_LIT( KSkin, "skin" ); |
|
48 |
_LIT( KMif, "mif" ); |
|
49 |
_LIT( KResourceDrive, "Z:" ); |
|
50 |
_LIT( KResourceFile, "mcspluginres.rsc" ); |
|
51 |
_LIT( KResPath, "\\resource\\" ); |
|
52 |
_LIT( KMMApplication, "mm://" ); |
|
122
6cadd6867c17
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
118
diff
changeset
|
53 |
_LIT( KSetOpenItemString, "!openitem?id=" ); |
114 | 54 |
_LIT( KIcon, "icon" ); |
55 |
_LIT( KMenuAttrUndefUid, "0x99999991" ); |
|
56 |
_LIT( KMenuIconFile, "aimcsplugin.mif" ); |
|
57 |
_LIT( KMenuBookmarkIconId, "16386" ); |
|
58 |
_LIT( KMenuBookmarkMaskId, "16387" ); |
|
59 |
_LIT( KMenuMailboxIconId, "16388" ); |
|
60 |
_LIT( KMenuMailboxMaskId, "16389" ); |
|
61 |
_LIT( KMenuTypeMailbox, "menu:mailbox" ); |
|
62 |
_LIT( KPrefix, "0x" ); |
|
118
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
63 |
_LIT( KMenuAttrInvokeSettingsUid, "0x99999990" ); |
114 | 64 |
|
65 |
const TUid KHomescreenUid = { AI_UID3_AIFW_COMMON }; |
|
66 |
const TUid KMMUid = { 0x101F4CD2 }; |
|
67 |
const TUid KMCSCmailUidValue = { 0x2001E277 }; |
|
68 |
const TUid KMCSCmailMailboxViewIdValue = { 0x2 }; |
|
69 |
const TUid KBrowserUid = { 0x10008D39 }; |
|
70 |
||
118
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
71 |
// maximum custom message length |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
72 |
const TInt KMaxCustomMsg = 256; |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
73 |
const TInt KUndefinedIndex = -1; |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
74 |
|
122
6cadd6867c17
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
118
diff
changeset
|
75 |
// maximun integer character length |
6cadd6867c17
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
118
diff
changeset
|
76 |
const TInt KMaxLength = 12; |
6cadd6867c17
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
118
diff
changeset
|
77 |
|
114 | 78 |
// ======== LOCAL FUNCTIONS ======== |
79 |
// ---------------------------------------------------------------------------- |
|
80 |
// NextIdToken |
|
81 |
// ---------------------------------------------------------------------------- |
|
82 |
// |
|
83 |
static TPtrC NextIdToken( TLex& aLexer ) |
|
84 |
{ |
|
85 |
aLexer.SkipSpace(); |
|
86 |
aLexer.Mark(); |
|
87 |
||
88 |
while( !aLexer.Eos() && !aLexer.Peek().IsSpace() && aLexer.Peek() != ')' ) |
|
89 |
{ |
|
90 |
aLexer.Inc(); |
|
91 |
} |
|
92 |
||
93 |
return aLexer.MarkedToken(); |
|
94 |
} |
|
95 |
||
96 |
// ---------------------------------------------------------------------------- |
|
97 |
// Shows note dailog, with the given resource. |
|
98 |
// ---------------------------------------------------------------------------- |
|
99 |
// |
|
100 |
static void ShowNoteDlgL( TInt aResource ) |
|
101 |
{ |
|
102 |
HBufC* temp = StringLoader::LoadLC( aResource ); |
|
103 |
||
104 |
CAknNoteDialog* dialog = new (ELeave) CAknNoteDialog( |
|
105 |
CAknNoteDialog::EConfirmationTone, |
|
106 |
CAknNoteDialog::ENoTimeout ); |
|
107 |
CleanupStack::PushL( dialog ); |
|
108 |
dialog->SetTextL( temp->Des() ); |
|
109 |
dialog->ExecuteDlgLD( R_MCS_DISABLE_OPEN_ITEM_DLG ); |
|
110 |
CleanupStack::Pop( dialog ); |
|
111 |
CleanupStack::PopAndDestroy( temp ); |
|
112 |
} |
|
113 |
||
114 |
// ---------------------------------------------------------------------------- |
|
115 |
// Parses uid in Hexadecimal format from the given string. |
|
116 |
// ---------------------------------------------------------------------------- |
|
117 |
// |
|
118 |
TUid ParseHexUidFromString(const TDesC& aUidString ) |
|
119 |
{ |
|
120 |
TUid uid( KNullUid ); |
|
121 |
const TInt pos( aUidString.FindF( KPrefix ) ); |
|
122 |
||
123 |
if ( pos != KErrNotFound ) |
|
124 |
{ |
|
125 |
TLex lex( aUidString.Mid( pos + KPrefix().Length() ) ); |
|
126 |
||
127 |
// Hex parsing needs unsigned int |
|
128 |
TUint32 value( 0 ); |
|
129 |
const TInt parseResult( lex.Val( value, EHex ) ); |
|
130 |
||
131 |
if ( parseResult == KErrNone ) |
|
132 |
{ |
|
133 |
TInt32 value32( value ); |
|
134 |
uid.iUid = value32; |
|
135 |
} |
|
136 |
} |
|
137 |
return uid; |
|
138 |
} |
|
139 |
||
140 |
// ---------------------------------------------------------------------------- |
|
141 |
// Start transition effect. User has launched the application with the given uid. |
|
142 |
// ---------------------------------------------------------------------------- |
|
143 |
// |
|
144 |
void StartEffect( TUid aUid ) |
|
145 |
{ |
|
146 |
//start a full screen effect |
|
147 |
GfxTransEffect::BeginFullScreen( |
|
148 |
AknTransEffect::EApplicationStart, |
|
149 |
TRect(), |
|
150 |
AknTransEffect::EParameterType, |
|
151 |
AknTransEffect::GfxTransParam( aUid, |
|
152 |
AknTransEffect::TParameter::EActivateExplicitContinue )); |
|
153 |
} |
|
154 |
||
155 |
// ============================ MEMBER FUNCTIONS =============================== |
|
156 |
// ---------------------------------------------------------------------------- |
|
157 |
// CMCSPluginEngine::CMCSPluginEngine |
|
158 |
// |
|
159 |
// ---------------------------------------------------------------------------- |
|
160 |
// |
|
161 |
CMCSPluginEngine::CMCSPluginEngine( CMCSPlugin& aPlugin, |
|
162 |
const TDesC8& aInstanceUid ) |
|
163 |
: iPlugin( aPlugin ), iInstanceUid( aInstanceUid ) |
|
164 |
{ |
|
165 |
} |
|
166 |
||
167 |
// ---------------------------------------------------------------------------- |
|
168 |
// CMCSPluginEngine::NewL |
|
169 |
// |
|
170 |
// ---------------------------------------------------------------------------- |
|
171 |
// |
|
172 |
CMCSPluginEngine* CMCSPluginEngine::NewL( CMCSPlugin& aPlugin, |
|
173 |
const TDesC8& aInstanceUid ) |
|
174 |
{ |
|
175 |
CMCSPluginEngine* self = |
|
176 |
new( ELeave ) CMCSPluginEngine( aPlugin, aInstanceUid ); |
|
177 |
||
178 |
CleanupStack::PushL( self ); |
|
179 |
self->ConstructL(); |
|
180 |
CleanupStack::Pop( self ); |
|
181 |
||
182 |
return self; |
|
183 |
} |
|
184 |
||
185 |
// ---------------------------------------------------------------------------- |
|
186 |
// CMCSPluginEngine::ConstructL |
|
187 |
// |
|
188 |
// ---------------------------------------------------------------------------- |
|
189 |
// |
|
190 |
void CMCSPluginEngine::ConstructL() |
|
191 |
{ |
|
192 |
TFullName resourceFile( KResourceDrive ); |
|
193 |
resourceFile.Append( KResPath ); |
|
194 |
resourceFile.Append( KResourceFile ); |
|
195 |
BaflUtils::NearestLanguageFile( |
|
196 |
CCoeEnv::Static()->FsSession(), |
|
197 |
resourceFile ); |
|
198 |
iResourceOffset = |
|
199 |
CCoeEnv::Static()->AddResourceFileL( resourceFile ); |
|
200 |
InitL(); |
|
201 |
StartObservingL(); |
|
202 |
||
203 |
// Get "Undefined" item |
|
204 |
CMenuFilter* filter = CMenuFilter::NewL(); |
|
205 |
CleanupStack::PushL( filter ); |
|
206 |
filter->HaveAttributeL( KMenuAttrUid, KMenuAttrUndefUid ); |
|
207 |
iUndefinedItemHeader = FindMenuItemL( *filter ); |
|
208 |
CleanupStack::PopAndDestroy( filter ); |
|
209 |
iUndefinedItem = CMenuItem::OpenL( iMenu, iUndefinedItemHeader ); |
|
210 |
} |
|
211 |
||
212 |
// ---------------------------------------------------------------------------- |
|
213 |
// CMCSPluginEngine::~CMCSPluginEngine |
|
214 |
// |
|
215 |
// ---------------------------------------------------------------------------- |
|
216 |
// |
|
217 |
CMCSPluginEngine::~CMCSPluginEngine() |
|
218 |
{ |
|
219 |
StopObserving(); |
|
220 |
||
221 |
delete iPluginData; |
|
222 |
||
223 |
// Notifier close has to be before iMenu close |
|
224 |
iNotifier.Close(); |
|
225 |
iMenu.Close(); |
|
226 |
delete iWatcher; |
|
227 |
delete iNotifyWatcher; |
|
228 |
||
229 |
CCoeEnv::Static()->DeleteResourceFile( iResourceOffset ); |
|
230 |
||
231 |
delete iUndefinedItem; |
|
232 |
} |
|
233 |
||
234 |
// --------------------------------------------------------------------------- |
|
235 |
// CMCSPluginEngine::InitL |
|
236 |
// |
|
237 |
// --------------------------------------------------------------------------- |
|
238 |
// |
|
239 |
void CMCSPluginEngine::InitL() |
|
240 |
{ |
|
241 |
iMenu.OpenL( KMyMenuData ); |
|
242 |
iPluginData = CMCSPluginData::NewL( *this, iInstanceUid ); |
|
243 |
iWatcher = CMCSPluginWatcher::NewL( CMCSPluginWatcher::EOperation ); |
|
244 |
||
245 |
TInt err( iNotifier.Open( iMenu ) ); |
|
246 |
||
247 |
if ( err == KErrNone ) |
|
248 |
{ |
|
249 |
iNotifyWatcher = CMCSPluginWatcher::NewL( CMCSPluginWatcher::ENotify ); |
|
250 |
||
251 |
iNotifier.Notify( 0, |
|
252 |
RMenuNotifier::EItemsAddedRemoved, |
|
253 |
iNotifyWatcher->iStatus ); |
|
254 |
iNotifyWatcher->WatchNotify( this ); |
|
255 |
} |
|
256 |
} |
|
257 |
||
258 |
// --------------------------------------------------------------------------- |
|
259 |
// CMCSPluginEngine::StartObservingL |
|
260 |
// |
|
261 |
// --------------------------------------------------------------------------- |
|
262 |
// |
|
263 |
void CMCSPluginEngine::StartObservingL() |
|
264 |
{ |
|
265 |
// registering to mailbox db. changes observing |
|
266 |
iMsvSession = CMsvSession::OpenAsObserverL( *this ); |
|
267 |
} |
|
268 |
||
269 |
// --------------------------------------------------------------------------- |
|
270 |
// CMCSPluginEngine::StopObserving |
|
271 |
// |
|
272 |
// --------------------------------------------------------------------------- |
|
273 |
// |
|
274 |
void CMCSPluginEngine::StopObserving() |
|
275 |
{ |
|
276 |
delete iMsvSession; |
|
277 |
iMsvSession = NULL; |
|
278 |
} |
|
279 |
||
280 |
// --------------------------------------------------------------------------- |
|
281 |
// CMCSPluginEngine::MenuDataL |
|
282 |
// |
|
283 |
// --------------------------------------------------------------------------- |
|
284 |
// |
|
285 |
CMCSData& CMCSPluginEngine::MenuDataL( const TInt& aIndex ) |
|
286 |
{ |
|
287 |
return iPluginData->DataItemL( aIndex ); |
|
288 |
} |
|
289 |
||
290 |
// --------------------------------------------------------------------------- |
|
291 |
// CMCSPluginEngine::MenuItemCount |
|
292 |
// |
|
293 |
// --------------------------------------------------------------------------- |
|
294 |
// |
|
295 |
TInt CMCSPluginEngine::MenuItemCount() |
|
296 |
{ |
|
297 |
return iPluginData->DataCount(); |
|
298 |
} |
|
299 |
||
300 |
// --------------------------------------------------------------------------- |
|
301 |
// CMCSPluginEngine::FindMenuItemL |
|
302 |
// Returns the menu item header, which matches the given filter. |
|
303 |
// --------------------------------------------------------------------------- |
|
304 |
// |
|
305 |
TMenuItem CMCSPluginEngine::FindMenuItemL( CMenuFilter& aFilter ) |
|
306 |
{ |
|
307 |
TMenuItem item; |
|
308 |
const TInt root( iMenu.RootFolderL() ); |
|
309 |
||
310 |
RArray<TMenuItem> items; |
|
311 |
CleanupClosePushL( items ); |
|
312 |
||
313 |
iMenu.GetItemsL( items, root, &aFilter, ETrue ); |
|
314 |
||
315 |
if ( items.Count() > 0 ) |
|
316 |
{ |
|
317 |
item = items[0]; |
|
318 |
} |
|
319 |
||
320 |
CleanupStack::PopAndDestroy( &items ); |
|
321 |
||
322 |
return item; |
|
323 |
} |
|
324 |
||
325 |
// --------------------------------------------------------------------------- |
|
326 |
// CMCSPluginEngine::FetchMenuItemL |
|
327 |
// Returns the actual menu item for the given header. |
|
328 |
// --------------------------------------------------------------------------- |
|
329 |
// |
|
330 |
CMenuItem* CMCSPluginEngine::FetchMenuItemL( CMCSData& aData ) |
|
331 |
{ |
|
332 |
CMenuItem* item = NULL; |
|
333 |
||
334 |
TRAP_IGNORE( item = CMenuItem::OpenL( iMenu, aData.MenuItem().Id() ) ); |
|
335 |
||
336 |
if( item ) |
|
337 |
{ |
|
338 |
return item; |
|
339 |
} |
|
340 |
||
341 |
if( aData.MenuItem().Type() == KMenuTypeUrl ) |
|
342 |
{ |
|
343 |
item = CreateBkmItemL( aData ); |
|
344 |
} |
|
345 |
else if( aData.MenuItem().Type() == KMenuTypeMailbox ) |
|
346 |
{ |
|
347 |
item = CreateMailboxItemL( aData); |
|
348 |
} |
|
349 |
||
350 |
return item; |
|
351 |
} |
|
352 |
||
353 |
// --------------------------------------------------------------------------- |
|
354 |
// |
|
355 |
// --------------------------------------------------------------------------- |
|
356 |
// |
|
357 |
CMenuItem* CMCSPluginEngine::CreateBkmItemL( CMCSData& aData ) |
|
358 |
{ |
|
359 |
CMenuItem* item( NULL ); |
|
360 |
if( aData.MenuItem().Id() != KErrNotFound ) |
|
361 |
{ |
|
362 |
item = CMenuItem::CreateL( iMenu, KMenuTypeUrl, 0, 0 ); |
|
363 |
CleanupStack::PushL( item ); |
|
118
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
364 |
item->SetAttributeL( KMenuAttrLongName, *aData.Name() ); |
114 | 365 |
item->SetAttributeL( KMenuAttrIconFile, KMenuIconFile ); |
366 |
item->SetAttributeL( KMenuAttrIconId, KMenuBookmarkIconId ); |
|
367 |
item->SetAttributeL( KMenuAttrMaskId, KMenuBookmarkMaskId ); |
|
368 |
CleanupStack::Pop( item ); |
|
369 |
} |
|
370 |
return item; |
|
371 |
} |
|
372 |
||
373 |
// --------------------------------------------------------------------------- |
|
374 |
// |
|
375 |
// --------------------------------------------------------------------------- |
|
376 |
// |
|
377 |
CMenuItem* CMCSPluginEngine::CreateMailboxItemL( CMCSData& aData ) |
|
378 |
{ |
|
379 |
CMenuItem* item( NULL ); |
|
380 |
if( aData.MenuItem().Id() != KErrNotFound ) |
|
381 |
{ |
|
382 |
item = CMenuItem::CreateL( iMenu, KMenuTypeMailbox, 0, 0 ); |
|
383 |
CleanupStack::PushL( item ); |
|
118
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
384 |
item->SetAttributeL( KMenuAttrLongName, *aData.Name() ); |
114 | 385 |
item->SetAttributeL( KMenuAttrIconFile, KMenuIconFile ); |
386 |
item->SetAttributeL( KMenuAttrIconId, KMenuMailboxIconId ); |
|
387 |
item->SetAttributeL( KMenuAttrMaskId, KMenuMailboxMaskId ); |
|
388 |
CleanupStack::Pop( item ); |
|
389 |
} |
|
390 |
return item; |
|
391 |
} |
|
392 |
||
393 |
// --------------------------------------------------------------------------- |
|
394 |
// CMCSPluginEngine::ItemIconL |
|
395 |
// Returns MCS default icon if attribute is 'icon' else parses the |
|
396 |
// skin definition from attribute and sets attributes to aMenuItem. |
|
397 |
// --------------------------------------------------------------------------- |
|
398 |
// |
|
399 |
CGulIcon* CMCSPluginEngine::ItemIconL( CMenuItem* aMenuItem, |
|
400 |
const TDesC& aAttr ) |
|
401 |
{ |
|
402 |
||
403 |
CMenuItem* menuItem; |
|
404 |
||
405 |
// check if item exists in MCS |
|
406 |
if ( aMenuItem ) |
|
407 |
{ |
|
408 |
TUint32 flags = aMenuItem->Flags(); |
|
409 |
TUint32 isHidden = flags & TMenuItem::EHidden; |
|
410 |
TUint32 isMissing = flags & TMenuItem::EMissing; |
|
411 |
||
118
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
412 |
TBool attrExists = ETrue; |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
413 |
TPtrC uid = aMenuItem->GetAttributeL(KMenuAttrUid, attrExists); |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
414 |
|
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
415 |
// if item is hidden or missing (mmc card removed) |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
416 |
// use "Undefined" icon instead |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
417 |
// for empty item it's own icon is shown |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
418 |
if ( iUndefinedItem && uid.Compare(KMenuAttrInvokeSettingsUid) != 0 && |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
419 |
( isHidden || isMissing ) ) |
114 | 420 |
{ |
421 |
menuItem = iUndefinedItem; |
|
422 |
} |
|
423 |
else |
|
424 |
{ |
|
425 |
menuItem = aMenuItem; |
|
426 |
} |
|
427 |
} |
|
428 |
else |
|
429 |
{ |
|
430 |
// item not found in MCS. Use Undefined Icon |
|
431 |
menuItem = iUndefinedItem; |
|
432 |
} |
|
433 |
||
434 |
CAknIcon* icon( NULL ); |
|
435 |
CGulIcon* gIcon( NULL ); |
|
436 |
TBool exists( ETrue ); |
|
437 |
||
438 |
if ( aAttr != KIcon ) |
|
439 |
{ |
|
440 |
// Resolve secondary icon definition from attribute |
|
441 |
TPtrC iconDef( menuItem->GetAttributeL( aAttr, exists ) ); |
|
442 |
||
443 |
if ( exists ) |
|
444 |
{ |
|
445 |
exists = ConstructMenuItemForIconL( iconDef, *menuItem ); |
|
446 |
} |
|
447 |
} |
|
448 |
||
449 |
if ( exists ) |
|
450 |
{ |
|
451 |
icon = MenuIconUtility::GetItemIconL( *menuItem ); |
|
452 |
||
453 |
if ( icon ) |
|
454 |
{ |
|
455 |
CleanupStack::PushL( icon ); |
|
456 |
||
457 |
gIcon = CGulIcon::NewL( icon->Bitmap(), icon->Mask() ); |
|
458 |
||
459 |
// Detach and delete |
|
460 |
icon->SetBitmap( NULL ); |
|
461 |
icon->SetMask( NULL ); |
|
462 |
||
463 |
CleanupStack::PopAndDestroy( icon ); |
|
464 |
} |
|
465 |
} |
|
466 |
||
467 |
return gIcon; |
|
468 |
} |
|
469 |
||
470 |
// --------------------------------------------------------------------------- |
|
471 |
// CMCSPluginEngine::ItemTextL |
|
472 |
// Returns text string for the given attribute |
|
473 |
// --------------------------------------------------------------------------- |
|
474 |
// |
|
475 |
TPtrC CMCSPluginEngine::ItemTextL( CMenuItem* aMenuItem, const TDesC& aAttr ) |
|
476 |
{ |
|
477 |
||
478 |
CMenuItem* menuItem; |
|
479 |
||
480 |
// check if item exists in MCS |
|
481 |
if ( aMenuItem ) |
|
482 |
{ |
|
483 |
TUint32 flags = aMenuItem->Flags(); |
|
484 |
TUint32 isHidden = flags & TMenuItem::EHidden; |
|
485 |
TUint32 isMissing = flags & TMenuItem::EMissing; |
|
486 |
||
118
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
487 |
TBool attrExists = ETrue; |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
488 |
TPtrC uid = aMenuItem->GetAttributeL(KMenuAttrUid, attrExists); |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
489 |
|
114 | 490 |
// if item is hidden or missing (mmc card removed) |
491 |
// use "Undefined" text instead |
|
118
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
492 |
// for empty item it's own icon is shown |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
493 |
if ( iUndefinedItem && uid.Compare(KMenuAttrInvokeSettingsUid) != 0 && |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
494 |
( isHidden || isMissing ) ) |
114 | 495 |
{ |
496 |
menuItem = iUndefinedItem; |
|
497 |
} |
|
498 |
else |
|
499 |
{ |
|
500 |
menuItem = aMenuItem; |
|
501 |
} |
|
502 |
} |
|
503 |
else |
|
504 |
{ |
|
505 |
// item not found in MCS. Use "Undefined" text |
|
506 |
menuItem = iUndefinedItem; |
|
507 |
} |
|
508 |
||
509 |
TBool exists( KErrNotFound ); |
|
510 |
||
511 |
TPtrC name( menuItem->GetAttributeL( aAttr, exists ) ); |
|
512 |
||
513 |
if ( exists ) |
|
514 |
{ |
|
515 |
return name; |
|
516 |
} |
|
517 |
||
518 |
return KNullDesC(); |
|
519 |
} |
|
520 |
||
521 |
// --------------------------------------------------------------------------- |
|
522 |
// CMCSPluginEngine::LaunchItemL |
|
523 |
// Calls the open command for the given menu item header |
|
524 |
// --------------------------------------------------------------------------- |
|
525 |
// |
|
526 |
void CMCSPluginEngine::LaunchItemL( const TInt& aIndex ) |
|
527 |
{ |
|
528 |
if ( iBackupRestore ) |
|
529 |
{ |
|
530 |
ShowNoteDlgL( R_MCS_DISABLE_OPEN_ITEM ); |
|
531 |
return; |
|
532 |
} |
|
533 |
||
534 |
CMCSData& dataItem( iPluginData->DataItemL( aIndex ) ); |
|
535 |
// run item based on its type |
|
536 |
TPtrC type( dataItem.MenuItem().Type()); |
|
537 |
||
538 |
// run folder |
|
539 |
if ( type == KMenuTypeFolder ) |
|
540 |
{ |
|
541 |
LaunchFolderItemL( dataItem ); |
|
542 |
} |
|
543 |
else if( type == KMenuTypeUrl ) |
|
544 |
{ |
|
545 |
LaunchBookmarkItemL( dataItem ); |
|
546 |
} |
|
547 |
else if( type == KMenuTypeMailbox ) |
|
548 |
{ |
|
549 |
LaunchMailboxItemL( dataItem ); |
|
550 |
} |
|
551 |
else |
|
552 |
{ |
|
118
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
553 |
CMenuItem* item(CMenuItem::OpenL(iMenu, dataItem.MenuItem().Id())); |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
554 |
CleanupStack::PushL(item); |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
555 |
|
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
556 |
TBool attrExists = ETrue; |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
557 |
|
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
558 |
TPtrC uid = item->GetAttributeL(KMenuAttrUid, attrExists); |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
559 |
|
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
560 |
// Show selected shortcut settings |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
561 |
if (uid.Compare(KMenuAttrInvokeSettingsUid) == 0) |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
562 |
{ |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
563 |
TRAP_IGNORE( ShowSettingsL(aIndex + 1) ); |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
564 |
} |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
565 |
else |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
566 |
{ |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
567 |
LaunchMCSItemL(dataItem); |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
568 |
} |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
569 |
CleanupStack::PopAndDestroy(item); |
114 | 570 |
} |
571 |
} |
|
572 |
||
573 |
// --------------------------------------------------------------------------- |
|
574 |
// |
|
575 |
// --------------------------------------------------------------------------- |
|
576 |
// |
|
577 |
void CMCSPluginEngine::LaunchFolderItemL( CMCSData& aData ) |
|
578 |
{ |
|
579 |
CMenuItem* item = NULL; |
|
580 |
TRAP_IGNORE( item = CMenuItem::OpenL( iMenu, aData.MenuItem().Id() ) ); |
|
581 |
||
582 |
// item does not exist at all in MCS |
|
583 |
if ( item == NULL ) |
|
584 |
{ |
|
585 |
ShowNoteDlgL( R_MCS_DISABLE_OPEN_ITEM_MISSING ); |
|
586 |
return; |
|
587 |
} |
|
588 |
||
589 |
CleanupStack::PushL( item ); |
|
590 |
||
591 |
StartEffect( KMMUid ); |
|
592 |
||
593 |
// message for MM application |
|
594 |
HBufC8* message; |
|
595 |
||
596 |
// prepare message for launching folder |
|
122
6cadd6867c17
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
118
diff
changeset
|
597 |
TBuf<KMaxLength> itemId; |
6cadd6867c17
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
118
diff
changeset
|
598 |
itemId.Num( item->Id() ); |
114 | 599 |
|
122
6cadd6867c17
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
118
diff
changeset
|
600 |
message = HBufC8::NewLC( KMMApplication().Length() |
6cadd6867c17
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
118
diff
changeset
|
601 |
+ KSetOpenItemString().Length() |
6cadd6867c17
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
118
diff
changeset
|
602 |
+ itemId.Length() ); |
114 | 603 |
message->Des().Copy( KMMApplication ); |
122
6cadd6867c17
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
118
diff
changeset
|
604 |
message->Des().Append( KSetOpenItemString ); |
6cadd6867c17
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
118
diff
changeset
|
605 |
message->Des().Append( itemId ); |
114 | 606 |
|
607 |
// find MM application |
|
608 |
TApaTaskList taskList( CCoeEnv::Static()->WsSession() ); |
|
609 |
TApaTask task( taskList.FindApp( KMMUid ) ); |
|
610 |
||
611 |
if ( task.Exists() ) |
|
612 |
{ |
|
613 |
// MM is already running in background - send APA Message |
|
614 |
task.SendMessage( |
|
615 |
TUid::Uid( KUidApaMessageSwitchOpenFileValue ), *message ); |
|
616 |
} |
|
617 |
else |
|
618 |
{ |
|
619 |
// MM not running yet - use Command Line Tail |
|
620 |
RApaLsSession appArcSession; |
|
621 |
CleanupClosePushL( appArcSession ); |
|
622 |
||
623 |
User::LeaveIfError( appArcSession.Connect() ); |
|
624 |
||
625 |
TApaAppInfo appInfo; |
|
626 |
TInt err( appArcSession.GetAppInfo( appInfo, KMMUid ) ); |
|
627 |
||
628 |
if ( err == KErrNone ) |
|
629 |
{ |
|
630 |
CApaCommandLine* cmdLine = CApaCommandLine::NewLC(); |
|
631 |
cmdLine->SetExecutableNameL( appInfo.iFullName ); |
|
632 |
cmdLine->SetCommandL( EApaCommandRun ); |
|
633 |
cmdLine->SetTailEndL( *message ); |
|
634 |
appArcSession.StartApp( *cmdLine ); |
|
635 |
CleanupStack::PopAndDestroy( cmdLine ); |
|
636 |
} |
|
637 |
CleanupStack::PopAndDestroy( &appArcSession ); |
|
638 |
} |
|
639 |
CleanupStack::PopAndDestroy( message ); |
|
640 |
CleanupStack::PopAndDestroy( item ); |
|
641 |
} |
|
642 |
||
643 |
// --------------------------------------------------------------------------- |
|
644 |
// |
|
645 |
// --------------------------------------------------------------------------- |
|
646 |
// |
|
647 |
void CMCSPluginEngine::LaunchBookmarkItemL( CMCSData& aData ) |
|
648 |
{ |
|
649 |
StartEffect( KBrowserUid ); |
|
650 |
||
118
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
651 |
CSchemeHandler* urlHandler = CSchemeHandler::NewL( *aData.Value()); |
114 | 652 |
CleanupStack::PushL( urlHandler ); |
653 |
urlHandler->HandleUrlStandaloneL(); |
|
654 |
CleanupStack::PopAndDestroy( urlHandler ); |
|
655 |
} |
|
656 |
||
657 |
// --------------------------------------------------------------------------- |
|
658 |
// |
|
659 |
// --------------------------------------------------------------------------- |
|
660 |
// |
|
661 |
void CMCSPluginEngine::LaunchMailboxItemL( CMCSData& aData ) |
|
662 |
{ |
|
663 |
TInt id( aData.MenuItem().Id()); |
|
664 |
if ( id == KErrNotFound ) |
|
665 |
{ |
|
666 |
ShowNoteDlgL( R_MCS_DISABLE_OPEN_ITEM_MISSING ); |
|
667 |
return; |
|
668 |
} |
|
669 |
||
670 |
StartEffect( KMCSCmailUidValue ); |
|
671 |
||
672 |
TUid uId = TUid::Uid( id ); |
|
673 |
const TVwsViewId viewId( KMCSCmailUidValue, KMCSCmailMailboxViewIdValue ); |
|
674 |
CVwsSessionWrapper* vwsSession = CVwsSessionWrapper::NewL(); |
|
675 |
vwsSession->CreateActivateViewEvent( viewId, uId, KNullDesC8() ); |
|
676 |
delete vwsSession; |
|
677 |
} |
|
678 |
||
679 |
// --------------------------------------------------------------------------- |
|
680 |
// |
|
681 |
// --------------------------------------------------------------------------- |
|
682 |
// |
|
683 |
void CMCSPluginEngine::LaunchMCSItemL( CMCSData& aData ) |
|
684 |
{ |
|
685 |
if( iWatcher->IsActive()) |
|
686 |
{ |
|
687 |
return; |
|
688 |
} |
|
689 |
CMenuItem* item = NULL; |
|
690 |
TRAP_IGNORE( item = CMenuItem::OpenL( iMenu, aData.MenuItem().Id() ) ); |
|
691 |
||
692 |
// item does not exist at all in MCS |
|
693 |
if ( item == NULL ) |
|
694 |
{ |
|
695 |
ShowNoteDlgL( R_MCS_DISABLE_OPEN_ITEM_MISSING ); |
|
696 |
return; |
|
697 |
} |
|
698 |
||
699 |
CleanupStack::PushL( item ); |
|
700 |
||
701 |
TBool attrExists = ETrue; |
|
702 |
TPtrC uid = item->GetAttributeL( KMenuAttrUid, attrExists ); |
|
703 |
||
704 |
// trying to run hidden or missing application (e.g. unistalled app |
|
705 |
// or app on MMC which was removed ) |
|
706 |
// -> We display a note for a user that this is not possible¨ |
|
707 |
TUint32 isHidden = item->Flags() & TMenuItem::EHidden; |
|
708 |
TUint32 isMissing = item->Flags() & TMenuItem::EMissing; |
|
709 |
||
710 |
if ( ( attrExists && uid == KMenuAttrUndefUid ) || isHidden || isMissing ) |
|
711 |
{ |
|
712 |
CleanupStack::PopAndDestroy( item ); |
|
713 |
ShowNoteDlgL( R_MCS_DISABLE_OPEN_ITEM_MISSING ); |
|
714 |
return; |
|
715 |
} |
|
716 |
||
717 |
if ( attrExists ) |
|
718 |
{ |
|
719 |
StartEffect( ParseHexUidFromString( uid )); |
|
720 |
} |
|
721 |
||
722 |
// run application/shortcut |
|
723 |
CMenuOperation* operation( item->HandleCommandL( |
|
724 |
KMenuCmdOpen, KNullDesC8, iWatcher->iStatus ) ); |
|
725 |
iWatcher->Watch( operation ); |
|
726 |
CleanupStack::PopAndDestroy( item ); |
|
727 |
} |
|
728 |
||
729 |
// --------------------------------------------------------------------------- |
|
730 |
// CMCSPluginEngine::HandleNotifyL |
|
731 |
// Handle the change in Menu Content |
|
732 |
// --------------------------------------------------------------------------- |
|
733 |
// |
|
734 |
void CMCSPluginEngine::HandleNotifyL() |
|
735 |
{ |
|
736 |
TInt count( iPluginData->DataCount() ); |
|
737 |
||
738 |
for ( TInt i = 0; i < count; i++ ) |
|
739 |
{ |
|
740 |
CMCSData& data( iPluginData->DataItemL( i ) ); |
|
741 |
data.SetDirty( ETrue ); |
|
742 |
} |
|
743 |
||
744 |
iPlugin.PublishL(); |
|
745 |
||
746 |
// Notification must be activated again |
|
747 |
iNotifyWatcher->Cancel(); |
|
748 |
iNotifier.Notify( 0, |
|
749 |
RMenuNotifier::EItemsAddedRemoved, |
|
750 |
iNotifyWatcher->iStatus ); |
|
751 |
||
752 |
iNotifyWatcher->WatchNotify( this ); |
|
753 |
} |
|
754 |
||
755 |
// --------------------------------------------------------------------------- |
|
756 |
// CMCSPluginEngine::HandleSessionEventL |
|
757 |
// Handles an event from the message server. |
|
758 |
// --------------------------------------------------------------------------- |
|
759 |
// |
|
760 |
void CMCSPluginEngine::HandleSessionEventL( TMsvSessionEvent aEvent, |
|
761 |
TAny* aArg1, TAny* /*aArg2*/, TAny* /*aArg3*/) |
|
762 |
{ |
|
763 |
switch ( aEvent ) |
|
764 |
{ |
|
765 |
case EMsvEntriesDeleted: |
|
766 |
{ |
|
767 |
CMsvEntrySelection* sel = static_cast<CMsvEntrySelection*>( aArg1 ); |
|
768 |
TInt count( sel->Count()); |
|
769 |
for( TInt i = 0; i < count; i++ ) |
|
770 |
{ |
|
771 |
iPluginData->RemoveDataL( sel->At( i ) ); |
|
772 |
} |
|
773 |
} |
|
774 |
break; |
|
775 |
default: |
|
776 |
break; |
|
777 |
} |
|
778 |
} |
|
779 |
||
780 |
// --------------------------------------------------------------------------- |
|
781 |
// CMCSPluginEngine::SetBackupRestore |
|
782 |
// |
|
783 |
// --------------------------------------------------------------------------- |
|
784 |
// |
|
785 |
void CMCSPluginEngine::SetBackupRestore( TBool aBackupRestore ) |
|
786 |
{ |
|
787 |
iBackupRestore = aBackupRestore; |
|
788 |
} |
|
789 |
||
790 |
// --------------------------------------------------------------------------- |
|
791 |
// CMCSPluginEngine::ShowSettingsL |
|
792 |
// Launch General Settings plugin |
|
793 |
// --------------------------------------------------------------------------- |
|
794 |
// |
|
118
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
795 |
void CMCSPluginEngine::ShowSettingsL( const TInt aEditIdx ) |
114 | 796 |
{ |
797 |
TUid uid = {AI_UID_ECOM_IMPLEMENTATION_SETTINGS_MCSPLUGIN}; |
|
798 |
||
118
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
799 |
// format the custom message |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
800 |
// iInstanceUid/aEditIdx is the format |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
801 |
TBuf8<KMaxCustomMsg> msg; |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
802 |
msg.Append(iInstanceUid); |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
803 |
if( aEditIdx != KUndefinedIndex ) |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
804 |
{ |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
805 |
msg.Append('//'); |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
806 |
msg.AppendFormat(_L8("%d"), aEditIdx); |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
807 |
} |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
808 |
|
114 | 809 |
CGSLauncher* launcher = CGSLauncher::NewLC(); |
118
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
810 |
launcher->LaunchGSViewL ( uid, KHomescreenUid, msg ); |
114 | 811 |
CleanupStack::PopAndDestroy( launcher ); |
812 |
} |
|
813 |
||
814 |
// --------------------------------------------------------------------------- |
|
815 |
// CMCSPluginEngine::ConstructMenuItemForIconL |
|
816 |
// Syntax: skin(major minor):mif(filename bimapId maskId) |
|
817 |
// --------------------------------------------------------------------------- |
|
818 |
// |
|
819 |
TBool CMCSPluginEngine::ConstructMenuItemForIconL( const TDesC& aPath, |
|
820 |
CMenuItem& aMenuItem ) |
|
821 |
{ |
|
822 |
TInt pos( aPath.Locate( ':' ) ); |
|
823 |
if ( pos == KErrNotFound ) |
|
824 |
{ |
|
825 |
pos = aPath.Length(); |
|
826 |
} |
|
827 |
TPtrC skin( aPath.Left( pos ) ); |
|
828 |
TInt sf( skin.FindF( KSkin ) ); |
|
829 |
||
830 |
if ( sf == KErrNotFound ) |
|
831 |
{ |
|
832 |
return EFalse; |
|
833 |
} |
|
834 |
||
835 |
TPtrC temp( skin.Mid( sf + KSkin().Length() ) ); |
|
836 |
TLex input( temp ); |
|
837 |
input.SkipSpace(); |
|
838 |
||
839 |
if ( !input.Eos() && input.Peek() == '(' ) |
|
840 |
{ |
|
841 |
input.Inc(); |
|
842 |
} |
|
843 |
TPtrC majorId( NextIdToken( input ) ); |
|
844 |
TPtrC minorId( NextIdToken( input ) ); |
|
845 |
||
846 |
aMenuItem.SetAttributeL( KMenuAttrIconSkinMajorId, majorId ); |
|
847 |
aMenuItem.SetAttributeL( KMenuAttrIconSkinMinorId, minorId ); |
|
848 |
||
849 |
if ( aPath.Length() > pos && |
|
850 |
( aPath.Mid( pos + 1 ).FindF( KMif ) != KErrNotFound ) ) |
|
851 |
{ |
|
852 |
TPtrC mif( aPath.Mid( pos + 1 ) ); |
|
853 |
TInt mf( mif.FindF( KMif ) ); |
|
854 |
||
855 |
TLex input1( mif.Mid( mf + KMif().Length() ) ); |
|
856 |
input1.SkipSpace(); |
|
857 |
||
858 |
if ( !input1.Eos() && input1.Peek() == '(' ) |
|
859 |
{ |
|
860 |
input1.Inc(); |
|
861 |
} |
|
862 |
||
863 |
TPtrC file( NextIdToken( input1 ) ); |
|
864 |
TPtrC bitmapId( NextIdToken( input1 ) ); |
|
865 |
TPtrC maskId( NextIdToken( input1 ) ); |
|
866 |
||
867 |
aMenuItem.SetAttributeL( KMenuAttrIconFile, file ); |
|
868 |
aMenuItem.SetAttributeL( KMenuAttrIconId, bitmapId ); |
|
869 |
aMenuItem.SetAttributeL( KMenuAttrMaskId, maskId ); |
|
870 |
} |
|
871 |
||
872 |
return ETrue; |
|
873 |
} |
|
874 |
||
875 |
// End of file |