emailservices/emailserver/cmailhandlerplugin/inc/fsmailmtmhandler.h
changeset 0 8466d47a6819
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2007 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: This file defines class CFSMailMtmHandler.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __FSMAIL_MTM_HANDLER_H__
       
    20 #define __FSMAIL_MTM_HANDLER_H__
       
    21 
       
    22 #include <msvapi.h>
       
    23 
       
    24 #include "fsnotificationhandlerbase.h"
       
    25 
       
    26 class CMsvSession;
       
    27 class CClientMtmRegistry;
       
    28 class CFsMtmClient;
       
    29 
       
    30 /**
       
    31  *  Class to handle informing of mtm about new/removed accounts
       
    32  *
       
    33  *  @code
       
    34  *   ?good_class_usage_example(s)
       
    35  *  @endcode
       
    36  *
       
    37  *  @lib ?library
       
    38  *  @since S60 ?S60_version *** for example, S60 v3.0
       
    39  */
       
    40 class CFSMailMtmHandler : public CFSNotificationHandlerBase,
       
    41                           public MMsvSessionObserver
       
    42     {
       
    43 public:
       
    44 
       
    45     /**
       
    46      * Two-phased constructor.
       
    47      * @param aMailClient Object to access email framework
       
    48      * @param aOwner Owner and manager of this handler. NULL if not
       
    49      *               specified.
       
    50      */	
       
    51     static CFSMailMtmHandler* NewL( MFSNotificationHandlerMgr& aOwner );
       
    52     /**
       
    53     * Destructor.
       
    54     */
       
    55     virtual ~CFSMailMtmHandler();
       
    56 
       
    57 // from base class MMsvSessionObserver
       
    58     void HandleSessionEventL(
       
    59         TMsvSessionEvent aEvent,
       
    60         TAny* aArg1, 
       
    61         TAny* aArg2,
       
    62         TAny* aArg3 );
       
    63 
       
    64 protected:
       
    65 
       
    66 
       
    67 // from base class CFSNotificationHandlerBase  
       
    68 
       
    69     /**
       
    70      * From CFSNotificationHandlerBase.
       
    71      * Implementation of CapabilitiesToContinueL. Checks whether
       
    72      * the mailbox handles the mtm communication itself.
       
    73      *
       
    74      * @see CFSNotificationHandlerBase::CapabilitiesToContinueL 
       
    75      *
       
    76      * @since S60 ?S60_version
       
    77      */
       
    78     virtual TBool CapabilitiesToContinueL(
       
    79         TFSMailEvent aEvent,
       
    80         TFSMailMsgId aMailbox,
       
    81         TAny* aParam1,
       
    82         TAny* aParam2,
       
    83         TAny* aParam3 ) const;
       
    84 
       
    85     /**
       
    86      * Function that does the actual event handling.
       
    87      *
       
    88      * @see CFSNotificationHandlerBase::EventL
       
    89      *
       
    90      * @since S60 ?S60_version
       
    91      */ 
       
    92     virtual void HandleEventL(
       
    93         TFSMailEvent aEvent,
       
    94         TFSMailMsgId aMailbox,
       
    95         TAny* aParam1,
       
    96         TAny* aParam2,
       
    97         TAny* aParam3 );
       
    98 
       
    99     
       
   100 private:
       
   101 
       
   102     /**
       
   103      * Constructor.
       
   104      *
       
   105      * @since S60 ?S60_version
       
   106      * @param aOwner Owner and manager of this handler.
       
   107      */ 
       
   108     CFSMailMtmHandler( MFSNotificationHandlerMgr& aOwner );
       
   109     void ConstructL();
       
   110 
       
   111     /**
       
   112      * Function to setup the mtm client before usage.
       
   113      *
       
   114      * @since S60 ?S60_version
       
   115      */
       
   116     void InstallMtmL();
       
   117     
       
   118     /**
       
   119      * Function to be called when mtm client is not needed anymore.
       
   120      *
       
   121      * @since S60 ?S60_version
       
   122      */
       
   123     void UninstallMtm();
       
   124 
       
   125     /**
       
   126      * Function used to retrieve file name for resource file used
       
   127      * in mtm installation/uninstallation.
       
   128      *
       
   129      * @since S60 ?S60_version
       
   130      * @return File name.
       
   131      */
       
   132     TFileName InstallationFilenameL();
       
   133 
       
   134     /**
       
   135      * Function to kill desired process.
       
   136      *
       
   137      * @since S60 ?S60_version
       
   138      * @param aName Name of the process. Kills all processes with given name
       
   139      */    
       
   140     void KillProcess( const TDesC& aName );
       
   141 
       
   142     /**
       
   143      * Kills applications with uids defined in KAppsToKill
       
   144      *
       
   145      * @since S60 ?S60_version
       
   146      */       
       
   147     void KillAppsL();
       
   148 
       
   149 // from base class CFSNotificationHandlerBase         
       
   150     virtual void TurnNotificationOn();
       
   151     virtual void TurnNotificationOff();
       
   152 
       
   153 private: // data
       
   154 	
       
   155 	/**
       
   156      * Boolean to inform whether we are in the start up or not.
       
   157      * ETrue means that we are starting up.
       
   158      */ 	
       
   159 	TBool iStartingUp;
       
   160 	
       
   161 	/**
       
   162      * Session to message server.
       
   163      * Own.
       
   164      */ 
       
   165 	CMsvSession* iMsvSession;
       
   166 	
       
   167 	/**
       
   168      * Access to client side MTM registry.
       
   169      * Own.
       
   170      */ 	
       
   171 	CClientMtmRegistry* iMtmRegistry;
       
   172 	
       
   173 	/**
       
   174      * MTM client used to notify of changes in accounts.
       
   175      * Own.
       
   176      */  
       
   177 	CFsMtmClient* iMtmClient;
       
   178 	
       
   179     };
       
   180 
       
   181 
       
   182 #endif  //__FSMAIL_MTM_HANDLER_H__