|
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 * Encapsulates connection validation |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef __MSVPOP3CONNECTOP_H__ |
|
20 #define __MSVPOP3CONNECTOP_H__ |
|
21 |
|
22 #include <ImumInternalApi.h> // CImumInternalApi |
|
23 #include <pop3set.h> |
|
24 #include <MsvPrgReporter.h> |
|
25 #include "ImumOnlineOperation.h" |
|
26 |
|
27 class CImumInSettingsData; |
|
28 class CMsvEmailConnectionProgressProvider; |
|
29 |
|
30 /** |
|
31 * Connect operation. |
|
32 * Encapsulates connection validation. |
|
33 */ |
|
34 class CMsvPop3ConnectOp : |
|
35 public CImumOnlineOperation |
|
36 { |
|
37 public: |
|
38 |
|
39 /** |
|
40 * |
|
41 */ |
|
42 static CMsvPop3ConnectOp* NewL( |
|
43 TRequestStatus& aObserverRequestStatus, |
|
44 MMsvProgressReporter& aReporter, |
|
45 TMsvId aService, |
|
46 TInt aPopulateLimit ); |
|
47 |
|
48 /** |
|
49 * |
|
50 */ |
|
51 virtual ~CMsvPop3ConnectOp(); |
|
52 |
|
53 /** |
|
54 * |
|
55 */ |
|
56 virtual const TDesC8& ProgressL(); |
|
57 |
|
58 /** |
|
59 * |
|
60 */ |
|
61 virtual const TDesC8& GetErrorProgressL(TInt aError); |
|
62 |
|
63 /** |
|
64 * |
|
65 */ |
|
66 inline TBool Connected() const; |
|
67 |
|
68 protected: |
|
69 |
|
70 /** |
|
71 * From CActive |
|
72 */ |
|
73 virtual void DoCancel(); |
|
74 |
|
75 /** |
|
76 * From CActive |
|
77 */ |
|
78 virtual void DoRunL(); |
|
79 private: |
|
80 |
|
81 /** |
|
82 * |
|
83 */ |
|
84 CMsvPop3ConnectOp( |
|
85 CImumInternalApi* aMailboxApi, |
|
86 TRequestStatus& aObserverRequestStatus, |
|
87 MMsvProgressReporter& aReporter, |
|
88 TMsvId aServiceId, |
|
89 TInt aPopulateLimit); |
|
90 |
|
91 /** |
|
92 * |
|
93 */ |
|
94 void ConstructL(); |
|
95 |
|
96 /** |
|
97 * |
|
98 */ |
|
99 void DoConnectL(); |
|
100 |
|
101 /** |
|
102 * |
|
103 * |
|
104 */ |
|
105 void DoPopulateL(); |
|
106 /** |
|
107 * |
|
108 */ |
|
109 TBool ValidateL( CImumInSettingsData& aSettings ); |
|
110 |
|
111 /** |
|
112 * |
|
113 */ |
|
114 inline void SetFlag(TUint32 aFlag); |
|
115 |
|
116 /** |
|
117 * |
|
118 */ |
|
119 inline void UnsetFlag(TUint32 aFlag); |
|
120 |
|
121 /** |
|
122 * |
|
123 */ |
|
124 inline TBool FlagIsSet(TUint32 aFlag) const; |
|
125 |
|
126 private: // Data |
|
127 enum TFlags { |
|
128 EUnsetPassword = 0x01, |
|
129 EInvalidDetails = 0x02, |
|
130 EDoConnect = 0x04, |
|
131 EMaxNumberOfLoginTries = 0x08, |
|
132 EIapWasInvalid = 0x10, |
|
133 EDoingPopulate = 0x20 }; |
|
134 |
|
135 TUint32 iFlags; |
|
136 CMsvEntry* iEntry; |
|
137 CMsvEmailConnectionProgressProvider* iProgProvider; |
|
138 TPckgBuf<TPop3Progress> iProgress; |
|
139 TInt iLoginRetryCounter; |
|
140 |
|
141 TInt iPopulateLimit; |
|
142 CMsvEntrySelection* iSelection; |
|
143 TBool iPopulated; |
|
144 // Own: Mailbox API |
|
145 CImumInternalApi* iMboxApi; |
|
146 }; |
|
147 |
|
148 inline TBool CMsvPop3ConnectOp::Connected() const |
|
149 { |
|
150 return iEntry->Entry().Connected(); |
|
151 } |
|
152 |
|
153 inline void CMsvPop3ConnectOp::SetFlag(TUint32 aFlag) |
|
154 { |
|
155 iFlags |= aFlag; |
|
156 } |
|
157 |
|
158 inline void CMsvPop3ConnectOp::UnsetFlag(TUint32 aFlag) |
|
159 { |
|
160 iFlags &= (~aFlag); |
|
161 } |
|
162 |
|
163 inline TBool CMsvPop3ConnectOp::FlagIsSet(TUint32 aFlag) const |
|
164 { |
|
165 return (iFlags & aFlag); |
|
166 } |
|
167 |
|
168 |
|
169 #endif |