commonuis/CommonUi/src/FindItemDialog.cpp
changeset 47 2f0c06423c72
parent 33 b3425bf29f82
equal deleted inserted replaced
46:0e1e0022bd03 47:2f0c06423c72
    44 #include <CPbkFieldsInfo.h> // Phonebook field types
    44 #include <CPbkFieldsInfo.h> // Phonebook field types
    45 #else // RD_VIRTUAL_PHONEBOOK
    45 #else // RD_VIRTUAL_PHONEBOOK
    46 #include <AiwServiceHandler.h> // CAiwServiceHandler
    46 #include <AiwServiceHandler.h> // CAiwServiceHandler
    47 #include <AiwContactAssignDataTypes.h> // AiwContactAssign
    47 #include <AiwContactAssignDataTypes.h> // AiwContactAssign
    48 #endif // !RD_VIRTUAL_PHONEBOOK
    48 #endif // !RD_VIRTUAL_PHONEBOOK
    49 
       
    50 #include <sendui.h> // for CSendAppUi
       
    51 #include <CMessageData.h> // for CMessageData
       
    52 #include <SendUiConsts.h> // Mtm uids
       
    53 
    49 
    54 #include <commonphoneparser.h> // Phonenumber parser
    50 #include <commonphoneparser.h> // Phonenumber parser
    55 
    51 
    56 #include <baclipb.h> // For CClipboard
    52 #include <baclipb.h> // For CClipboard
    57 
    53 
   299         }
   295         }
   300     delete iNaviDecorator;
   296     delete iNaviDecorator;
   301     delete iSBFrame;
   297     delete iSBFrame;
   302     delete iItemArrayForScrollBar;
   298     delete iItemArrayForScrollBar;
   303 
   299 
   304     delete iSendUi;
       
   305 #ifndef RD_VIRTUAL_PHONEBOOK
   300 #ifndef RD_VIRTUAL_PHONEBOOK
   306     delete iPbkDataSave;
   301     delete iPbkDataSave;
   307     delete iPbkEngine;
   302     delete iPbkEngine;
   308     iPbkResourceFile.Close();
   303     iPbkResourceFile.Close();
   309 #endif //RD_VIRTUAL_PHONEBOOK
   304 #endif //RD_VIRTUAL_PHONEBOOK
   610 //  Sends message (SMS, MMS or E-mail) to selected item
   605 //  Sends message (SMS, MMS or E-mail) to selected item
   611 // -----------------------------------------------------------------------------
   606 // -----------------------------------------------------------------------------
   612 //
   607 //
   613 void CFindItemDialog::SendMessageL( const TUid aMtmUid )
   608 void CFindItemDialog::SendMessageL( const TUid aMtmUid )
   614     {
   609     {
   615     __ASSERT_DEBUG( iEdwin->SelectionLength() > 0, Panic( ENoItemSelected ) );
   610 	
   616 
       
   617     if ( !iSendUi )
       
   618         {
       
   619         return;
       
   620         }
       
   621 
       
   622     // Hide options menu if showing
       
   623     if ( CAknDialog::MenuShowing() )
       
   624         {
       
   625         CAknDialog::HideMenu();
       
   626         }
       
   627 
       
   628     TCursorSelection selection = iEdwin->Selection();
       
   629     HBufC* number = HBufC::NewLC( selection.Length() );
       
   630     TPtr numberPtr = number->Des();
       
   631     numberPtr.Append(
       
   632         iPlainText.Mid(
       
   633             selection.LowerPos(), selection.Length() ) );
       
   634     if ( iSearchCase & CFindItemEngine::EFindItemSearchPhoneNumberBin )
       
   635         {
       
   636         CommonPhoneParser::ParsePhoneNumber(
       
   637             numberPtr, CommonPhoneParser::EPlainPhoneNumber );
       
   638         AknTextUtils::ConvertDigitsTo( numberPtr, EDigitTypeWestern );            
       
   639         }
       
   640 
       
   641     CMessageData* messageData = CMessageData::NewL();
       
   642     CleanupStack::PushL( messageData );
       
   643     messageData->AppendToAddressL( *number );
       
   644 
       
   645     iSendUi->CreateAndSendMessageL( aMtmUid, messageData );
       
   646     CleanupStack::PopAndDestroy(2); // messageData, number
       
   647 
       
   648     }
   611     }
   649 
   612 
   650 // -----------------------------------------------------------------------------
   613 // -----------------------------------------------------------------------------
   651 // CFindItemDialog::LaunchGenericUriL
   614 // CFindItemDialog::LaunchGenericUriL
   652 //  Handles URIs launching. If parent application is Browser,
   615 //  Handles URIs launching. If parent application is Browser,
   829             break;
   792             break;
   830             }
   793             }
   831         // fix for FAMZ-7JVQ4Y
   794         // fix for FAMZ-7JVQ4Y
   832         case EFindItemSubMenuSend:
   795         case EFindItemSubMenuSend:
   833            {
   796            {
   834            CFindItemEngine::SFoundItem item;
       
   835            TBool founditem = iController->Item( item );
       
   836            TSendingCapabilities sendingCapabilities;
       
   837            sendingCapabilities.iFlags = TSendingCapabilities::ESupportsEditor;
       
   838            CArrayFixFlat<TUid>* mtmFilter = new(ELeave) CArrayFixFlat<TUid>( 1 );
       
   839            CleanupStack::PushL(mtmFilter);
       
   840            mtmFilter->AppendL(KSenduiMtmPostcardUid);// hide postcard
       
   841            // Hide MMs
       
   842            #ifndef RD_UNIFIED_EDITOR
       
   843            if( !iMMSFeatureSupported )
       
   844                {
       
   845            	   mtmFilter->AppendL(KSenduiMtmMmsUid);
       
   846                }
       
   847            #endif
       
   848            
       
   849            // Hide Sms
       
   850            if ( iSearchCase == CFindItemEngine::EFindItemSearchMailAddressBin ||
       
   851               ( iFindItemVoIPExtension->IsVoIPSupported() &&
       
   852                   founditem && item.iItemType == CFindItemEngine::EFindItemSearchMailAddressBin &&
       
   853                   iSearchCase == KSearchTelInternetNumber ) )
       
   854               {
       
   855               #ifndef RD_UNIFIED_EDITOR
       
   856               if ( !iEmailOverSmsFeatureSupported )
       
   857                   {
       
   858                   mtmFilter->AppendL(KSenduiMtmSmsUid);
       
   859                   }
       
   860               #endif
       
   861               }
       
   862               
       
   863            // Hide Mail
       
   864            else if ( !iEmailUiFeatureSupported ||
       
   865                ( iSearchCase == CFindItemEngine::EFindItemSearchPhoneNumberBin ||
       
   866                ( iFindItemVoIPExtension->IsVoIPSupported() && founditem &&
       
   867                    item.iItemType == CFindItemEngine::EFindItemSearchPhoneNumberBin &&
       
   868                    iSearchCase == KSearchTelInternetNumber ) ) )
       
   869                {
       
   870        	       mtmFilter->AppendL(KSenduiMtmSmtpUid);
       
   871                mtmFilter->AppendL(KSenduiMtmImap4Uid);
       
   872                mtmFilter->AppendL(KSenduiMtmPop3Uid);
       
   873                mtmFilter->AppendL(KSenduiMtmSyncMLEmailUid);
       
   874                }
       
   875            // Hide Audio
       
   876            if ( iSearchCase != CFindItemEngine::EFindItemSearchPhoneNumberBin ||
       
   877                !iAudioMessagingFeatureSupported )
       
   878                {
       
   879                mtmFilter->AppendL(KSenduiMtmAudioMessageUid);
       
   880                }
       
   881                
       
   882            TUid uid = iSendUi->ShowTypedQueryL( CSendUi::EWriteMenu, NULL, sendingCapabilities, mtmFilter );
       
   883           
       
   884            CleanupStack::PopAndDestroy();
       
   885            
       
   886            if ( uid == KNullUid )
       
   887               {
       
   888               break;
       
   889               }
       
   890            SendMessageL(uid);  
       
   891            
       
   892            break;
   797            break;
   893            }
   798            }
   894         case EFindItemCmdGoToUrl:
   799         case EFindItemCmdGoToUrl:
   895             {
   800             {
   896             if ( LaunchGenericUriL() )
   801             if ( LaunchGenericUriL() )
  1587         TInt resource = 0;
  1492         TInt resource = 0;
  1588 
  1493 
  1589         if ( iSearchCase == KSearchTelInternetNumber )
  1494         if ( iSearchCase == KSearchTelInternetNumber )
  1590             {
  1495             {
  1591             resource = R_FINDITEM_TITLE_TELINTERNET;
  1496             resource = R_FINDITEM_TITLE_TELINTERNET;
  1592             iSendUi = CSendUi::NewL();
       
  1593             }
  1497             }
  1594         else if ( iSearchCase & CFindItemEngine::EFindItemSearchURLBin )
  1498         else if ( iSearchCase & CFindItemEngine::EFindItemSearchURLBin )
  1595             {
  1499             {
  1596             resource = R_FINDITEM_TITLE_URL;
  1500             resource = R_FINDITEM_TITLE_URL;
  1597             }
  1501             }
  1598         else if ( iSearchCase & CFindItemEngine::EFindItemSearchMailAddressBin )
  1502         else if ( iSearchCase & CFindItemEngine::EFindItemSearchMailAddressBin )
  1599             {
  1503             {
  1600             resource = R_FINDITEM_TITLE_MAIL;
  1504             resource = R_FINDITEM_TITLE_MAIL;
  1601             iSendUi = CSendUi::NewL();
       
  1602             }
  1505             }
  1603         else if ( iSearchCase & CFindItemEngine::EFindItemSearchPhoneNumberBin )
  1506         else if ( iSearchCase & CFindItemEngine::EFindItemSearchPhoneNumberBin )
  1604             {
  1507             {
  1605             resource = R_FINDITEM_TITLE_PHONE;
  1508             resource = R_FINDITEM_TITLE_PHONE;
  1606             iSendUi = CSendUi::NewL();
       
  1607             }
  1509             }
  1608         else
  1510         else
  1609           {
  1511           {
  1610           __ASSERT_ALWAYS( 0, Panic( ENoSearchCase ) );
  1512           __ASSERT_ALWAYS( 0, Panic( ENoSearchCase ) );
  1611           return;
  1513           return;