28 #include "msgstoresortcriteria.h" |
28 #include "msgstoresortcriteria.h" |
29 #include "msgstoresortresultiterator.h" |
29 #include "msgstoresortresultiterator.h" |
30 //Freestyle. |
30 //Freestyle. |
31 #include "cfsmailcommon.h" |
31 #include "cfsmailcommon.h" |
32 #include "cfsmailmessage.h" |
32 #include "cfsmailmessage.h" |
|
33 #include "cmrcalendarinfo.h" |
33 //</cmail> |
34 //</cmail> |
34 //Base plugin. |
35 //Base plugin. |
35 #include "baseplugin.h" |
36 #include "baseplugin.h" |
36 #include "basepluginpanic.h" |
37 #include "basepluginpanic.h" |
37 #include "baseplugincommonutils.h" |
38 #include "baseplugincommonutils.h" |
38 #include "mailiterator.h" |
39 #include "mailiterator.h" |
39 #include "baseplugindelayedopsprivate.h" |
40 #include "baseplugindelayedopsprivate.h" |
40 // Other |
41 // Other |
41 #include <e32base.h> |
42 #include <e32base.h> |
42 #include <utf.h> |
43 #include <utf.h> |
|
44 #include <calsession.h> |
43 |
45 |
44 //<cmail> |
46 //<cmail> |
45 #include "FreestyleEmailUiConstants.h" |
47 #include "FreestyleEmailUiConstants.h" |
46 //</cmail> |
48 //</cmail> |
47 |
49 |
255 |
257 |
256 CleanupStack::Pop( ownMailBox ); |
258 CleanupStack::Pop( ownMailBox ); |
257 |
259 |
258 MMRInfoProcessor* infoProcessor = CBaseMrInfoProcessor::NewL( *this ); |
260 MMRInfoProcessor* infoProcessor = CBaseMrInfoProcessor::NewL( *this ); |
259 result->SetMRInfoProcessorL( infoProcessor ); |
261 result->SetMRInfoProcessorL( infoProcessor ); |
|
262 |
|
263 //JOJA-83VJ4L Plugins need to set the correct Calendar Database ID for MRUI to work |
|
264 //get the calendar file name from the derived class |
|
265 const TDesC& calFileName = CalendarFileName(); |
|
266 if ( calFileName != KNullDesC ) |
|
267 { |
|
268 //the derived class does use its own calendar file, check if that file exists |
|
269 //the file may not exist because cal sync was disabled, or the file was deleted from the calendar UI |
|
270 CCalSession* calSession = CCalSession::NewL(); |
|
271 CleanupStack::PushL( calSession ); |
|
272 |
|
273 TRAPD( error, calSession->OpenL( calFileName ) ); |
|
274 if ( error == KErrNone ) |
|
275 { |
|
276 //calendar file exists, get its file id, and set it to cMail Celendar Info via the extention |
|
277 TCalFileId fileId = KNullFileId; |
|
278 calSession->FileIdL( fileId ); |
|
279 |
|
280 //get the extention api for the MR info, set the cal db id, and release the extention |
|
281 CEmailExtension* extension = NULL; |
|
282 TRAP( error, extension = result->ExtensionL( KMailboxExtMrCalInfo ) ); |
|
283 if ( error == KErrNone ) |
|
284 { |
|
285 CMRCalendarInfo* calInfo = reinterpret_cast<CMRCalendarInfo*>( extension ); |
|
286 calInfo->SetCalendarDatabaseIdL( fileId ); // cannot actually leave |
|
287 result->ReleaseExtension( calInfo ); |
|
288 } |
|
289 } |
|
290 |
|
291 CleanupStack::PopAndDestroy( calSession ); |
|
292 } |
260 |
293 |
261 CleanupStack::Pop( result ); |
294 CleanupStack::Pop( result ); |
262 |
295 |
263 __LOG_EXIT |
296 __LOG_EXIT |
264 return result; |
297 return result; |