emailuis/emailui/src/FreestyleEmailUiUtilities.cpp
branchRCL_3
changeset 73 c8382f7b54ef
parent 70 968773a0b6ef
child 80 726fba06891a
equal deleted inserted replaced
70:968773a0b6ef 73:c8382f7b54ef
   797 // -----------------------------------------------------------------------------
   797 // -----------------------------------------------------------------------------
   798 void TFsEmailUiUtility::OpenAttachmentL( const TPartData& aAttachmentPart )
   798 void TFsEmailUiUtility::OpenAttachmentL( const TPartData& aAttachmentPart )
   799     {
   799     {
   800     FUNC_LOG;
   800     FUNC_LOG;
   801     CFreestyleEmailUiAppUi* appUi = (CFreestyleEmailUiAppUi*)CCoeEnv::Static()->AppUi();
   801     CFreestyleEmailUiAppUi* appUi = (CFreestyleEmailUiAppUi*)CCoeEnv::Static()->AppUi();
   802     CFSMailMessage* mailMessage = appUi->GetMailClient()->GetMessageByUidL(
   802     CFSMailMessage* message = appUi->GetMailClient()->GetMessageByUidL(
   803         aAttachmentPart.iMailBoxId, aAttachmentPart.iFolderId,
   803         aAttachmentPart.iMailBoxId, aAttachmentPart.iFolderId,
   804         aAttachmentPart.iMessageId, EFSMsgDataStructure );
   804         aAttachmentPart.iMessageId, EFSMsgDataStructure );
   805 
   805 
   806     CleanupStack::PushL( mailMessage );
   806     CleanupStack::PushL( message );
   807     CFSMailMessagePart* messagePart = mailMessage->ChildPartL(
   807     CFSMailMessagePart* messagePart = NULL;
   808         aAttachmentPart.iMessagePartId );
   808     if ( message )
       
   809         {
       
   810         messagePart = message->ChildPartL( aAttachmentPart.iMessagePartId );
       
   811         }
   809     CleanupStack::PushL( messagePart );
   812     CleanupStack::PushL( messagePart );
   810 
   813 
   811     OpenAttachmentL( *messagePart );
   814     if ( messagePart )
       
   815         {
       
   816         OpenAttachmentL( *messagePart );
       
   817         }
       
   818     else
       
   819         {
       
   820         User::Leave( KErrNotFound );
       
   821         }
   812 
   822 
   813     CleanupStack::PopAndDestroy( messagePart );
   823     CleanupStack::PopAndDestroy( messagePart );
   814     CleanupStack::PopAndDestroy( mailMessage );
   824     CleanupStack::PopAndDestroy( message );
   815     }
   825     }
   816 
   826 
   817 // -----------------------------------------------------------------------------
   827 // -----------------------------------------------------------------------------
   818 // TFsEmailUiUtility::OpenAttachmentL
   828 // TFsEmailUiUtility::OpenAttachmentL
   819 // -----------------------------------------------------------------------------
   829 // -----------------------------------------------------------------------------
   820 void TFsEmailUiUtility::OpenAttachmentL( CFSMailMessagePart& aAttachmentPart,
   830 void TFsEmailUiUtility::OpenAttachmentL( CFSMailMessagePart& aAttachmentPart,
   821         TBool aAllowSave /*= ETrue*/)
   831         TBool aAllowSave /*= ETrue*/)
   822     {
   832     {
   823     FUNC_LOG;
   833     FUNC_LOG;
   824     const TDesC& attName = aAttachmentPart.AttachmentNameL();
   834     const TDesC& attName = aAttachmentPart.AttachmentNameL();
   825     const TDesC* mimeType16 = &aAttachmentPart.GetContentType();
   835     const TDesC& mimeType16 = aAttachmentPart.GetContentType();
   826     TFileType fileType = GetFileType( attName, *mimeType16 );
   836     TFileType fileType = GetFileType( attName, mimeType16 );
   827 
   837 
   828     // Check if attachment is actually an embedded message object. In that case we try to
   838     // Check if attachment is actually an embedded message object. In that case we try to
   829     // open it using mail viewer.
   839     // open it using mail viewer.
   830     TBool openedAsMessage = EFalse;
   840     TBool openedAsMessage = EFalse;
   831     if ( fileType == EMessageType )
   841     if ( fileType == EMessageType )
  3113             }
  3123             }
  3114         }
  3124         }
  3115     return isChineseSearchStr;
  3125     return isChineseSearchStr;
  3116     }
  3126     }
  3117 
  3127 
       
  3128 // ---------------------------------------------------------
       
  3129 // Find if text is including Korean word  
       
  3130 // ---------------------------------------------------------
       
  3131 //
       
  3132 TBool TFsEmailUiUtility::IsKoreanWord( const TDesC& aWord )
       
  3133     {
       
  3134     TBool isKoreanSearchStr = EFalse;
       
  3135     const TInt len = aWord.Length();
       
  3136     
       
  3137     const TUint KKoreanUnicodeHangulJamoBegin = 0x1100;
       
  3138     const TUint KKoreanUnicodeHangulJamoEnd = 0x11FF;
       
  3139     
       
  3140     for ( TInt ii = 0; ii < len; ii++ )
       
  3141         {
       
  3142         if ( (TInt) aWord[ii] >= KKoreanUnicodeHangulJamoBegin 
       
  3143              && (TInt) aWord[ii] <= KKoreanUnicodeHangulJamoEnd )
       
  3144             {
       
  3145             isKoreanSearchStr = ETrue;
       
  3146             break;
       
  3147             }
       
  3148         }
       
  3149     
       
  3150     const TUint KKoreanUnicodeHangulCompatibilityJamoBegin = 0x3130;
       
  3151     const TUint KKoreanUnicodeHangulCompatibilityJamoEnd = 0x322F;
       
  3152     
       
  3153     if ( !isKoreanSearchStr )
       
  3154         {
       
  3155         for ( TInt ii = 0; ii < len; ii++ )
       
  3156             {
       
  3157             if ( (TInt) aWord[ii] >= KKoreanUnicodeHangulCompatibilityJamoBegin 
       
  3158                  && (TInt) aWord[ii] <= KKoreanUnicodeHangulCompatibilityJamoEnd )
       
  3159                 {
       
  3160                 isKoreanSearchStr = ETrue;
       
  3161                 break;
       
  3162                 }
       
  3163             }
       
  3164         }
       
  3165     
       
  3166     const TUint KKoreanUnicodeSpanBegin = 0xAC00;
       
  3167     const TUint KKoreanUnicodeSpanEnd = 0xD7A3;
       
  3168 
       
  3169     if ( !isKoreanSearchStr )
       
  3170         {
       
  3171         for ( TInt ii = 0; ii < len; ii++ )
       
  3172             {
       
  3173             if ( (TInt) aWord[ii] >= KKoreanUnicodeSpanBegin 
       
  3174                  && (TInt) aWord[ii] <= KKoreanUnicodeSpanEnd )
       
  3175                 {
       
  3176                 isKoreanSearchStr = ETrue;
       
  3177                 break;
       
  3178                 }
       
  3179             }
       
  3180         }
       
  3181     
       
  3182     return isKoreanSearchStr;
       
  3183     }
       
  3184 
  3118 
  3185 
  3119 // -----------------------------------------------------------------------------
  3186 // -----------------------------------------------------------------------------
  3120 // TFsEmailUiUtility::GetFullIconFileNameL
  3187 // TFsEmailUiUtility::GetFullIconFileNameL
  3121 // -----------------------------------------------------------------------------
  3188 // -----------------------------------------------------------------------------
  3122 void TFsEmailUiUtility::GetFullIconFileNameL( TDes& aFileName )
  3189 void TFsEmailUiUtility::GetFullIconFileNameL( TDes& aFileName )