commonuis/CommonUi/src/FindItemDialog.cpp
branchRCL_3
changeset 55 aecbbf00d063
parent 51 fcdfafb36fe7
child 56 d48ab3b357f1
equal deleted inserted replaced
51:fcdfafb36fe7 55:aecbbf00d063
    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 
       
    43 #include <apgcli.h> // RApaLsSession for WMLBrowser launch
    38 #include <apgcli.h> // RApaLsSession for WMLBrowser launch
    44 
    39 
    45 #ifndef RD_VIRTUAL_PHONEBOOK
    40 #ifndef RD_VIRTUAL_PHONEBOOK
    46 #include <CPbkContactEngine.h> // Phonebook Engine
    41 #include <CPbkContactEngine.h> // Phonebook Engine
    47 #include <RPbkViewResourceFile.h> // Phonebook view dll resource loader
    42 #include <RPbkViewResourceFile.h> // Phonebook view dll resource loader
    50 #else // RD_VIRTUAL_PHONEBOOK
    45 #else // RD_VIRTUAL_PHONEBOOK
    51 #include <AiwServiceHandler.h> // CAiwServiceHandler
    46 #include <AiwServiceHandler.h> // CAiwServiceHandler
    52 #include <AiwContactAssignDataTypes.h> // AiwContactAssign
    47 #include <AiwContactAssignDataTypes.h> // AiwContactAssign
    53 #endif // !RD_VIRTUAL_PHONEBOOK
    48 #endif // !RD_VIRTUAL_PHONEBOOK
    54 
    49 
    55 #include <sendui.h> // for CSendAppUi
       
    56 #include <CMessageData.h> // for CMessageData
       
    57 #include <SendUiConsts.h> // Mtm uids
       
    58 
       
    59 #include <commonphoneparser.h> // Phonenumber parser
    50 #include <commonphoneparser.h> // Phonenumber parser
    60 
    51 
    61 #include <baclipb.h> // For CClipboard
    52 #include <baclipb.h> // For CClipboard
    62 
       
    63 #include <schemehandler.h> // For CSchemeHandler
       
    64 
    53 
    65 #include <aknnotewrappers.h>
    54 #include <aknnotewrappers.h>
    66 
    55 
    67 #include <finditemui.rsg>
    56 #include <finditemui.rsg>
    68 
    57 
    93 #include <txtfrmat.h>  // for TCharFormat
    82 #include <txtfrmat.h>  // for TCharFormat
    94 
    83 
    95 #include <aknnavilabel.h> // for changing the lable of navipane
    84 #include <aknnavilabel.h> // for changing the lable of navipane
    96 
    85 
    97 #include <AknTasHook.h> // for testability hooks
    86 #include <AknTasHook.h> // for testability hooks
    98 #include <touchfeedback.h>
       
    99 _LIT( KResFileName, "z:\\resource\\finditemui.rsc" );
    87 _LIT( KResFileName, "z:\\resource\\finditemui.rsc" );
   100 
    88 
   101 // Panic
    89 // Panic
   102 _LIT( KFindItemPanic, "FindItemDialog" );
    90 _LIT( KFindItemPanic, "FindItemDialog" );
   103 // Space for WML Browser's parameter
    91 // Space for WML Browser's parameter
   235     // phonebook to know it can exit    
   223     // phonebook to know it can exit    
   236     return ETrue;
   224     return ETrue;
   237     }    
   225     }    
   238 
   226 
   239 NONSHARABLE_CLASS(CItemFinderExtension) : public CBase
   227 NONSHARABLE_CLASS(CItemFinderExtension) : public CBase
   240     {
   228 	{
   241 public: 
   229 public: 
   242     ~CItemFinderExtension(); 
   230 	~CItemFinderExtension(); 
   243     static CItemFinderExtension* NewL(); 
   231 	static CItemFinderExtension* NewL(); 
   244 
   232 	
   245     //new function
   233 	//new function
   246 public:
   234 public:
   247     PBAiwNotify* CallBack();
   235 	PBAiwNotify* CallBack();
   248 
   236 	
   249 private: 
   237 private: 
   250     CItemFinderExtension(); 
   238 	CItemFinderExtension(); 
   251     void ConstructL();	
   239 	void ConstructL();	
   252 
   240 	
   253 public:
   241 public:
   254     PBAiwNotify iCallBack;
   242 	PBAiwNotify iCallBack;
   255     };
   243 	};
   256 
   244 
   257 CItemFinderExtension::~CItemFinderExtension()
   245 CItemFinderExtension::~CItemFinderExtension()
   258     {
   246 	{
   259     }
   247 	
       
   248 	}
   260 
   249 
   261 CItemFinderExtension* CItemFinderExtension::NewL()
   250 CItemFinderExtension* CItemFinderExtension::NewL()
   262     {
   251 	{
   263     CItemFinderExtension* self = new ( ELeave )CItemFinderExtension;
   252 	CItemFinderExtension* self = new ( ELeave )CItemFinderExtension;
   264     CleanupStack::PushL(self);
   253 	CleanupStack::PushL(self);
   265     self->ConstructL();
   254 	self->ConstructL();
   266     CleanupStack::Pop();
   255 	CleanupStack::Pop();
   267     return self;
   256 	return self;
   268     }
   257 	}
   269 
   258 
   270 PBAiwNotify* CItemFinderExtension::CallBack()
   259 PBAiwNotify* CItemFinderExtension::CallBack()
   271     {
   260 	{
   272     return &iCallBack;
   261 	return &iCallBack;
   273     }
   262 	}
   274 
   263 
   275 CItemFinderExtension::CItemFinderExtension()
   264 CItemFinderExtension::CItemFinderExtension()
   276     {
   265 	{
   277 
   266 	
   278     }
   267 	}
   279 
   268 
   280 void CItemFinderExtension::ConstructL()
   269 void CItemFinderExtension::ConstructL()
   281     {
   270 	{
   282 
   271 	
   283     }
   272 	}
   284 
   273 
   285 
   274 
   286 
   275 
   287 // ================= MEMBER FUNCTIONS =======================
   276 // ================= MEMBER FUNCTIONS =======================
   288 
   277 
   306         }
   295         }
   307     delete iNaviDecorator;
   296     delete iNaviDecorator;
   308     delete iSBFrame;
   297     delete iSBFrame;
   309     delete iItemArrayForScrollBar;
   298     delete iItemArrayForScrollBar;
   310 
   299 
   311     delete iSendUi;
       
   312 #ifndef RD_VIRTUAL_PHONEBOOK
   300 #ifndef RD_VIRTUAL_PHONEBOOK
   313     delete iPbkDataSave;
   301     delete iPbkDataSave;
   314     delete iPbkEngine;
   302     delete iPbkEngine;
   315     iPbkResourceFile.Close();
   303     iPbkResourceFile.Close();
   316 #endif //RD_VIRTUAL_PHONEBOOK
   304 #endif //RD_VIRTUAL_PHONEBOOK
   317     delete iIdle;
   305     delete iIdle;
   318 
   306 
   319     delete iServiceHandler;
   307     delete iServiceHandler;
   320     delete iFindItemVoIPExtension;
   308     delete iFindItemVoIPExtension;
   321 
       
   322     delete iSchemeHandler;
       
   323 
   309 
   324     delete iBgContext;
   310     delete iBgContext;
   325 
   311 
   326     delete iTitleText;
   312     delete iTitleText;
   327 
   313 
   455         FeatureManager::FeatureSupported( KFeatureIdEmailUi );
   441         FeatureManager::FeatureSupported( KFeatureIdEmailUi );
   456 
   442 
   457     iFindItemVoIPExtension = CFindItemVoIPExtension::NewL();
   443     iFindItemVoIPExtension = CFindItemVoIPExtension::NewL();
   458     
   444     
   459     iExtension = CItemFinderExtension::NewL();
   445     iExtension = CItemFinderExtension::NewL();
   460     iFeedback = MTouchFeedback::Instance();
   446     }
   461     }
   447 
   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     }
       
   575 
   448 
   576 // -----------------------------------------------------------------------------
   449 // -----------------------------------------------------------------------------
   577 // CFindItemDialog::DoCopyToClipboardL
   450 // CFindItemDialog::DoCopyToClipboardL
   578 //  Copies the selected item to EPOC clipboard
   451 //  Copies the selected item to EPOC clipboard
   579 // -----------------------------------------------------------------------------
   452 // -----------------------------------------------------------------------------
   732 //  Sends message (SMS, MMS or E-mail) to selected item
   605 //  Sends message (SMS, MMS or E-mail) to selected item
   733 // -----------------------------------------------------------------------------
   606 // -----------------------------------------------------------------------------
   734 //
   607 //
   735 void CFindItemDialog::SendMessageL( const TUid aMtmUid )
   608 void CFindItemDialog::SendMessageL( const TUid aMtmUid )
   736     {
   609     {
   737     __ASSERT_DEBUG( iEdwin->SelectionLength() > 0, Panic( ENoItemSelected ) );
   610 	
   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 
       
   770     }
   611     }
   771 
   612 
   772 // -----------------------------------------------------------------------------
   613 // -----------------------------------------------------------------------------
   773 // CFindItemDialog::LaunchGenericUriL
   614 // CFindItemDialog::LaunchGenericUriL
   774 //  Handles URIs launching. If parent application is Browser,
   615 //  Handles URIs launching. If parent application is Browser,
   818         CleanupStack::PopAndDestroy(); // itemtext
   659         CleanupStack::PopAndDestroy(); // itemtext
   819         return ETrue;
   660         return ETrue;
   820         }
   661         }
   821     // If current app is other than Browser, use schemehandler for launching
   662     // If current app is other than Browser, use schemehandler for launching
   822     // file
   663     // file
   823     else
       
   824         {
       
   825         if ( iSchemeHandler )
       
   826             {
       
   827             delete iSchemeHandler;
       
   828             iSchemeHandler = 0;
       
   829             }
       
   830         iSchemeHandler = CSchemeHandler::NewL( itemtextPtr );
       
   831         if ( itemtext->FindF( KRtspUrlAddress ) != KErrNotFound )
       
   832             {
       
   833             iSchemeHandler->HandleUrlEmbeddedL();
       
   834             }
       
   835         else
       
   836             {
       
   837             iSchemeHandler->HandleUrlStandaloneL();
       
   838             }
       
   839         }
       
   840 
   664 
   841     CleanupStack::PopAndDestroy(); // itemtext
   665     CleanupStack::PopAndDestroy(); // itemtext
   842     return EFalse;
   666     return EFalse;
   843     }
   667     }
   844 
   668 
   855 
   679 
   856     HBufC *parameters = HBufC::NewLC( paramLength );
   680     HBufC *parameters = HBufC::NewLC( paramLength );
   857     TPtr paramPtr = parameters->Des();
   681     TPtr paramPtr = parameters->Des();
   858     paramPtr.Copy( KWmlBrowserParameter );
   682     paramPtr.Copy( KWmlBrowserParameter );
   859     paramPtr.Append( KSpace );
   683     paramPtr.Append( KSpace );
   860     paramPtr.Append(
   684     paramPtr.Append( aItemtextPtr.Mid( 0, aItemtextPtr.Length() ) );
   861         aItemtextPtr.Mid(
       
   862             0, Min( aItemtextPtr.Length(), KFavouritesMaxUrl ) ) );
       
   863 
   685 
   864     TApaTaskList taskList( iEikonEnv->WsSession() );
   686     TApaTaskList taskList( iEikonEnv->WsSession() );
   865     TApaTask task = taskList.FindApp( KWapUid );
   687     TApaTask task = taskList.FindApp( KWapUid );
   866     if ( task.Exists() )
   688     if ( task.Exists() )
   867         {
   689         {
   889 //
   711 //
   890 void CFindItemDialog::AddToBookmarkL()
   712 void CFindItemDialog::AddToBookmarkL()
   891     {
   713     {
   892     __ASSERT_DEBUG( iEdwin->SelectionLength() > 0, Panic( ENoItemSelected ) );
   714     __ASSERT_DEBUG( iEdwin->SelectionLength() > 0, Panic( ENoItemSelected ) );
   893 
   715 
   894     // Create an item and fill with meaningful data.
       
   895     CFavouritesItem* item = CFavouritesItem::NewLC();
       
   896     item->SetParentFolder( KFavouritesRootUid );
       
   897     item->SetType( CFavouritesItem::EItem );
       
   898     // Read default name from resources
   716     // Read default name from resources
   899     HBufC* defaultName =
   717     HBufC* defaultName =
   900         iEikonEnv->AllocReadResourceLC( R_FINDITEM_DEFAULT_BOOKMARK_NAME );
   718         iEikonEnv->AllocReadResourceLC( R_FINDITEM_DEFAULT_BOOKMARK_NAME );
   901 
   719 
   902     TBuf<KMaxBookmarkNameLength> retName;
   720     TBuf<KMaxBookmarkNameLength> retName;
   907     CAknTextQueryDialog* dlg = CAknTextQueryDialog::NewL( retName );
   725     CAknTextQueryDialog* dlg = CAknTextQueryDialog::NewL( retName );
   908     dlg->SetMaxLength( KMaxBookmarkNameLength );
   726     dlg->SetMaxLength( KMaxBookmarkNameLength );
   909     if ( !dlg->ExecuteLD( R_FINDITEM_BOOKMARK_QUERY_DIALOG ) )
   727     if ( !dlg->ExecuteLD( R_FINDITEM_BOOKMARK_QUERY_DIALOG ) )
   910         {
   728         {
   911         // User press cancel - do not add bookmark
   729         // User press cancel - do not add bookmark
   912         CleanupStack::PopAndDestroy( ); // item
       
   913         return;
   730         return;
   914         }
   731         }
   915 
   732     
   916     item->SetNameL( retName );
       
   917     TCursorSelection selection = iEdwin->Selection();
   733     TCursorSelection selection = iEdwin->Selection();
   918     item->SetUrlL( iPlainText.Mid( selection.LowerPos(), selection.Length() ) );
   734     
   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 
       
   933     HBufC* msgBuffer =
   735     HBufC* msgBuffer =
   934         iCoeEnv->AllocReadResourceLC( R_FINDITEM_BOOKMARK_SAVED );
   736         iCoeEnv->AllocReadResourceLC( R_FINDITEM_BOOKMARK_SAVED );
   935     CAknConfirmationNote* note = new (ELeave)CAknConfirmationNote( ETrue );
   737     CAknConfirmationNote* note = new (ELeave)CAknConfirmationNote( ETrue );
   936     note->ExecuteLD( *msgBuffer );
   738     note->ExecuteLD( *msgBuffer );
   937 
   739 
   938     CleanupStack::PopAndDestroy( 4 );   // magBuffer, db, sess, item
   740     CleanupStack::PopAndDestroy();   // magBuffer
   939     }
   741     }
   940 
   742 
   941 // -----------------------------------------------------------------------------
   743 // -----------------------------------------------------------------------------
   942 // CFindItemDialog::EnableSingleClick
       
   943 // -----------------------------------------------------------------------------
       
   944 //
       
   945 EXPORT_C void CFindItemDialog::EnableSingleClick ( TBool aEnable )
       
   946     {
       
   947     iSingleClick = aEnable;
       
   948     }
       
   949 
       
   950 // CFindItemDialog::ProcessCommandL
   744 // CFindItemDialog::ProcessCommandL
   951 //  Prosesses menu commands
   745 //  Prosesses menu commands
   952 // -----------------------------------------------------------------------------
   746 // -----------------------------------------------------------------------------
   953 //
   747 //
   954 EXPORT_C void CFindItemDialog::ProcessCommandL( TInt aCommandId )
   748 EXPORT_C void CFindItemDialog::ProcessCommandL( TInt aCommandId )
   989             contextPane->SetPictureToDefaultL();
   783             contextPane->SetPictureToDefaultL();
   990             break;
   784             break;
   991             }
   785             }
   992         // Phone number cmds
   786         // Phone number cmds
   993         case EFindItemCmdCall:
   787         case EFindItemCmdCall:
   994             {
   788             { // bit awkward but correct functionality provided.
   995             if ( !iHideCallSubMenu )
   789             TKeyEvent keyEvent;
   996                 { // bit awkward but correct functionality provided.
   790             keyEvent.iCode = EKeyPhoneSend;
   997                 TKeyEvent keyEvent;
   791             OfferKeyEventL( keyEvent, EEventKey );
   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                 }
       
  1030             break;
   792             break;
  1031             }
   793             }
  1032         // fix for FAMZ-7JVQ4Y
   794         // fix for FAMZ-7JVQ4Y
  1033         case EFindItemSubMenuSend:
   795         case EFindItemSubMenuSend:
  1034            {
   796            {
  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            
       
  1093            break;
   797            break;
  1094            }
   798            }
  1095         case EFindItemCmdGoToUrl:
   799         case EFindItemCmdGoToUrl:
  1096             {
   800             {
  1097             if ( LaunchGenericUriL() )
   801             if ( LaunchGenericUriL() )
  1182         {
   886         {
  1183         return;
   887         return;
  1184         }
   888         }
  1185 
   889 
  1186     CFindItemEngine::SFoundItem item;
   890     CFindItemEngine::SFoundItem item;
  1187     TBool foundItem = iController->Item( item );
   891     TBool founditem = iController->Item( item );
  1188     if ( iSingleClick )
   892 
  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         
       
  1197     if ( aMenuId == R_FINDITEM_CALLUI_AIW_SUBMENU )
   893     if ( aMenuId == R_FINDITEM_CALLUI_AIW_SUBMENU )
  1198         {
   894         {
  1199         if ( iFindItemVoIPExtension->IsVoIPSupported() &&
   895         if ( iFindItemVoIPExtension->IsVoIPSupported() &&
  1200             ( iSearchCase ==
   896             ( iSearchCase ==
  1201                 CFindItemEngine::EFindItemSearchMailAddressBin ||
   897                 CFindItemEngine::EFindItemSearchMailAddressBin ||
  1202             ( iSearchCase == KSearchTelInternetNumber &&
   898             ( iSearchCase == KSearchTelInternetNumber &&
  1203             foundItem && item.iItemType ==
   899             founditem && item.iItemType ==
  1204                 CFindItemEngine::EFindItemSearchMailAddressBin ) ) )
   900                 CFindItemEngine::EFindItemSearchMailAddressBin ) ) )
  1205             {
   901             {
  1206             CAiwGenericParamList* inList = CAiwGenericParamList::NewLC();
   902             CAiwGenericParamList* inList = CAiwGenericParamList::NewLC();
  1207 
   903 
  1208             // SIP Address
   904             // SIP Address
  1282            ;
   978            ;
  1283            }
   979            }
  1284 
   980 
  1285         aMenuPane->AddMenuItemsL( resource, EAknFormMaxDefault - 1, ETrue );
   981         aMenuPane->AddMenuItemsL( resource, EAknFormMaxDefault - 1, ETrue );
  1286 
   982 
  1287 
       
  1288         if ( iSearchCase == KSearchTelInternetNumber &&
   983         if ( iSearchCase == KSearchTelInternetNumber &&
  1289             iFindItemVoIPExtension->VoIPProfilesExistL() ||
   984             iFindItemVoIPExtension->VoIPProfilesExistL() ||
  1290             iSearchCase == KSearchTelInternetNumber &&
   985             iSearchCase == KSearchTelInternetNumber &&
  1291             !iFindItemVoIPExtension->VoIPProfilesExistL() &&
   986             !iFindItemVoIPExtension->VoIPProfilesExistL() &&
  1292             foundItem &&
   987             founditem &&
  1293             item.iItemType ==
   988             item.iItemType ==
  1294                 CFindItemEngine::EFindItemSearchPhoneNumberBin ||
   989                 CFindItemEngine::EFindItemSearchPhoneNumberBin ||
  1295             iSearchCase & CFindItemEngine::EFindItemSearchMailAddressBin &&
   990             iSearchCase & CFindItemEngine::EFindItemSearchMailAddressBin &&
  1296             iFindItemVoIPExtension->VoIPProfilesExistL() )
   991             iFindItemVoIPExtension->VoIPProfilesExistL() )
  1297             {
   992             {
  1307             {
  1002             {
  1308             aMenuPane->DeleteMenuItem(EFindItemCmdCall);
  1003             aMenuPane->DeleteMenuItem(EFindItemCmdCall);
  1309             }
  1004             }
  1310         else if (
  1005         else if (
  1311             iSearchCase & CFindItemEngine::EFindItemSearchPhoneNumberBin &&
  1006             iSearchCase & CFindItemEngine::EFindItemSearchPhoneNumberBin &&
  1312             !iHideCallMenu && !iHideCallSubMenu )
  1007             !iHideCallMenu )
  1313             {
  1008             {
  1314             aMenuPane->SetItemDimmed( EFindItemCmdCall, ETrue );
  1009             aMenuPane->SetItemDimmed( EFindItemCmdCall, ETrue );
  1315             aMenuPane->AddMenuItemsL(
  1010             aMenuPane->AddMenuItemsL(
  1316                 R_FINDITEM_CALLUI_AIW_ITEM,
  1011                 R_FINDITEM_CALLUI_AIW_ITEM,
  1317                 EFindItemCmdCall );
  1012                 EFindItemCmdCall );
  1371         iPbkDataSave->DynInitMenuPaneL( aMenuId, aMenuPane );
  1066         iPbkDataSave->DynInitMenuPaneL( aMenuId, aMenuPane );
  1372 #endif // !RD_VIRTUAL_PHONEBOOK
  1067 #endif // !RD_VIRTUAL_PHONEBOOK
  1373         }
  1068         }
  1374     }
  1069     }
  1375 
  1070 
  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 
       
  1388 // -----------------------------------------------------------------------------
  1071 // -----------------------------------------------------------------------------
  1389 // CFindItemDialog::OfferKeyEventL
  1072 // CFindItemDialog::OfferKeyEventL
  1390 //  Handles key events
  1073 //  Handles key events
  1391 // -----------------------------------------------------------------------------
  1074 // -----------------------------------------------------------------------------
  1392 //
  1075 //
  1413         {
  1096         {
  1414         case EKeyRightArrow:
  1097         case EKeyRightArrow:
  1415             iController->NextItemL();
  1098             iController->NextItemL();
  1416             break;
  1099             break;
  1417         case EKeyDownArrow:
  1100         case EKeyDownArrow:
  1418             iController->MoveDownL();   
  1101             iController->MoveDownL();
  1419             break;
  1102             break;
  1420         case EKeyLeftArrow:
  1103         case EKeyLeftArrow:
  1421             iController->PrevItemL();	
  1104             iController->PrevItemL();
  1422             break;
  1105             break;
  1423         case EKeyUpArrow:
  1106         case EKeyUpArrow:
  1424             iController->MoveUpL();
  1107             iController->MoveUpL();
  1425             break;
  1108             break;
  1426         case EKeyOK:
  1109         case EKeyOK:
  1428             iIsSensitiveMenu = ETrue;
  1111             iIsSensitiveMenu = ETrue;
  1429             iMenuBar->SetMenuType(CEikMenuBar::EMenuContext);
  1112             iMenuBar->SetMenuType(CEikMenuBar::EMenuContext);
  1430             CAknDialog::DisplayMenuL();
  1113             CAknDialog::DisplayMenuL();
  1431             break;
  1114             break;
  1432         case EKeyPhoneSend:
  1115         case EKeyPhoneSend:
  1433 
       
  1434             if ( !iDialData )
  1116             if ( !iDialData )
  1435                 {
  1117                 {
  1436                 break;
  1118                 break;
  1437                 }
  1119                 }
       
  1120 
  1438             CFindItemEngine::SFoundItem item;
  1121             CFindItemEngine::SFoundItem item;
  1439             founditem = iController->Item( item );
  1122             founditem = iController->Item( item );
  1440 
  1123 
  1441             if ( iSearchCase ==
  1124             if ( iSearchCase ==
  1442                     CFindItemEngine::EFindItemSearchPhoneNumberBin ||
  1125                     CFindItemEngine::EFindItemSearchPhoneNumberBin ||
  1560     
  1243     
  1561     // change the color of the text according to the skin color
  1244     // change the color of the text according to the skin color
  1562     TRgb color;
  1245     TRgb color;
  1563     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
  1246     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
  1564     TInt error = AknsUtils::GetCachedColor(skin, color, KAknsIIDQsnTextColors, 
  1247     TInt error = AknsUtils::GetCachedColor(skin, color, KAknsIIDQsnTextColors, 
  1565         EAknsCIQsnTextColorsCG6 );
  1248     												EAknsCIQsnTextColorsCG6 );
  1566     if(error==KErrNone)
  1249     if(error==KErrNone)
  1567         {
  1250     	{
  1568         TCharFormat charFormat;
  1251       	TCharFormat charFormat;
  1569         TCharFormatMask charFormatMask;
  1252     	TCharFormatMask charFormatMask;
  1570         charFormatMask.SetAttrib(EAttColor);
  1253     	charFormatMask.SetAttrib(EAttColor);
  1571         charFormat.iFontPresentation.iTextColor = color; 
  1254     	charFormat.iFontPresentation.iTextColor = color; 
  1572 
  1255     
  1573         CRichText * richText = NULL;
  1256     	CRichText * richText = NULL;
  1574         richText = iEdwin->RichText();
  1257     	richText = iEdwin->RichText();
  1575         if( NULL!=richText )
  1258     	if( NULL!=richText )
  1576             {
  1259     		{
  1577             TInt length = richText->DocumentLength();
  1260     		TInt length = richText->DocumentLength();
  1578             length++;
  1261     		length++;
  1579             // apply the color to text
  1262     		// apply the color to text
  1580             TRAP_IGNORE(richText->ApplyCharFormatL( charFormat,
  1263     		TRAP_IGNORE(richText->ApplyCharFormatL( charFormat, charFormatMask, 0, length ));
  1581                 charFormatMask, 0, length ));
  1264     		}
  1582             }
       
  1583        	}
  1265        	}
  1584     if ( anyFound )
  1266     if ( anyFound )
  1585         {
  1267         {
  1586         // Insert paragraphs inside the text if needed, i.e. if text is
  1268         // Insert paragraphs inside the text if needed, i.e. if text is
  1587         // bandformatted and there's not enough paragraphs already. The
  1269         // bandformatted and there's not enough paragraphs already. The
  1728         aItem1, point1, CLayoutData::EFWholeTBoxesOnly ) );
  1410         aItem1, point1, CLayoutData::EFWholeTBoxesOnly ) );
  1729     if ( error != KErrNone )
  1411     if ( error != KErrNone )
  1730         {
  1412         {
  1731         return EFalse;
  1413         return EFalse;
  1732         }
  1414         }
  1733     TBool pos2 = EFalse;
  1415     TBool pos2 = EFalse;        
  1734     TPoint point2;
  1416     TPoint point2;
  1735     TRAP( error, pos2 = iEdwin->TextLayout()->DocPosToXyPosL( 
  1417     TRAP( error, pos2 = iEdwin->TextLayout()->DocPosToXyPosL( 
  1736         aItem2, point2, CLayoutData::EFWholeTBoxesOnly ) );
  1418         aItem2, point2, CLayoutData::EFWholeTBoxesOnly ) );
  1737     if ( error != KErrNone )
  1419     if ( error != KErrNone )
  1738         {
  1420         {
  1810         TInt resource = 0;
  1492         TInt resource = 0;
  1811 
  1493 
  1812         if ( iSearchCase == KSearchTelInternetNumber )
  1494         if ( iSearchCase == KSearchTelInternetNumber )
  1813             {
  1495             {
  1814             resource = R_FINDITEM_TITLE_TELINTERNET;
  1496             resource = R_FINDITEM_TITLE_TELINTERNET;
  1815             iSendUi = CSendUi::NewL();
       
  1816             }
  1497             }
  1817         else if ( iSearchCase & CFindItemEngine::EFindItemSearchURLBin )
  1498         else if ( iSearchCase & CFindItemEngine::EFindItemSearchURLBin )
  1818             {
  1499             {
  1819             resource = R_FINDITEM_TITLE_URL;
  1500             resource = R_FINDITEM_TITLE_URL;
  1820             }
  1501             }
  1821         else if ( iSearchCase & CFindItemEngine::EFindItemSearchMailAddressBin )
  1502         else if ( iSearchCase & CFindItemEngine::EFindItemSearchMailAddressBin )
  1822             {
  1503             {
  1823             resource = R_FINDITEM_TITLE_MAIL;
  1504             resource = R_FINDITEM_TITLE_MAIL;
  1824             iSendUi = CSendUi::NewL();
       
  1825             }
  1505             }
  1826         else if ( iSearchCase & CFindItemEngine::EFindItemSearchPhoneNumberBin )
  1506         else if ( iSearchCase & CFindItemEngine::EFindItemSearchPhoneNumberBin )
  1827             {
  1507             {
  1828             resource = R_FINDITEM_TITLE_PHONE;
  1508             resource = R_FINDITEM_TITLE_PHONE;
  1829             iSendUi = CSendUi::NewL();
       
  1830             }
  1509             }
  1831         else
  1510         else
  1832           {
  1511           {
  1833           __ASSERT_ALWAYS( 0, Panic( ENoSearchCase ) );
  1512           __ASSERT_ALWAYS( 0, Panic( ENoSearchCase ) );
  1834           return;
  1513           return;
  1980     TBuf<16> naviText;
  1659     TBuf<16> naviText;
  1981     naviText.Format(
  1660     naviText.Format(
  1982         KPosIndicator, iController->Position() + 1, iController->ItemCount() );
  1661         KPosIndicator, iController->Position() + 1, iController->ItemCount() );
  1983 
  1662 
  1984     if(NULL == iNaviDecorator)
  1663     if(NULL == iNaviDecorator)
  1985         {
  1664     	{
  1986         iNaviDecorator = iNaviPane->CreateNavigationLabelL( naviText );
  1665     	iNaviDecorator = iNaviPane->CreateNavigationLabelL( naviText );
  1987         iNaviDecorator->SetNaviDecoratorObserver( this );
  1666        	iNaviDecorator->SetNaviDecoratorObserver( this );  
  1988         iNaviDecorator->MakeScrollButtonVisible( ETrue );
  1667        	iNaviDecorator->MakeScrollButtonVisible( ETrue );
  1989         }
  1668        	}
  1990     else
  1669     else
  1991         {
  1670     	{
  1992         // Change the label on Nave pane control...
  1671     	// Change the label on Nave pane control...
  1993         CAknNaviLabel * label =( CAknNaviLabel* )iNaviDecorator->DecoratedControl();
  1672     	CAknNaviLabel * label =( CAknNaviLabel* )iNaviDecorator->DecoratedControl();
  1994         label->SetTextL(naviText);
  1673     	label->SetTextL(naviText);
  1995         }
  1674     	}
  1996 
  1675 
  1997     // Dimm arrows if needed
  1676     // Dimm arrows if needed
  1998     if ( iController->LastItem() )
  1677     if ( iController->LastItem() )
  1999         {
  1678         {
  2000         iNaviDecorator->SetScrollButtonDimmed(
  1679         iNaviDecorator->SetScrollButtonDimmed(
  2109 // -----------------------------------------------------------------------------
  1788 // -----------------------------------------------------------------------------
  2110 void CFindItemDialog::HandleResourceChange( TInt aType )
  1789 void CFindItemDialog::HandleResourceChange( TInt aType )
  2111     {
  1790     {
  2112 	//Update Horizantal Scroll bar color if skin changes
  1791 	//Update Horizantal Scroll bar color if skin changes
  2113     if( aType == KAknsMessageSkinChange)
  1792     if( aType == KAknsMessageSkinChange)
  2114         {
  1793     	{
  2115         CAknScrollBar *scrollBar = iSBFrame->VerticalScrollBar();
  1794     	CAknScrollBar *scrollBar = iSBFrame->VerticalScrollBar();
  2116         scrollBar->HandleResourceChange(aType);
  1795     	scrollBar->HandleResourceChange(aType);
  2117         }
  1796     	}
  2118     CAknDialog::HandleResourceChange( aType );
  1797     CAknDialog::HandleResourceChange( aType );
  2119     }
  1798     }
  2120 
  1799 
  2121 // -----------------------------------------------------------------------------
  1800 // -----------------------------------------------------------------------------
  2122 // CFindItemDialog::SizeChanged
  1801 // CFindItemDialog::SizeChanged
  2140         {
  1819         {
  2141         iBgContext->SetRect( Rect() );
  1820         iBgContext->SetRect( Rect() );
  2142         }
  1821         }
  2143 
  1822 
  2144     iTappingOffset = iEdwin->Rect().iTl - Rect().iTl;
  1823     iTappingOffset = iEdwin->Rect().iTl - Rect().iTl;
  2145 
       
  2146     CFindItemEngine::SFoundItem item;
       
  2147     TBool anyFound = iController->Item( item );
       
  2148     if( anyFound )
       
  2149     	{
       
  2150         TInt pos = 0;
       
  2151         TInt length = iEdwin->TextLayout()->PosRangeInBand( pos );
       
  2152         if( item.iStartPos >= pos + length )
       
  2153             {
       
  2154             TRAP_IGNORE( iEdwin->MoveDisplayL( TCursorPosition::EFPageDown ) );
       
  2155             }
       
  2156         }
       
  2157 
  1824 
  2158     TRAP_IGNORE( UpdateScrollIndicatorL() );
  1825     TRAP_IGNORE( UpdateScrollIndicatorL() );
  2159     }
  1826     }
  2160 
  1827 
  2161 // ----------------------------------------------------------------------------
  1828 // ----------------------------------------------------------------------------
  2208     const TPointerEvent& aPointerEvent )
  1875     const TPointerEvent& aPointerEvent )
  2209     {
  1876     {
  2210     if ( AknLayoutUtils::PenEnabled() &&
  1877     if ( AknLayoutUtils::PenEnabled() &&
  2211         aPointerEvent.iType == TPointerEvent::EButton1Down )
  1878         aPointerEvent.iType == TPointerEvent::EButton1Down )
  2212         {
  1879         {
  2213         TPoint tapPoint( aPointerEvent.iPosition - iTappingOffset );
  1880         TPoint tapPoint( aPointerEvent.iPosition - iTappingOffset );        
  2214         TInt pos = 0;
  1881         TInt pos = 0;
  2215         TInt len = iEdwin->TextLayout()->PosRangeInBand( pos );
  1882         TInt len = iEdwin->TextLayout()->PosRangeInBand( pos );
  2216         CFindItemEngine::SFoundItem item;
  1883         CFindItemEngine::SFoundItem item;
  2217         TRect rect;
  1884         TRect rect;
  2218         TInt i = 0;
  1885         TInt i = 0;
  2220             {
  1887             {
  2221             if ( !iController->Item( i, item ) ) // Get item.
  1888             if ( !iController->Item( i, item ) ) // Get item.
  2222                 {
  1889                 {
  2223                 break; // Error: invalid item.
  1890                 break; // Error: invalid item.
  2224                 };
  1891                 };
  2225             TInt end = item.iStartPos + item.iLength - 1;
  1892             TInt end = item.iStartPos + item.iLength - 1;                            
  2226             if ( end < pos )
  1893             if ( end < pos )
  2227                 {
  1894                 {
  2228                 i++;
  1895                 i++;
  2229                 continue; // item not visible.
  1896                 continue; // item not visible.                
  2230                 };
  1897                 };                                            
  2231             TInt start = item.iStartPos;
  1898             TInt start = item.iStartPos;
  2232             if ( start >= ( pos + len ) )
  1899             if ( start >= ( pos + len ) )
  2233                 {
  1900                 {
  2234                 break; // item not visible.
  1901                 break; // item not visible.
  2235                 }
  1902                 }
  2236             TInt lastLine = iEdwin->TextLayout()->GetLineNumber( end );
  1903             TInt lastLine = iEdwin->TextLayout()->GetLineNumber( end );
  2237             TInt nextLine = 0;
  1904             TInt nextLine = 0;
  2238             TInt lastPos = start;
  1905             TInt lastPos = start;
  2239             do // Check all rects of one item.
  1906             do // Check all rects of one item.
  2240                 {
  1907                 {     
  2241                 TInt error = KErrNone;
  1908                 TInt error = KErrNone;                   
  2242                 TRAP( error, rect = iEdwin->TextLayout()->GetLineRectL( start, end ) );
  1909                 TRAP( error, rect = iEdwin->TextLayout()->GetLineRectL( start, end ) );
  2243                 if ( error == KErrNone )
  1910                 if ( error == KErrNone )
  2244                     {
  1911                     {
  2245                     if ( rect.Contains( tapPoint ) ) // Item rect tapped.
  1912                     if ( rect.Contains( tapPoint ) ) // Item rect tapped.
  2246                         {
  1913                         {                                    
  2247                         TRAP( error, iController->TappedItemL( i ) ); // Change selection
  1914                         TRAP( error, iController->TappedItemL( i ) ); // Change selection
  2248                         if ( error != KErrNone )
  1915                         if ( error != KErrNone )
  2249                             {
  1916                             {
  2250                             return false; // Error: no selection made.
  1917                             return false; // Error: no selection made.
  2251                             }
  1918                             }
  2256                         }
  1923                         }
  2257                     }                 
  1924                     }                 
  2258                 else
  1925                 else
  2259                     {
  1926                     {
  2260                     return false; // Error: no rect.
  1927                     return false; // Error: no rect.
  2261                     }
  1928                     }                                                    
  2262                 TPoint midPoint( rect.iBr.iX, ( rect.iBr.iY + rect.iTl.iY) / 2 );
  1929                 TPoint midPoint( rect.iBr.iX, ( rect.iBr.iY + rect.iTl.iY) / 2 );
  2263                 TRAP( error, lastPos = iEdwin->TextLayout()->XyPosToDocPosL( midPoint ) );
  1930                 TRAP( error, lastPos = iEdwin->TextLayout()->XyPosToDocPosL( midPoint ) );            
  2264                 if ( error != KErrNone )
  1931                 if ( error != KErrNone )
  2265                     {
  1932                     {
  2266                     return false; // Error: no last pos.
  1933                     return false; // Error: no last pos.
  2267                     }
  1934                     }
  2268                 start = lastPos + 1;
  1935                 start = lastPos + 1;
  2269                 nextLine = iEdwin->TextLayout()->GetLineNumber( lastPos );
  1936                 nextLine = iEdwin->TextLayout()->GetLineNumber( lastPos );                       
  2270                 } while ( nextLine != lastLine ); 
  1937                 } while ( nextLine != lastLine ); 
  2271             i++;
  1938             i++;
  2272             }
  1939             }
  2273         }
  1940         }
  2274     return false;   // No hit, no further handling.
  1941     return false;   // No hit, no further handling.
  2329             iController->NextItemL();
  1996             iController->NextItemL();
  2330             break;
  1997             break;
  2331         default:
  1998         default:
  2332             break;
  1999             break;
  2333         }    
  2000         }    
  2334     }
  2001     }   
  2335 
       
  2336 
  2002 
  2337 //
  2003 //
  2338 // CONTAINER CLASS
  2004 // CONTAINER CLASS
  2339 //
  2005 //
  2340 
  2006 
  2416         // change the color of the text according to the skin color
  2082         // change the color of the text according to the skin color
  2417         // this is needed if finditemdialog is active and theme is changed.
  2083         // this is needed if finditemdialog is active and theme is changed.
  2418         TRgb color;
  2084         TRgb color;
  2419         MAknsSkinInstance* skin = AknsUtils::SkinInstance();
  2085         MAknsSkinInstance* skin = AknsUtils::SkinInstance();
  2420         TInt error = AknsUtils::GetCachedColor(skin, color, KAknsIIDQsnTextColors, 
  2086         TInt error = AknsUtils::GetCachedColor(skin, color, KAknsIIDQsnTextColors, 
  2421             EAknsCIQsnTextColorsCG6 );
  2087         												EAknsCIQsnTextColorsCG6 );
  2422         if(error==KErrNone)
  2088         if(error==KErrNone)
  2423             {
  2089         	{
  2424             TCharFormat charFormat;
  2090            	TCharFormat charFormat;
  2425             TCharFormatMask charFormatMask;
  2091         	TCharFormatMask charFormatMask;
  2426             charFormatMask.SetAttrib(EAttColor);
  2092         	charFormatMask.SetAttrib(EAttColor);
  2427             charFormat.iFontPresentation.iTextColor = color; 
  2093         	charFormat.iFontPresentation.iTextColor = color; 
  2428 
  2094      
  2429             CRichText * richText = NULL;
  2095         	CRichText * richText = NULL;
  2430             richText = iEditor->RichText();
  2096         	richText = iEditor->RichText();
  2431             if( NULL!=richText )
  2097         	if( NULL!=richText )
  2432                 {
  2098         		{
  2433                 TInt length = richText->DocumentLength();
  2099         		TInt length = richText->DocumentLength();
  2434                 length++;
  2100         		length++;
  2435                 // apply the color to the text
  2101         		// apply the color to the text
  2436                 TRAP_IGNORE(richText->ApplyCharFormatL( charFormat, charFormatMask, 0, length ));
  2102         		TRAP_IGNORE(richText->ApplyCharFormatL( charFormat, charFormatMask, 0, length ));
  2437                 }
  2103         		}
  2438             }
  2104            	}
  2439         }
  2105         }
  2440     }
  2106     }
  2441 
  2107 
  2442 // -----------------------------------------------------------------------------
  2108 // -----------------------------------------------------------------------------
  2443 // CRichTextEditorContainer::HandleResourceChange
  2109 // CRichTextEditorContainer::HandleResourceChange