emailservices/emailserver/cmailhandlerplugin/inc/cmailpluginproxy.h
branchRCL_3
changeset 8 e1b6206813b4
equal deleted inserted replaced
4:e7aa27f58ae1 8:e1b6206813b4
       
     1 /*
       
     2 * Copyright (c) 2009 - 2010 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 CMailMessageDetails.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CMAILPLUGINPROXY_H_
       
    19 #define CMAILPLUGINPROXY_H_
       
    20 
       
    21 #include <e32def.h>
       
    22 #include <e32base.h>
       
    23 #include <emailobserverplugin.h>
       
    24 #include <memailobserverlistener.h>
       
    25 #include <memailmailboxdata.h>
       
    26 
       
    27 class CMailExternalAccount;
       
    28 class CMailCpsIf;
       
    29 
       
    30 /**
       
    31  * Class that represents the 3rd party email widget plugin to the rest of the cps logic
       
    32  * Also takes care of all the email accounts that the plugin handles
       
    33  * @lib cmailhandlerplugin.lib
       
    34  * @since S60 v9.2
       
    35  */
       
    36 NONSHARABLE_CLASS( CMailPluginProxy ) : public CBase, public EmailInterface::MEmailObserverListener
       
    37     {
       
    38 public:
       
    39     static CMailPluginProxy* NewL(
       
    40         const TInt aPluginId,
       
    41         CMailCpsIf& aPublisher );
       
    42 
       
    43     virtual ~CMailPluginProxy();
       
    44     
       
    45     // From MEmailObserverListener
       
    46     /**
       
    47      * Called by 3rd party plugins when there are chnages in the data to be published
       
    48      * @param aData offers access to all the necessary data needed for publishing data on widget
       
    49      */
       
    50     void EmailObserverEvent( EmailInterface::MEmailData& aData );
       
    51 
       
    52     /**
       
    53      * Accessor for the plugin id
       
    54      * @return this plugin's 'implementation id'
       
    55      */
       
    56     TInt PluginId();
       
    57         
       
    58     /**
       
    59      * Whether this plugin handles the specified contentId (i.e. email account)
       
    60      * @param aContentId specifying a widget instance and a mailbox related to it
       
    61      * @return boolean
       
    62      */
       
    63     TBool HasAccount( const TDesC& aContentId );
       
    64     
       
    65     /**
       
    66      * Looks up the data related to trigger event, and launches the specified application
       
    67      * @param aContentId content id of the widget that received the key press
       
    68      */
       
    69     void LaunchExtAppL( const TDesC& aContentId );
       
    70     
       
    71     /**
       
    72      * Picks the accounts that belong to this plugin, and updates the data
       
    73      * publishing of them all
       
    74      * @param aAccounts list of external accounts
       
    75      */
       
    76     void SelectAndUpdateAccountsL( RPointerArray<CMailExternalAccount>& aAccounts );
       
    77 
       
    78     /**
       
    79      * Handles updating of one account/widget data based on contentId
       
    80      * @param aContentId content id of the widget
       
    81      */
       
    82     void UpdateAccountL( const TDesC& aContentId );
       
    83 
       
    84 private:
       
    85 
       
    86     void ConstructL();
       
    87 
       
    88     CMailPluginProxy(
       
    89         const TInt aPluginId,
       
    90         CMailCpsIf& aPublisher );
       
    91 
       
    92     void RemoveAccountsL();
       
    93     
       
    94     void ResetAccountL( const TDesC& aContentId );
       
    95 
       
    96     void ResetMessageRowL( const TInt aWidgetInstanceId, const TInt aRow );
       
    97 
       
    98     void SelectOwnAccountsL( RPointerArray<CMailExternalAccount>& aAccounts );
       
    99     
       
   100     TInt ResolveWidgetInstance( const TDesC& aContentId );
       
   101 
       
   102     TInt GetMailboxId( const TDesC& aContentId );
       
   103 
       
   104     void PublishAccountsL();
       
   105 
       
   106     void PublishAccountL( const TInt aWidgetInstanceId, const TInt aMailboxId );
       
   107 
       
   108     void PublishAccountL( const TInt aWidgetInstanceId, EmailInterface::MMailboxData& aMailboxData );
       
   109 
       
   110     void PublishFirstRowL( const TInt aWidgetInstanceId, EmailInterface::MMailboxData& aMailboxData );
       
   111     
       
   112     void PublishMessageRowL( const TInt aWidgetInstanceId, EmailInterface::MMessageData& aMessageData, const TInt aRow );
       
   113     
       
   114     HBufC* ConstructMailboxNameWithMessageCountLC( EmailInterface::MMailboxData& aMailboxData );
       
   115     
       
   116     TInt ResolveIndicatorIcon( EmailInterface::MMailboxData& aMailboxData );
       
   117 
       
   118     EmailInterface::MMailboxData& GetMailboxDataL( TInt aMailboxId );
       
   119     
       
   120     TInt UnreadCountL( EmailInterface::MMailboxData& aMailboxData );
       
   121     
       
   122 private: // data
       
   123     // identifier of the plugin
       
   124     TInt iPluginId;
       
   125     // plugin instance where rest of the data is buffered
       
   126     EmailInterface::CEmailObserverPlugin* iPlugin;
       
   127     // reference to publisher interface
       
   128     CMailCpsIf& iPublisher;
       
   129     // array of accounts that have widget and this plugin is responsible for
       
   130     RPointerArray<CMailExternalAccount> iAccounts;
       
   131     };
       
   132 
       
   133 #endif /* CMAILPLUGINPROXY_H_ */