messagingappbase/msgavkon/muiu_internal/servicesinternal/inc/MuiuMsvUiServiceUtilitiesInternal.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2002 - 2005 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: MuiuMsvUiServiceUtilitiesInternal  declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __MSVUISERVICEUTILITIESINTERNAL_H__
       
    22 #define __MSVUISERVICEUTILITIESINTERNAL_H__
       
    23 
       
    24 //  INCLUDES
       
    25 #include <msvipc.h>
       
    26 #include <commonphoneparser.h>
       
    27 
       
    28 // DATA TYPES
       
    29 /// Address types used inside messaging application
       
    30 enum TMuiuAddressType   
       
    31     {
       
    32     EMuiuAddressTypeNone,         // Address does not exist or type is not any of below values
       
    33     EMuiuAddressTypePhoneNumber,
       
    34     EMuiuAddressTypeEmail
       
    35     };
       
    36 
       
    37 
       
    38 // FORWARD DECLARATIONS
       
    39 class CMsvSession;
       
    40 class RFs;
       
    41 class CEikonEnv;
       
    42 class CMsgVoIPExtension;
       
    43 /**
       
    44 * Static class to help service handling.
       
    45 */
       
    46 class MsvUiServiceUtilitiesInternal
       
    47     {
       
    48     public:
       
    49 
       
    50         /**
       
    51         * Messaging application viewer or other application may call to sender or 
       
    52         * higlighted address when send key is pressed or in other situation. 
       
    53         * This function makes the decision whether voice or VoIP
       
    54         * call is done. For more information about usage see CallToSenderQueryL(),
       
    55         * CallServiceL(), InternetCallToSenderQueryL() and InternetCallServiceL(). 
       
    56         * @param aSenderAddress: Sender's address number. Calling voice call to email
       
    57         *           address is not supported. 
       
    58         *           Address must be pure address i.e. alias must not be part of it.
       
    59         * @param aSenderName: Sender name
       
    60         * @param aAddressInFocus: Address which is highlighted in message. 
       
    61         *           Calling voice call to email address is not supported.
       
    62         *           Address must be pure address i.e. alias must not be part of it.
       
    63         * @param aDialWithoutQueries: If this parameter is true and calling to sender 
       
    64         *           is chosen, then call immediately to sender of the message and 
       
    65         *           doesn't ask nothing from user before it.
       
    66         * @return Returns ETrue if the address was valid.
       
    67         */
       
    68         IMPORT_C static TBool InternetOrVoiceCallServiceL( 
       
    69             const CMsgVoIPExtension&    aVoIPExtension,
       
    70             const TDesC&                aSenderAddress,
       
    71             const TDesC&                aSenderName,
       
    72             const TDesC&                aAddressInFocus = KNullDesC,
       
    73             TBool                       aDialWithoutQueries = ETrue,
       
    74             CEikonEnv*                  aEnv = NULL );
       
    75 
       
    76         /**
       
    77         * Messaging application viewer or other application may call to sender or 
       
    78         * higlighted address when send key is pressed or in other situation. 
       
    79         * This function makes the decision whether voice or VoIP
       
    80         * call is done. For more information about usage see CallToSenderQueryL(),
       
    81         * CallServiceL(), InternetCallToSenderQueryL() and InternetCallServiceL(). 
       
    82         * @param aSenderAddress: Sender's address number. Calling voice call to email
       
    83         *           address is not supported. 
       
    84         *           Address must be pure address i.e. alias must not be part of it.
       
    85         * @param aSenderName: Sender name
       
    86         * @param aSenderAddressType address type of sender
       
    87         * @param aAddressInFocus: Address which is highlighted in message. 
       
    88         *           Calling voice call to email address is not supported.
       
    89         *           Address must be pure address i.e. alias must not be part of it.
       
    90         * @param aAddressInFocusType address type of focused address
       
    91         * @param aDialWithoutQueries: If this parameter is true and calling to sender 
       
    92         *           is chosen, then call immediately to sender of the message and 
       
    93         *           doesn't ask nothing from user before it.
       
    94         * @return Returns ETrue if the address was valid.
       
    95         */
       
    96         IMPORT_C static TBool InternetOrVoiceCallServiceL( 
       
    97             CEikonEnv&                  aEnv,
       
    98             const CMsgVoIPExtension&    aVoIPExtension,
       
    99             const TDesC&                aSenderAddress,
       
   100             const TDesC&                aSenderName,
       
   101             TMuiuAddressType            aSenderAddressType,
       
   102             const TDesC&                aAddressInFocus = KNullDesC,
       
   103             TMuiuAddressType            aAddressInFocusType = EMuiuAddressTypeNone,
       
   104             TBool                       aDialWithoutQueries = ETrue );
       
   105 
       
   106         /**
       
   107         * Used when asking from user if calling to sender of the message and dial to sender
       
   108         * if user select "Yes". Check immediately if phone number is valid. If phone number
       
   109         * is not valid then return EFalse and doesn't do nothing.If parameter "aDialWithoutQueries" 
       
   110         * is true then call immediately to sender of the message and doesn't ask nothing from user before it.
       
   111         * @param aNumber: Phone number.
       
   112         * @param aName: Name
       
   113         * @param aDialWithoutQueries: If this parameter is true then call immediately 
       
   114         * to sender of the message and doesn't ask nothing from user before it.
       
   115         * @return Returns ETrue if the phone number was valid.
       
   116         */
       
   117         IMPORT_C static TBool CallToSenderQueryL( 
       
   118             const TDesC& aNumber,
       
   119             const TDesC& aName, 
       
   120             TBool aDialWithoutQueries = ETrue );
       
   121 
       
   122         /**
       
   123         * When SMS viewer or MMS viewer is open it is possible to call
       
   124         * back to sender or phone number which is currently highlighted
       
   125         * in message. If user select Send-key then CAknListQueryDialog 
       
   126         * is opened with items "Back to sender" and currently highlighted
       
   127         * phone number and with soft keys "Call" and "Cancel". If item
       
   128         * "Back to sender" is selected and user select "Call" then function
       
   129         * call "CallToSenderQueryL" function with parameters "aSenderNumber"
       
   130         * and "aSenderName".
       
   131         * If currently highlighted item is selected and user select "Call"
       
   132         * then function call "CallToSenderQueryL" function with parameters "aSenderNumber"
       
   133         * and KNullDesC. If no phone number is highlighted in message and user
       
   134         * select Send-key then function launch the normal call query.
       
   135         * @param aSenderNumber: Sender phone number.
       
   136         * @param aSenderName: Sender name
       
   137         * @param aNumberInFocus: Phone number which is highlighted in message
       
   138         * @return Returns ETrue if the phone number was valid.
       
   139         */
       
   140         IMPORT_C static TBool CallServiceL( 
       
   141             const TDesC& aSenderNumber,
       
   142             const TDesC& aSenderName,
       
   143             const TDesC& aNumberInFocus = KNullDesC,
       
   144             CEikonEnv* aEnv = NULL );
       
   145 
       
   146         /**
       
   147         * Used when asking from user if calling to sender of the message and dial to sender
       
   148         * if user select "Yes". Assumes allways that Internet call number is valid and 
       
   149         * ETrue returned. If parameter "aDialWithoutQueries" 
       
   150         * is true then call immediately to sender of the message and doesn't ask nothing from user before it.
       
   151         * @since 3.0
       
   152         * @param aNumber: Phone number.
       
   153         * @param aName: Name
       
   154         * @param aDialWithoutQueries: If this parameter is true then call immediately 
       
   155         * to sender of the message and doesn't ask nothing from user before it.
       
   156         * @return Returns ETrue.
       
   157         */
       
   158         IMPORT_C static TBool InternetCallToSenderQueryL( 
       
   159             const TDesC& aNumber,
       
   160             const TDesC& aName, 
       
   161             TBool aDialWithoutQueries = ETrue );
       
   162             
       
   163         /**
       
   164         * When SMS viewer or MMS viewer is open it is possible to call
       
   165         * back to sender or phone number which is currently highlighted
       
   166         * in message. If user select Send-key then CAknListQueryDialog 
       
   167         * is opened with items "Back to sender" and currently highlighted
       
   168         * phone number and with soft keys "Call" and "Cancel". If item
       
   169         * "Back to sender" is selected and user select "Call" then function
       
   170         * call "CallToSenderQueryL" function with parameters "aSenderNumber"
       
   171         * and "aSenderName".
       
   172         * If currently highlighted item is selected and user select "Call"
       
   173         * then function call "CallToSenderQueryL" function with parameters "aSenderNumber"
       
   174         * and KNullDesC. If no phone number is highlighted in message and user
       
   175         * select Send-key then function launch the normal call query.
       
   176         * @since 3.0
       
   177         * @param aSenderNumber: Sender phone number.
       
   178         * @param aSenderName: Sender name
       
   179         * @param aNumberInFocus: Phone number which is highlighted in message
       
   180         * @return Returns ETrue if the phone number was valid.
       
   181         */
       
   182         IMPORT_C static TBool InternetCallServiceL( 
       
   183             const TDesC& aSenderNumber,
       
   184             const TDesC& aSenderName,
       
   185             const TDesC& aNumberInFocus = KNullDesC,
       
   186             CEikonEnv* aEnv = NULL );
       
   187 
       
   188         /**
       
   189         * Sets message store to phone's internal memory.
       
   190         * This function is possible to use for example in situation
       
   191         * where current drive is memory card and memory card is not in use.
       
   192         * @param aSession: reference to CMsvSession object
       
   193         *
       
   194         */
       
   195         IMPORT_C  static void ChangeMessageStoreToPhoneL( CMsvSession& aSession );
       
   196 
       
   197         /**
       
   198         * Check if iUnicueID of memory card is same than uniqueid of
       
   199         * memory card in message server.
       
   200         * @param aSession: reference to CMsvSession object
       
   201         * @return Returns ETrue if iUniqueID of memory card is same than
       
   202         * memory card unique id in message server.
       
   203         *
       
   204         */
       
   205         IMPORT_C static TBool MmcDriveInfoL( CMsvSession& aSession );
       
   206 
       
   207         /**
       
   208         * Returns id of the default service of certain mtm type.
       
   209         * @param aSession: reference to CMsvSession object
       
   210         * @param aMtm: uid of the mtm type to be searched.
       
   211         * @param aFindFirstServiceIfNoDefault: if true returns first service
       
   212         *    if no default set.
       
   213         * @return TMsvId of the default service.
       
   214         *    KMsvUnknownServiceIndexEntryId if no default service.
       
   215         */
       
   216         IMPORT_C static TMsvId DefaultServiceForMTML(
       
   217             CMsvSession& aSession,
       
   218             TUid aMtm,
       
   219             TBool aFindFirstServiceIfNoDefault );
       
   220 
       
   221         /**
       
   222         * Sets default service for the certain mtm type.
       
   223         * @param aSession: reference to CMsvSession object
       
   224         * @param aMtm: uid of the mtm type to be searched.
       
   225         * @param aServiceId: id of the new default service.
       
   226         */
       
   227         IMPORT_C static void SetDefaultServiceForMTML(
       
   228             CMsvSession& aSession,
       
   229             TUid aMtm,
       
   230             TMsvId aServiceId );
       
   231             
       
   232         /**
       
   233         * Checks if phone is in offline mode or not
       
   234         * Make sure that offline feature has been checked 
       
   235         * using feature manager
       
   236         *
       
   237         * @return ETrue if phone is in offline mode
       
   238         *         Otherwise EFalse.
       
   239         */
       
   240         IMPORT_C static TBool IsPhoneOfflineL(); 
       
   241 
       
   242         /**
       
   243         * Resolves type of given address
       
   244         * Phone number is checked by CommonPhoneParser. 
       
   245         * Email address is checked by MsvUiServiceUtilities
       
   246         * @param aAddress address to check
       
   247         * @param aDefaultPhoneNumberType subtype of phone number check
       
   248         * @return TMuiuAddressType
       
   249         */
       
   250         IMPORT_C static TMuiuAddressType ResolveAddressTypeL(    
       
   251                     const TDesC&                        aAddress,
       
   252                     CommonPhoneParser::TPhoneNumberType aDefaultPhoneNumberType = 
       
   253                        CommonPhoneParser::EPhoneClientNumber);
       
   254                      
       
   255         /**
       
   256         * Converts UTC time to local time
       
   257         *
       
   258         * @param aTime Utc time that is converted to local time on return. 
       
   259         */
       
   260         IMPORT_C static void ConvertUtcToLocalTime( TTime& aTime );
       
   261         
       
   262         /**
       
   263          * Compares two phone numbers.
       
   264          * @param aNumber1
       
   265          * @param aNumber2
       
   266          * @return ETrue if numbers are same, EFalse if numbers are different.
       
   267          */
       
   268         IMPORT_C static TBool ComparePhoneNumberL(
       
   269             const TDesC& aNumber1, const TDesC& aNumber2, TInt aCompareLength = -1);
       
   270         IMPORT_C static TBool OtherEmailMTMExistL( CMsvSession& aSession, TInt aMailbox = 0 );
       
   271                        
       
   272     private:
       
   273         /**
       
   274         * Launch CMuiuListQueryDialog
       
   275         * @param aGroupedNumberPtr Phone number 
       
   276         * which is groupped before it goes to dialog
       
   277         * @param aIndex tell which item is selected when dialog is closed
       
   278         * @return command id of dialog:
       
   279         * return 1 if user select some item in the list, 
       
   280         * return 0 if user cancel selection
       
   281         */
       
   282         static TInt LaunchDialogL( const TPtr aGroupedNumberPtr, TInt* aIndex );
       
   283 
       
   284     };
       
   285 
       
   286 #endif //__MSVUISERVICEUTILITIES_H__
       
   287 
       
   288 // End of file