|
1 /* |
|
2 * Copyright (c) 2006 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: |
|
15 * Static functions for validating account settings prior to connection |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __MSVCONNECTIONVALIDATION_H__ |
|
22 #define __MSVCONNECTIONVALIDATION_H__ |
|
23 |
|
24 #include <msvapi.h> |
|
25 #include <eikdialg.h> |
|
26 #include <iapprefs.h> |
|
27 #include <ImumInternalApi.h> |
|
28 |
|
29 #include "Imas.hrh" // For KImasPasswordLength, KImasImailServiceNameLength |
|
30 #include "ComDbUtl.h" |
|
31 |
|
32 // CONSTANTS |
|
33 enum TIMASPasswordSave |
|
34 { |
|
35 EIMASPasswordNoSave = 0, |
|
36 EIMASPasswordTempSave, |
|
37 EIMASPasswordPermanentSave, |
|
38 EIMASPasswordCancelSave // User cancelled username/password query |
|
39 }; |
|
40 |
|
41 // FORWARD DECLEARATIONS |
|
42 |
|
43 class CMsvCommDbUtilities; |
|
44 class CImBaseEmailSettings; |
|
45 class MMsvProgressReporter; |
|
46 |
|
47 class TMsvLoginData |
|
48 { |
|
49 public: |
|
50 TBuf8<KImasLoginLength> iUsername; |
|
51 TBuf8<KImasPasswordLength> iPassword; |
|
52 TBool iIsPasswordTemporary; |
|
53 }; |
|
54 |
|
55 /** |
|
56 * MsvConnectionValidation |
|
57 * |
|
58 * Static functions for validating account settings prior to connection. |
|
59 */ |
|
60 class MsvConnectionValidation |
|
61 { |
|
62 public: |
|
63 |
|
64 /** |
|
65 * Queries the login information and stores them to settings |
|
66 * @since S60 3.0 |
|
67 */ |
|
68 static TIMASPasswordSave RunAndHandleLoginDialogL( |
|
69 TDes8& aUserName, |
|
70 TDes8& aPassword, |
|
71 TBool& aPasswordTemporary ); |
|
72 |
|
73 /** |
|
74 * Check that there is a password specified for aRcvServiceId, and if not, set 'aNoPassword', |
|
75 * prompt user to enter one, and store it in the settings. Returns EFalse if user cancels. |
|
76 * @param aMailboxApi: Mailbox api |
|
77 * @param aServiceId: service id to be connected |
|
78 * @param aLoginData: Username and password |
|
79 * @param aLoginRetryCounter: incremented by 1 if login dialog is displayed |
|
80 */ |
|
81 static TBool CheckAndPromptForPasswordL( |
|
82 CImumInternalApi& aMailboxApi, |
|
83 TMsvId aServiceId, |
|
84 TMsvLoginData aLoginData, |
|
85 TInt& aLoginRetryCounter ); |
|
86 |
|
87 |
|
88 /** |
|
89 * Prompt the user to check the login details for aRcvServiceId, allowing them to change the |
|
90 * details. Returns EFalse if user cancels. |
|
91 */ |
|
92 static TBool ShowLoginDetailsRejectionDlgL( |
|
93 CImumInternalApi& aMailboxApi, |
|
94 TMsvId aRcvServiceId); |
|
95 |
|
96 /** |
|
97 * Check that the IAP specified for aSendServiceId is valid |
|
98 * If current iap is not valid removes all the iaps from the service and returns EFalse. |
|
99 * @return ETrue if services iap found from commdb, EFalse if not. |
|
100 */ |
|
101 static TBool CheckForIapL( |
|
102 CMsvSession& aSession, |
|
103 TMsvId aServiceId ); |
|
104 |
|
105 /** |
|
106 * Get the name of the service with Id aServiceId. |
|
107 */ |
|
108 static void GetServiceNameL(CMsvSession& aSession, TMsvId aServiceId, TDes& aServiceName); |
|
109 |
|
110 /** |
|
111 * Get the name of the IAP in use for the aMtmId. |
|
112 */ |
|
113 static void GetServiceIapNameL(CImumInSettingsData& aAccountSettings, |
|
114 TUid aMtmUid, TDes& aIapName); |
|
115 |
|
116 private: |
|
117 |
|
118 /** |
|
119 * |
|
120 */ |
|
121 static CImBaseEmailSettings* InstantiateSettingsObjectLC(const TMsvEntry& aEntry, TUid& aMtmType); |
|
122 |
|
123 /** |
|
124 * |
|
125 */ |
|
126 static TInt RunUsernameAndPasswordDialogL( TDes& aUserName, TDes& aPassword ); |
|
127 |
|
128 /** |
|
129 * |
|
130 * @since S60 3.0 |
|
131 */ |
|
132 static TBool IsAlwaysAskSet( |
|
133 const CImIAPPreferences& iapPref ); |
|
134 }; |
|
135 |
|
136 |
|
137 |
|
138 #endif // __MSVCONNECTIONVALIDATION_H__ |