williamr@2: // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@4: // under the terms of "Eclipse Public License v1.0" williamr@2: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: #ifndef IAPPrefs__ williamr@2: #define IAPPrefs__ williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: williamr@2: // Note: Version 1 = EPOC6.1 williamr@2: // Version 2 = EPOC6.2 / Hurricane williamr@2: const TInt KImIAPPreferencesVersion = 2; // identify which version of this class has been stored williamr@2: williamr@2: // for builds which don't define it. williamr@2: /* williamr@2: enum TCommDbDialogPref williamr@2: { williamr@2: ECommDbDialogPrefUnknown =0, williamr@2: ECommDbDialogPrefPrompt, williamr@2: ECommDbDialogPrefWarn, williamr@2: ECommDbDialogPrefDoNotPrompt williamr@2: }; williamr@2: */ williamr@2: williamr@2: class TImIAPChoice williamr@2: /** Sets the connection dialog preference to be used with a particular IAP used williamr@2: for an internet mail service. williamr@2: williamr@2: The connection control component (GenConn) allows various options for whether williamr@2: or not the user should be should be prompted with a dialog at connect time. williamr@2: For example, a connection using the first choice GPRS IAP might not show a williamr@2: dialog, but a second choice connection using GSM might bring up a warning. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: /** The IAP identifier, as specified in the CommDb record for the IAP. */ williamr@2: TUint32 iIAP; williamr@2: /** Preference for what type of dialog is shown before a connection is made using williamr@2: the specified IAP. */ williamr@2: TCommDbDialogPref iDialogPref; williamr@2: }; williamr@2: williamr@2: class CImIAPPreferences : public CBase williamr@2: /** Encapsulates preferences relating to IAPs for an email service. williamr@2: williamr@2: An IAP defines all of the variable factors that determine how an Internet williamr@2: connection is made. These variable factors can include the bearer (CDMA, GSM williamr@2: or GPRS), dial-in number. network login names and passwords. williamr@2: williamr@2: The Comms Database is capable of storing details of several IAPs, which can williamr@2: then be used to initiate different types of connection. The database also williamr@2: stores the preference order of the IAPs: this defines which IAP should be williamr@2: used as the first choice, and also an optional second choice to be used if williamr@2: the first choice is not available. williamr@2: williamr@2: The CImIAPPreferences class associates a first choice, and optionally a second williamr@2: choice IAP to use with a particular email service. The preference object is williamr@2: stored in the service entry's message store. williamr@2: williamr@2: For SMTP, if no object has been stored in the service, then the SMTP client williamr@2: will attempt to use any default Internet settings in the Comms Database, or williamr@2: will use the existing Internet connection if one does already exist. Note williamr@2: that SMTP sessions will normally fail to send any email messages if the SMTP williamr@2: session is not created using an IAP which the SMTP server does not accept. williamr@2: williamr@2: Note that in Symbian OS v6.0 a single IAP was associated with an email service williamr@2: entry through the iMtmData1 field. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C static CImIAPPreferences* NewLC(); williamr@2: IMPORT_C TInt Version() const; williamr@2: IMPORT_C TInt NumberOfIAPs() const; williamr@2: IMPORT_C TImIAPChoice IAPPreference(TInt aPreference) const; williamr@2: IMPORT_C void AddIAPL(TImIAPChoice aIap, TInt aIndex=0); williamr@2: IMPORT_C void RemoveIAPL(TInt aPreferenceNumber); williamr@2: IMPORT_C TInt FindIAPL(TUint32 aIAP, TInt &aLocation) const; williamr@2: IMPORT_C void ReplaceIAPL(TInt aPreferenceNumber,TImIAPChoice aIap); williamr@2: IMPORT_C ~CImIAPPreferences(); williamr@2: IMPORT_C TBool SNAPDefined() const; williamr@2: IMPORT_C TUint32 SNAPPreference() const; williamr@2: IMPORT_C void SetSNAPL(TUint32 aSnap); williamr@2: IMPORT_C void RemoveSNAP(); williamr@2: williamr@2: void Reset(); williamr@2: williamr@2: // class constants williamr@2: /** williamr@2: @deprecated williamr@2: */ williamr@2: enum williamr@2: { williamr@2: KSanityCheckOldWins = 0xEFBEADDE, williamr@2: KSanityCheck = 0xDEADBEEF williamr@2: }; williamr@2: /** ID of the stream used to store IAP preference information in a williamr@2: message store. */ williamr@2: const static TUid KUidMsgFileInternetAccessPreferences; williamr@2: private: williamr@2: CArrayFixFlat* iChoices; williamr@2: TInt iVersion; williamr@2: TUint32 iSnapId; williamr@2: private: williamr@2: CImIAPPreferences(); williamr@2: CImIAPPreferences(CImIAPPreferences& aOther); // not implemented williamr@2: int operator=(CImIAPPreferences& aOther); // not implemented williamr@2: void ConstructL(); williamr@2: void Panic(int err) const; williamr@2: }; williamr@2: williamr@2: #endif