emailservices/emailstore/base_plugin/src/basepluginmisc.cpp
branchRCL_3
changeset 64 3533d4323edc
parent 63 d189ee25cf9d
child 80 726fba06891a
equal deleted inserted replaced
63:d189ee25cf9d 64:3533d4323edc
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 
    19 
    20 //<cmail>
    20 //<cmail>
    21 #include "MsgStore.h"
    21 #include "msgstore.h"
    22 #include "MsgStoreSearchCriteria.h"
    22 #include "msgstoresearchcriteria.h"
    23 #include "MFSMailBoxSearchObserver.h"
    23 #include "mfsmailboxsearchobserver.h"
    24 //</cmail>
    24 //</cmail>
    25 
    25 
    26 #include "BasePlugin.h"
    26 #include "baseplugin.h"
    27 #include "BasePluginPanic.h"
    27 #include "basepluginpanic.h"
    28 #include "baseplugincommonutils.h"
    28 #include "baseplugincommonutils.h"
    29 #include "baseplugindelayedopsprivate.h"
    29 #include "baseplugindelayedopsprivate.h"
    30 
    30 
    31 /**
    31 /**
    32  * Base plugin has no particular id.
    32  * Base plugin has no particular id.
    33  */
    33  */
    34 TUint CBasePlugin::GetPluginId()
    34 EXPORT_C TUint CBasePlugin::GetPluginId()
    35     {
    35     {
    36     return 0;
    36     return 0;
    37     }
    37     }
    38 
    38 
    39 
    39 
    40 /**
    40 /**
    41  *
    41  *
    42  */
    42  */
    43 TFSMailBoxStatus CBasePlugin::GetMailBoxStatus(
    43 EXPORT_C TFSMailBoxStatus CBasePlugin::GetMailBoxStatus(
    44     const TFSMailMsgId& /*aMailBoxId*/ )
    44     const TFSMailMsgId& /*aMailBoxId*/ )
    45     {
    45     {
    46     return EFSMailBoxOnline;
    46     return EFSMailBoxOnline;
    47     }
    47     }
    48 
    48 
    49 
    49 
    50 /**
    50 /**
    51  *
    51  *
    52  */
    52  */
    53 TBool CBasePlugin::MailboxHasCapabilityL(
    53 EXPORT_C TBool CBasePlugin::MailboxHasCapabilityL(
    54     TFSMailBoxCapabilities /*aCapability*/,
    54     TFSMailBoxCapabilities /*aCapability*/,
    55     TFSMailMsgId /*aMailBoxId*/ )
    55     TFSMailMsgId /*aMailBoxId*/ )
    56     {
    56     {
    57     return EFalse;
    57     return EFalse;
    58     }
    58     }
    59 
    59 
    60 
    60 
    61 /**
    61 /**
    62  *
    62  *
    63  */
    63  */
    64 TInt CBasePlugin::WizardDataAvailableL()
    64 EXPORT_C TInt CBasePlugin::WizardDataAvailableL()
    65     {
    65     {
    66     return KErrNotSupported;
    66     return KErrNotSupported;
    67     }
    67     }
    68 
    68 
    69 
    69 
    70 /**
    70 /**
    71  *
    71  *
    72  */
    72  */
    73 void CBasePlugin::AuthenticateL(
    73 EXPORT_C void CBasePlugin::AuthenticateL(
    74     MFSMailRequestObserver& /*aOperationObserver*/,
    74     MFSMailRequestObserver& /*aOperationObserver*/,
    75     TInt /*aRequestId*/ )
    75     TInt /*aRequestId*/ )
    76     {
    76     {
    77 
    77 
    78     }
    78     }
    79 
    79 
    80 
    80 
    81 /**
    81 /**
    82  */
    82  */
    83 void CBasePlugin::SetCredentialsL(
    83 EXPORT_C void CBasePlugin::SetCredentialsL(
    84     const TFSMailMsgId& /* aMailBoxId */,
    84     const TFSMailMsgId& /* aMailBoxId */,
    85     const TDesC& /* aUsername */,
    85     const TDesC& /* aUsername */,
    86     const TDesC& /* aPassword */ )
    86     const TDesC& /* aPassword */ )
    87     {
    87     {
    88     User::Leave( KErrNotSupported );
    88     User::Leave( KErrNotSupported );
    90 
    90 
    91 
    91 
    92 /**
    92 /**
    93  *
    93  *
    94  */
    94  */
    95 TDesC& CBasePlugin::GetBrandingIdL( const TFSMailMsgId& aMailboxId )
    95 EXPORT_C TDesC& CBasePlugin::GetBrandingIdL( const TFSMailMsgId& aMailboxId )
    96     {
    96     {
    97     CMailboxInfo& mailbox = GetMailboxInfoL( aMailboxId.Id() );
    97     CMailboxInfo& mailbox = GetMailboxInfoL( aMailboxId.Id() );
    98     return *mailbox.iBrandingId;
    98     return *mailbox.iBrandingId;
    99     }
    99     }
   100 
   100 
   101 
   101 
   102 /**
   102 /**
   103  *
   103  *
   104  */
   104  */
   105 TInt CBasePlugin::CancelSyncL( const TFSMailMsgId& /*aMailBoxId*/ )
   105 EXPORT_C TInt CBasePlugin::CancelSyncL( const TFSMailMsgId& /*aMailBoxId*/ )
   106 	{
   106 	{
   107 	return KErrNotSupported;
   107 	return KErrNotSupported;
   108 	}
   108 	}
   109 
   109 
   110 
   110 
   169 
   169 
   170 
   170 
   171 /**
   171 /**
   172  *
   172  *
   173  */
   173  */
   174 void CBasePlugin::SearchL(
   174 EXPORT_C void CBasePlugin::SearchL(
   175     const TFSMailMsgId& aMailBoxId,
   175     const TFSMailMsgId& aMailBoxId,
   176     const RArray<TFSMailMsgId>& aFolderIds,
   176     const RArray<TFSMailMsgId>& aFolderIds,
   177     const RPointerArray<TDesC>& aSearchStrings,
   177     const RPointerArray<TDesC>& aSearchStrings,
   178     const TFSMailSortCriteria& aSortCriteria,
   178     const TFSMailSortCriteria& aSortCriteria,
   179     MFSMailBoxSearchObserver& aSearchObserver )
   179     MFSMailBoxSearchObserver& aSearchObserver )
   221 
   221 
   222 
   222 
   223 /**
   223 /**
   224  *
   224  *
   225  */
   225  */
   226 void CBasePlugin::CancelSearch(
   226 EXPORT_C void CBasePlugin::CancelSearch(
   227     const TFSMailMsgId& aMailBoxId )
   227     const TFSMailMsgId& aMailBoxId )
   228 
   228 
   229     {
   229     {
   230     TRAP_IGNORE( DoCancelSearchL( aMailBoxId ) );
   230     TRAP_IGNORE( DoCancelSearchL( aMailBoxId ) );
   231     }
   231     }
   232 
   232 
   233 
   233 
   234 /**
   234 /**
   235  *
   235  *
   236  */
   236  */
   237 void CBasePlugin::ClearSearchResultCache(
   237 EXPORT_C void CBasePlugin::ClearSearchResultCache(
   238     const TFSMailMsgId& aMailBoxId )
   238     const TFSMailMsgId& aMailBoxId )
   239 
   239 
   240     {
   240     {
   241     TRAP_IGNORE( DoClearSearchResultCacheL( aMailBoxId ) );
   241     TRAP_IGNORE( DoClearSearchResultCacheL( aMailBoxId ) );
   242     }
   242     }
   246 
   246 
   247 
   247 
   248 /**
   248 /**
   249  *
   249  *
   250  */
   250  */
   251 void CBasePlugin::GoOfflineL(
   251 EXPORT_C void CBasePlugin::GoOfflineL(
   252     const TFSMailMsgId& /*aMailBoxId*/ )
   252     const TFSMailMsgId& /*aMailBoxId*/ )
   253     {
   253     {
   254     }
   254     }
   255 
   255 
   256 
   256 
   257 /**
   257 /**
   258  *
   258  *
   259  */
   259  */
   260 void CBasePlugin::GoOnlineL(
   260 EXPORT_C void CBasePlugin::GoOnlineL(
   261     const TFSMailMsgId& /*aMailBoxId*/ )
   261     const TFSMailMsgId& /*aMailBoxId*/ )
   262     {
   262     {
   263     }
   263     }
   264 
   264 
   265 
   265 
   266 /**
   266 /**
   267  *
   267  *
   268  */
   268  */
   269 void CBasePlugin::RefreshNowL(
   269 EXPORT_C void CBasePlugin::RefreshNowL(
   270     const TFSMailMsgId& /*aMailBoxId*/,
   270     const TFSMailMsgId& /*aMailBoxId*/,
   271  	MFSMailRequestObserver& /*aOperationObserver*/,
   271  	MFSMailRequestObserver& /*aOperationObserver*/,
   272  	TInt /*aRequestId*/,
   272  	TInt /*aRequestId*/ )
   273  	const TBool /*aSilentConnection=EFalse*/ )
       
   274     {
   273     {
   275 
   274 
   276     }
   275     }
   277 
   276 
   278 
   277 
   281 
   280 
   282 
   281 
   283 /**
   282 /**
   284  *
   283  *
   285  */
   284  */
   286 MDesCArray* CBasePlugin::GetMrusL(
   285 EXPORT_C MDesCArray* CBasePlugin::GetMrusL(
   287     const TFSMailMsgId& aMailBoxId )
   286     const TFSMailMsgId& aMailBoxId )
   288 
   287 
   289     {
   288     {
   290     CMailboxInfo& mailBox = GetMailboxInfoL( aMailBoxId.Id() );
   289     CMailboxInfo& mailBox = GetMailboxInfoL( aMailBoxId.Id() );
   291 
   290 
   315 
   314 
   316 
   315 
   317 /**
   316 /**
   318  *
   317  *
   319  */
   318  */
   320 void CBasePlugin::SetMrusL(
   319 EXPORT_C void CBasePlugin::SetMrusL(
   321     const TFSMailMsgId& aMailBoxId,
   320     const TFSMailMsgId& aMailBoxId,
   322     MDesCArray* aNewMruList )
   321     MDesCArray* aNewMruList )
   323 
   322 
   324     {
   323     {
   325     CMailboxInfo& mailBox = GetMailboxInfoL( aMailBoxId.Id() );
   324     CMailboxInfo& mailBox = GetMailboxInfoL( aMailBoxId.Id() );
   352 
   351 
   353 
   352 
   354 /**
   353 /**
   355  *
   354  *
   356  */
   355  */
   357 TFSProgress CBasePlugin::StatusL( TInt /*aRequestId*/ )
   356 EXPORT_C TFSProgress CBasePlugin::StatusL( TInt /*aRequestId*/ )
   358     {
   357     {
   359     TFSProgress result = { TFSProgress::EFSStatus_Waiting, 0, 0, 0 };
   358     TFSProgress result = { TFSProgress::EFSStatus_Waiting, 0, 0, 0 };
   360     return result;
   359     return result;
   361     }
   360     }
   362 
   361 
   363 
   362 
   364 /**
   363 /**
   365  * Concrete plugins need to call the base plugin's implementation.
   364  * Concrete plugins need to call the base plugin's implementation.
   366  * @param aRequestId
   365  * @param aRequestId
   367  */
   366  */
   368 void CBasePlugin::CancelL( TInt aRequestId )
   367 EXPORT_C void CBasePlugin::CancelL( TInt aRequestId )
   369     {
   368     {
   370     //find the fetch request and notify the observer.
   369     //find the fetch request and notify the observer.
   371     TInt count = iReqs.Count();
   370     TInt count = iReqs.Count();
   372     for ( TInt i = 0; i < count; i++ )
   371     for ( TInt i = 0; i < count; i++ )
   373     	{
   372     	{
   374     	if ( iReqs[i]->iRequestId == aRequestId )
   373     	if ( iReqs[i]->iRequestId == aRequestId )
   375     		{
   374     		{
   376     		CFetchRequester* request = iReqs[i];
   375     		CFetchRequester* request = iReqs[i];
   377 //<qmail>
   376 
   378     		TFSProgress progress = TFSProgress();
   377     		TFSProgress progress;
   379 //</qmail>
       
   380     		progress.iProgressStatus = TFSProgress::EFSStatus_RequestCancelled;
   378     		progress.iProgressStatus = TFSProgress::EFSStatus_RequestCancelled;
   381     		progress.iCounter = progress.iMaxCount = 1;
   379     		progress.iCounter = progress.iMaxCount = 1;
   382     		progress.iError = KErrNone;
   380     		progress.iError = KErrNone;
   383     		request->iObserver.RequestResponseL( progress, aRequestId );
   381     		request->iObserver.RequestResponseL( progress, aRequestId );
   384 
   382 
   385     		iReqs.Remove( i );
   383     		iReqs.Remove( i );
   386     		delete request;
   384     		delete request;
   387     		break;
   385     		break;
   388     		}
   386     		}
   389     	}
   387     	}
   390 //<qmail>		
   388     }
   391     count = iDelayedOpReqs.Count();
   389 
   392     for ( TInt i = 0; i < count; i++ )
   390 
   393         {
   391 /**
   394         if ( iDelayedOpReqs[i]->iRequestId == aRequestId )
   392  *
   395             {
   393  */
   396             CDelayedOp* request = iDelayedOpReqs[i];
   394 EXPORT_C const TFSProgress CBasePlugin::GetLastSyncStatusL(
   397             TFSProgress progress = TFSProgress();
       
   398             progress.iProgressStatus = TFSProgress::EFSStatus_RequestCancelled;
       
   399             progress.iCounter = progress.iMaxCount = 1;
       
   400             progress.iError = KErrNone;
       
   401             request->iOperationObserver->RequestResponseL( progress, aRequestId );
       
   402             iDelayedOpsManager->DequeueOp(*request);
       
   403             iDelayedOpReqs.Remove( i );
       
   404             delete request;
       
   405             break;
       
   406             }
       
   407         }
       
   408 //</qmail>		
       
   409     }
       
   410 
       
   411 
       
   412 /**
       
   413  *
       
   414  */
       
   415 const TFSProgress CBasePlugin::GetLastSyncStatusL(
       
   416     const TFSMailMsgId& /*aMailBoxId*/ )
   395     const TFSMailMsgId& /*aMailBoxId*/ )
   417 
   396 
   418     {
   397     {
   419     User::Leave( KErrNotSupported );
   398     User::Leave( KErrNotSupported );
   420 
   399 
   424 
   403 
   425 
   404 
   426 /**
   405 /**
   427  *
   406  *
   428  */
   407  */
   429 //<qmail>
   408 EXPORT_C TSSMailSyncState CBasePlugin::CurrentSyncState(
   430 TSSMailSyncState CBasePlugin::CurrentSyncState(
       
   431             const TFSMailMsgId& /*aMailboxId*/ )
   409             const TFSMailMsgId& /*aMailboxId*/ )
   432     {
   410     {
   433     return Idle;
   411     return Idle;
   434     }
   412     }
   435 //</qmail>
   413 
   436 
   414 
   437 /**
   415 /**
   438  *
   416  *
   439  */
   417  */
   440 CMsgStoreAccount* CBasePlugin::GetAccountForMsgBoxL(
   418 EXPORT_C CMsgStoreAccount* CBasePlugin::GetAccountForMsgBoxL(
   441     const TFSMailMsgId& aMailboxId )
   419     const TFSMailMsgId& aMailboxId )
   442 
   420 
   443     {
   421     {
   444     CMsgStoreAccount* result = NULL;
   422     CMsgStoreAccount* result = NULL;
   445 
   423 
   492     }
   470     }
   493 
   471 
   494 /**
   472 /**
   495  *
   473  *
   496  */
   474  */
   497 /*virtual*/ void CBasePlugin::SetMailboxName(
   475 EXPORT_C /*virtual*/ void CBasePlugin::SetMailboxName(
   498     const TFSMailMsgId& /*aMailboxId*/,
   476     const TFSMailMsgId& /*aMailboxId*/,
   499     const TDesC& /*aMailboxName*/ )
   477     const TDesC& /*aMailboxName*/ )
   500     {
   478     {
   501     }
   479     }
   502 
   480 
   503 /**
   481 /**
   504  *
   482  *
   505  */
   483  */
   506 /*protected*/ void CBasePlugin::ResetCache()
   484 /*protected*/ EXPORT_C void CBasePlugin::ResetCache()
   507     {
   485     {
   508     __LOG_ENTER_SUPPRESS( "ResetCache" );
   486     __LOG_ENTER_SUPPRESS( "ResetCache" );
   509 
   487 
   510     ResetBodyCache();
   488     ResetBodyCache();
   511 
   489 
   519     }
   497     }
   520 
   498 
   521 /**
   499 /**
   522  *
   500  *
   523  */
   501  */
   524 /*protected*/ void CBasePlugin::ResetBodyCache()
   502 /*protected*/ EXPORT_C void CBasePlugin::ResetBodyCache()
   525     {
   503     {
   526     __LOG_ENTER_SUPPRESS( "ResetCache" );
   504     __LOG_ENTER_SUPPRESS( "ResetCache" );
   527     iCacheLine.iBodyChildren.ResetAndDestroy();
   505     iCacheLine.iBodyChildren.ResetAndDestroy();
   528     iCacheLine.iBodyChildren.Close();
   506     iCacheLine.iBodyChildren.Close();
   529 
   507 
   534     }
   512     }
   535 
   513 
   536 /**
   514 /**
   537  *
   515  *
   538  */
   516  */
   539 /*protected*/ CMsgStoreMessage* CBasePlugin::GetCachedMsgL(
   517 /*protected*/ EXPORT_C CMsgStoreMessage* CBasePlugin::GetCachedMsgL(
   540     TMsgStoreId aMailBoxId,
   518     TMsgStoreId aMailBoxId,
   541     TMsgStoreId aMsgId )
   519     TMsgStoreId aMsgId )
   542     {
   520     {
   543     __LOG_ENTER_SUPPRESS( "GetCachedMsgL" );
   521     __LOG_ENTER_SUPPRESS( "GetCachedMsgL" );
   544     CMsgStoreMessage* result = NULL;
   522     CMsgStoreMessage* result = NULL;
   569 
   547 
   570 /**
   548 /**
   571  *
   549  *
   572  */
   550  */
   573 /*protected*/
   551 /*protected*/
   574 CMsgStoreMessagePart* CBasePlugin::GetCachedBodyL(
   552 EXPORT_C CMsgStoreMessagePart* CBasePlugin::GetCachedBodyL(
   575     TMsgStoreId aPartId )
   553     TMsgStoreId aPartId )
   576     {
   554     {
   577     __LOG_ENTER_SUPPRESS( "GetCachedBodyL" );
   555     __LOG_ENTER_SUPPRESS( "GetCachedBodyL" );
   578     __ASSERT_DEBUG( NULL != iCacheLine.iMsg,
   556     __ASSERT_DEBUG( NULL != iCacheLine.iMsg,
   579         BasePluginPanic( EInvalidMsgStoreCacheState ) );
   557         BasePluginPanic( EInvalidMsgStoreCacheState ) );
   597 
   575 
   598 /**
   576 /**
   599  *
   577  *
   600  */
   578  */
   601 /*protected*/
   579 /*protected*/
   602 RPointerArray<CMsgStoreMessagePart>& CBasePlugin::GetCachedMsgChildrenL()
   580 EXPORT_C RPointerArray<CMsgStoreMessagePart>& CBasePlugin::GetCachedMsgChildrenL()
   603     {
   581     {
   604     __LOG_ENTER_SUPPRESS( "GetCachedMsgChildrenL" );
   582     __LOG_ENTER_SUPPRESS( "GetCachedMsgChildrenL" );
   605 
   583 
   606     __ASSERT_DEBUG( NULL != iCacheLine.iMsg,
   584     __ASSERT_DEBUG( NULL != iCacheLine.iMsg,
   607         BasePluginPanic( EInvalidMsgStoreCacheState ) );
   585         BasePluginPanic( EInvalidMsgStoreCacheState ) );
   621 
   599 
   622 /**
   600 /**
   623  *
   601  *
   624  */
   602  */
   625 /*protected*/
   603 /*protected*/
   626 RPointerArray<CMsgStoreMessagePart>& CBasePlugin::GetCachedBodyChildrenL()
   604 EXPORT_C RPointerArray<CMsgStoreMessagePart>& CBasePlugin::GetCachedBodyChildrenL()
   627     {
   605     {
   628     __LOG_ENTER_SUPPRESS( "GetCachedBodyChildrenL" );
   606     __LOG_ENTER_SUPPRESS( "GetCachedBodyChildrenL" );
   629 
   607 
   630     __ASSERT_DEBUG( NULL != iCacheLine.iBody,
   608     __ASSERT_DEBUG( NULL != iCacheLine.iBody,
   631         BasePluginPanic( EInvalidMsgStoreCacheState ) );
   609         BasePluginPanic( EInvalidMsgStoreCacheState ) );
   644     }
   622     }
   645 
   623 
   646 /**
   624 /**
   647  *
   625  *
   648  */
   626  */
   649 /*protected*/ void CBasePlugin::InvalidateCacheIfNecessary(
   627 /*protected*/ EXPORT_C void CBasePlugin::InvalidateCacheIfNecessary(
   650     TMsgStoreId aId,
   628     TMsgStoreId aId,
   651     TMsgStoreId aParentId,
   629     TMsgStoreId aParentId,
   652     TMsgStoreId aOtherId )
   630     TMsgStoreId aOtherId )
   653     {
   631     {
   654     if ( iCacheLine.iMsg )
   632     if ( iCacheLine.iMsg )
   663 
   641 
   664 
   642 
   665 /**
   643 /**
   666  *
   644  *
   667  */
   645  */
   668 /*public*/ MDelayedOpsManager& CBasePlugin::GetDelayedOpsManager()
   646 /*public*/ EXPORT_C MDelayedOpsManager& CBasePlugin::GetDelayedOpsManager()
   669     {
   647     {
   670     return *iDelayedOpsManager;
   648     return *iDelayedOpsManager;
   671     }
   649     }
   672 
   650 
   673 /*protected*/ const TDesC& CBasePlugin::CalendarFileName() const
   651 /*protected*/ EXPORT_C const TDesC& CBasePlugin::CalendarFileName() const
   674     {
   652     {
   675     return KNullDesC();
   653     return KNullDesC();
   676     }
   654     }