|
1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef IAPPrefs__ |
|
17 #define IAPPrefs__ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <msvapi.h> |
|
24 #include <msvuids.h> |
|
25 #include <cdbcols.h> |
|
26 |
|
27 // Note: Version 1 = EPOC6.1 |
|
28 // Version 2 = EPOC6.2 / Hurricane |
|
29 const TInt KImIAPPreferencesVersion = 2; // identify which version of this class has been stored |
|
30 |
|
31 // for builds which don't define it. |
|
32 /* |
|
33 enum TCommDbDialogPref |
|
34 { |
|
35 ECommDbDialogPrefUnknown =0, |
|
36 ECommDbDialogPrefPrompt, |
|
37 ECommDbDialogPrefWarn, |
|
38 ECommDbDialogPrefDoNotPrompt |
|
39 }; |
|
40 */ |
|
41 |
|
42 class TImIAPChoice |
|
43 /** Sets the connection dialog preference to be used with a particular IAP used |
|
44 for an internet mail service. |
|
45 |
|
46 The connection control component (GenConn) allows various options for whether |
|
47 or not the user should be should be prompted with a dialog at connect time. |
|
48 For example, a connection using the first choice GPRS IAP might not show a |
|
49 dialog, but a second choice connection using GSM might bring up a warning. |
|
50 @publishedAll |
|
51 @released |
|
52 */ |
|
53 { |
|
54 public: |
|
55 /** The IAP identifier, as specified in the CommDb record for the IAP. */ |
|
56 TUint32 iIAP; |
|
57 /** Preference for what type of dialog is shown before a connection is made using |
|
58 the specified IAP. */ |
|
59 TCommDbDialogPref iDialogPref; |
|
60 }; |
|
61 |
|
62 class CImIAPPreferences : public CBase |
|
63 /** Encapsulates preferences relating to IAPs for an email service. |
|
64 |
|
65 An IAP defines all of the variable factors that determine how an Internet |
|
66 connection is made. These variable factors can include the bearer (CDMA, GSM |
|
67 or GPRS), dial-in number. network login names and passwords. |
|
68 |
|
69 The Comms Database is capable of storing details of several IAPs, which can |
|
70 then be used to initiate different types of connection. The database also |
|
71 stores the preference order of the IAPs: this defines which IAP should be |
|
72 used as the first choice, and also an optional second choice to be used if |
|
73 the first choice is not available. |
|
74 |
|
75 The CImIAPPreferences class associates a first choice, and optionally a second |
|
76 choice IAP to use with a particular email service. The preference object is |
|
77 stored in the service entry's message store. |
|
78 |
|
79 For SMTP, if no object has been stored in the service, then the SMTP client |
|
80 will attempt to use any default Internet settings in the Comms Database, or |
|
81 will use the existing Internet connection if one does already exist. Note |
|
82 that SMTP sessions will normally fail to send any email messages if the SMTP |
|
83 session is not created using an IAP which the SMTP server does not accept. |
|
84 |
|
85 Note that in Symbian OS v6.0 a single IAP was associated with an email service |
|
86 entry through the iMtmData1 field. |
|
87 @publishedAll |
|
88 @released |
|
89 */ |
|
90 { |
|
91 public: |
|
92 IMPORT_C static CImIAPPreferences* NewLC(); |
|
93 IMPORT_C TInt Version() const; |
|
94 IMPORT_C TInt NumberOfIAPs() const; |
|
95 IMPORT_C TImIAPChoice IAPPreference(TInt aPreference) const; |
|
96 IMPORT_C void AddIAPL(TImIAPChoice aIap, TInt aIndex=0); |
|
97 IMPORT_C void RemoveIAPL(TInt aPreferenceNumber); |
|
98 IMPORT_C TInt FindIAPL(TUint32 aIAP, TInt &aLocation) const; |
|
99 IMPORT_C void ReplaceIAPL(TInt aPreferenceNumber,TImIAPChoice aIap); |
|
100 IMPORT_C ~CImIAPPreferences(); |
|
101 IMPORT_C TBool SNAPDefined() const; |
|
102 IMPORT_C TUint32 SNAPPreference() const; |
|
103 IMPORT_C void SetSNAPL(TUint32 aSnap); |
|
104 IMPORT_C void RemoveSNAP(); |
|
105 |
|
106 void Reset(); |
|
107 |
|
108 // class constants |
|
109 /** |
|
110 @deprecated |
|
111 */ |
|
112 enum |
|
113 { |
|
114 KSanityCheckOldWins = 0xEFBEADDE, |
|
115 KSanityCheck = 0xDEADBEEF |
|
116 }; |
|
117 /** ID of the stream used to store IAP preference information in a |
|
118 message store. */ |
|
119 const static TUid KUidMsgFileInternetAccessPreferences; |
|
120 private: |
|
121 CArrayFixFlat<TImIAPChoice>* iChoices; |
|
122 TInt iVersion; |
|
123 TUint32 iSnapId; |
|
124 private: |
|
125 CImIAPPreferences(); |
|
126 CImIAPPreferences(CImIAPPreferences& aOther); // not implemented |
|
127 int operator=(CImIAPPreferences& aOther); // not implemented |
|
128 void ConstructL(); |
|
129 void Panic(int err) const; |
|
130 }; |
|
131 |
|
132 #endif |