mobilemessaging/unieditor/smsplugin/inc/UniSmsPlugin.h
branchRCL_3
changeset 60 7fdbb852d323
equal deleted inserted replaced
57:ebe688cedc25 60:7fdbb852d323
       
     1 /*
       
     2 * Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *       UniEditor SMS Plugin definition.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __UNISMSPLUGIN_H
       
    22 #define __UNISMSPLUGIN_H
       
    23 
       
    24 // INCLUDES
       
    25 #include "UniPluginApi.h"
       
    26 
       
    27 // DATA TYPES
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 
       
    31 //class CSmsSettings;
       
    32 //class CSmsNumber;
       
    33 //class CSmsMessage;
       
    34 class CClientMtmRegistry;
       
    35 class CSmsClientMtm;
       
    36 class CSmsHeader;
       
    37 class CParaFormatLayer;
       
    38 class CCharFormatLayer;
       
    39 class CRichText;
       
    40 class CMsgSmsEmailOverSmsFunc;
       
    41 class CSmsNumber;
       
    42 class CSmsMessage;
       
    43 
       
    44 // CLASS DECLARATION
       
    45 
       
    46 /**
       
    47 * CUniSmsPlugin
       
    48 */ 
       
    49 class CUniSmsPlugin : public CUniEditorPlugin
       
    50 	{
       
    51 	public:  // Constructors and destructor
       
    52         
       
    53         /**
       
    54         * Two-phased constructor.
       
    55         */
       
    56         static CUniSmsPlugin* NewL( TAny* aConstructionParameters );
       
    57  		
       
    58         /**
       
    59         * Destructor.
       
    60         */
       
    61         virtual ~CUniSmsPlugin();
       
    62 
       
    63     public: // From CUniEditorPlugin
       
    64 
       
    65         void LoadHeadersL( CMsvStore* aStore );
       
    66 
       
    67         void SaveHeadersL( CMsvStore& aStore );
       
    68 
       
    69         TMsvId ConvertFromL( TMsvId aId );
       
    70 
       
    71         TMsvId ConvertToL( TMsvId aId );
       
    72         
       
    73         TMsvId CreateReplyL( TMsvId aSrc, TMsvId aDest, TMsvPartList aParts );
       
    74 
       
    75         TMsvId CreateForwardL( TMsvId aSrc, TMsvId aDest, TMsvPartList aParts );
       
    76         
       
    77         void SendL( TMsvId aId );
       
    78 
       
    79         TBool ValidateServiceL( TBool aEmailOverSms = EFalse );
       
    80 
       
    81         void GetSendingSettingsL( TUniSendingSettings& aSettings );
       
    82 
       
    83         void SetSendingSettingsL( TUniSendingSettings& aSettings );
       
    84         
       
    85         TBool IsServiceValidL();
       
    86         
       
    87         inline void SetUnicodeMode( TBool aUnicodeMode );
       
    88         
       
    89         //Turkish SMS(PREQ2265) specific...
       
    90         void SetEncodingSettings(TBool aUnicodeMode, TSmsEncoding aAlternativeEncodingType, TInt charSupportType);
       
    91        
       
    92         void GetNumPDUsL(
       
    93                TDesC& aBuf,
       
    94                TInt& aNumOfRemainingChars,
       
    95                TInt& aNumOfPDUs,
       
    96                TBool& aUnicodeMode, 
       
    97                TSmsEncoding& aAlternativeEncodingType);
       
    98 
       
    99 	private: // Constructors
       
   100 	
       
   101 	    /**
       
   102         * C++ default constructor.
       
   103         */
       
   104         CUniSmsPlugin( CMsvSession& aSession, CUniClientMtm& aUniMtm );
       
   105 
       
   106         /**
       
   107         * By default Symbian 2nd phase constructor is private.
       
   108         */
       
   109 		void ConstructL();
       
   110 		
       
   111 		/**
       
   112 		* Returns pointer to iSmsMtm member variable
       
   113 		*/
       
   114 		CSmsClientMtm* SmsMtmL();
       
   115 
       
   116         /**
       
   117         * Creates reply or forward message
       
   118         */
       
   119         TMsvId DoCreateReplyOrForwardL( 
       
   120             TBool aReply, 
       
   121             TMsvId aSrc, 
       
   122             TMsvId aDest, 
       
   123             TMsvPartList aParts );
       
   124 
       
   125         /**
       
   126         * Moves message into outbox for sending and creates copies of SMS messages
       
   127         * into outbox in case of multiple recipients
       
   128         */
       
   129         void MoveMessagesToOutboxL();
       
   130 
       
   131         /**
       
   132         * Called in MoveMessagesToOutboxL, calls the actual moving
       
   133         * function
       
   134         */
       
   135         TMsvId MoveMessageEntryL( TMsvId aTarget );
       
   136 
       
   137         
       
   138         /**
       
   139         * Creates messages into the Outbox if there are several recipients
       
   140         * @param TMsvEntry& a reference to entry to be copied
       
   141         * @param CSmsNumber& a reference to CSmsNumber to be copied
       
   142         * @param CRichText& a reference to msg body contents
       
   143         * @return TMsvId of the created msg entry
       
   144         */
       
   145         TMsvId CreateMessageInOutboxL(
       
   146             const TMsvEntry& aEntry, 
       
   147             const CSmsNumber& aRecipient, 
       
   148             const CRichText& aBody );
       
   149             
       
   150         /**
       
   151         * Creates messages into the Outbox if there are several recipients
       
   152         * and the message is E-Mail over SMS message
       
   153         * @param aEntry a reference to entry to be copied
       
   154         * @param aAddress a reference to address to be copied
       
   155         * @return TMsvId of the created msg entry
       
   156         */
       
   157         virtual TMsvId CreateMessageInOutboxL(
       
   158             const TMsvEntry& aEntry, 
       
   159             const TDesC& aAddress );    
       
   160         
       
   161 
       
   162         /**
       
   163         * Calls the actual sending method of SMS Client MTM
       
   164         */
       
   165         void SetScheduledSendingStateL( CMsvEntrySelection* aSelection );
       
   166         
       
   167         /**
       
   168         * Extracts name and address
       
   169         */
       
   170         void NameAndAddress( const TDesC& aMsvAddress, TPtrC& aName, TPtrC& aAddress );
       
   171 
       
   172         /**
       
   173         * Creates text for TMsvEntry::iDescription. It could be subject or
       
   174         * if subject does not exist a beginning of the message body 
       
   175         */
       
   176         void ExtractDescriptionFromMessageL(
       
   177             const CSmsMessage& aMessage, 
       
   178             TDes& aDescription, 
       
   179             TInt aMaxLength);
       
   180             
       
   181         /**
       
   182         * Copies text from attachment into the body of the SMS
       
   183         */
       
   184         void CreatePlainTextSMSL( RFile& aFile );
       
   185 
       
   186         /** 
       
   187         * Insert subject into the body of the SMS
       
   188         */
       
   189         void InsertSubjectL( CSmsHeader& aHeader, CRichText& aText );
       
   190         
       
   191         /**
       
   192         * Copies data from VCard attachment into body of the SMS
       
   193         */
       
   194         void CreateVCardSMSL( RFile& aFile );
       
   195         
       
   196         /**
       
   197         * Copies data from VCCalendar attachment into body of the SMS
       
   198         */
       
   199         void CreateVCalSMSL( RFile& aFile );
       
   200                 
       
   201         /**
       
   202         * Checks service center address 
       
   203         */
       
   204         TBool ValidateSCNumberL();
       
   205         
       
   206         /**
       
   207         * Checks service center address for E-Mail over SMS messages
       
   208         */
       
   209         TBool ValidateSCNumberForEmailOverSmsL();
       
   210         
       
   211         /**
       
   212         * Executes service setting query dialog
       
   213         */
       
   214         TBool SmsScDialogL();
       
   215         
       
   216         /**
       
   217         * Saves E-Mail specific information in header
       
   218         */
       
   219         void FillEmailInformationDataL( CSmsHeader& aHeader,  const TPtrC& aAddress );
       
   220     
       
   221         /**
       
   222         * Checks if the address is E-Mail address
       
   223         */
       
   224         TBool IsEmailAddress( const TPtrC& aAddress ) const;
       
   225             
       
   226         /**
       
   227         * Converts sms message to uni message format.
       
   228         */
       
   229 		TMsvId DoConvertFromL( TMsvId aId, TBool aIsForward );
       
   230 
       
   231         /**
       
   232         * returns attachment size.
       
   233         */
       
   234 		TInt32 AttachmentsSizeL( CMsvStore& aStore );     
       
   235         /**
       
   236         * resets Unimtm addresslist.
       
   237         */
       
   238 		void ResetUniAddresselist();
       
   239 
       
   240     private:  // Data    
       
   241 
       
   242         CMsvSession& iSession;
       
   243         CUniClientMtm& iUniMtm;
       
   244         
       
   245         CClientMtmRegistry* iMtmRegistry;
       
   246         CSmsClientMtm* iSmsMtm;
       
   247         
       
   248         TMsvId iSmsServiceId;
       
   249         CSmsHeader* iSmsHeader;
       
   250         
       
   251         CParaFormatLayer* iParaFormatLayer;
       
   252         CCharFormatLayer* iCharFormatLayer;
       
   253         CRichText* iRichText;
       
   254         
       
   255         CDesCArray* iRecipients;
       
   256               
       
   257         TFileName iAttachmentFileName;    	 
       
   258        	 
       
   259        	TBool iBioMsg;
       
   260         
       
   261         enum TUniPluginPanic
       
   262             {
       
   263             EIllegalArguments  
       
   264             }; 
       
   265     
       
   266         // EmailOverSms specific ...
       
   267 		TInt                    iLongestEmailAddrLength ;
       
   268 		TUint32                 iMsgLengthFlags;
       
   269 		TBool                   iFullyConstructed;
       
   270 		
       
   271         CSmsNumber*				iEmailOverSmsC;
       
   272         TBool                   iUnicodeMode;
       
   273         TBool                   iOfflineSupported; //is offline feature supported
       
   274         
       
   275         //Turkish SMS(PREQ2265) specific...
       
   276         TInt iCharSupportType;
       
   277         TSmsEncoding  iAlternativeEncodingType;
       
   278         TBool iNLTFeatureSupport;
       
   279         
       
   280         TBool iStoreChanged ;
       
   281     };
       
   282 
       
   283 inline void CUniSmsPlugin::SetUnicodeMode( TBool aUnicodeMode )
       
   284     {
       
   285     iUnicodeMode = aUnicodeMode;
       
   286     }
       
   287 
       
   288 #endif      // __UNISMSPLUGIN_H
       
   289 
       
   290 // End of File