omacp/omacpadapters/EmailAdapter/Inc/CWPEmailAdapter.h
changeset 0 3ce708148e4d
equal deleted inserted replaced
-1:000000000000 0:3ce708148e4d
       
     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:  Email setting adapter.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef _CWPEMAILADAPTER_H
       
    20 #define _CWPEMAILADAPTER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include "CWPAdapter.h"
       
    24 #include <MWPContextExtension.h>
       
    25 
       
    26 #include <msvapi.h>
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CDesC16Array;
       
    30 class CWPEmailItem;
       
    31 class CWPEmailSaveItem;
       
    32 class CCommsDatabase;
       
    33 
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38  * CWPEmailAdapter handles provisioning settings.
       
    39  *  @lib WPEmail.dll
       
    40  *  @since 2.0
       
    41  */ 
       
    42 class CWPEmailAdapter : public CWPAdapter, 
       
    43                         private MMsvSessionObserver, 
       
    44                         private MWPContextExtension
       
    45 	{
       
    46 	public:  // Constructors and destructor
       
    47         
       
    48         /**
       
    49         * Two-phased constructor.
       
    50         * @param None
       
    51         * @return self
       
    52         */
       
    53         static CWPEmailAdapter* NewL();
       
    54  		
       
    55         /// Destructor
       
    56         virtual ~CWPEmailAdapter();
       
    57 
       
    58     public: // From CWPAdapter
       
    59         /**
       
    60         * From CWPAdapter
       
    61         * @param 
       
    62         * @return 
       
    63         */     
       
    64         TInt ItemCount() const;
       
    65         /**
       
    66         * From CWPAdapter
       
    67         * @param 
       
    68         * @return 
       
    69         */             
       
    70 		const TDesC16& SummaryTitle(TInt aIndex) const;
       
    71 
       
    72         /**
       
    73         * From CWPAdapter
       
    74         * @param 
       
    75         * @return 
       
    76         */     		
       
    77 		const TDesC16& SummaryText(TInt aIndex) const;
       
    78 		
       
    79         /**
       
    80         * From CWPAdapter
       
    81         * @param 
       
    82         * @return 
       
    83         */     		
       
    84         void SaveL(TInt aItem);
       
    85 
       
    86         /**
       
    87         * From CWPAdapter
       
    88         * @param 
       
    89         * @return 
       
    90         */             
       
    91         TBool CanSetAsDefault( TInt aItem ) const;
       
    92 
       
    93         /**
       
    94         * From CWPAdapter
       
    95         * @param 
       
    96         * @return 
       
    97         */             
       
    98         void SetAsDefaultL( TInt aItem );
       
    99         
       
   100         /**
       
   101         * From CWPAdapter
       
   102         * @param 
       
   103         * @return 
       
   104         */             
       
   105 		TInt DetailsL( TInt aItem, MWPPairVisitor& aVisitor );
       
   106 
       
   107         /**
       
   108         * From CWPAdapter
       
   109         * @param 
       
   110         * @return 
       
   111         */     		
       
   112         TInt ContextExtension( MWPContextExtension*& );
       
   113 
       
   114 	private: // From MWPVisitor
       
   115         /**
       
   116         * From MWPVisitor
       
   117         * @param 
       
   118         * @return 
       
   119         */       
       
   120 		void VisitL(CWPCharacteristic& aElement);
       
   121 		
       
   122 		/**
       
   123         * From MWPVisitor
       
   124         * @param 
       
   125         * @return 
       
   126         */       
       
   127 		void VisitL(CWPParameter& aElement);
       
   128 		
       
   129 		/**
       
   130         * From MWPVisitor
       
   131         * @param 
       
   132         * @return 
       
   133         */       
       
   134 		void VisitLinkL(CWPCharacteristic& aCharacteristic );
       
   135     
       
   136     private: // From MWPContextExtension
       
   137 		
       
   138 		/**
       
   139         * From MWPContextExtension
       
   140         * @param 
       
   141         * @return 
       
   142         */    
       
   143 		const TDesC8& SaveDataL( TInt aIndex ) const;
       
   144 		
       
   145 		/**
       
   146         * From MWPContextExtension
       
   147         * @param 
       
   148         * @return 
       
   149         */    		
       
   150 		void DeleteL( const TDesC8& aSaveData );
       
   151 		
       
   152 		/**
       
   153         * From MWPContextExtension
       
   154         * @param 
       
   155         * @return 
       
   156         */    		
       
   157         TUint32 Uid() const;
       
   158 
       
   159 	private:  // Constructor
       
   160         /**
       
   161         * C++ default constructor.
       
   162         */
       
   163 		CWPEmailAdapter();
       
   164 
       
   165         /**
       
   166         * Symbian 2nd phase constructor.
       
   167         */
       
   168 		void ConstructL();
       
   169 
       
   170     private:  // New functions
       
   171 
       
   172         /**
       
   173         * Check are we dealing with email settings
       
   174         * @return ETrue if settings accepted
       
   175         */
       
   176         TBool AcceptedSettingGroup();
       
   177 
       
   178         /**
       
   179         * Add SMTP IMAP setting pair to iEmailSettingPair array
       
   180         * @param aSmtpItem SMTP setting item.
       
   181         * @param aImapItem IMAP setting item.
       
   182         */
       
   183         void AddSmtpImapSettingsL( CWPEmailItem* aSmtpItem, 
       
   184                                    CWPEmailItem* aImapItem );
       
   185 
       
   186         /**
       
   187         * Add SMTP POP setting pair to iEmailSettingPair array
       
   188         * @param aSmtpItem SMTP setting item.
       
   189         * @param aPopItem POP setting item.
       
   190         */
       
   191         void AddSmtpPopSettingsL( CWPEmailItem* aSmtpItem, 
       
   192                                   CWPEmailItem* aPopItem );
       
   193 
       
   194         /**
       
   195         * Search from iEmailSettings array a pair for new setting item.
       
   196         * If match found creates new setting pair. 
       
   197 		* @param aItem new setting item
       
   198         */
       
   199         void CreateSettingsL( CWPEmailItem* aItem );
       
   200     
       
   201     protected:  // Functions from base classes
       
   202         
       
   203         /**
       
   204         * From MMsvSessionObserver
       
   205         */
       
   206         void HandleSessionEventL( TMsvSessionEvent aEvent, 
       
   207                                   TAny* aArg1, 
       
   208                                   TAny* aArg2, 
       
   209                                   TAny* aArg3 );
       
   210 
       
   211 		
       
   212 	private:  // Data
       
   213         
       
   214         // Own: Message server session
       
   215         CMsvSession* iSession;
       
   216         
       
   217         /// Own: CommsDataBase
       
   218         CCommsDatabase* iCommsDb;
       
   219         /**
       
   220         * Own: Stores all individual settings
       
   221         */
       
   222         CArrayPtr<CWPEmailItem>* iEmailSettings;
       
   223         
       
   224         /** 
       
   225         * Own: Stores complete settings pairs
       
   226         */
       
   227         CArrayPtr<CWPEmailSaveItem>* iEmailSettingPair;
       
   228         
       
   229         /** 
       
   230         * Ref: Current setting item. 
       
   231         * Ownership is transferred to Setting array
       
   232         **/
       
   233         CWPEmailItem* iCurrentItem;
       
   234 
       
   235         /**
       
   236         * Own: Title text for email settings
       
   237         */
       
   238         HBufC* iTitle;
       
   239 	
       
   240     private: // For testing usage.
       
   241 		friend class T_CWPEmailAdapter;
       
   242         
       
   243 	};
       
   244 
       
   245 #endif	_CWPEMAILADAPTER_H
       
   246             
       
   247 // End of File