33 #include <akncontext.h> // for AknContextPane |
33 #include <akncontext.h> // for AknContextPane |
34 #include <bautils.h> // BaflUtils |
34 #include <bautils.h> // BaflUtils |
35 #include <eikbtgpc.h> // for ButtonGroupContainer |
35 #include <eikbtgpc.h> // for ButtonGroupContainer |
36 #include <uikon.hrh> // for EKeyOk |
36 #include <uikon.hrh> // for EKeyOk |
37 |
37 |
|
38 #include <favouriteslimits.h> // KFavouritesMaxUrl |
|
39 #include <favouritesitem.h> // for CBookmarkItem |
|
40 |
|
41 #include <favouritesdb.h> |
|
42 |
38 #include <apgcli.h> // RApaLsSession for WMLBrowser launch |
43 #include <apgcli.h> // RApaLsSession for WMLBrowser launch |
39 |
44 |
40 #ifndef RD_VIRTUAL_PHONEBOOK |
45 #ifndef RD_VIRTUAL_PHONEBOOK |
41 #include <CPbkContactEngine.h> // Phonebook Engine |
46 #include <CPbkContactEngine.h> // Phonebook Engine |
42 #include <RPbkViewResourceFile.h> // Phonebook view dll resource loader |
47 #include <RPbkViewResourceFile.h> // Phonebook view dll resource loader |
45 #else // RD_VIRTUAL_PHONEBOOK |
50 #else // RD_VIRTUAL_PHONEBOOK |
46 #include <AiwServiceHandler.h> // CAiwServiceHandler |
51 #include <AiwServiceHandler.h> // CAiwServiceHandler |
47 #include <AiwContactAssignDataTypes.h> // AiwContactAssign |
52 #include <AiwContactAssignDataTypes.h> // AiwContactAssign |
48 #endif // !RD_VIRTUAL_PHONEBOOK |
53 #endif // !RD_VIRTUAL_PHONEBOOK |
49 |
54 |
|
55 #include <sendui.h> // for CSendAppUi |
|
56 #include <CMessageData.h> // for CMessageData |
|
57 #include <SendUiConsts.h> // Mtm uids |
|
58 |
50 #include <commonphoneparser.h> // Phonenumber parser |
59 #include <commonphoneparser.h> // Phonenumber parser |
51 |
60 |
52 #include <baclipb.h> // For CClipboard |
61 #include <baclipb.h> // For CClipboard |
|
62 |
|
63 #include <schemehandler.h> // For CSchemeHandler |
53 |
64 |
54 #include <aknnotewrappers.h> |
65 #include <aknnotewrappers.h> |
55 |
66 |
56 #include <finditemui.rsg> |
67 #include <finditemui.rsg> |
57 |
68 |
82 #include <txtfrmat.h> // for TCharFormat |
93 #include <txtfrmat.h> // for TCharFormat |
83 |
94 |
84 #include <aknnavilabel.h> // for changing the lable of navipane |
95 #include <aknnavilabel.h> // for changing the lable of navipane |
85 |
96 |
86 #include <AknTasHook.h> // for testability hooks |
97 #include <AknTasHook.h> // for testability hooks |
|
98 #include <touchfeedback.h> |
87 _LIT( KResFileName, "z:\\resource\\finditemui.rsc" ); |
99 _LIT( KResFileName, "z:\\resource\\finditemui.rsc" ); |
88 |
100 |
89 // Panic |
101 // Panic |
90 _LIT( KFindItemPanic, "FindItemDialog" ); |
102 _LIT( KFindItemPanic, "FindItemDialog" ); |
91 // Space for WML Browser's parameter |
103 // Space for WML Browser's parameter |
223 // phonebook to know it can exit |
235 // phonebook to know it can exit |
224 return ETrue; |
236 return ETrue; |
225 } |
237 } |
226 |
238 |
227 NONSHARABLE_CLASS(CItemFinderExtension) : public CBase |
239 NONSHARABLE_CLASS(CItemFinderExtension) : public CBase |
228 { |
240 { |
229 public: |
241 public: |
230 ~CItemFinderExtension(); |
242 ~CItemFinderExtension(); |
231 static CItemFinderExtension* NewL(); |
243 static CItemFinderExtension* NewL(); |
232 |
244 |
233 //new function |
245 //new function |
234 public: |
246 public: |
235 PBAiwNotify* CallBack(); |
247 PBAiwNotify* CallBack(); |
236 |
248 |
237 private: |
249 private: |
238 CItemFinderExtension(); |
250 CItemFinderExtension(); |
239 void ConstructL(); |
251 void ConstructL(); |
240 |
252 |
241 public: |
253 public: |
242 PBAiwNotify iCallBack; |
254 PBAiwNotify iCallBack; |
243 }; |
255 }; |
244 |
256 |
245 CItemFinderExtension::~CItemFinderExtension() |
257 CItemFinderExtension::~CItemFinderExtension() |
246 { |
258 { |
247 |
259 } |
248 } |
|
249 |
260 |
250 CItemFinderExtension* CItemFinderExtension::NewL() |
261 CItemFinderExtension* CItemFinderExtension::NewL() |
251 { |
262 { |
252 CItemFinderExtension* self = new ( ELeave )CItemFinderExtension; |
263 CItemFinderExtension* self = new ( ELeave )CItemFinderExtension; |
253 CleanupStack::PushL(self); |
264 CleanupStack::PushL(self); |
254 self->ConstructL(); |
265 self->ConstructL(); |
255 CleanupStack::Pop(); |
266 CleanupStack::Pop(); |
256 return self; |
267 return self; |
257 } |
268 } |
258 |
269 |
259 PBAiwNotify* CItemFinderExtension::CallBack() |
270 PBAiwNotify* CItemFinderExtension::CallBack() |
260 { |
271 { |
261 return &iCallBack; |
272 return &iCallBack; |
262 } |
273 } |
263 |
274 |
264 CItemFinderExtension::CItemFinderExtension() |
275 CItemFinderExtension::CItemFinderExtension() |
265 { |
276 { |
266 |
277 |
267 } |
278 } |
268 |
279 |
269 void CItemFinderExtension::ConstructL() |
280 void CItemFinderExtension::ConstructL() |
270 { |
281 { |
271 |
282 |
272 } |
283 } |
273 |
284 |
274 |
285 |
275 |
286 |
276 // ================= MEMBER FUNCTIONS ======================= |
287 // ================= MEMBER FUNCTIONS ======================= |
277 |
288 |
441 FeatureManager::FeatureSupported( KFeatureIdEmailUi ); |
455 FeatureManager::FeatureSupported( KFeatureIdEmailUi ); |
442 |
456 |
443 iFindItemVoIPExtension = CFindItemVoIPExtension::NewL(); |
457 iFindItemVoIPExtension = CFindItemVoIPExtension::NewL(); |
444 |
458 |
445 iExtension = CItemFinderExtension::NewL(); |
459 iExtension = CItemFinderExtension::NewL(); |
446 } |
460 iFeedback = MTouchFeedback::Instance(); |
447 |
461 } |
|
462 |
|
463 // ----------------------------------------------------------------------------- |
|
464 // CFindItemDialog::HandlePointerEventL |
|
465 // ----------------------------------------------------------------------------- |
|
466 // |
|
467 void CFindItemDialog::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
|
468 { |
|
469 if ( !iSingleClick ) |
|
470 { |
|
471 if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
|
472 { |
|
473 this->PointerEvent( NULL, aPointerEvent ); |
|
474 } |
|
475 } |
|
476 else |
|
477 { |
|
478 DoHandlePointerEventL( aPointerEvent ); |
|
479 } |
|
480 } |
|
481 |
|
482 // ----------------------------------------------------------------------------- |
|
483 // CFindItemDialog::DoHandlePointerEventL |
|
484 // ----------------------------------------------------------------------------- |
|
485 // |
|
486 void CFindItemDialog::DoHandlePointerEventL ( const TPointerEvent& aPointerEvent ) |
|
487 { |
|
488 if ( aPointerEvent.iType == TPointerEvent::EButton1Up || |
|
489 aPointerEvent.iType == TPointerEvent::EButton1Down ) |
|
490 { |
|
491 TPoint tapPoint( aPointerEvent.iPosition - iTappingOffset ); |
|
492 TInt pos = 0; |
|
493 TInt len = iEdwin->TextLayout()->PosRangeInBand( pos ); |
|
494 CFindItemEngine::SFoundItem item; |
|
495 TRect rect; |
|
496 TInt i = 0; |
|
497 while ( i < iController->ItemCount() ) // Check visible rects |
|
498 { |
|
499 if ( !iController->Item( i, item ) ) // Get item. |
|
500 { |
|
501 break; // Error: invalid item. |
|
502 } |
|
503 TInt end = item.iStartPos + item.iLength - 1; |
|
504 if ( end < pos ) |
|
505 { |
|
506 i++; |
|
507 continue; // item not visible. |
|
508 } |
|
509 TInt start = item.iStartPos; |
|
510 if ( start >= ( pos + len ) ) |
|
511 { |
|
512 break; // item not visible. |
|
513 } |
|
514 TInt lastLine = iEdwin->TextLayout()->GetLineNumber( end ); |
|
515 TInt nextLine = 0; |
|
516 TInt lastPos = start; |
|
517 do // Check all rects of one item. |
|
518 { |
|
519 TInt error = KErrNone; |
|
520 TRAP( error, rect = |
|
521 iEdwin->TextLayout()->GetLineRectL( start, end ) ); |
|
522 if ( error == KErrNone ) |
|
523 { |
|
524 if ( rect.Contains( tapPoint ) ) // Item rect tapped. |
|
525 { |
|
526 if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
|
527 { |
|
528 TRAP( error, iController->TappedItemL( i ) ); |
|
529 // Change selection |
|
530 if ( error != KErrNone ) |
|
531 { |
|
532 return; // Error: no selection made. |
|
533 } |
|
534 if ( iFeedback ) |
|
535 { |
|
536 iFeedback->InstantFeedback( ETouchFeedbackBasicButton ); |
|
537 } |
|
538 iLastTappedItem = TPoint ( item.iStartPos, item.iLength |
|
539 + item.iStartPos ); |
|
540 return; // Hit, no further handling. |
|
541 } |
|
542 else if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
|
543 { |
|
544 if ( iLastTappedItem == TPoint ( item.iStartPos, |
|
545 item.iLength + item.iStartPos ) ) |
|
546 { |
|
547 iIsSensitiveMenu = ETrue; |
|
548 iMenuBar->SetMenuType( CEikMenuBar::EMenuContext ); |
|
549 TRAP_IGNORE( CAknDialog::DisplayMenuL() ); |
|
550 } |
|
551 return; // Hit, no further handling. |
|
552 } |
|
553 } |
|
554 } |
|
555 else |
|
556 { |
|
557 return; // Error: no rect. |
|
558 } |
|
559 TPoint midPoint( rect.iBr.iX, |
|
560 ( rect.iBr.iY + rect.iTl.iY ) / 2 ); |
|
561 TRAP( error, lastPos = |
|
562 iEdwin->TextLayout()->XyPosToDocPosL( midPoint ) ); |
|
563 if ( error != KErrNone ) |
|
564 { |
|
565 return; // Error: no last pos. |
|
566 } |
|
567 start = lastPos + 1; |
|
568 nextLine = iEdwin->TextLayout()->GetLineNumber( lastPos ); |
|
569 } while ( nextLine != lastLine ); |
|
570 i++; |
|
571 } |
|
572 } |
|
573 return; // No hit, no further handling. |
|
574 } |
448 |
575 |
449 // ----------------------------------------------------------------------------- |
576 // ----------------------------------------------------------------------------- |
450 // CFindItemDialog::DoCopyToClipboardL |
577 // CFindItemDialog::DoCopyToClipboardL |
451 // Copies the selected item to EPOC clipboard |
578 // Copies the selected item to EPOC clipboard |
452 // ----------------------------------------------------------------------------- |
579 // ----------------------------------------------------------------------------- |
605 // Sends message (SMS, MMS or E-mail) to selected item |
732 // Sends message (SMS, MMS or E-mail) to selected item |
606 // ----------------------------------------------------------------------------- |
733 // ----------------------------------------------------------------------------- |
607 // |
734 // |
608 void CFindItemDialog::SendMessageL( const TUid aMtmUid ) |
735 void CFindItemDialog::SendMessageL( const TUid aMtmUid ) |
609 { |
736 { |
610 |
737 __ASSERT_DEBUG( iEdwin->SelectionLength() > 0, Panic( ENoItemSelected ) ); |
|
738 |
|
739 if ( !iSendUi ) |
|
740 { |
|
741 return; |
|
742 } |
|
743 |
|
744 // Hide options menu if showing |
|
745 if ( CAknDialog::MenuShowing() ) |
|
746 { |
|
747 CAknDialog::HideMenu(); |
|
748 } |
|
749 |
|
750 TCursorSelection selection = iEdwin->Selection(); |
|
751 HBufC* number = HBufC::NewLC( selection.Length() ); |
|
752 TPtr numberPtr = number->Des(); |
|
753 numberPtr.Append( |
|
754 iPlainText.Mid( |
|
755 selection.LowerPos(), selection.Length() ) ); |
|
756 if ( iSearchCase & CFindItemEngine::EFindItemSearchPhoneNumberBin ) |
|
757 { |
|
758 CommonPhoneParser::ParsePhoneNumber( |
|
759 numberPtr, CommonPhoneParser::EPlainPhoneNumber ); |
|
760 AknTextUtils::ConvertDigitsTo( numberPtr, EDigitTypeWestern ); |
|
761 } |
|
762 |
|
763 CMessageData* messageData = CMessageData::NewL(); |
|
764 CleanupStack::PushL( messageData ); |
|
765 messageData->AppendToAddressL( *number ); |
|
766 |
|
767 iSendUi->CreateAndSendMessageL( aMtmUid, messageData ); |
|
768 CleanupStack::PopAndDestroy(2); // messageData, number |
|
769 |
611 } |
770 } |
612 |
771 |
613 // ----------------------------------------------------------------------------- |
772 // ----------------------------------------------------------------------------- |
614 // CFindItemDialog::LaunchGenericUriL |
773 // CFindItemDialog::LaunchGenericUriL |
615 // Handles URIs launching. If parent application is Browser, |
774 // Handles URIs launching. If parent application is Browser, |
679 |
855 |
680 HBufC *parameters = HBufC::NewLC( paramLength ); |
856 HBufC *parameters = HBufC::NewLC( paramLength ); |
681 TPtr paramPtr = parameters->Des(); |
857 TPtr paramPtr = parameters->Des(); |
682 paramPtr.Copy( KWmlBrowserParameter ); |
858 paramPtr.Copy( KWmlBrowserParameter ); |
683 paramPtr.Append( KSpace ); |
859 paramPtr.Append( KSpace ); |
684 paramPtr.Append( aItemtextPtr.Mid( 0, aItemtextPtr.Length() ) ); |
860 paramPtr.Append( |
|
861 aItemtextPtr.Mid( |
|
862 0, Min( aItemtextPtr.Length(), KFavouritesMaxUrl ) ) ); |
685 |
863 |
686 TApaTaskList taskList( iEikonEnv->WsSession() ); |
864 TApaTaskList taskList( iEikonEnv->WsSession() ); |
687 TApaTask task = taskList.FindApp( KWapUid ); |
865 TApaTask task = taskList.FindApp( KWapUid ); |
688 if ( task.Exists() ) |
866 if ( task.Exists() ) |
689 { |
867 { |
711 // |
889 // |
712 void CFindItemDialog::AddToBookmarkL() |
890 void CFindItemDialog::AddToBookmarkL() |
713 { |
891 { |
714 __ASSERT_DEBUG( iEdwin->SelectionLength() > 0, Panic( ENoItemSelected ) ); |
892 __ASSERT_DEBUG( iEdwin->SelectionLength() > 0, Panic( ENoItemSelected ) ); |
715 |
893 |
|
894 // Create an item and fill with meaningful data. |
|
895 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
896 item->SetParentFolder( KFavouritesRootUid ); |
|
897 item->SetType( CFavouritesItem::EItem ); |
716 // Read default name from resources |
898 // Read default name from resources |
717 HBufC* defaultName = |
899 HBufC* defaultName = |
718 iEikonEnv->AllocReadResourceLC( R_FINDITEM_DEFAULT_BOOKMARK_NAME ); |
900 iEikonEnv->AllocReadResourceLC( R_FINDITEM_DEFAULT_BOOKMARK_NAME ); |
719 |
901 |
720 TBuf<KMaxBookmarkNameLength> retName; |
902 TBuf<KMaxBookmarkNameLength> retName; |
725 CAknTextQueryDialog* dlg = CAknTextQueryDialog::NewL( retName ); |
907 CAknTextQueryDialog* dlg = CAknTextQueryDialog::NewL( retName ); |
726 dlg->SetMaxLength( KMaxBookmarkNameLength ); |
908 dlg->SetMaxLength( KMaxBookmarkNameLength ); |
727 if ( !dlg->ExecuteLD( R_FINDITEM_BOOKMARK_QUERY_DIALOG ) ) |
909 if ( !dlg->ExecuteLD( R_FINDITEM_BOOKMARK_QUERY_DIALOG ) ) |
728 { |
910 { |
729 // User press cancel - do not add bookmark |
911 // User press cancel - do not add bookmark |
|
912 CleanupStack::PopAndDestroy( ); // item |
730 return; |
913 return; |
731 } |
914 } |
732 |
915 |
|
916 item->SetNameL( retName ); |
733 TCursorSelection selection = iEdwin->Selection(); |
917 TCursorSelection selection = iEdwin->Selection(); |
734 |
918 item->SetUrlL( iPlainText.Mid( selection.LowerPos(), selection.Length() ) ); |
|
919 |
|
920 RFavouritesSession sess; |
|
921 RFavouritesDb db; |
|
922 |
|
923 User::LeaveIfError( sess.Connect() ); |
|
924 CleanupClosePushL<RFavouritesSession>( sess ); |
|
925 User::LeaveIfError( db.Open( sess, KBrowserBookmarks ) ); |
|
926 CleanupClosePushL<RFavouritesDb>( db ); |
|
927 |
|
928 // Add item. |
|
929 db.Add( *item, ETrue ); |
|
930 // Close the database. |
|
931 db.Close(); |
|
932 |
735 HBufC* msgBuffer = |
933 HBufC* msgBuffer = |
736 iCoeEnv->AllocReadResourceLC( R_FINDITEM_BOOKMARK_SAVED ); |
934 iCoeEnv->AllocReadResourceLC( R_FINDITEM_BOOKMARK_SAVED ); |
737 CAknConfirmationNote* note = new (ELeave)CAknConfirmationNote( ETrue ); |
935 CAknConfirmationNote* note = new (ELeave)CAknConfirmationNote( ETrue ); |
738 note->ExecuteLD( *msgBuffer ); |
936 note->ExecuteLD( *msgBuffer ); |
739 |
937 |
740 CleanupStack::PopAndDestroy(); // magBuffer |
938 CleanupStack::PopAndDestroy( 4 ); // magBuffer, db, sess, item |
741 } |
939 } |
742 |
940 |
743 // ----------------------------------------------------------------------------- |
941 // ----------------------------------------------------------------------------- |
|
942 // CFindItemDialog::EnableSingleClick |
|
943 // ----------------------------------------------------------------------------- |
|
944 // |
|
945 EXPORT_C void CFindItemDialog::EnableSingleClick ( TBool aEnable ) |
|
946 { |
|
947 iSingleClick = aEnable; |
|
948 } |
|
949 |
744 // CFindItemDialog::ProcessCommandL |
950 // CFindItemDialog::ProcessCommandL |
745 // Prosesses menu commands |
951 // Prosesses menu commands |
746 // ----------------------------------------------------------------------------- |
952 // ----------------------------------------------------------------------------- |
747 // |
953 // |
748 EXPORT_C void CFindItemDialog::ProcessCommandL( TInt aCommandId ) |
954 EXPORT_C void CFindItemDialog::ProcessCommandL( TInt aCommandId ) |
783 contextPane->SetPictureToDefaultL(); |
989 contextPane->SetPictureToDefaultL(); |
784 break; |
990 break; |
785 } |
991 } |
786 // Phone number cmds |
992 // Phone number cmds |
787 case EFindItemCmdCall: |
993 case EFindItemCmdCall: |
788 { // bit awkward but correct functionality provided. |
994 { |
789 TKeyEvent keyEvent; |
995 if ( !iHideCallSubMenu ) |
790 keyEvent.iCode = EKeyPhoneSend; |
996 { // bit awkward but correct functionality provided. |
791 OfferKeyEventL( keyEvent, EEventKey ); |
997 TKeyEvent keyEvent; |
|
998 keyEvent.iCode = EKeyPhoneSend; |
|
999 OfferKeyEventL( keyEvent, EEventKey ); |
|
1000 } |
|
1001 else |
|
1002 { |
|
1003 if ( !iDialData ) |
|
1004 { |
|
1005 break; |
|
1006 } |
|
1007 FormatDialDataL( aCommandId ); |
|
1008 |
|
1009 CAiwGenericParamList& paramList = |
|
1010 iServiceHandler->InParamListL(); |
|
1011 |
|
1012 if ( iFindItemVoIPExtension->VoIPProfilesExistL() && |
|
1013 ( iSearchCase == |
|
1014 CFindItemEngine::EFindItemSearchMailAddressBin || |
|
1015 iSearchCase == KSearchTelInternetNumber ) ) |
|
1016 { |
|
1017 //voip |
|
1018 iDialData->SetCallType( CAiwDialData::EAIWVoiP ); |
|
1019 } |
|
1020 |
|
1021 iDialData->FillInParamListL( paramList ); |
|
1022 |
|
1023 iServiceHandler->ExecuteServiceCmdL( |
|
1024 KAiwCmdCall, |
|
1025 paramList, |
|
1026 iServiceHandler->OutParamListL(), |
|
1027 0, // No options used. |
|
1028 NULL ); // Dial results are not wanted. |
|
1029 } |
792 break; |
1030 break; |
793 } |
1031 } |
794 // fix for FAMZ-7JVQ4Y |
1032 // fix for FAMZ-7JVQ4Y |
795 case EFindItemSubMenuSend: |
1033 case EFindItemSubMenuSend: |
796 { |
1034 { |
|
1035 CFindItemEngine::SFoundItem item; |
|
1036 TBool founditem = iController->Item( item ); |
|
1037 TSendingCapabilities sendingCapabilities; |
|
1038 sendingCapabilities.iFlags = TSendingCapabilities::ESupportsEditor; |
|
1039 CArrayFixFlat<TUid>* mtmFilter = new(ELeave) CArrayFixFlat<TUid>( 1 ); |
|
1040 CleanupStack::PushL(mtmFilter); |
|
1041 mtmFilter->AppendL(KSenduiMtmPostcardUid);// hide postcard |
|
1042 // Hide MMs |
|
1043 #ifndef RD_UNIFIED_EDITOR |
|
1044 if( !iMMSFeatureSupported ) |
|
1045 { |
|
1046 mtmFilter->AppendL(KSenduiMtmMmsUid); |
|
1047 } |
|
1048 #endif |
|
1049 |
|
1050 // Hide Sms |
|
1051 if ( iSearchCase == CFindItemEngine::EFindItemSearchMailAddressBin || |
|
1052 ( iFindItemVoIPExtension->IsVoIPSupported() && |
|
1053 founditem && item.iItemType == CFindItemEngine::EFindItemSearchMailAddressBin && |
|
1054 iSearchCase == KSearchTelInternetNumber ) ) |
|
1055 { |
|
1056 #ifndef RD_UNIFIED_EDITOR |
|
1057 if ( !iEmailOverSmsFeatureSupported ) |
|
1058 { |
|
1059 mtmFilter->AppendL(KSenduiMtmSmsUid); |
|
1060 } |
|
1061 #endif |
|
1062 } |
|
1063 |
|
1064 // Hide Mail |
|
1065 else if ( !iEmailUiFeatureSupported || |
|
1066 ( iSearchCase == CFindItemEngine::EFindItemSearchPhoneNumberBin || |
|
1067 ( iFindItemVoIPExtension->IsVoIPSupported() && founditem && |
|
1068 item.iItemType == CFindItemEngine::EFindItemSearchPhoneNumberBin && |
|
1069 iSearchCase == KSearchTelInternetNumber ) ) ) |
|
1070 { |
|
1071 mtmFilter->AppendL(KSenduiMtmSmtpUid); |
|
1072 mtmFilter->AppendL(KSenduiMtmImap4Uid); |
|
1073 mtmFilter->AppendL(KSenduiMtmPop3Uid); |
|
1074 mtmFilter->AppendL(KSenduiMtmSyncMLEmailUid); |
|
1075 } |
|
1076 // Hide Audio |
|
1077 if ( iSearchCase != CFindItemEngine::EFindItemSearchPhoneNumberBin || |
|
1078 !iAudioMessagingFeatureSupported ) |
|
1079 { |
|
1080 mtmFilter->AppendL(KSenduiMtmAudioMessageUid); |
|
1081 } |
|
1082 |
|
1083 TUid uid = iSendUi->ShowTypedQueryL( CSendUi::EWriteMenu, NULL, sendingCapabilities, mtmFilter ); |
|
1084 |
|
1085 CleanupStack::PopAndDestroy(); |
|
1086 |
|
1087 if ( uid == KNullUid ) |
|
1088 { |
|
1089 break; |
|
1090 } |
|
1091 SendMessageL(uid); |
|
1092 |
797 break; |
1093 break; |
798 } |
1094 } |
799 case EFindItemCmdGoToUrl: |
1095 case EFindItemCmdGoToUrl: |
800 { |
1096 { |
801 if ( LaunchGenericUriL() ) |
1097 if ( LaunchGenericUriL() ) |
886 { |
1182 { |
887 return; |
1183 return; |
888 } |
1184 } |
889 |
1185 |
890 CFindItemEngine::SFoundItem item; |
1186 CFindItemEngine::SFoundItem item; |
891 TBool founditem = iController->Item( item ); |
1187 TBool foundItem = iController->Item( item ); |
892 |
1188 if ( iSingleClick ) |
|
1189 { |
|
1190 // foundItem remains as ETrue, if item found by controller is exactly |
|
1191 // same as highlighted selection |
|
1192 foundItem = foundItem && ( item.iLength == iEdwin->SelectionLength() |
|
1193 && item.iStartPos == Min( iEdwin->Selection().iCursorPos, |
|
1194 iEdwin->Selection().iAnchorPos ) ); |
|
1195 } |
|
1196 |
893 if ( aMenuId == R_FINDITEM_CALLUI_AIW_SUBMENU ) |
1197 if ( aMenuId == R_FINDITEM_CALLUI_AIW_SUBMENU ) |
894 { |
1198 { |
895 if ( iFindItemVoIPExtension->IsVoIPSupported() && |
1199 if ( iFindItemVoIPExtension->IsVoIPSupported() && |
896 ( iSearchCase == |
1200 ( iSearchCase == |
897 CFindItemEngine::EFindItemSearchMailAddressBin || |
1201 CFindItemEngine::EFindItemSearchMailAddressBin || |
898 ( iSearchCase == KSearchTelInternetNumber && |
1202 ( iSearchCase == KSearchTelInternetNumber && |
899 founditem && item.iItemType == |
1203 foundItem && item.iItemType == |
900 CFindItemEngine::EFindItemSearchMailAddressBin ) ) ) |
1204 CFindItemEngine::EFindItemSearchMailAddressBin ) ) ) |
901 { |
1205 { |
902 CAiwGenericParamList* inList = CAiwGenericParamList::NewLC(); |
1206 CAiwGenericParamList* inList = CAiwGenericParamList::NewLC(); |
903 |
1207 |
904 // SIP Address |
1208 // SIP Address |
978 ; |
1282 ; |
979 } |
1283 } |
980 |
1284 |
981 aMenuPane->AddMenuItemsL( resource, EAknFormMaxDefault - 1, ETrue ); |
1285 aMenuPane->AddMenuItemsL( resource, EAknFormMaxDefault - 1, ETrue ); |
982 |
1286 |
|
1287 |
983 if ( iSearchCase == KSearchTelInternetNumber && |
1288 if ( iSearchCase == KSearchTelInternetNumber && |
984 iFindItemVoIPExtension->VoIPProfilesExistL() || |
1289 iFindItemVoIPExtension->VoIPProfilesExistL() || |
985 iSearchCase == KSearchTelInternetNumber && |
1290 iSearchCase == KSearchTelInternetNumber && |
986 !iFindItemVoIPExtension->VoIPProfilesExistL() && |
1291 !iFindItemVoIPExtension->VoIPProfilesExistL() && |
987 founditem && |
1292 foundItem && |
988 item.iItemType == |
1293 item.iItemType == |
989 CFindItemEngine::EFindItemSearchPhoneNumberBin || |
1294 CFindItemEngine::EFindItemSearchPhoneNumberBin || |
990 iSearchCase & CFindItemEngine::EFindItemSearchMailAddressBin && |
1295 iSearchCase & CFindItemEngine::EFindItemSearchMailAddressBin && |
991 iFindItemVoIPExtension->VoIPProfilesExistL() ) |
1296 iFindItemVoIPExtension->VoIPProfilesExistL() ) |
992 { |
1297 { |
1066 iPbkDataSave->DynInitMenuPaneL( aMenuId, aMenuPane ); |
1371 iPbkDataSave->DynInitMenuPaneL( aMenuId, aMenuPane ); |
1067 #endif // !RD_VIRTUAL_PHONEBOOK |
1372 #endif // !RD_VIRTUAL_PHONEBOOK |
1068 } |
1373 } |
1069 } |
1374 } |
1070 |
1375 |
|
1376 |
|
1377 // ----------------------------------------------------------------------------- |
|
1378 // CFindItemDialog::SetCallSubMenuVisibility |
|
1379 // Sets AIW submenu visibility |
|
1380 // ----------------------------------------------------------------------------- |
|
1381 // |
|
1382 EXPORT_C void CFindItemDialog::SetCallSubMenuVisibility( TBool aVisible ) |
|
1383 { |
|
1384 iHideCallSubMenu = !aVisible; |
|
1385 } |
|
1386 |
|
1387 |
1071 // ----------------------------------------------------------------------------- |
1388 // ----------------------------------------------------------------------------- |
1072 // CFindItemDialog::OfferKeyEventL |
1389 // CFindItemDialog::OfferKeyEventL |
1073 // Handles key events |
1390 // Handles key events |
1074 // ----------------------------------------------------------------------------- |
1391 // ----------------------------------------------------------------------------- |
1075 // |
1392 // |
1243 |
1560 |
1244 // change the color of the text according to the skin color |
1561 // change the color of the text according to the skin color |
1245 TRgb color; |
1562 TRgb color; |
1246 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
1563 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
1247 TInt error = AknsUtils::GetCachedColor(skin, color, KAknsIIDQsnTextColors, |
1564 TInt error = AknsUtils::GetCachedColor(skin, color, KAknsIIDQsnTextColors, |
1248 EAknsCIQsnTextColorsCG6 ); |
1565 EAknsCIQsnTextColorsCG6 ); |
1249 if(error==KErrNone) |
1566 if(error==KErrNone) |
1250 { |
1567 { |
1251 TCharFormat charFormat; |
1568 TCharFormat charFormat; |
1252 TCharFormatMask charFormatMask; |
1569 TCharFormatMask charFormatMask; |
1253 charFormatMask.SetAttrib(EAttColor); |
1570 charFormatMask.SetAttrib(EAttColor); |
1254 charFormat.iFontPresentation.iTextColor = color; |
1571 charFormat.iFontPresentation.iTextColor = color; |
1255 |
1572 |
1256 CRichText * richText = NULL; |
1573 CRichText * richText = NULL; |
1257 richText = iEdwin->RichText(); |
1574 richText = iEdwin->RichText(); |
1258 if( NULL!=richText ) |
1575 if( NULL!=richText ) |
1259 { |
1576 { |
1260 TInt length = richText->DocumentLength(); |
1577 TInt length = richText->DocumentLength(); |
1261 length++; |
1578 length++; |
1262 // apply the color to text |
1579 // apply the color to text |
1263 TRAP_IGNORE(richText->ApplyCharFormatL( charFormat, charFormatMask, 0, length )); |
1580 TRAP_IGNORE(richText->ApplyCharFormatL( charFormat, |
1264 } |
1581 charFormatMask, 0, length )); |
|
1582 } |
1265 } |
1583 } |
1266 if ( anyFound ) |
1584 if ( anyFound ) |
1267 { |
1585 { |
1268 // Insert paragraphs inside the text if needed, i.e. if text is |
1586 // Insert paragraphs inside the text if needed, i.e. if text is |
1269 // bandformatted and there's not enough paragraphs already. The |
1587 // bandformatted and there's not enough paragraphs already. The |
1410 aItem1, point1, CLayoutData::EFWholeTBoxesOnly ) ); |
1728 aItem1, point1, CLayoutData::EFWholeTBoxesOnly ) ); |
1411 if ( error != KErrNone ) |
1729 if ( error != KErrNone ) |
1412 { |
1730 { |
1413 return EFalse; |
1731 return EFalse; |
1414 } |
1732 } |
1415 TBool pos2 = EFalse; |
1733 TBool pos2 = EFalse; |
1416 TPoint point2; |
1734 TPoint point2; |
1417 TRAP( error, pos2 = iEdwin->TextLayout()->DocPosToXyPosL( |
1735 TRAP( error, pos2 = iEdwin->TextLayout()->DocPosToXyPosL( |
1418 aItem2, point2, CLayoutData::EFWholeTBoxesOnly ) ); |
1736 aItem2, point2, CLayoutData::EFWholeTBoxesOnly ) ); |
1419 if ( error != KErrNone ) |
1737 if ( error != KErrNone ) |
1420 { |
1738 { |
1492 TInt resource = 0; |
1810 TInt resource = 0; |
1493 |
1811 |
1494 if ( iSearchCase == KSearchTelInternetNumber ) |
1812 if ( iSearchCase == KSearchTelInternetNumber ) |
1495 { |
1813 { |
1496 resource = R_FINDITEM_TITLE_TELINTERNET; |
1814 resource = R_FINDITEM_TITLE_TELINTERNET; |
|
1815 iSendUi = CSendUi::NewL(); |
1497 } |
1816 } |
1498 else if ( iSearchCase & CFindItemEngine::EFindItemSearchURLBin ) |
1817 else if ( iSearchCase & CFindItemEngine::EFindItemSearchURLBin ) |
1499 { |
1818 { |
1500 resource = R_FINDITEM_TITLE_URL; |
1819 resource = R_FINDITEM_TITLE_URL; |
1501 } |
1820 } |
1502 else if ( iSearchCase & CFindItemEngine::EFindItemSearchMailAddressBin ) |
1821 else if ( iSearchCase & CFindItemEngine::EFindItemSearchMailAddressBin ) |
1503 { |
1822 { |
1504 resource = R_FINDITEM_TITLE_MAIL; |
1823 resource = R_FINDITEM_TITLE_MAIL; |
|
1824 iSendUi = CSendUi::NewL(); |
1505 } |
1825 } |
1506 else if ( iSearchCase & CFindItemEngine::EFindItemSearchPhoneNumberBin ) |
1826 else if ( iSearchCase & CFindItemEngine::EFindItemSearchPhoneNumberBin ) |
1507 { |
1827 { |
1508 resource = R_FINDITEM_TITLE_PHONE; |
1828 resource = R_FINDITEM_TITLE_PHONE; |
|
1829 iSendUi = CSendUi::NewL(); |
1509 } |
1830 } |
1510 else |
1831 else |
1511 { |
1832 { |
1512 __ASSERT_ALWAYS( 0, Panic( ENoSearchCase ) ); |
1833 __ASSERT_ALWAYS( 0, Panic( ENoSearchCase ) ); |
1513 return; |
1834 return; |
1659 TBuf<16> naviText; |
1980 TBuf<16> naviText; |
1660 naviText.Format( |
1981 naviText.Format( |
1661 KPosIndicator, iController->Position() + 1, iController->ItemCount() ); |
1982 KPosIndicator, iController->Position() + 1, iController->ItemCount() ); |
1662 |
1983 |
1663 if(NULL == iNaviDecorator) |
1984 if(NULL == iNaviDecorator) |
1664 { |
1985 { |
1665 iNaviDecorator = iNaviPane->CreateNavigationLabelL( naviText ); |
1986 iNaviDecorator = iNaviPane->CreateNavigationLabelL( naviText ); |
1666 iNaviDecorator->SetNaviDecoratorObserver( this ); |
1987 iNaviDecorator->SetNaviDecoratorObserver( this ); |
1667 iNaviDecorator->MakeScrollButtonVisible( ETrue ); |
1988 iNaviDecorator->MakeScrollButtonVisible( ETrue ); |
1668 } |
1989 } |
1669 else |
1990 else |
1670 { |
1991 { |
1671 // Change the label on Nave pane control... |
1992 // Change the label on Nave pane control... |
1672 CAknNaviLabel * label =( CAknNaviLabel* )iNaviDecorator->DecoratedControl(); |
1993 CAknNaviLabel * label =( CAknNaviLabel* )iNaviDecorator->DecoratedControl(); |
1673 label->SetTextL(naviText); |
1994 label->SetTextL(naviText); |
1674 } |
1995 } |
1675 |
1996 |
1676 // Dimm arrows if needed |
1997 // Dimm arrows if needed |
1677 if ( iController->LastItem() ) |
1998 if ( iController->LastItem() ) |
1678 { |
1999 { |
1679 iNaviDecorator->SetScrollButtonDimmed( |
2000 iNaviDecorator->SetScrollButtonDimmed( |
1788 // ----------------------------------------------------------------------------- |
2109 // ----------------------------------------------------------------------------- |
1789 void CFindItemDialog::HandleResourceChange( TInt aType ) |
2110 void CFindItemDialog::HandleResourceChange( TInt aType ) |
1790 { |
2111 { |
1791 //Update Horizantal Scroll bar color if skin changes |
2112 //Update Horizantal Scroll bar color if skin changes |
1792 if( aType == KAknsMessageSkinChange) |
2113 if( aType == KAknsMessageSkinChange) |
1793 { |
2114 { |
1794 CAknScrollBar *scrollBar = iSBFrame->VerticalScrollBar(); |
2115 CAknScrollBar *scrollBar = iSBFrame->VerticalScrollBar(); |
1795 scrollBar->HandleResourceChange(aType); |
2116 scrollBar->HandleResourceChange(aType); |
1796 } |
2117 } |
1797 CAknDialog::HandleResourceChange( aType ); |
2118 CAknDialog::HandleResourceChange( aType ); |
1798 } |
2119 } |
1799 |
2120 |
1800 // ----------------------------------------------------------------------------- |
2121 // ----------------------------------------------------------------------------- |
1801 // CFindItemDialog::SizeChanged |
2122 // CFindItemDialog::SizeChanged |
1887 { |
2220 { |
1888 if ( !iController->Item( i, item ) ) // Get item. |
2221 if ( !iController->Item( i, item ) ) // Get item. |
1889 { |
2222 { |
1890 break; // Error: invalid item. |
2223 break; // Error: invalid item. |
1891 }; |
2224 }; |
1892 TInt end = item.iStartPos + item.iLength - 1; |
2225 TInt end = item.iStartPos + item.iLength - 1; |
1893 if ( end < pos ) |
2226 if ( end < pos ) |
1894 { |
2227 { |
1895 i++; |
2228 i++; |
1896 continue; // item not visible. |
2229 continue; // item not visible. |
1897 }; |
2230 }; |
1898 TInt start = item.iStartPos; |
2231 TInt start = item.iStartPos; |
1899 if ( start >= ( pos + len ) ) |
2232 if ( start >= ( pos + len ) ) |
1900 { |
2233 { |
1901 break; // item not visible. |
2234 break; // item not visible. |
1902 } |
2235 } |
1903 TInt lastLine = iEdwin->TextLayout()->GetLineNumber( end ); |
2236 TInt lastLine = iEdwin->TextLayout()->GetLineNumber( end ); |
1904 TInt nextLine = 0; |
2237 TInt nextLine = 0; |
1905 TInt lastPos = start; |
2238 TInt lastPos = start; |
1906 do // Check all rects of one item. |
2239 do // Check all rects of one item. |
1907 { |
2240 { |
1908 TInt error = KErrNone; |
2241 TInt error = KErrNone; |
1909 TRAP( error, rect = iEdwin->TextLayout()->GetLineRectL( start, end ) ); |
2242 TRAP( error, rect = iEdwin->TextLayout()->GetLineRectL( start, end ) ); |
1910 if ( error == KErrNone ) |
2243 if ( error == KErrNone ) |
1911 { |
2244 { |
1912 if ( rect.Contains( tapPoint ) ) // Item rect tapped. |
2245 if ( rect.Contains( tapPoint ) ) // Item rect tapped. |
1913 { |
2246 { |
1914 TRAP( error, iController->TappedItemL( i ) ); // Change selection |
2247 TRAP( error, iController->TappedItemL( i ) ); // Change selection |
1915 if ( error != KErrNone ) |
2248 if ( error != KErrNone ) |
1916 { |
2249 { |
1917 return false; // Error: no selection made. |
2250 return false; // Error: no selection made. |
1918 } |
2251 } |
1923 } |
2256 } |
1924 } |
2257 } |
1925 else |
2258 else |
1926 { |
2259 { |
1927 return false; // Error: no rect. |
2260 return false; // Error: no rect. |
1928 } |
2261 } |
1929 TPoint midPoint( rect.iBr.iX, ( rect.iBr.iY + rect.iTl.iY) / 2 ); |
2262 TPoint midPoint( rect.iBr.iX, ( rect.iBr.iY + rect.iTl.iY) / 2 ); |
1930 TRAP( error, lastPos = iEdwin->TextLayout()->XyPosToDocPosL( midPoint ) ); |
2263 TRAP( error, lastPos = iEdwin->TextLayout()->XyPosToDocPosL( midPoint ) ); |
1931 if ( error != KErrNone ) |
2264 if ( error != KErrNone ) |
1932 { |
2265 { |
1933 return false; // Error: no last pos. |
2266 return false; // Error: no last pos. |
1934 } |
2267 } |
1935 start = lastPos + 1; |
2268 start = lastPos + 1; |
1936 nextLine = iEdwin->TextLayout()->GetLineNumber( lastPos ); |
2269 nextLine = iEdwin->TextLayout()->GetLineNumber( lastPos ); |
1937 } while ( nextLine != lastLine ); |
2270 } while ( nextLine != lastLine ); |
1938 i++; |
2271 i++; |
1939 } |
2272 } |
1940 } |
2273 } |
1941 return false; // No hit, no further handling. |
2274 return false; // No hit, no further handling. |
2082 // change the color of the text according to the skin color |
2416 // change the color of the text according to the skin color |
2083 // this is needed if finditemdialog is active and theme is changed. |
2417 // this is needed if finditemdialog is active and theme is changed. |
2084 TRgb color; |
2418 TRgb color; |
2085 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
2419 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
2086 TInt error = AknsUtils::GetCachedColor(skin, color, KAknsIIDQsnTextColors, |
2420 TInt error = AknsUtils::GetCachedColor(skin, color, KAknsIIDQsnTextColors, |
2087 EAknsCIQsnTextColorsCG6 ); |
2421 EAknsCIQsnTextColorsCG6 ); |
2088 if(error==KErrNone) |
2422 if(error==KErrNone) |
2089 { |
2423 { |
2090 TCharFormat charFormat; |
2424 TCharFormat charFormat; |
2091 TCharFormatMask charFormatMask; |
2425 TCharFormatMask charFormatMask; |
2092 charFormatMask.SetAttrib(EAttColor); |
2426 charFormatMask.SetAttrib(EAttColor); |
2093 charFormat.iFontPresentation.iTextColor = color; |
2427 charFormat.iFontPresentation.iTextColor = color; |
2094 |
2428 |
2095 CRichText * richText = NULL; |
2429 CRichText * richText = NULL; |
2096 richText = iEditor->RichText(); |
2430 richText = iEditor->RichText(); |
2097 if( NULL!=richText ) |
2431 if( NULL!=richText ) |
2098 { |
2432 { |
2099 TInt length = richText->DocumentLength(); |
2433 TInt length = richText->DocumentLength(); |
2100 length++; |
2434 length++; |
2101 // apply the color to the text |
2435 // apply the color to the text |
2102 TRAP_IGNORE(richText->ApplyCharFormatL( charFormat, charFormatMask, 0, length )); |
2436 TRAP_IGNORE(richText->ApplyCharFormatL( charFormat, charFormatMask, 0, length )); |
2103 } |
2437 } |
2104 } |
2438 } |
2105 } |
2439 } |
2106 } |
2440 } |
2107 |
2441 |
2108 // ----------------------------------------------------------------------------- |
2442 // ----------------------------------------------------------------------------- |
2109 // CRichTextEditorContainer::HandleResourceChange |
2443 // CRichTextEditorContainer::HandleResourceChange |