|
1 /* |
|
2 * Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <eikmenup.h> // for CEikMenuPane |
|
21 #include <bautils.h> // BaflUtils |
|
22 #include <eikenv.h> // CEikonEnv |
|
23 #include "finditemmenu.h" |
|
24 #include <finditemengine.h> |
|
25 #include "finditemdialogpanic.h" |
|
26 #include <finditemmenu.rsg> |
|
27 #include <ConeResLoader.h> |
|
28 |
|
29 #include <ItemFinder.h> |
|
30 |
|
31 #include <sendui.h> // for CSendAppUi |
|
32 #include <CMessageData.h> // for CMessageData |
|
33 |
|
34 #include <commonphoneparser.h> // Phonenumber parser |
|
35 #include <SendUiConsts.h> // Mtm uids |
|
36 |
|
37 #include <FavouritesLimits.h> // KFavouritesMaxUrl |
|
38 #include <FavouritesItem.h> // for CBookmarkItem |
|
39 |
|
40 #include <FavouritesDb.h> |
|
41 |
|
42 #include <apgcli.h> // RApaLsSession for WMLBrowser launch |
|
43 #include <apgtask.h> |
|
44 |
|
45 #ifndef RD_VIRTUAL_PHONEBOOK |
|
46 #include <CPbkContactEngine.h> // Phonebook Engine |
|
47 #include <RPbkViewResourceFile.h> // Phonebook view dll resource loader |
|
48 #include <cpbkdatasaveappui.h> // for PbkDataSaveAppUi |
|
49 #include <CPbkFieldsInfo.h> // Phonebook field types |
|
50 #else // RD_VIRTUAL_PHONEBOOK |
|
51 #include <AiwServiceHandler.h> // CAiwServiceHandler |
|
52 #include <AiwContactAssignDataTypes.h> // AiwContactAssign |
|
53 #endif // !RD_VIRTUAL_PHONEBOOK |
|
54 |
|
55 #include "finditem.hrh" |
|
56 #include <FindItemui.rsg> |
|
57 #include <aknnotewrappers.h> |
|
58 |
|
59 // add to gallery related |
|
60 #include <AknCommonDialogs.h> |
|
61 |
|
62 #include <featmgr.h> |
|
63 |
|
64 #include <centralrepository.h> |
|
65 #include <CommonUiInternalCRKeys.h> |
|
66 |
|
67 #include <AiwCommon.hrh> |
|
68 #include <SchemeHandler.h> |
|
69 |
|
70 // Callback query |
|
71 #include <aknlists.h> |
|
72 #include <aknPopup.h> |
|
73 #include <StringLoader.h> |
|
74 |
|
75 #include "FindItemVoIPExtension.h" |
|
76 |
|
77 #include "FindItemMenuWrapper.h" |
|
78 #include <akncontext.h> // AknContextPane |
|
79 |
|
80 #include <baclipb.h> // CClipboard |
|
81 |
|
82 #include "commonuimpengineapiloader.h" |
|
83 |
|
84 // LOCAL CONSTANTS AND MACROS |
|
85 |
|
86 // Resource files |
|
87 _LIT( KResFileName, "z:\\resource\\finditemmenu.rsc" ); |
|
88 _LIT( KDialogResourceName, "z:\\resource\\finditemui.rsc" ); |
|
89 _LIT( KCommonUiMPEngineApiLoaderName, "z:\\sys\\bin\\commonuimpengineapiloader.dll" ); |
|
90 |
|
91 enum TFindUIAddCNList //handling popup indeces, update there if order of |
|
92 // query items changes |
|
93 { |
|
94 EFindUISenderNumber = 0, |
|
95 EFindUICallbackNumber = 1 |
|
96 }; |
|
97 |
|
98 |
|
99 _LIT( KRtspUrlAddress, "rtsp://" ); |
|
100 |
|
101 const TInt KMaxMenuTextLength = 40; |
|
102 |
|
103 // Maximum length of Browser bookmark |
|
104 const TInt KMaxBookmarkNameLength = 50; |
|
105 |
|
106 // Entry point for dynamically loaded dlls. |
|
107 const TInt KMPEngineApiDllEntryPoint = 1; |
|
108 |
|
109 // TYPE DEFINITIONS |
|
110 typedef TAny* (*MPEngineApiL)(); |
|
111 |
|
112 |
|
113 // ============================= MEMBER FUNCTIONS ============================== |
|
114 // ----------------------------------------------------------------------------- |
|
115 // CFindItemMenu::CFindItemMenu |
|
116 // C++ default constructor. |
|
117 // ----------------------------------------------------------------------------- |
|
118 // |
|
119 CFindItemMenu::CFindItemMenu() : |
|
120 iCoeEnv( CCoeEnv::Static() ), |
|
121 iResLoader( *iCoeEnv ), |
|
122 iSenderDescType( CItemFinder::EPhoneNumber ), |
|
123 iSenderHighlighted( EFalse ) |
|
124 #ifdef RD_VOIP_REL_2_2 |
|
125 ,iMenuItemFlags( NULL ) // all menu items allowed |
|
126 #endif // RD_VOIP_REL_2_2 |
|
127 { |
|
128 } |
|
129 |
|
130 // ----------------------------------------------------------------------------- |
|
131 // CFindItemMenu::ConstructL |
|
132 // Second-phase constructor |
|
133 // ----------------------------------------------------------------------------- |
|
134 // |
|
135 void CFindItemMenu::ConstructL( const TInt aCommandId ) |
|
136 { |
|
137 iFindItemCommandId = aCommandId; |
|
138 iFindItemMenuItemAdded = EFalse; |
|
139 |
|
140 iDialData = CAiwDialDataExt::NewL(); |
|
141 |
|
142 iMMSFeatureSupported = |
|
143 FeatureManager::FeatureSupported( KFeatureIdMMS ); |
|
144 |
|
145 iFindItemVoIPExtension = CFindItemVoIPExtension::NewL(); |
|
146 |
|
147 iAudioMessagingFeatureSupported = |
|
148 FeatureManager::FeatureSupported( KFeatureIdAudioMessaging ); |
|
149 |
|
150 iEmailOverSmsFeatureSupported = |
|
151 FeatureManager::FeatureSupported( KFeatureIdEmailOverSms ); |
|
152 |
|
153 iEmailUiFeatureSupported = |
|
154 FeatureManager::FeatureSupported( KFeatureIdEmailUi ); |
|
155 |
|
156 LoadResourceFileL(); |
|
157 } |
|
158 |
|
159 // ----------------------------------------------------------------------------- |
|
160 // CFindItemMenu::NewL |
|
161 // Two-phased constructor. |
|
162 // ----------------------------------------------------------------------------- |
|
163 // |
|
164 EXPORT_C CFindItemMenu* CFindItemMenu::NewL( const TInt aCommandId ) |
|
165 { |
|
166 CFindItemMenu* self = CFindItemMenu::NewLC( aCommandId ); |
|
167 CleanupStack::Pop(); |
|
168 return self; |
|
169 } |
|
170 |
|
171 // ----------------------------------------------------------------------------- |
|
172 // CFindItemMenu::NewLC |
|
173 // Two-phased constructor. |
|
174 // ----------------------------------------------------------------------------- |
|
175 // |
|
176 EXPORT_C CFindItemMenu* CFindItemMenu::NewLC( const TInt aCommandId ) |
|
177 { |
|
178 |
|
179 CFindItemMenu* self = new (ELeave) CFindItemMenu; |
|
180 CleanupStack::PushL( self ); |
|
181 self->ConstructL( aCommandId ); |
|
182 return self; |
|
183 } |
|
184 |
|
185 // ----------------------------------------------------------------------------- |
|
186 // CFindItemMenu::~CFindItemMenu |
|
187 // Default destructor |
|
188 // ----------------------------------------------------------------------------- |
|
189 // |
|
190 CFindItemMenu::~CFindItemMenu() |
|
191 { |
|
192 delete iMPEngineApi; |
|
193 if( iMPEngineDllLoaded ) |
|
194 { |
|
195 iMPEngineDll.Close(); |
|
196 } |
|
197 |
|
198 // Unload the resourcefile |
|
199 iResLoader.Close(); |
|
200 delete iFindItemMenuItemString; |
|
201 delete iFindItemUrlItemString; |
|
202 delete iFindItemMailItemString; |
|
203 delete iFindItemPhoneItemString; |
|
204 |
|
205 delete iFindItemVoIPExtension; |
|
206 |
|
207 if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) ) |
|
208 { |
|
209 delete iFindItemTelInternetItemString; |
|
210 } |
|
211 |
|
212 #ifndef RD_VIRTUAL_PHONEBOOK |
|
213 delete iPbkEngine; |
|
214 delete iPbkDataSave; |
|
215 if ( iRPbkResourceFile ) |
|
216 { |
|
217 iRPbkResourceFile->Close(); |
|
218 } |
|
219 delete iRPbkResourceFile; |
|
220 #endif // !RD_VIRTUAL_PHONEBOOK |
|
221 delete iSendUi; |
|
222 delete iSenderDescriptor; |
|
223 |
|
224 delete iServiceHandler; |
|
225 |
|
226 delete iCommonUiRepositoryWatcher; |
|
227 delete iCommonUiRepository; |
|
228 |
|
229 |
|
230 delete iCallbackNumber; |
|
231 delete iSchemeHandler; |
|
232 |
|
233 delete iDialData; |
|
234 |
|
235 delete iSenderDisplayText; |
|
236 } |
|
237 |
|
238 // ----------------------------------------------------------------------------- |
|
239 // CFindItemMenu::LoadResourceFileL |
|
240 // Loads the resource for menuitems |
|
241 // ----------------------------------------------------------------------------- |
|
242 // |
|
243 void CFindItemMenu::LoadResourceFileL() |
|
244 { |
|
245 TFileName fileName( KResFileName ); |
|
246 iResLoader.OpenL( fileName ); |
|
247 |
|
248 // Read menu item's names from resource r_finditemmenu_menu_item |
|
249 iFindItemMenuItemString = |
|
250 iCoeEnv->AllocReadResourceL( R_FINDITEMMENU_MENU_ITEM ); |
|
251 iFindItemUrlItemString = |
|
252 iCoeEnv->AllocReadResourceL( R_FINDITEMMENU_URL_ITEM ); |
|
253 iFindItemMailItemString = |
|
254 iCoeEnv->AllocReadResourceL( R_FINDITEMMENU_MAIL_ITEM ); |
|
255 iFindItemPhoneItemString = |
|
256 iCoeEnv->AllocReadResourceL( R_FINDITEMMENU_PHONE_ITEM ); |
|
257 if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) ) |
|
258 { |
|
259 iFindItemTelInternetItemString = |
|
260 iCoeEnv->AllocReadResourceL( R_FINDITEMMENU_TELINTERNET_ITEM ); |
|
261 } |
|
262 } |
|
263 |
|
264 // ----------------------------------------------------------------------------- |
|
265 // CFindItemMenu::CommandIsValidL |
|
266 // Allows the application's HandleCommandL() method to switch appropriately |
|
267 // on menuselections |
|
268 // ----------------------------------------------------------------------------- |
|
269 // |
|
270 EXPORT_C TBool CFindItemMenu::CommandIsValidL( const TInt aCommandId ) const |
|
271 { |
|
272 if ( (iFindItemMenuItemAdded && ( aCommandId > iFindItemCommandId && |
|
273 aCommandId <= (iFindItemCommandId + (iFindItemVoIPExtension->IsVoIPSupported()?4:3)))) // traditional find |
|
274 || |
|
275 (!iFindItemMenuItemAdded && |
|
276 // normal autofind command. Let call ui to handle the VoIP profile |
|
277 // count. |
|
278 ( ( aCommandId >= EFindItemCmdCall && |
|
279 aCommandId <= EFindItemCmdSendAudio ) || |
|
280 // or autofind AIW command |
|
281 ( iServiceHandler && |
|
282 ( iServiceHandler->ServiceCmdByMenuCmd( aCommandId ) == KAiwCmdCall || |
|
283 iServiceHandler->ServiceCmdByMenuCmd( aCommandId ) == |
|
284 KAiwCmdAssign ) ) ) ) ) |
|
285 { |
|
286 return ETrue; |
|
287 } |
|
288 return EFalse; |
|
289 } |
|
290 |
|
291 // ----------------------------------------------------------------------------- |
|
292 // CFindItemMenu::DisplayFindItemMenuItemL |
|
293 // |
|
294 // Inserts the FindItem menu item into menupane |
|
295 // ----------------------------------------------------------------------------- |
|
296 // |
|
297 EXPORT_C void CFindItemMenu::DisplayFindItemMenuItemL( |
|
298 CEikMenuPane& aMenuPane, |
|
299 const TInt aIndex ) |
|
300 { |
|
301 // Call this from DynInitMenuPaneL to add a find item menu item to your menu |
|
302 AddMenuItemL( |
|
303 aMenuPane, |
|
304 iFindItemCommandId, |
|
305 aIndex, |
|
306 R_FINDITEMMENU_MENU, |
|
307 *iFindItemMenuItemString ); |
|
308 |
|
309 iFindItemMenuItemAdded = ETrue; |
|
310 } |
|
311 |
|
312 // ----------------------------------------------------------------------------- |
|
313 // CFindItemMenu::DisplayFindItemCascadeMenuL |
|
314 // Displays the FindItem cascade menu |
|
315 // ----------------------------------------------------------------------------- |
|
316 // |
|
317 EXPORT_C void CFindItemMenu::DisplayFindItemCascadeMenuL( |
|
318 CEikMenuPane& aMenuPane ) const |
|
319 { |
|
320 // Call this from DynInitMenuPaneL to add a find item's cascading menu |
|
321 // items to your menu |
|
322 if ( iFindItemMenuItemAdded ) |
|
323 { |
|
324 AddMenuItemL( |
|
325 aMenuPane, |
|
326 iFindItemCommandId + 1, |
|
327 0, |
|
328 0, |
|
329 *iFindItemPhoneItemString ); |
|
330 |
|
331 if ( iFindItemVoIPExtension->IsVoIPSupported() ) |
|
332 { |
|
333 AddMenuItemL( |
|
334 aMenuPane, |
|
335 iFindItemCommandId + 4, |
|
336 0, |
|
337 0, |
|
338 *iFindItemTelInternetItemString ); |
|
339 } |
|
340 |
|
341 if ( iEmailUiFeatureSupported ) |
|
342 { |
|
343 AddMenuItemL( |
|
344 aMenuPane, |
|
345 iFindItemCommandId + 2, |
|
346 0, |
|
347 0, |
|
348 *iFindItemMailItemString ); |
|
349 } |
|
350 |
|
351 AddMenuItemL( |
|
352 aMenuPane, |
|
353 iFindItemCommandId + 3, |
|
354 0, |
|
355 0, |
|
356 *iFindItemUrlItemString ); |
|
357 } |
|
358 } |
|
359 |
|
360 // ----------------------------------------------------------------------------- |
|
361 // AddMenuItemL |
|
362 // Adds the menu item to menupane |
|
363 // ----------------------------------------------------------------------------- |
|
364 // |
|
365 void CFindItemMenu::AddMenuItemL( |
|
366 CEikMenuPane& aMenuPane, |
|
367 TInt aCommandId, |
|
368 TInt aIndex, |
|
369 TInt aCascadeId, |
|
370 const TDesC& aText ) const |
|
371 { |
|
372 CEikMenuPaneItem::SData data; |
|
373 data.iCascadeId = aCascadeId; |
|
374 data.iFlags = 0; |
|
375 data.iText = aText; |
|
376 data.iCommandId = aCommandId; |
|
377 if ( aIndex == 0 ) |
|
378 { |
|
379 aMenuPane.AddMenuItemL( data ); |
|
380 } |
|
381 else |
|
382 { |
|
383 aMenuPane.AddMenuItemL( data, aIndex ); |
|
384 } |
|
385 } |
|
386 |
|
387 // ----------------------------------------------------------------------------- |
|
388 // CFindItemEngine::TFindItemSearchCase CFindItemMenu::SearchCase |
|
389 // Gives a search case for a command id |
|
390 // Use the return value when creating a CFindItemDialog. |
|
391 // ----------------------------------------------------------------------------- |
|
392 // |
|
393 EXPORT_C CFindItemEngine::TFindItemSearchCase CFindItemMenu::SearchCase( |
|
394 const TInt aCommandId ) const |
|
395 { |
|
396 switch ( aCommandId - iFindItemCommandId ) |
|
397 { |
|
398 case 1: |
|
399 return CFindItemEngine::EFindItemSearchPhoneNumberBin; |
|
400 case 2: |
|
401 return CFindItemEngine::EFindItemSearchMailAddressBin; |
|
402 case 3: |
|
403 return CFindItemEngine::EFindItemSearchURLBin; |
|
404 case 4: |
|
405 return static_cast<CFindItemEngine::TFindItemSearchCase> |
|
406 ( CFindItemEngine::EFindItemSearchPhoneNumberBin | |
|
407 CFindItemEngine::EFindItemSearchMailAddressBin ); |
|
408 default: |
|
409 __ASSERT_DEBUG( 0, Panic( ENoSearchCase ) ); |
|
410 return CFindItemEngine::EFindItemSearchPhoneNumberBin; |
|
411 } |
|
412 } |
|
413 |
|
414 EXPORT_C void CFindItemMenu::AddItemFindMenuL( |
|
415 CItemFinder* aItemFinder, |
|
416 CEikMenuPane* aMenuPane, |
|
417 TInt aIndex, |
|
418 const TDesC& aSenderDescriptor, |
|
419 TBool aKnownSender, |
|
420 TBool aIsContextMenu ) |
|
421 { |
|
422 // create items |
|
423 iIsSenderKnown = aKnownSender; |
|
424 delete iSenderDescriptor; |
|
425 iSenderDescriptor = 0; |
|
426 iSenderDescriptor = aSenderDescriptor.AllocL(); |
|
427 |
|
428 iAutomaticFind = aItemFinder; |
|
429 |
|
430 iMenuPane = aMenuPane; |
|
431 |
|
432 iIndex = aIndex; |
|
433 |
|
434 iIsContextMenu = aIsContextMenu; |
|
435 |
|
436 UpdateItemFinderMenuL(); |
|
437 } |
|
438 |
|
439 EXPORT_C void CFindItemMenu::UpdateItemFinderMenuL( |
|
440 TInt aResource, |
|
441 CEikMenuPane* aMenuPane ) |
|
442 { |
|
443 if ( !iServiceHandler ) |
|
444 { |
|
445 AttachItemFinderMenuL( 0 ); // param not really used |
|
446 } |
|
447 |
|
448 CItemFinder::TItemType itemType = iAutomaticFind ? iAutomaticFind->CurrentItemExt().iItemType : CItemFinder::ENoneSelected; |
|
449 if ( aResource != -1 && aMenuPane ) |
|
450 { |
|
451 if( aResource == R_FINDMENU_CALLUI_AIW_SUBMENU ) |
|
452 { |
|
453 //Show full call command when number type is not SIP URI or |
|
454 //number type is phone number or |
|
455 //it is possible to call sender or callback number |
|
456 if ( ( itemType != CItemFinder::EEmailAddress || |
|
457 ( itemType == CItemFinder::EEmailAddress && |
|
458 !iFindItemVoIPExtension->VoIPProfilesExistL() ) ) && |
|
459 ( itemType == CItemFinder::EPhoneNumber || |
|
460 ( iSenderDescriptor->Length() && |
|
461 iSenderDescType == CItemFinder::EPhoneNumber ) || |
|
462 ( iCallbackNumber && iCallbackNumber->Length() ) ) ) |
|
463 { |
|
464 iServiceHandler->InitializeMenuPaneL( |
|
465 *aMenuPane, |
|
466 aResource, |
|
467 EFindMenuPlaceHolderCallUI, |
|
468 iServiceHandler->InParamListL() ); |
|
469 } |
|
470 //Show only Internet call command in Call submenu when |
|
471 //Number type is SIP URI |
|
472 else |
|
473 { |
|
474 CAiwGenericParamList* inList = CAiwGenericParamList::NewLC(); |
|
475 |
|
476 // SIP Address |
|
477 TAiwGenericParam param( EGenericParamSIPAddress ); |
|
478 inList->AppendL( param ); |
|
479 |
|
480 iServiceHandler->InitializeMenuPaneL( |
|
481 *aMenuPane, |
|
482 aResource, |
|
483 EFindMenuPlaceHolderCallUI, |
|
484 *inList ); |
|
485 |
|
486 CleanupStack::PopAndDestroy(); // inList |
|
487 } |
|
488 |
|
489 return; |
|
490 } |
|
491 |
|
492 #ifdef RD_VIRTUAL_PHONEBOOK |
|
493 // Aiw Contacts |
|
494 else if ( aResource == R_FINDMENU_CONTACTS_AIW_SUBMENU ) |
|
495 { |
|
496 if ( ( ( ( !iIsSenderKnown && iSenderDescriptor->Length() ) || |
|
497 iCallbackNumber ) && |
|
498 itemType == CItemFinder::ENoneSelected ) || |
|
499 itemType != CItemFinder::ENoneSelected ) |
|
500 { |
|
501 using namespace AiwContactAssign; |
|
502 |
|
503 CAiwGenericParamList& inList = iServiceHandler->InParamListL(); |
|
504 |
|
505 // Contact Assign Data |
|
506 TAiwGenericParam param( EGenericParamContactAssignData ); |
|
507 TAiwSingleContactAssignDataV1 assignData; |
|
508 assignData.SetFlags( 0 ); // Reset |
|
509 param.Value().Set( |
|
510 TAiwSingleContactAssignDataV1Pckg( assignData ) ); |
|
511 inList.AppendL( param ); |
|
512 |
|
513 // Contact Data Type |
|
514 param.Reset(); |
|
515 param.SetSemanticId( EGenericParamPhoneNumber ); |
|
516 inList.AppendL( param ); |
|
517 |
|
518 iServiceHandler->InitializeMenuPaneL( |
|
519 *aMenuPane, |
|
520 aResource, |
|
521 EFindMenuCmdLast, |
|
522 inList ); |
|
523 |
|
524 return; |
|
525 } |
|
526 } |
|
527 #endif // RD_VIRTUAL_PHONEBOOK |
|
528 |
|
529 #ifndef RD_VIRTUAL_PHONEBOOK |
|
530 else if ( iPbkDataSave ) |
|
531 { |
|
532 iPbkDataSave->DynInitMenuPaneL( aResource, aMenuPane ); |
|
533 } |
|
534 #endif // !RD_VIRTUAL_PHONEBOOK |
|
535 |
|
536 return; |
|
537 } |
|
538 |
|
539 TInt index = iIndex; |
|
540 |
|
541 TBuf<KMaxMenuTextLength> tempBuf; |
|
542 |
|
543 // Adds menu items depending the selected item |
|
544 switch ( itemType ) |
|
545 { |
|
546 case CItemFinder::EPhoneNumber: |
|
547 { |
|
548 #ifdef RD_VOIP_REL_2_2 |
|
549 if ( FeatureManager::FeatureSupported(KFeatureIdCommonVoip ) ) |
|
550 { |
|
551 // show call menu if allowed |
|
552 if ( !( iMenuItemFlags & CFindItemMenu::ECallItem ) ) |
|
553 { |
|
554 // Call |
|
555 iCoeEnv->ReadResourceL( tempBuf, R_FINDITEMMENU_CALL ); |
|
556 AddMenuItemL( |
|
557 *iMenuPane, |
|
558 EFindItemCmdCall, |
|
559 ( iIsContextMenu ? EFindItemContextMenuPlaceHolder : index ), |
|
560 0, |
|
561 tempBuf ); |
|
562 } |
|
563 // if context menu, we will show call item anyway |
|
564 else if ( iIsContextMenu ) |
|
565 { |
|
566 // Call |
|
567 iCoeEnv->ReadResourceL( tempBuf, R_FINDITEMMENU_CALL ); |
|
568 AddMenuItemL( |
|
569 *iMenuPane, |
|
570 EFindItemCmdCall, |
|
571 EFindItemContextMenuPlaceHolder, |
|
572 0, |
|
573 tempBuf ); |
|
574 } |
|
575 } |
|
576 else |
|
577 { |
|
578 // Call |
|
579 iCoeEnv->ReadResourceL( tempBuf, R_FINDITEMMENU_CALL ); |
|
580 AddMenuItemL( |
|
581 *iMenuPane, |
|
582 EFindItemCmdCall, |
|
583 ( iIsContextMenu ? EFindItemContextMenuPlaceHolder : index ), |
|
584 0, |
|
585 tempBuf ); |
|
586 } |
|
587 index = EFindItemCmdCall; |
|
588 #else |
|
589 // Call |
|
590 iCoeEnv->ReadResourceL( tempBuf, R_FINDITEMMENU_CALL ); |
|
591 AddMenuItemL( |
|
592 *iMenuPane, |
|
593 EFindItemCmdCall, |
|
594 ( iIsContextMenu ? EFindItemContextMenuPlaceHolder : index ), |
|
595 0, |
|
596 tempBuf ); |
|
597 index = EFindItemCmdCall; |
|
598 #endif // RD_VOIP_REL_2_2 |
|
599 // Write |
|
600 iCoeEnv->ReadResourceL( tempBuf, R_FINDITEMMENU_MESSAGE_SUB ); |
|
601 AddMenuItemL( |
|
602 *iMenuPane, |
|
603 EFindItemSubMenuSend, |
|
604 index, |
|
605 0,//R_FINDITEM_NUMBER_MESSAGE_SUBMENU, |
|
606 tempBuf ); |
|
607 index = EFindItemSubMenuSend; |
|
608 |
|
609 break; |
|
610 } |
|
611 case CItemFinder::EUrlAddress: |
|
612 { |
|
613 iCoeEnv->ReadResourceL( tempBuf, R_FINDITEMMENU_GOTO_URL ); |
|
614 |
|
615 // check if not rstp |
|
616 if ( iAutomaticFind->CurrentItemExt().iItemDescriptor->FindF( KRtspUrlAddress ) == KErrNotFound ) |
|
617 { |
|
618 AddMenuItemL( |
|
619 *iMenuPane, |
|
620 EFindItemCmdGoToUrl, |
|
621 ( iIsContextMenu ? EFindItemContextMenuPlaceHolder : index ), |
|
622 0, |
|
623 tempBuf); |
|
624 index = EFindItemCmdGoToUrl; |
|
625 |
|
626 if ( !iIsContextMenu ) |
|
627 { |
|
628 // Add bookmark |
|
629 iCoeEnv->ReadResourceL( |
|
630 tempBuf, R_FINDITEMMENU_ADD_BOOKMARK ); |
|
631 AddMenuItemL( |
|
632 *iMenuPane, |
|
633 EFindItemCmdAddToBookmark, |
|
634 index, |
|
635 0, |
|
636 tempBuf ); |
|
637 index = EFindItemCmdAddToBookmark; |
|
638 } |
|
639 } |
|
640 else |
|
641 { |
|
642 AddMenuItemL( |
|
643 *iMenuPane, |
|
644 EFindItemCmdGoToRstp, |
|
645 ( iIsContextMenu ? EFindItemContextMenuPlaceHolder : index ), |
|
646 0, |
|
647 tempBuf ); |
|
648 index = EFindItemCmdGoToRstp; |
|
649 |
|
650 if ( !iIsContextMenu ) |
|
651 { |
|
652 iCoeEnv->ReadResourceL( |
|
653 tempBuf, R_FINDITEMMENU_ADD_TO_GALLERY ); |
|
654 AddMenuItemL( |
|
655 *iMenuPane, |
|
656 EFindItemCmdAddToGallery, |
|
657 index, |
|
658 0, |
|
659 tempBuf ); |
|
660 index = EFindItemCmdAddToGallery; |
|
661 } |
|
662 } |
|
663 break; |
|
664 } |
|
665 case CItemFinder::EEmailAddress: |
|
666 { |
|
667 // Checks VoIP profile count and local variation |
|
668 if ( iIsContextMenu && iFindItemVoIPExtension->VoIPProfilesExistL() ) |
|
669 { |
|
670 //Call |
|
671 iCoeEnv->ReadResourceL( tempBuf, R_FINDITEMMENU_CALL ); |
|
672 AddMenuItemL( |
|
673 *iMenuPane, |
|
674 EFindItemCmdCall, |
|
675 EFindItemContextMenuPlaceHolder, |
|
676 0, |
|
677 tempBuf ); |
|
678 index = EFindItemCmdCall; // Replaces the call ui menu when email |
|
679 // field is selected. |
|
680 } |
|
681 |
|
682 // Write |
|
683 if( iEmailOverSmsFeatureSupported || iMMSFeatureSupported || |
|
684 iEmailUiFeatureSupported ) // Sometimes submenu can be empty. |
|
685 { |
|
686 iCoeEnv->ReadResourceL( tempBuf, R_FINDITEMMENU_MESSAGE_SUB ); |
|
687 AddMenuItemL( |
|
688 *iMenuPane, |
|
689 EFindItemSubMenuSend, |
|
690 ( ( iIsContextMenu && |
|
691 !iFindItemVoIPExtension->VoIPProfilesExistL() ) ? |
|
692 EFindItemContextMenuPlaceHolder : index ), |
|
693 0,//R_FINDITEM_EMAIL_MESSAGE_SUBMENU, |
|
694 tempBuf ); |
|
695 index = EFindItemSubMenuSend; |
|
696 } |
|
697 break; |
|
698 } |
|
699 case CItemFinder::EUriScheme: |
|
700 { |
|
701 // Use |
|
702 iCoeEnv->ReadResourceL( tempBuf, R_QTN_OPTIONS_SCHEME_USE ); |
|
703 AddMenuItemL( |
|
704 *iMenuPane, |
|
705 EFindItemCmdUse, |
|
706 ( iIsContextMenu ? EFindItemContextMenuPlaceHolder : index ), |
|
707 0, |
|
708 tempBuf ); |
|
709 index = EFindItemCmdUse; |
|
710 break; |
|
711 } |
|
712 default: |
|
713 { |
|
714 // Something else, probably nothing selected or new type which we |
|
715 // don't support. |
|
716 break; |
|
717 } |
|
718 } |
|
719 // Call |
|
720 if ( |
|
721 ( itemType == CItemFinder::ENoneSelected ) && |
|
722 ( |
|
723 ( |
|
724 iSenderDescriptor->Length() && |
|
725 iSenderDescType == CItemFinder::EPhoneNumber || |
|
726 iSenderDescriptor->Length() && |
|
727 iSenderDescType == CItemFinder::EEmailAddress && |
|
728 iFindItemVoIPExtension->VoIPProfilesExistL() |
|
729 ) |
|
730 || |
|
731 ( iCallbackNumber && iCallbackNumber->Length() ) ) |
|
732 |
|
733 || |
|
734 ( itemType == CItemFinder::EEmailAddress && |
|
735 iFindItemVoIPExtension->VoIPProfilesExistL() && |
|
736 !iIsContextMenu ) |
|
737 ) |
|
738 { |
|
739 #ifdef RD_VOIP_REL_2_2 |
|
740 if ( FeatureManager::FeatureSupported(KFeatureIdCommonVoip ) ) |
|
741 { |
|
742 if ( !iMenuItemFlags & CFindItemMenu::ECallItem ) |
|
743 { |
|
744 iCoeEnv->ReadResourceL( tempBuf, R_FINDITEMMENU_CALL ); |
|
745 AddMenuItemL( |
|
746 *iMenuPane, |
|
747 EFindItemCmdCall, |
|
748 iIndex, |
|
749 0, |
|
750 tempBuf ); // this goes always first |
|
751 if ( index == iIndex ) |
|
752 { |
|
753 index = EFindItemCmdCall; // other commands are added after this. |
|
754 } |
|
755 } |
|
756 } |
|
757 else |
|
758 { |
|
759 iCoeEnv->ReadResourceL( tempBuf, R_FINDITEMMENU_CALL ); |
|
760 AddMenuItemL( |
|
761 *iMenuPane, |
|
762 EFindItemCmdCall, |
|
763 iIndex, |
|
764 0, |
|
765 tempBuf ); // this goes always first |
|
766 if ( index == iIndex ) |
|
767 { |
|
768 index = EFindItemCmdCall; // other commands are added after this. |
|
769 } |
|
770 } |
|
771 #else |
|
772 iCoeEnv->ReadResourceL( tempBuf, R_FINDITEMMENU_CALL ); |
|
773 AddMenuItemL( |
|
774 *iMenuPane, |
|
775 EFindItemCmdCall, |
|
776 iIndex, |
|
777 0, |
|
778 tempBuf ); // this goes always first |
|
779 if ( index == iIndex ) |
|
780 { |
|
781 index = EFindItemCmdCall; // other commands are added after this. |
|
782 |
|
783 } |
|
784 #endif // RD_VOIP_REL_2_2 |
|
785 } |
|
786 // Highlight status |
|
787 TInt highlight = 0; |
|
788 if ( iCommonUiRepository ) |
|
789 { |
|
790 iCommonUiRepository->Get( KCuiAutomaticHighlight, highlight ); |
|
791 } |
|
792 if ( !iIsContextMenu ) |
|
793 { |
|
794 // Activate/Deactivate find |
|
795 if ( highlight ) |
|
796 { |
|
797 iCoeEnv->ReadResourceL( tempBuf, R_QTN_FIND_DEACTIVATE_OPTION ); |
|
798 AddMenuItemL( |
|
799 *iMenuPane, |
|
800 EFindItemCmdDisableAutoFind, |
|
801 index, |
|
802 0, |
|
803 tempBuf ); |
|
804 } |
|
805 else |
|
806 { |
|
807 iCoeEnv->ReadResourceL( tempBuf, R_QTN_FIND_ACTIVATE_OPTION ); |
|
808 AddMenuItemL( |
|
809 *iMenuPane, |
|
810 EFindItemCmdEnableAutoFind, |
|
811 index, |
|
812 0, |
|
813 tempBuf ); |
|
814 } |
|
815 |
|
816 // Copy |
|
817 |
|
818 TInt len = 0; |
|
819 if ( iAutomaticFind && iAutomaticFind->CurrentItemExt().iItemType != CItemFinder::ENoneSelected ) |
|
820 { |
|
821 HBufC* item = iAutomaticFind->CurrentSelection().AllocLC(); |
|
822 len = item->Length(); |
|
823 CleanupStack::PopAndDestroy( ); |
|
824 } |
|
825 |
|
826 if( (!iAutomaticFind || len != 0) && |
|
827 highlight && |
|
828 ( itemType != CItemFinder::ENoneSelected || |
|
829 iSenderHighlighted ) ) |
|
830 { |
|
831 iCoeEnv->ReadResourceL( tempBuf, R_FINDITEMMENU_COPY ); |
|
832 AddMenuItemL( |
|
833 *iMenuPane, |
|
834 EFindItemCmdCopy, |
|
835 index, |
|
836 0, |
|
837 tempBuf ); |
|
838 } |
|
839 |
|
840 |
|
841 } |
|
842 |
|
843 // Add to contacts |
|
844 if ( ( itemType != CItemFinder::EUriScheme ) && |
|
845 !( itemType == CItemFinder::EUrlAddress && |
|
846 iIsContextMenu ) && |
|
847 ( ( ( ( !iIsSenderKnown && |
|
848 iSenderDescriptor->Length() ) || |
|
849 iCallbackNumber ) && |
|
850 itemType == CItemFinder::ENoneSelected ) || |
|
851 itemType != CItemFinder::ENoneSelected ) ) |
|
852 { |
|
853 AddMenuItemL( |
|
854 *iMenuPane, |
|
855 EFindItemCmdCreateContactCard, |
|
856 index, |
|
857 0, |
|
858 KNullDesC ); |
|
859 #ifndef RD_VIRTUAL_PHONEBOOK |
|
860 iPbkDataSave->AddMenuItemsL( |
|
861 iMenuPane, |
|
862 EFindItemCmdCreateContactCard ); |
|
863 #else |
|
864 iMenuPane->SetItemDimmed( |
|
865 EFindItemCmdCreateContactCard, ETrue ); |
|
866 iMenuPane->AddMenuItemsL( |
|
867 R_FINDMENU_CONTACTS_AIW_ITEM, |
|
868 EFindItemCmdCreateContactCard ); |
|
869 #endif // !RD_VIRTUAL_PHONEBOOK |
|
870 } |
|
871 // Diming |
|
872 if ( !iIsContextMenu ) |
|
873 { |
|
874 TInt dummy = 0; |
|
875 if ( iMenuPane->MenuItemExists( EFindItemMenuPlaceHolder, dummy ) ) |
|
876 { |
|
877 iMenuPane->SetItemDimmed( EFindItemMenuPlaceHolder, ETrue ); |
|
878 } |
|
879 } |
|
880 else |
|
881 { |
|
882 TInt dummy = 0; |
|
883 if ( iMenuPane->MenuItemExists( EFindItemContextMenuPlaceHolder, dummy ) ) |
|
884 { |
|
885 iMenuPane->SetItemDimmed( EFindItemContextMenuPlaceHolder, ETrue ); |
|
886 } |
|
887 } |
|
888 // Replace cmd call with AIW menu if more than one option available in AIW |
|
889 // menu |
|
890 // Note: count of VoIP profiles is not static. If phone contains VoIP |
|
891 // profiles there must be Internet call command in call submenu. |
|
892 TInt dummy = 0; |
|
893 if ( ( !iHideCallMenu || |
|
894 ( iFindItemVoIPExtension->IsVoIPSupported() && |
|
895 iFindItemVoIPExtension->VoIPProfilesExistL() ) ) && |
|
896 iMenuPane->MenuItemExists( EFindItemCmdCall, dummy ) ) |
|
897 { |
|
898 iMenuPane->SetItemDimmed( EFindItemCmdCall, ETrue ); |
|
899 iMenuPane->AddMenuItemsL( |
|
900 R_FINDMENU_CALLUI_AIW_ITEM, |
|
901 EFindItemCmdCall ); |
|
902 } |
|
903 } |
|
904 |
|
905 EXPORT_C void CFindItemMenu::HandleItemFinderCommandL( TInt aCommand ) |
|
906 { |
|
907 switch ( aCommand ) |
|
908 { |
|
909 case EFindItemCmdCall: |
|
910 { |
|
911 CallL(); |
|
912 break; |
|
913 } |
|
914 case EFindItemSubMenuSend: |
|
915 { |
|
916 TSendingCapabilities sendingCapabilities; |
|
917 sendingCapabilities.iFlags = TSendingCapabilities::ESupportsEditor; |
|
918 CArrayFixFlat<TUid>* mtmFilter = new(ELeave) CArrayFixFlat<TUid>( 1 ); |
|
919 CleanupStack::PushL(mtmFilter); |
|
920 CItemFinder::TItemType itemType = iAutomaticFind ? iAutomaticFind->CurrentItemExt().iItemType : CItemFinder::ENoneSelected; |
|
921 |
|
922 mtmFilter->AppendL(KSenduiMtmPostcardUid);// dim postcard |
|
923 // Hide SMS if not supported |
|
924 |
|
925 #ifndef RD_UNIFIED_EDITOR |
|
926 if ( !iEmailOverSmsFeatureSupported ) |
|
927 { |
|
928 mtmFilter->AppendL(KSenduiMtmSmsUid); |
|
929 } |
|
930 // Hide MMS if not supported |
|
931 if (!iMMSFeatureSupported) |
|
932 { |
|
933 mtmFilter->AppendL(KSenduiMtmMmsUid); |
|
934 } |
|
935 #endif |
|
936 |
|
937 // Hide E-Mail if nosupported or phonenumber |
|
938 if ( !iEmailUiFeatureSupported || itemType == CItemFinder::EPhoneNumber ) |
|
939 { |
|
940 mtmFilter->AppendL(KSenduiMtmSmtpUid); |
|
941 mtmFilter->AppendL(KSenduiMtmImap4Uid); |
|
942 mtmFilter->AppendL(KSenduiMtmPop3Uid); |
|
943 mtmFilter->AppendL(KSenduiMtmSyncMLEmailUid); |
|
944 } |
|
945 // Hide Audio if not supported or E-mail address |
|
946 if( !iAudioMessagingFeatureSupported || itemType == CItemFinder::EEmailAddress) |
|
947 { |
|
948 mtmFilter->AppendL(KSenduiMtmAudioMessageUid); |
|
949 } |
|
950 TUid uid = iSendUi->ShowTypedQueryL( CSendUi::EWriteMenu, NULL, sendingCapabilities, mtmFilter ); |
|
951 |
|
952 CleanupStack::PopAndDestroy(); |
|
953 if ( uid == KNullUid ) |
|
954 { |
|
955 break; |
|
956 } |
|
957 SendMessageL(uid); |
|
958 |
|
959 break; |
|
960 } |
|
961 |
|
962 case EFindItemCmdGoToUrl: |
|
963 { |
|
964 LaunchGenericUriL(); |
|
965 break; |
|
966 } |
|
967 case EFindItemCmdGoToRstp: |
|
968 { |
|
969 LaunchGenericUriL(); |
|
970 break; |
|
971 } |
|
972 |
|
973 case EFindItemCmdAddToBookmark: |
|
974 { |
|
975 AddToBookmarkL(); |
|
976 break; |
|
977 } |
|
978 case EFindItemCmdCreateContactCardSub1: |
|
979 case EFindItemCmdCreateContactCardSub2: |
|
980 case EFindItemCmdCreateContactCardSub3: |
|
981 { |
|
982 CreateContactCardL( aCommand ); |
|
983 // Restore original client application icon back to context pane. |
|
984 CEikStatusPane* statusPane = |
|
985 ( (CAknAppUi*)CEikonEnv::Static()->EikAppUi() )->StatusPane(); |
|
986 CCoeControl* contextControl = |
|
987 statusPane->ControlL( TUid::Uid( EEikStatusPaneUidContext ) ); |
|
988 CAknContextPane* contextPane = |
|
989 static_cast<CAknContextPane*>( contextControl ); |
|
990 contextPane->SetPictureToDefaultL(); |
|
991 break; |
|
992 } |
|
993 case EFindItemCmdAddToGallery: |
|
994 { |
|
995 AddToGalleryL(); |
|
996 break; |
|
997 } |
|
998 |
|
999 case EFindItemCmdDisableAutoFind: |
|
1000 { |
|
1001 if (iCommonUiRepository) |
|
1002 { |
|
1003 iCommonUiRepository->Set( KCuiAutomaticHighlight, 0 ); |
|
1004 } |
|
1005 AutoFindStatusChangedL(); |
|
1006 break; |
|
1007 } |
|
1008 |
|
1009 case EFindItemCmdEnableAutoFind: |
|
1010 { |
|
1011 if (iCommonUiRepository) |
|
1012 { |
|
1013 iCommonUiRepository->Set( KCuiAutomaticHighlight, 1 ); |
|
1014 } |
|
1015 AutoFindStatusChangedL(); |
|
1016 break; |
|
1017 } |
|
1018 |
|
1019 case EFindItemCmdUse: |
|
1020 { |
|
1021 LaunchGenericUriL(); |
|
1022 break; |
|
1023 } |
|
1024 |
|
1025 case EFindItemCmdCopy: |
|
1026 { |
|
1027 CopyToClipboardL(); |
|
1028 break; |
|
1029 } |
|
1030 default: |
|
1031 { |
|
1032 TInt aiwCmd = iServiceHandler->ServiceCmdByMenuCmd( aCommand ); |
|
1033 TBool calltypeInternetCall( EFalse ); |
|
1034 if ( iFindItemVoIPExtension->VoIPProfilesExistL() && iAutomaticFind && iAutomaticFind->CurrentItemExt().iItemType == CItemFinder::EEmailAddress ) |
|
1035 { |
|
1036 calltypeInternetCall = ETrue; |
|
1037 } |
|
1038 |
|
1039 // Call via Aiw |
|
1040 if ( aiwCmd == KAiwCmdCall && FormatDialDataL( calltypeInternetCall ) ) |
|
1041 { |
|
1042 if ( !iDialData ) |
|
1043 { |
|
1044 break; |
|
1045 } |
|
1046 |
|
1047 CAiwGenericParamList& paramList = |
|
1048 iServiceHandler->InParamListL(); |
|
1049 |
|
1050 iDialData->FillInParamListL( paramList ); |
|
1051 |
|
1052 iServiceHandler->ExecuteMenuCmdL( |
|
1053 aCommand, |
|
1054 paramList, |
|
1055 iServiceHandler->OutParamListL(), |
|
1056 0, // No options used. |
|
1057 0 ); // no dial results are wanted. |
|
1058 } |
|
1059 #ifdef RD_VIRTUAL_PHONEBOOK |
|
1060 // Contacts via Aiw |
|
1061 else if ( aiwCmd == KAiwCmdAssign ) |
|
1062 { |
|
1063 CreateContactCardL( aCommand ); |
|
1064 } |
|
1065 #endif // RD_VIRTUAL_PHONEBOOK |
|
1066 break; |
|
1067 } |
|
1068 } |
|
1069 } |
|
1070 |
|
1071 EXPORT_C void CFindItemMenu::HandleCallL( const TDesC& aSenderDescriptor ) |
|
1072 { |
|
1073 AttachItemFinderMenuL( 0 ); // Make sure that this get called even if |
|
1074 // caller won't call this |
|
1075 |
|
1076 delete iSenderDescriptor; |
|
1077 iSenderDescriptor = 0; |
|
1078 iSenderDescriptor = aSenderDescriptor.AllocL(); |
|
1079 |
|
1080 CallL(); |
|
1081 } |
|
1082 |
|
1083 EXPORT_C void CFindItemMenu::HandleVoIPCallL( const TDesC& aSenderDescriptor ) |
|
1084 { |
|
1085 AttachItemFinderMenuL( 0 ); // Make sure that this get called even if |
|
1086 // caller won't call this |
|
1087 |
|
1088 delete iSenderDescriptor; |
|
1089 iSenderDescriptor = 0; |
|
1090 iSenderDescriptor = aSenderDescriptor.AllocL(); |
|
1091 |
|
1092 VoIPCallL(); |
|
1093 } |
|
1094 |
|
1095 void CFindItemMenu::CallL() |
|
1096 { |
|
1097 if ( !iDialData ) |
|
1098 { |
|
1099 return; |
|
1100 } |
|
1101 |
|
1102 if ( !FormatDialDataL( EFalse ) ) |
|
1103 { |
|
1104 return; |
|
1105 } |
|
1106 |
|
1107 // Create Call W/O Menu |
|
1108 CAiwGenericParamList& paramList = |
|
1109 iServiceHandler->InParamListL(); |
|
1110 |
|
1111 iDialData->FillInParamListL( paramList ); |
|
1112 |
|
1113 iServiceHandler->ExecuteServiceCmdL( |
|
1114 KAiwCmdCall, |
|
1115 paramList, |
|
1116 iServiceHandler->OutParamListL(), |
|
1117 0, // No options used. |
|
1118 NULL ); |
|
1119 } |
|
1120 |
|
1121 void CFindItemMenu::VoIPCallL() |
|
1122 { |
|
1123 if ( !iDialData ) |
|
1124 { |
|
1125 return; |
|
1126 } |
|
1127 if ( !FormatDialDataL( ETrue ) || |
|
1128 !iFindItemVoIPExtension->IsVoIPSupported() ) |
|
1129 { |
|
1130 return; |
|
1131 } |
|
1132 |
|
1133 // Create Call W/O Menu |
|
1134 CAiwGenericParamList& paramList = iServiceHandler->InParamListL(); |
|
1135 |
|
1136 iDialData->FillInParamListL( paramList ); |
|
1137 |
|
1138 iServiceHandler->ExecuteServiceCmdL( |
|
1139 KAiwCmdCall, |
|
1140 paramList, |
|
1141 iServiceHandler->OutParamListL(), |
|
1142 0, // No options used. |
|
1143 NULL ); |
|
1144 } |
|
1145 |
|
1146 void CFindItemMenu::SendMessageL( const TUid aMtmUid ) |
|
1147 { |
|
1148 HBufC* parsedAddress = 0; |
|
1149 TBool isNumber = EFalse; |
|
1150 if ( iAutomaticFind && iAutomaticFind->CurrentItemExt().iItemType == CItemFinder::EEmailAddress ) |
|
1151 { |
|
1152 parsedAddress = iAutomaticFind->CurrentItemExt().iItemDescriptor; |
|
1153 } |
|
1154 else |
|
1155 { |
|
1156 // if sender descriptor is something else than phone number it will |
|
1157 // still go through this brach.. |
|
1158 TBool numberSelected = ( iAutomaticFind && iAutomaticFind->CurrentItemExt().iItemType == CItemFinder::EPhoneNumber ); |
|
1159 parsedAddress = ( numberSelected ? iAutomaticFind->CurrentItemExt().iItemDescriptor : iSenderDescriptor)->AllocLC(); |
|
1160 TPtr numberPtr = parsedAddress->Des(); |
|
1161 CommonPhoneParser::ParsePhoneNumber( numberPtr, CommonPhoneParser::EPlainPhoneNumber ); |
|
1162 AknTextUtils::ConvertDigitsTo( numberPtr, EDigitTypeWestern ); |
|
1163 isNumber = ETrue; |
|
1164 } |
|
1165 |
|
1166 CMessageData* messageData = CMessageData::NewL(); |
|
1167 CleanupStack::PushL( messageData ); |
|
1168 messageData->AppendToAddressL( parsedAddress->Des() ); |
|
1169 iSendUi->CreateAndSendMessageL( aMtmUid,messageData ); |
|
1170 CleanupStack::PopAndDestroy( isNumber ? 2 : 1 ); // messageData, number |
|
1171 } |
|
1172 |
|
1173 void CFindItemMenu::GoToUrlL( TUid /*aHandlerAppUid*/ ) |
|
1174 { |
|
1175 // Scheme handler can handle this |
|
1176 } |
|
1177 |
|
1178 void CFindItemMenu::AddToBookmarkL() |
|
1179 { |
|
1180 // Create an item |
|
1181 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
1182 item->SetParentFolder( KFavouritesRootUid ); |
|
1183 item->SetType( CFavouritesItem::EItem ); |
|
1184 // Read default name from resources |
|
1185 RConeResourceLoader ldr( *iCoeEnv ); |
|
1186 |
|
1187 TFileName dialogResource( KDialogResourceName ); |
|
1188 |
|
1189 ldr.OpenL( dialogResource ); |
|
1190 CleanupClosePushL( ldr ); |
|
1191 |
|
1192 // Read default name from resources |
|
1193 HBufC* defaultName = |
|
1194 iCoeEnv->AllocReadResourceLC( R_FINDITEM_DEFAULT_BOOKMARK_NAME ); |
|
1195 |
|
1196 TBuf<KMaxBookmarkNameLength> retName; |
|
1197 retName.Copy( defaultName->Des() ); |
|
1198 |
|
1199 // Query bookmark name from user |
|
1200 CAknTextQueryDialog* dlg = CAknTextQueryDialog::NewL( retName ); |
|
1201 dlg->SetMaxLength( KMaxBookmarkNameLength ); |
|
1202 if ( !dlg->ExecuteLD( R_FINDITEM_BOOKMARK_QUERY_DIALOG ) ) |
|
1203 { |
|
1204 // User press cancel - do not add bookmark |
|
1205 CleanupStack::PopAndDestroy( 3 ); // item, defaultName, resourceLoader |
|
1206 return; |
|
1207 } |
|
1208 |
|
1209 item->SetNameL( retName ); |
|
1210 item->SetUrlL( iAutomaticFind->CurrentItemExt().iItemDescriptor->Des() ); |
|
1211 |
|
1212 RFavouritesSession sess; |
|
1213 RFavouritesDb db; |
|
1214 |
|
1215 User::LeaveIfError( sess.Connect() ); |
|
1216 CleanupClosePushL<RFavouritesSession>( sess ); |
|
1217 User::LeaveIfError( db.Open( sess, KBrowserBookmarks ) ); |
|
1218 CleanupClosePushL<RFavouritesDb>( db ); |
|
1219 |
|
1220 // add item |
|
1221 db.Add( *item, ETrue ); |
|
1222 // Close the database. |
|
1223 db.Close(); |
|
1224 |
|
1225 HBufC* msgBuffer = iCoeEnv->AllocReadResourceLC( R_FINDITEM_BOOKMARK_SAVED ); |
|
1226 CAknConfirmationNote* note = new (ELeave)CAknConfirmationNote( ETrue ); |
|
1227 note->ExecuteLD( *msgBuffer ); |
|
1228 |
|
1229 CleanupStack::PopAndDestroy( 6 ); // item, db, sess, resourceLoader, |
|
1230 // defaultName, msgBuffer |
|
1231 } |
|
1232 |
|
1233 void CFindItemMenu::CreateContactCardL( TInt aCommandId ) |
|
1234 { |
|
1235 CItemFinder::TItemType itemType = iSenderDescType; // default |
|
1236 HBufC* item = 0; |
|
1237 if ( iAutomaticFind && iAutomaticFind->CurrentItemExt().iItemType != CItemFinder::ENoneSelected ) |
|
1238 { |
|
1239 item = iAutomaticFind->CurrentItemExt().iItemDescriptor->AllocLC(); |
|
1240 itemType = iAutomaticFind->CurrentItemExt().iItemType; |
|
1241 } |
|
1242 else if ( !iCallbackNumber ) // default type if ok |
|
1243 { |
|
1244 item = iSenderDescriptor->AllocLC(); |
|
1245 } |
|
1246 else if ( iIsSenderKnown || !iSenderDescriptor->Length() ) |
|
1247 { |
|
1248 // callbacknumber exists and sender's address is already in phonebook |
|
1249 // or sender's number is NULL |
|
1250 item = iCallbackNumber->AllocLC(); |
|
1251 } |
|
1252 else |
|
1253 { |
|
1254 TInt index = 0; |
|
1255 item = ChooseNumberQueryL( index ); |
|
1256 if (item) |
|
1257 { |
|
1258 CleanupStack::PushL( item ); |
|
1259 if ( index == EFindUICallbackNumber ) // sender type is still |
|
1260 // default |
|
1261 { |
|
1262 itemType = CItemFinder::EPhoneNumber; |
|
1263 } |
|
1264 } |
|
1265 else |
|
1266 { |
|
1267 return; |
|
1268 } |
|
1269 } |
|
1270 #ifndef RD_VIRTUAL_PHONEBOOK |
|
1271 CArrayPtrFlat<CPbkFieldInfo> *fieldArray = |
|
1272 new(ELeave)CArrayPtrFlat<CPbkFieldInfo>( 1 ); |
|
1273 CleanupStack::PushL( fieldArray ); |
|
1274 |
|
1275 for ( TInt i = 0; i < iPbkEngine->FieldsInfo().Count(); i++ ) |
|
1276 { |
|
1277 CPbkFieldInfo* fieldInfo = iPbkEngine->FieldsInfo()[ i ]; |
|
1278 // Only interested in text storage fields |
|
1279 if ( !( fieldInfo->FieldStorageType() == KStorageTypeText ) ) |
|
1280 { |
|
1281 continue; |
|
1282 } |
|
1283 |
|
1284 if ( itemType == CItemFinder::EPhoneNumber && |
|
1285 ( fieldInfo->IsPhoneNumberField() || |
|
1286 #ifdef __VOIP |
|
1287 iFindItemVoIPExtension->IsVoIPSupported() && |
|
1288 #else |
|
1289 iVoIPFeatureSupported && |
|
1290 #endif |
|
1291 fieldInfo->FieldId() == EPbkFieldIdVOIP ) ) |
|
1292 { |
|
1293 fieldArray->AppendL( fieldInfo ); |
|
1294 } |
|
1295 else if ( itemType == CItemFinder::EEmailAddress && |
|
1296 ( fieldInfo->FieldId() == EPbkFieldIdEmailAddress || |
|
1297 #ifdef __VOIP |
|
1298 iFindItemVoIPExtension->IsVoIPSupported() && |
|
1299 #else |
|
1300 iVoIPFeatureSupported && |
|
1301 #endif |
|
1302 fieldInfo->FieldId() == EPbkFieldIdVOIP ) ) |
|
1303 { |
|
1304 fieldArray->AppendL(fieldInfo); |
|
1305 } |
|
1306 else if ( ( itemType == CItemFinder::EUrlAddress || |
|
1307 itemType == CItemFinder::EUriScheme ) && |
|
1308 fieldInfo->FieldId() == EPbkFieldIdURL ) |
|
1309 { |
|
1310 fieldArray->AppendL( fieldInfo ); |
|
1311 } |
|
1312 } |
|
1313 #endif // !RD_VIRTUAL_PHONEBOOK |
|
1314 |
|
1315 TPtr itemDes = item->Des(); |
|
1316 |
|
1317 #ifndef RD_VIRTUAL_PHONEBOOK |
|
1318 iPbkDataSave->HandleCommandL( aCommandId, *fieldArray, *item ); |
|
1319 CleanupStack::PopAndDestroy( 2 ); // fieldArray, item |
|
1320 #else //RD_VIRTUAL_PHONEBOOK |
|
1321 using namespace AiwContactAssign; |
|
1322 |
|
1323 CAiwGenericParamList& inList = iServiceHandler->InParamListL(); |
|
1324 |
|
1325 // Contact Assign Data. |
|
1326 TAiwGenericParam param( EGenericParamContactAssignData ); |
|
1327 TAiwSingleContactAssignDataV1 assignData; |
|
1328 assignData.SetFlags( 0 ); |
|
1329 param.Value().Set( TAiwSingleContactAssignDataV1Pckg( assignData ) ); |
|
1330 inList.AppendL( param ); |
|
1331 |
|
1332 // Contact Data Type. |
|
1333 param.Reset(); |
|
1334 switch( itemType ) // Resolve type. |
|
1335 { |
|
1336 case CItemFinder::EPhoneNumber: // Phone number |
|
1337 param.SetSemanticId( EGenericParamPhoneNumber ); |
|
1338 // convert phone number. |
|
1339 CommonPhoneParser::ParsePhoneNumber( |
|
1340 itemDes, CommonPhoneParser::EPhoneClientNumber ); |
|
1341 break; |
|
1342 case CItemFinder::EEmailAddress: // E-mail |
|
1343 param.SetSemanticId( EGenericParamEmailAddress ); |
|
1344 break; |
|
1345 case CItemFinder::EUrlAddress: // URL |
|
1346 case CItemFinder::EUriScheme: // URI |
|
1347 param.SetSemanticId( EGenericParamURL ); |
|
1348 break; |
|
1349 default: |
|
1350 CleanupStack::PopAndDestroy( 1 ); // item |
|
1351 return; // unknown item type. |
|
1352 } |
|
1353 param.Value().Set( itemDes ); |
|
1354 inList.AppendL( param ); |
|
1355 |
|
1356 iServiceHandler->ExecuteMenuCmdL( |
|
1357 aCommandId, |
|
1358 inList, |
|
1359 iServiceHandler->OutParamListL(), |
|
1360 0, |
|
1361 &iCallback ); |
|
1362 CleanupStack::PopAndDestroy( 1 ); // item |
|
1363 #endif // !RD_VIRTUAL_PHONEBOOK |
|
1364 } |
|
1365 |
|
1366 void CFindItemMenu::AddToGalleryL() |
|
1367 { |
|
1368 _LIT( KRamFileExtension,".ram" ); |
|
1369 TFileName fileName; |
|
1370 iCoeEnv->ReadResourceL( fileName, R_FINDITEMMENU_DEFAULT_GALL_NAME ); |
|
1371 fileName.Append( KRamFileExtension ); |
|
1372 if ( AknCommonDialogs::RunSaveDlgLD( |
|
1373 fileName, R_MEMORY_SELECTION_LOCATIONS ) ) |
|
1374 { |
|
1375 CDesCArrayFlat* array = new (ELeave)CDesCArrayFlat( 1 ); |
|
1376 CleanupStack::PushL( array ); |
|
1377 array->AppendL( iAutomaticFind->CurrentItemExt().iItemDescriptor->Des() ); |
|
1378 TInt err = KErrNone; |
|
1379 if( !iMPEngineDllLoaded ) |
|
1380 { |
|
1381 LoadMPEngineApiL(); |
|
1382 } |
|
1383 err = iMPEngineApi->CreateNewLinkFileL( fileName, array, ETrue ); |
|
1384 CleanupStack::PopAndDestroy( 1 ); |
|
1385 |
|
1386 if ( err == KErrNone ) |
|
1387 { |
|
1388 // Show note |
|
1389 HBufC* msgBuffer = |
|
1390 iCoeEnv->AllocReadResourceLC( R_FINDITEMMENU_LINK_SAVED ); |
|
1391 CAknConfirmationNote* note = |
|
1392 new (ELeave) CAknConfirmationNote( ETrue ); |
|
1393 note->ExecuteLD( *msgBuffer ); |
|
1394 CleanupStack::PopAndDestroy(); // msgBuffer |
|
1395 } |
|
1396 } |
|
1397 } |
|
1398 |
|
1399 EXPORT_C void CFindItemMenu::SetSenderDescriptorType( |
|
1400 CItemFinder::TItemType aType ) |
|
1401 { |
|
1402 iSenderDescType = aType; |
|
1403 } |
|
1404 |
|
1405 EXPORT_C void CFindItemMenu::AttachItemFinderMenuL( TInt /*aResource*/ ) |
|
1406 { |
|
1407 if ( iServiceHandler ) // this method should be called once and only once. |
|
1408 { |
|
1409 return; |
|
1410 } |
|
1411 #ifndef RD_VIRTUAL_PHONEBOOK |
|
1412 iRPbkResourceFile = new (ELeave)RPbkViewResourceFile( *iCoeEnv ); |
|
1413 iRPbkResourceFile->OpenL(); |
|
1414 iPbkEngine = CPbkContactEngine::NewL(); |
|
1415 iPbkDataSave = CPbkDataSaveAppUi::NewL( *iPbkEngine ); |
|
1416 #endif // !RD_VIRTUAL_PHONEBOOK |
|
1417 iSendUi = CSendUi::NewL(); |
|
1418 |
|
1419 TRAPD( ret, iCommonUiRepository = CRepository::NewL( KCRUidCommonUi ) ); |
|
1420 if ( ret == KErrNone ) |
|
1421 { |
|
1422 iCommonUiRepositoryWatcher = CCommonUiRepositoryWatcher::NewL( |
|
1423 KCRUidCommonUi, |
|
1424 KCuiAutomaticHighlight, |
|
1425 CCenRepNotifyHandler::EIntKey, |
|
1426 TCallBack( AutoFindStatusChanged, this ), |
|
1427 iCommonUiRepository ); |
|
1428 } |
|
1429 |
|
1430 // AIW |
|
1431 iServiceHandler = CAiwServiceHandler::NewL(); |
|
1432 |
|
1433 // Call UI |
|
1434 iServiceHandler->AttachMenuL( |
|
1435 R_FINDMENU_CALLUI_AIW_SUBMENU, |
|
1436 R_FINDMENU_CALLUI_AIW_INTEREST ); |
|
1437 |
|
1438 CMyMenuPane* callUiMenu = |
|
1439 new (ELeave) CMyMenuPane( (MEikMenuObserver*)this ); // not used really |
|
1440 CleanupStack::PushL( callUiMenu ); |
|
1441 TResourceReader callUiReader; |
|
1442 iCoeEnv->CreateResourceReaderLC( |
|
1443 callUiReader, R_FINDMENU_CALLUI_AIW_SUBMENU ); |
|
1444 callUiMenu->ConstructFromResourceL( callUiReader ); |
|
1445 CleanupStack::PopAndDestroy(); // callUiReader |
|
1446 |
|
1447 iServiceHandler->InitializeMenuPaneL( |
|
1448 *(CEikMenuPane*)callUiMenu, |
|
1449 R_FINDMENU_CALLUI_AIW_SUBMENU, |
|
1450 EFindMenuPlaceHolderCallUI, |
|
1451 iServiceHandler->InParamListL() ); |
|
1452 |
|
1453 if ( callUiMenu->NumberOfItemsInPane() < 2 ) |
|
1454 { |
|
1455 iHideCallMenu = ETrue; |
|
1456 } |
|
1457 |
|
1458 iServiceHandler->AttachL( R_FINDMENU_CALLUI_AIW_INTEREST ); |
|
1459 CleanupStack::PopAndDestroy(); // callUiMenu |
|
1460 |
|
1461 #ifdef RD_VIRTUAL_PHONEBOOK |
|
1462 // Contacts |
|
1463 iServiceHandler->AttachMenuL( |
|
1464 R_FINDMENU_CONTACTS_AIW_SUBMENU, |
|
1465 R_FINDMENU_CONTACTS_AIW_INTEREST ); |
|
1466 #endif // RD_VIRTUAL_PHONEBOOK |
|
1467 } |
|
1468 |
|
1469 void CFindItemMenu::AutoFindStatusChangedL() |
|
1470 { |
|
1471 if ( iAutomaticFind ) |
|
1472 { |
|
1473 TInt value = 0; |
|
1474 if ( iCommonUiRepository ) |
|
1475 { |
|
1476 iCommonUiRepository->Get( KCuiAutomaticHighlight, value ); |
|
1477 } |
|
1478 if ( value == 1 ) |
|
1479 { |
|
1480 iAutomaticFind->SetFindModeL( CItemFinder::EUrlAddress|CItemFinder::EEmailAddress|CItemFinder::EPhoneNumber ); |
|
1481 } |
|
1482 else |
|
1483 { |
|
1484 iAutomaticFind->SetFindModeL( 0 ); |
|
1485 } |
|
1486 } |
|
1487 } |
|
1488 |
|
1489 TInt CFindItemMenu::AutoFindStatusChanged( TAny* aThis ) |
|
1490 { |
|
1491 CFindItemMenu* me = (CFindItemMenu*)aThis; |
|
1492 TRAPD( err, me->AutoFindStatusChangedL() ); |
|
1493 return err; |
|
1494 } |
|
1495 |
|
1496 TBool CFindItemMenu::FormatDialDataL( TBool aFormatVoIPDialData ) |
|
1497 { |
|
1498 if ( !iDialData ) |
|
1499 { |
|
1500 return EFalse; |
|
1501 } |
|
1502 |
|
1503 TBool numberSelected = ( iAutomaticFind && iAutomaticFind->CurrentItemExt().iItemType == CItemFinder::EPhoneNumber ); |
|
1504 |
|
1505 TBool SIPURISelected = |
|
1506 ( aFormatVoIPDialData && |
|
1507 iAutomaticFind && |
|
1508 iFindItemVoIPExtension->VoIPProfilesExistL() && |
|
1509 iAutomaticFind->CurrentItemExt().iItemType == CItemFinder::EEmailAddress ); |
|
1510 |
|
1511 HBufC* parsedNumber = NULL ; |
|
1512 // Foucs in text body and a phone number has been selected |
|
1513 // Takes number from selected item when SIP URI is selected. |
|
1514 if ( numberSelected || SIPURISelected ) |
|
1515 { |
|
1516 parsedNumber = iAutomaticFind->CurrentItemExt().iItemDescriptor->AllocLC(); |
|
1517 } |
|
1518 else if ( !iCallbackNumber ) // Focus in address control with callback |
|
1519 // number |
|
1520 { |
|
1521 parsedNumber = iSenderDescriptor->AllocLC(); |
|
1522 } |
|
1523 else if ( !( iSenderDescType == CItemFinder::EPhoneNumber && iSenderDescriptor->Length() ) ) |
|
1524 // Eg. Email over Sms with callback number |
|
1525 { |
|
1526 parsedNumber = iCallbackNumber->AllocLC(); |
|
1527 } |
|
1528 else // both callback number and sender number, use query |
|
1529 { |
|
1530 TInt dummy = 0; |
|
1531 parsedNumber = ChooseNumberQueryL( dummy ); |
|
1532 if( parsedNumber ) |
|
1533 { |
|
1534 CleanupStack::PushL( parsedNumber ); |
|
1535 } |
|
1536 else |
|
1537 { |
|
1538 return EFalse; |
|
1539 } |
|
1540 } |
|
1541 TPtr numberPtr = parsedNumber->Des(); |
|
1542 |
|
1543 using namespace AIWDialDataExt; |
|
1544 CommonPhoneParser::ParsePhoneNumber( |
|
1545 numberPtr, CommonPhoneParser::EPhoneClientNumber ); |
|
1546 __ASSERT_ALWAYS( parsedNumber->Length() <= KMaximumPhoneNumberLength, |
|
1547 Panic( ETooLongItem ) ); |
|
1548 AknTextUtils::ConvertDigitsTo( numberPtr, EDigitTypeWestern ); |
|
1549 #ifdef RD_VOIP_REL_2_2 |
|
1550 if ( FeatureManager::FeatureSupported(KFeatureIdCommonVoip ) ) |
|
1551 { |
|
1552 if ( aFormatVoIPDialData ) |
|
1553 { |
|
1554 // sets call type for VoIP |
|
1555 iDialData->SetCallType( CAiwDialData::EAIWVoiP ); |
|
1556 } |
|
1557 } |
|
1558 #endif // RD_VOIP_REL_2_2 |
|
1559 iDialData->SetPhoneNumberL( numberPtr ); |
|
1560 |
|
1561 CleanupStack::PopAndDestroy(); // number; |
|
1562 return ETrue; |
|
1563 } |
|
1564 |
|
1565 void CFindItemMenu::LaunchGenericUriL() |
|
1566 { |
|
1567 if ( iSchemeHandler ) |
|
1568 { |
|
1569 delete iSchemeHandler; |
|
1570 iSchemeHandler = 0; |
|
1571 } |
|
1572 iSchemeHandler = CSchemeHandler::NewL( iAutomaticFind->CurrentItemExt().iItemDescriptor->Des() ); |
|
1573 if ( iAutomaticFind->CurrentItemExt().iItemDescriptor->FindF( KRtspUrlAddress ) != KErrNotFound ) |
|
1574 { |
|
1575 iSchemeHandler->HandleUrlEmbeddedL(); |
|
1576 } |
|
1577 else |
|
1578 { |
|
1579 iSchemeHandler->HandleUrlStandaloneL(); |
|
1580 } |
|
1581 } |
|
1582 |
|
1583 EXPORT_C void CFindItemMenu::SetCallbackNumber( const TDesC& aPhoneNumber ) |
|
1584 { |
|
1585 delete iCallbackNumber; |
|
1586 iCallbackNumber = 0; |
|
1587 iCallbackNumber = aPhoneNumber.Alloc(); |
|
1588 } |
|
1589 |
|
1590 HBufC* CFindItemMenu::ChooseNumberQueryL( TInt& aIndex ) |
|
1591 { |
|
1592 HBufC* ret = 0; |
|
1593 |
|
1594 // First phase construction of menu list |
|
1595 CAknSingleHeadingPopupMenuStyleListBox* phoneNumberList = |
|
1596 new (ELeave) CAknSingleHeadingPopupMenuStyleListBox; |
|
1597 CleanupStack::PushL( phoneNumberList ); |
|
1598 |
|
1599 // Create a popuplist to show the menu list in |
|
1600 CAknPopupList* popupList = |
|
1601 CAknPopupList::NewL( phoneNumberList, R_AVKON_SOFTKEYS_OK_CANCEL ); |
|
1602 CleanupStack::PushL( popupList ); |
|
1603 // Second phase construction of popupList |
|
1604 phoneNumberList->ConstructL( popupList,EAknListBoxMenuList ); |
|
1605 |
|
1606 // Set up menu items |
|
1607 CTextListBoxModel* model = phoneNumberList->Model(); |
|
1608 model->SetOwnershipType( ELbmOwnsItemArray ); |
|
1609 |
|
1610 CDesCArray* phoneNumberListArray = |
|
1611 static_cast<CDesCArray*>( model->ItemTextArray() ); |
|
1612 |
|
1613 HBufC* title; |
|
1614 title = StringLoader::LoadLC( R_QTN_SMS_USENUMBER ); |
|
1615 popupList->SetTitleL( *title ); |
|
1616 CleanupStack::PopAndDestroy( title ); |
|
1617 |
|
1618 _LIT( KStringHeader, "%S\t%S" ); |
|
1619 TBuf <256> string; |
|
1620 HBufC* head; |
|
1621 // sender item |
|
1622 head = StringLoader::LoadLC( R_QTN_SMS_USENUMBER_FROM ); |
|
1623 string.Format( KStringHeader(), head, iSenderDescriptor ); |
|
1624 phoneNumberListArray->AppendL ( string); |
|
1625 CleanupStack::PopAndDestroy( head ); |
|
1626 // callback number |
|
1627 head = StringLoader::LoadLC( R_QTN_SMS_USENUMBER_CALLBACK ); |
|
1628 string.Format( KStringHeader(), head, iCallbackNumber ); |
|
1629 phoneNumberListArray->AppendL( string ); |
|
1630 CleanupStack::PopAndDestroy( head ); |
|
1631 |
|
1632 CleanupStack::Pop( popupList ); |
|
1633 |
|
1634 if ( popupList->ExecuteLD() ) |
|
1635 { |
|
1636 ret = ( phoneNumberList->CurrentItemIndex() == EFindUICallbackNumber ) ? |
|
1637 iCallbackNumber->AllocL() : iSenderDescriptor->AllocL(); |
|
1638 aIndex = phoneNumberList->CurrentItemIndex(); |
|
1639 } |
|
1640 |
|
1641 CleanupStack::PopAndDestroy( phoneNumberList ); |
|
1642 |
|
1643 return ret; |
|
1644 } |
|
1645 |
|
1646 // ----------------------------------------------------------------------------- |
|
1647 // TInt CFindItemMenu::LoadMPEngineApiL |
|
1648 // Load MPEngine Api. |
|
1649 // ----------------------------------------------------------------------------- |
|
1650 void CFindItemMenu::LoadMPEngineApiL() |
|
1651 { |
|
1652 // Memo saving dll loading. |
|
1653 if( !iMPEngineDllLoaded ) |
|
1654 { |
|
1655 if( iMPEngineDll.Load( KCommonUiMPEngineApiLoaderName ) == KErrNone ) |
|
1656 { |
|
1657 iMPEngineDllLoaded = ETrue; |
|
1658 // Request the entry function |
|
1659 MPEngineApiL mpengineApi = |
|
1660 (MPEngineApiL) iMPEngineDll.Lookup( KMPEngineApiDllEntryPoint ); |
|
1661 if( mpengineApi ) |
|
1662 { |
|
1663 // Create the class |
|
1664 iMPEngineApi = (CCommonUiMPEngineApiLoader*) (*mpengineApi)(); |
|
1665 } |
|
1666 } |
|
1667 } |
|
1668 // The wrapper failed to load. |
|
1669 if ( !iMPEngineApi ) |
|
1670 { |
|
1671 User::Leave( KErrNotFound ); |
|
1672 } |
|
1673 } |
|
1674 |
|
1675 // ----------------------------------------------------------------------------- |
|
1676 // TInt CFindItemMenu::CopyToClipboardL |
|
1677 // |
|
1678 // ----------------------------------------------------------------------------- |
|
1679 void CFindItemMenu::CopyToClipboardL() |
|
1680 { |
|
1681 HBufC* item = 0; |
|
1682 TInt len = 0; |
|
1683 if ( iAutomaticFind && iAutomaticFind->CurrentItemExt().iItemType != CItemFinder::ENoneSelected ) |
|
1684 { |
|
1685 item = iAutomaticFind->CurrentSelection().AllocLC(); |
|
1686 len = item->Length(); |
|
1687 } |
|
1688 else if( iSenderHighlighted ) |
|
1689 { |
|
1690 item = iSenderDisplayText->AllocLC(); |
|
1691 len = item->Length(); |
|
1692 } |
|
1693 __ASSERT_DEBUG( len > 0, Panic( ENoItemSelected ) ); |
|
1694 |
|
1695 CPlainText* plainText = CPlainText::NewL( CPlainText::ESegmentedStorage, len ); |
|
1696 CleanupStack::PushL( plainText ); |
|
1697 plainText->InsertL( 0, *item ); |
|
1698 |
|
1699 CClipboard* cb = CClipboard::NewForWritingLC( iCoeEnv->FsSession() ); |
|
1700 plainText->CopyToStoreL( cb->Store(), cb->StreamDictionary(), 0, len ); |
|
1701 cb->CommitL(); |
|
1702 |
|
1703 CleanupStack::PopAndDestroy( 3 ); // item, plainText, cb |
|
1704 // fix for EJCU-7K98TM |
|
1705 CAknNoteDialog* dlg = new (ELeave) CAknNoteDialog(); |
|
1706 dlg->SetTimeout(CAknNoteDialog::EShortTimeout); |
|
1707 dlg->SetTone(CAknNoteDialog::ENoTone); |
|
1708 dlg->ExecuteLD( R_AVKON_NOTE_CONF_COPIED ); |
|
1709 // fix end |
|
1710 } |
|
1711 |
|
1712 EXPORT_C void CFindItemMenu::SetSenderHighlightStatus( TBool aStatus ) |
|
1713 { |
|
1714 iSenderHighlighted = aStatus; |
|
1715 } |
|
1716 |
|
1717 EXPORT_C void CFindItemMenu::SetSenderDisplayText( const TDesC& aText ) |
|
1718 { |
|
1719 delete iSenderDisplayText; |
|
1720 iSenderDisplayText = 0; |
|
1721 iSenderDisplayText = aText.Alloc(); |
|
1722 } |
|
1723 |
|
1724 #ifdef RD_VOIP_REL_2_2 |
|
1725 EXPORT_C void CFindItemMenu::SetMenuItemVisibility( |
|
1726 CFindItemMenu::TMenuItem aItem, |
|
1727 TBool aVisible ) |
|
1728 { |
|
1729 if ( aVisible ) |
|
1730 { |
|
1731 // iMenuItemFlags, 0 = visible |
|
1732 iMenuItemFlags &= ~(TInt)aItem; |
|
1733 } |
|
1734 else |
|
1735 { |
|
1736 // iMenuItemFlags, 1 = not allowed |
|
1737 iMenuItemFlags |= (TInt)aItem; |
|
1738 } |
|
1739 } |
|
1740 #else |
|
1741 EXPORT_C void CFindItemMenu::SetMenuItemVisibility( |
|
1742 CFindItemMenu::TMenuItem /*aItem*/, |
|
1743 TBool /*aVisible*/ ) |
|
1744 { |
|
1745 } |
|
1746 #endif // RD_VOIP_REL_2_2 |
|
1747 CCommonUiRepositoryWatcher* CCommonUiRepositoryWatcher::NewL( |
|
1748 const TUid aUid, |
|
1749 const TUint32 aKey, |
|
1750 CCenRepNotifyHandler::TCenRepKeyType aKeyType, |
|
1751 TCallBack aCallBack, |
|
1752 CRepository* aRepository ) |
|
1753 { |
|
1754 CCommonUiRepositoryWatcher* self = |
|
1755 new(ELeave) CCommonUiRepositoryWatcher( |
|
1756 aUid, aKey, aCallBack, aRepository ); |
|
1757 |
|
1758 CleanupStack::PushL( self ); |
|
1759 self->ConstructL( aKeyType ); |
|
1760 CleanupStack::Pop( self ); |
|
1761 |
|
1762 return self; |
|
1763 } |
|
1764 |
|
1765 CCommonUiRepositoryWatcher::~CCommonUiRepositoryWatcher() |
|
1766 { |
|
1767 if ( iNotifyHandler ) |
|
1768 { |
|
1769 iNotifyHandler->StopListening(); |
|
1770 } |
|
1771 delete iNotifyHandler; |
|
1772 } |
|
1773 |
|
1774 CCommonUiRepositoryWatcher::CCommonUiRepositoryWatcher( |
|
1775 const TUid aUid, |
|
1776 const TUint32 aKey, |
|
1777 TCallBack aCallBack, |
|
1778 CRepository* aRepository ) |
|
1779 : iUid( aUid ), |
|
1780 iKey( aKey ), |
|
1781 iCallBack( aCallBack ), |
|
1782 iRepository( aRepository ) |
|
1783 { |
|
1784 } |
|
1785 |
|
1786 void CCommonUiRepositoryWatcher::ConstructL( |
|
1787 CCenRepNotifyHandler::TCenRepKeyType aKeyType ) |
|
1788 { |
|
1789 iNotifyHandler = |
|
1790 CCenRepNotifyHandler::NewL( *this, *iRepository, aKeyType, iKey ); |
|
1791 iNotifyHandler->StartListeningL(); |
|
1792 } |
|
1793 |
|
1794 void CCommonUiRepositoryWatcher::ConstructL() |
|
1795 { |
|
1796 iNotifyHandler = CCenRepNotifyHandler::NewL( *this, *iRepository ); |
|
1797 iNotifyHandler->StartListeningL(); |
|
1798 } |
|
1799 |
|
1800 TUint32 CCommonUiRepositoryWatcher::ChangedKey() |
|
1801 { |
|
1802 return iChangedKey; |
|
1803 } |
|
1804 |
|
1805 void CCommonUiRepositoryWatcher::HandleNotifyInt( |
|
1806 TUint32 aKey, |
|
1807 TInt aNewValue ) |
|
1808 { |
|
1809 #ifdef _DEBUG |
|
1810 RDebug::Print(_L("CCommonUiRepositoryWatcher::HandleNotifyInt aKey=%d, aNewValue=%d"), aKey, aNewValue); |
|
1811 #endif |
|
1812 (void)aNewValue; |
|
1813 iChangedKey = aKey; |
|
1814 iCallBack.CallBack(); |
|
1815 iChangedKey = NCentralRepositoryConstants::KInvalidNotificationId; |
|
1816 } |
|
1817 |
|
1818 void CCommonUiRepositoryWatcher::HandleNotifyError( |
|
1819 TUint32 /*aKey*/, |
|
1820 TInt /*aError*/, |
|
1821 CCenRepNotifyHandler* /*aHandler*/ ) |
|
1822 { |
|
1823 } |
|
1824 |
|
1825 |
|
1826 EXPORT_C TInt MPBAiwNotify::HandleNotifyL(TInt /*aCmdId*/, TInt aEventId, |
|
1827 CAiwGenericParamList& aEventParamList, |
|
1828 const CAiwGenericParamList& /*aInParamList*/) |
|
1829 { |
|
1830 if (aEventId == KAiwEventError) |
|
1831 { |
|
1832 if (aEventParamList.Count() > 0) |
|
1833 { |
|
1834 TInt32 err = aEventParamList[0].Value().AsTInt32(); |
|
1835 User::Leave(err); |
|
1836 } |
|
1837 } |
|
1838 return KErrNone; |
|
1839 } |
|
1840 |
|
1841 // End of File |