62 void CFSNotificationHandlerMgr::ConstructL() |
66 void CFSNotificationHandlerMgr::ConstructL() |
63 { |
67 { |
64 FUNC_LOG; |
68 FUNC_LOG; |
65 // Performs the time consuming initialization asynchronously in RunL, in order |
69 // Performs the time consuming initialization asynchronously in RunL, in order |
66 // to let the process startup finish quicker |
70 // to let the process startup finish quicker |
|
71 iTimer.CreateLocal(); |
|
72 SetActive(); |
|
73 iState = EPrepareInitialization; |
67 TRequestStatus* status = &iStatus; |
74 TRequestStatus* status = &iStatus; |
68 User::RequestComplete(status, KErrNone); |
75 User::RequestComplete( status, KErrNone ); |
69 SetActive(); |
|
70 } |
76 } |
71 |
77 |
72 // --------------------------------------------------------------------------- |
78 // --------------------------------------------------------------------------- |
73 // Finishes the initialization |
79 // Finishes the initialization |
74 // --------------------------------------------------------------------------- |
80 // --------------------------------------------------------------------------- |
75 // |
81 // |
76 void CFSNotificationHandlerMgr::RunL() |
82 void CFSNotificationHandlerMgr::RunL() |
77 { |
83 { |
78 FUNC_LOG; |
84 FUNC_LOG; |
79 // Create mail client |
85 |
80 iMailClient = CFSMailClient::NewL(); |
86 TBool goToNextState = ETrue; |
81 if ( iMailClient == NULL ) |
87 |
82 { |
88 switch( iState ) |
83 User::Leave( KErrNoMemory ); |
89 { |
84 } |
90 case EPrepareInitialization: |
85 |
91 { |
86 // Once mail client is created ok, disk space needs to be checked |
92 // Create mail client |
87 // and cleaned if necessary |
93 iMailClient = CFSMailClient::NewL(); |
88 CleanTempFilesIfNeededL(); |
94 if ( iMailClient == NULL ) |
89 |
95 { |
90 //<cmail> |
96 User::Leave( KErrNoMemory ); |
91 // Notification handlers are created next. |
97 } |
92 // Notice that if a handler cannot be created it does not mean |
98 // Once mail client is created ok, disk space needs to be checked |
93 // that the construction of the manager would be stopped. This |
99 // and cleaned if necessary |
94 // approach is chosen so that if something goes wrong with |
100 CleanTempFilesIfNeededL(); |
95 // construction of a handler it can safely leave and get |
101 break; |
96 // destroyed but does not interfere other handlers. |
102 } |
97 |
103 case EInitializeMailIconHandler: |
98 CreateAndStoreHandlerL( KMailIconHandlerUid ); |
104 { |
99 |
105 CreateAndStoreHandlerL( KMailIconHandlerUid ); |
100 CreateAndStoreHandlerL( KLedHandlerUid ); |
106 break; |
101 |
107 } |
|
108 case EInitializeLedHandler: |
|
109 { |
|
110 CreateAndStoreHandlerL( KLedHandlerUid ); |
|
111 break; |
|
112 } |
102 #ifndef __WINS__ |
113 #ifndef __WINS__ |
103 CreateAndStoreHandlerL( KSoundHandlerUid ); |
114 case ESoundHandler: |
104 // Earlier RefreshData() was called for the soundhandler |
115 { |
105 // object after creation, but as it does not do anything |
116 // Earlier RefreshData() was called for the soundhandler |
106 // it is not called anymore. |
117 // object after creation, but as it does not do anything |
|
118 // it is not called anymore. |
|
119 CreateAndStoreHandlerL( KSoundHandlerUid ); |
|
120 break; |
|
121 } |
107 #endif |
122 #endif |
108 |
123 case EInitializeMtmHandler: |
109 CreateAndStoreHandlerL( KMtmHandlerUid ); |
124 { |
110 |
125 CreateAndStoreHandlerL( KMtmHandlerUid ); |
111 CreateAndStoreHandlerL( KOutofMemoryHandlerUid ); |
126 break; |
112 |
127 } |
113 CreateAndStoreHandlerL( KAuthenticationHandlerUid ); |
128 case EInitializeOutofMemoryHandler: |
114 |
129 { |
115 CreateAndStoreHandlerL( KMessageQueryHandlerUid ); |
130 CreateAndStoreHandlerL( KOutofMemoryHandlerUid ); |
116 |
131 break; |
117 CreateAndStoreHandlerL( KCMailCpsHandlerUid ); |
132 } |
118 //</cmail> |
133 case EInitializeAuthenticationHandler: |
119 |
134 { |
120 StartObservingL(); |
135 CreateAndStoreHandlerL( KAuthenticationHandlerUid ); |
|
136 break; |
|
137 } |
|
138 case EInitializeMessageQueryHandlerUid: |
|
139 { |
|
140 CreateAndStoreHandlerL( KMessageQueryHandlerUid ); |
|
141 break; |
|
142 } |
|
143 case EWaitForPluginsReady: |
|
144 { |
|
145 if ( !iMailClient->AreAllPluginsLoaded() ) |
|
146 { |
|
147 goToNextState = EFalse; |
|
148 SetActive(); |
|
149 iTimer.After( iStatus, KDelay ); |
|
150 } |
|
151 break; |
|
152 } |
|
153 case EInitializeCMailCpsHandlerUid: |
|
154 { |
|
155 CreateAndStoreHandlerL( KCMailCpsHandlerUid ); |
|
156 break; |
|
157 } |
|
158 case EFinish: |
|
159 { |
|
160 StartObservingL(); |
|
161 goToNextState = EFalse; |
|
162 break; |
|
163 } |
|
164 default: |
|
165 { |
|
166 User::Panic( KFSMailServerPanic, KUndefinedState ); |
|
167 break; |
|
168 } |
|
169 } |
|
170 if ( goToNextState ) |
|
171 { |
|
172 iState = TState( iState + 1 ); |
|
173 SetActive(); |
|
174 TRequestStatus* status = &iStatus; |
|
175 User::RequestComplete( status, KErrNone ); |
|
176 } |
121 } |
177 } |
122 |
178 |
123 // --------------------------------------------------------------------------- |
179 // --------------------------------------------------------------------------- |
124 // |
180 // |
125 // --------------------------------------------------------------------------- |
181 // --------------------------------------------------------------------------- |