messagingappbase/mce/inc/MceUtils.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2002 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 *     Mixed class to offer different account functions.
       
    16 *     Implemented by CMceUi.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 #ifndef MCEUTILS_H
       
    23 #define MCEUTILS_H
       
    24 
       
    25 //  INCLUDES
       
    26 
       
    27 #include <msvstd.h>     // TMsvId
       
    28 #include <msvstd.hrh>   // KMsvNullIndexEntryIdValue
       
    29 #include <msvreg.h>     // THumanReadableName
       
    30 
       
    31 #include <bldvariant.hrh>
       
    32 #include <ImumInHealthServices.h>       // MImumInHealthServices
       
    33 #include <PhCltTypes.h>
       
    34 
       
    35 // DATA TYPES
       
    36 enum TMceListType
       
    37     {
       
    38     EMceListTypeMainView,
       
    39     EMceListTypeMessage
       
    40     };
       
    41 
       
    42 // FORWARD DECLARATIONS
       
    43 class CUidNameArray;
       
    44 class CMsvSession;
       
    45 class CImumInternalApi;
       
    46 
       
    47 // CLASS DECLARATION
       
    48 
       
    49 /**
       
    50 *  Mixed class to offer different account functions.
       
    51 *  Implemented by CMceUi
       
    52 */
       
    53 class MMceAccountManager
       
    54     {
       
    55     public:
       
    56         /**
       
    57         * Create new account.
       
    58         * @param aType type of the account.
       
    59         * @param aOldServiceId id of the service where old settings are copied (this is for 'create from existing')
       
    60         * @return ETrue if account created, EFalse otherwise
       
    61         */
       
    62         virtual TBool CreateNewAccountL(TUid aType, TMsvId aOldServiceId )=0;
       
    63 
       
    64         /**
       
    65         * Edit account.
       
    66         * @param aId id of the account to be edited.
       
    67         */
       
    68         virtual void EditAccountL(TMsvId aId)=0;
       
    69 
       
    70         /**
       
    71         * Returns array of accounts of desired type.
       
    72         * Callers responsibility to destroy array!
       
    73         * @param aType type of the account.
       
    74         */
       
    75         virtual CUidNameArray* MtmAccountsL( TUid aType )=0;
       
    76 
       
    77         /**
       
    78         * Can create create new account of aMtm.
       
    79         * @param aMtm Mtm uid.
       
    80         * @return EFalse if new accounts cannot be created for mtm aMtm.
       
    81         */
       
    82         virtual TBool CanCreateNewAccountL(TUid aMtm) = 0;
       
    83 
       
    84         /**
       
    85         * Delete account.
       
    86         * @param aId id of the account to be deleted.
       
    87         */
       
    88         virtual void DeleteAccountL(TMsvId aId) = 0;
       
    89 
       
    90         /**
       
    91          * Returns session used.
       
    92          * @return reference to object of CMsvSession class.
       
    93          */
       
    94         virtual CMsvSession& Session() = 0;
       
    95 
       
    96         /**
       
    97          * Returns ETrue if aMtm is installed in the device.
       
    98          * @param aMtm: Mtm uid to be checked.
       
    99          * @return EFalse if aMtm is not installed, ETrue if it is installed.
       
   100          */
       
   101         virtual TBool IsPresent( TUid aMtm ) const = 0;
       
   102 
       
   103         /**
       
   104          * Returns human readable name of mtm.
       
   105          * @param aMtm: Mtm uid
       
   106          * @return human readable name of mtm.
       
   107          */
       
   108          virtual THumanReadableName MtmName( TUid aMtm ) const = 0;
       
   109 
       
   110     };
       
   111 
       
   112 /**
       
   113 * Helper class
       
   114 * Includes static functions.
       
   115 */
       
   116 class MceUtils
       
   117     {
       
   118     public:
       
   119         /**
       
   120         * Returns ETrue if given entry is one of the default folders:
       
   121         * Inbox, Outbox, Sent items, Draft, Documents, Templates.
       
   122         * @param TMsvId of the entry
       
   123         * @return ETrue / EFalse
       
   124         */
       
   125         static TBool IsEntryFixed( TMsvId aId );
       
   126 
       
   127         /**
       
   128         * Replaces tab and enter characters by spaces using AknTextUtils::ReplaceCharacters
       
   129         */
       
   130         static void ReplaceCharacters( TDes& aText );
       
   131 
       
   132         /**
       
   133         * Gets ir attachment file name and path for the aEntryId.
       
   134         * @param aSession: session object
       
   135         * @param aEntryId: entry to be checked
       
   136         * @param aFileName: filename buffer to be filled
       
   137         * @param aFileHandle: handle to the file (aFileName)
       
   138         * @param aSize: size of the file (aFileName)
       
   139         */
       
   140 		static void GetIrFilePathL( CMsvSession& aSession, TMsvId aEntryId, TFileName& aFileName, RFile& aFileHandle, TInt& aSize );
       
   141 
       
   142         /**
       
   143         * Returns ETrue if 'Memory in use' option is enabled in mce/settings               
       
   144         */
       
   145         static TBool MemoryInUseOptionL( );        
       
   146                                                     
       
   147         /**
       
   148          * Gets the array of valid mailboxes.
       
   149          *
       
   150          * @since S60 v3.2
       
   151          * @param aEmailApi: Ptr to the email API
       
   152          * @param aMailboxIdArray: list of valid mailboxes
       
   153          * @param aGetImap4: ETrue if the imap mailboxes are to be included
       
   154          * @param aGetPop3: ETrue if the pop3 mailboxes are to be included
       
   155          * @param aGetSyncML: ETrue if the syncml mailboxes are to be included
       
   156          * @param aGetOther: ETrue if the Other (3rd party) mailboxes are to be included
       
   157          * @return KErrNone if the list of healthy mailboxes list is found
       
   158          */
       
   159         static TInt GetHealthyMailboxListL(
       
   160             const MImumInHealthServices& aHealthServices,
       
   161             MImumInHealthServices::RMailboxIdArray& aMailboxIdArray,
       
   162             TBool aGetImap4,
       
   163             TBool aGetPop3,
       
   164             TBool aGetSyncML,
       
   165             TBool aGetOther );           
       
   166             
       
   167         /**
       
   168         * Returns ETrue if phonenumber in entry is valid
       
   169         * @since 5.0
       
   170         * @param aEntryId of the entry
       
   171         * @param aSession: Session to message server
       
   172         * @param aPhoneNumber: Phone number
       
   173         * @param aEntryDetails: If this is not NULL, 
       
   174         * then KMceVisibleTextLength from the 
       
   175         * TMsvEntry.iDetails is copied to aEntryDetails buffer
       
   176         * @Returns ETrue if phonenumber is valid
       
   177         */
       
   178         static TBool ValidPhoneNumberL( 
       
   179             TMsvId aEntryId,
       
   180             CMsvSession& aSession,
       
   181             TPhCltTelephoneNumber& aPhoneNumber, 
       
   182             TDes* aEntryDetails );
       
   183 
       
   184         /**
       
   185         * Returns ETrue if phonenumber in entry is valid
       
   186         * @since 5.0
       
   187         * @param aEntryId of the entry
       
   188         * @param aSession: Session to message server
       
   189         * @Returns ETrue if phonenumber is valid
       
   190         */
       
   191         static TBool ValidPhoneNumberL( 
       
   192             TMsvId aEntryId,
       
   193             CMsvSession& aSession );
       
   194 
       
   195         /**
       
   196         * Gets phone number from SMS entry
       
   197         * @since 5.0
       
   198         * @param aEntryId of the entry
       
   199         * @param aSession: Session to message server
       
   200         * @param aPhoneNumber: Phone number
       
   201         */
       
   202         static void GetSmsNumberL( 
       
   203             TMsvId aEntryId, 
       
   204             CMsvSession& aSession,
       
   205             TPhCltTelephoneNumber& aNumber );
       
   206 
       
   207         /**
       
   208         * Gets phone number from MMS entry
       
   209         * @since 5.0
       
   210         * @param aEntryId of the entry
       
   211         * @param aSession: Session to message server
       
   212         * @param aPhoneNumber: Phone number
       
   213         */
       
   214         static void GetMmsNumberL( 
       
   215             TMsvEntry& aEntry, 
       
   216             CMsvSession& aSession,
       
   217             TPhCltTelephoneNumber& aNumber );
       
   218             
       
   219             
       
   220         /**
       
   221         * Copies text buffer from aSourceString to 
       
   222         * aTargetSting and also adds EEllipsis if needed and 
       
   223         * performs AknTextUtils::ReplaceCharacters to copied buffer.
       
   224         * @since 5.0
       
   225         * @param aTargetString
       
   226         * @param aSourceString
       
   227         * @param aDescriptionLength
       
   228         * @return: none
       
   229         */
       
   230         static void StripAndAppendStringL(
       
   231             TDes& aTargetString, 
       
   232             const TDesC& aSourceString, 
       
   233             TInt aDescriptionLength );
       
   234             
       
   235         /**
       
   236         * Reads description length value from muiu cenrep file:
       
   237         * KCRUidMuiuSettings / KMuiuDescriptionLength
       
   238         * If some errors, returns KMceVisibleTextLength.
       
   239         * @since 5.0
       
   240         * @return iDescription length value. 
       
   241         */            
       
   242         static TInt DescriptionLength();
       
   243 
       
   244         /**
       
   245         * Reads description length value from muiu cenrep file:
       
   246         * KCRUidMuiuSettings / KMuiuDescriptionLength
       
   247         * If some errors, returns KMceVisibleTextLength.
       
   248         * @since 5.0
       
   249         * @return iDescription length value. 
       
   250         * @leave KErrNoMemory
       
   251         */            
       
   252         static TInt DescriptionLengthL();
       
   253 
       
   254         /**
       
   255         * Returns ETrue if MTM is build in type 
       
   256         * @since 5.0
       
   257         * @param aMtmUid
       
   258         * @return ETrue/EFalse
       
   259         */    
       
   260         static TBool IsMtmBuiltIn( TUid aMtmUid );
       
   261         
       
   262         /**
       
   263          * Reads KCRUidNumberGrouping / KNumberGrouping
       
   264          * from the cenrep and returns ETrue if number 
       
   265          * grouping is enabled. 
       
   266          * If reading fails then it returns EFalse
       
   267          * @since 5.0
       
   268          */
       
   269         static TBool NumberGroupingEnabled();
       
   270 
       
   271         /**
       
   272          * Reads KCRUidNumberGrouping / KNumberGrouping
       
   273          * from the cenrep and returns ETrue if number 
       
   274          * grouping is enabled. 
       
   275          * If reading fails then it returns EFalse
       
   276          * @since 5.0
       
   277          * @leave if CRepository::NewL leaves.
       
   278          */
       
   279         static TBool NumberGroupingEnabledL();
       
   280             
       
   281 
       
   282     };
       
   283 /**
       
   284 * Helper class for flags.
       
   285 */
       
   286 class TMceFlags
       
   287     {
       
   288     public:
       
   289         /**
       
   290         * constructor
       
   291         */
       
   292         TMceFlags();
       
   293 
       
   294         /**
       
   295         * Sets flag on
       
   296         * @param aFlag: flag to be set
       
   297         */
       
   298         inline void SetMceFlag( TUint32 aFlag );
       
   299 
       
   300         /**
       
   301         * Clear flag on
       
   302         * @param aFlag: flag to be cleared
       
   303         */
       
   304         inline void ClearMceFlag( TUint32 aFlag );
       
   305 
       
   306         /**
       
   307         * Query for the flag
       
   308         * @param aFlag: flag to be checked
       
   309         */
       
   310         inline TBool MceFlag( TUint32 aFlag ) const;
       
   311 
       
   312     private:
       
   313         TUint32 iFlags;
       
   314 
       
   315     };
       
   316 
       
   317 #include "MceUtils.inl"
       
   318 
       
   319 #endif
       
   320 
       
   321 // End of file