emailservices/emailstore/base_plugin/src/basepluginmisc.cpp
branchRCL_3
changeset 24 d189ee25cf9d
parent 23 dcf0eedfc1a3
child 25 3533d4323edc
equal deleted inserted replaced
23:dcf0eedfc1a3 24:d189ee25cf9d
    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 EXPORT_C TUint CBasePlugin::GetPluginId()
    34 TUint CBasePlugin::GetPluginId()
    35     {
    35     {
    36     return 0;
    36     return 0;
    37     }
    37     }
    38 
    38 
    39 
    39 
    40 /**
    40 /**
    41  *
    41  *
    42  */
    42  */
    43 EXPORT_C TFSMailBoxStatus CBasePlugin::GetMailBoxStatus(
    43 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 EXPORT_C TBool CBasePlugin::MailboxHasCapabilityL(
    53 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 EXPORT_C TInt CBasePlugin::WizardDataAvailableL()
    64 TInt CBasePlugin::WizardDataAvailableL()
    65     {
    65     {
    66     return KErrNotSupported;
    66     return KErrNotSupported;
    67     }
    67     }
    68 
    68 
    69 
    69 
    70 /**
    70 /**
    71  *
    71  *
    72  */
    72  */
    73 EXPORT_C void CBasePlugin::AuthenticateL(
    73 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 EXPORT_C void CBasePlugin::SetCredentialsL(
    83 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 EXPORT_C TDesC& CBasePlugin::GetBrandingIdL( const TFSMailMsgId& aMailboxId )
    95 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 EXPORT_C TInt CBasePlugin::CancelSyncL( const TFSMailMsgId& /*aMailBoxId*/ )
   105 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 EXPORT_C void CBasePlugin::SearchL(
   174 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 EXPORT_C void CBasePlugin::CancelSearch(
   226 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 EXPORT_C void CBasePlugin::ClearSearchResultCache(
   237 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 EXPORT_C void CBasePlugin::GoOfflineL(
   251 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 EXPORT_C void CBasePlugin::GoOnlineL(
   260 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 EXPORT_C void CBasePlugin::RefreshNowL(
   269 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*/ )
   273     {
   274     {
   274 
   275 
   275     }
   276     }
   276 
   277 
   277 
   278 
   280 
   281 
   281 
   282 
   282 /**
   283 /**
   283  *
   284  *
   284  */
   285  */
   285 EXPORT_C MDesCArray* CBasePlugin::GetMrusL(
   286 MDesCArray* CBasePlugin::GetMrusL(
   286     const TFSMailMsgId& aMailBoxId )
   287     const TFSMailMsgId& aMailBoxId )
   287 
   288 
   288     {
   289     {
   289     CMailboxInfo& mailBox = GetMailboxInfoL( aMailBoxId.Id() );
   290     CMailboxInfo& mailBox = GetMailboxInfoL( aMailBoxId.Id() );
   290 
   291 
   314 
   315 
   315 
   316 
   316 /**
   317 /**
   317  *
   318  *
   318  */
   319  */
   319 EXPORT_C void CBasePlugin::SetMrusL(
   320 void CBasePlugin::SetMrusL(
   320     const TFSMailMsgId& aMailBoxId,
   321     const TFSMailMsgId& aMailBoxId,
   321     MDesCArray* aNewMruList )
   322     MDesCArray* aNewMruList )
   322 
   323 
   323     {
   324     {
   324     CMailboxInfo& mailBox = GetMailboxInfoL( aMailBoxId.Id() );
   325     CMailboxInfo& mailBox = GetMailboxInfoL( aMailBoxId.Id() );
   351 
   352 
   352 
   353 
   353 /**
   354 /**
   354  *
   355  *
   355  */
   356  */
   356 EXPORT_C TFSProgress CBasePlugin::StatusL( TInt /*aRequestId*/ )
   357 TFSProgress CBasePlugin::StatusL( TInt /*aRequestId*/ )
   357     {
   358     {
   358     TFSProgress result = { TFSProgress::EFSStatus_Waiting, 0, 0, 0 };
   359     TFSProgress result = { TFSProgress::EFSStatus_Waiting, 0, 0, 0 };
   359     return result;
   360     return result;
   360     }
   361     }
   361 
   362 
   362 
   363 
   363 /**
   364 /**
   364  * Concrete plugins need to call the base plugin's implementation.
   365  * Concrete plugins need to call the base plugin's implementation.
   365  * @param aRequestId
   366  * @param aRequestId
   366  */
   367  */
   367 EXPORT_C void CBasePlugin::CancelL( TInt aRequestId )
   368 void CBasePlugin::CancelL( TInt aRequestId )
   368     {
   369     {
   369     //find the fetch request and notify the observer.
   370     //find the fetch request and notify the observer.
   370     TInt count = iReqs.Count();
   371     TInt count = iReqs.Count();
   371     for ( TInt i = 0; i < count; i++ )
   372     for ( TInt i = 0; i < count; i++ )
   372     	{
   373     	{
   373     	if ( iReqs[i]->iRequestId == aRequestId )
   374     	if ( iReqs[i]->iRequestId == aRequestId )
   374     		{
   375     		{
   375     		CFetchRequester* request = iReqs[i];
   376     		CFetchRequester* request = iReqs[i];
   376 
   377 //<qmail>
   377     		TFSProgress progress;
   378     		TFSProgress progress = TFSProgress();
       
   379 //</qmail>
   378     		progress.iProgressStatus = TFSProgress::EFSStatus_RequestCancelled;
   380     		progress.iProgressStatus = TFSProgress::EFSStatus_RequestCancelled;
   379     		progress.iCounter = progress.iMaxCount = 1;
   381     		progress.iCounter = progress.iMaxCount = 1;
   380     		progress.iError = KErrNone;
   382     		progress.iError = KErrNone;
   381     		request->iObserver.RequestResponseL( progress, aRequestId );
   383     		request->iObserver.RequestResponseL( progress, aRequestId );
   382 
   384 
   383     		iReqs.Remove( i );
   385     		iReqs.Remove( i );
   384     		delete request;
   386     		delete request;
   385     		break;
   387     		break;
   386     		}
   388     		}
   387     	}
   389     	}
   388     }
   390 //<qmail>		
   389 
   391     count = iDelayedOpReqs.Count();
   390 
   392     for ( TInt i = 0; i < count; i++ )
   391 /**
   393         {
   392  *
   394         if ( iDelayedOpReqs[i]->iRequestId == aRequestId )
   393  */
   395             {
   394 EXPORT_C const TFSProgress CBasePlugin::GetLastSyncStatusL(
   396             CDelayedOp* request = iDelayedOpReqs[i];
       
   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(
   395     const TFSMailMsgId& /*aMailBoxId*/ )
   416     const TFSMailMsgId& /*aMailBoxId*/ )
   396 
   417 
   397     {
   418     {
   398     User::Leave( KErrNotSupported );
   419     User::Leave( KErrNotSupported );
   399 
   420 
   403 
   424 
   404 
   425 
   405 /**
   426 /**
   406  *
   427  *
   407  */
   428  */
   408 EXPORT_C TSSMailSyncState CBasePlugin::CurrentSyncState(
   429 //<qmail>
       
   430 TSSMailSyncState CBasePlugin::CurrentSyncState(
   409             const TFSMailMsgId& /*aMailboxId*/ )
   431             const TFSMailMsgId& /*aMailboxId*/ )
   410     {
   432     {
   411     return Idle;
   433     return Idle;
   412     }
   434     }
   413 
   435 //</qmail>
   414 
   436 
   415 /**
   437 /**
   416  *
   438  *
   417  */
   439  */
   418 EXPORT_C CMsgStoreAccount* CBasePlugin::GetAccountForMsgBoxL(
   440 CMsgStoreAccount* CBasePlugin::GetAccountForMsgBoxL(
   419     const TFSMailMsgId& aMailboxId )
   441     const TFSMailMsgId& aMailboxId )
   420 
   442 
   421     {
   443     {
   422     CMsgStoreAccount* result = NULL;
   444     CMsgStoreAccount* result = NULL;
   423 
   445 
   470     }
   492     }
   471 
   493 
   472 /**
   494 /**
   473  *
   495  *
   474  */
   496  */
   475 EXPORT_C /*virtual*/ void CBasePlugin::SetMailboxName(
   497 /*virtual*/ void CBasePlugin::SetMailboxName(
   476     const TFSMailMsgId& /*aMailboxId*/,
   498     const TFSMailMsgId& /*aMailboxId*/,
   477     const TDesC& /*aMailboxName*/ )
   499     const TDesC& /*aMailboxName*/ )
   478     {
   500     {
   479     }
   501     }
   480 
   502 
   481 /**
   503 /**
   482  *
   504  *
   483  */
   505  */
   484 /*protected*/ EXPORT_C void CBasePlugin::ResetCache()
   506 /*protected*/ void CBasePlugin::ResetCache()
   485     {
   507     {
   486     __LOG_ENTER_SUPPRESS( "ResetCache" );
   508     __LOG_ENTER_SUPPRESS( "ResetCache" );
   487 
   509 
   488     ResetBodyCache();
   510     ResetBodyCache();
   489 
   511 
   497     }
   519     }
   498 
   520 
   499 /**
   521 /**
   500  *
   522  *
   501  */
   523  */
   502 /*protected*/ EXPORT_C void CBasePlugin::ResetBodyCache()
   524 /*protected*/ void CBasePlugin::ResetBodyCache()
   503     {
   525     {
   504     __LOG_ENTER_SUPPRESS( "ResetCache" );
   526     __LOG_ENTER_SUPPRESS( "ResetCache" );
   505     iCacheLine.iBodyChildren.ResetAndDestroy();
   527     iCacheLine.iBodyChildren.ResetAndDestroy();
   506     iCacheLine.iBodyChildren.Close();
   528     iCacheLine.iBodyChildren.Close();
   507 
   529 
   512     }
   534     }
   513 
   535 
   514 /**
   536 /**
   515  *
   537  *
   516  */
   538  */
   517 /*protected*/ EXPORT_C CMsgStoreMessage* CBasePlugin::GetCachedMsgL(
   539 /*protected*/ CMsgStoreMessage* CBasePlugin::GetCachedMsgL(
   518     TMsgStoreId aMailBoxId,
   540     TMsgStoreId aMailBoxId,
   519     TMsgStoreId aMsgId )
   541     TMsgStoreId aMsgId )
   520     {
   542     {
   521     __LOG_ENTER_SUPPRESS( "GetCachedMsgL" );
   543     __LOG_ENTER_SUPPRESS( "GetCachedMsgL" );
   522     CMsgStoreMessage* result = NULL;
   544     CMsgStoreMessage* result = NULL;
   547 
   569 
   548 /**
   570 /**
   549  *
   571  *
   550  */
   572  */
   551 /*protected*/
   573 /*protected*/
   552 EXPORT_C CMsgStoreMessagePart* CBasePlugin::GetCachedBodyL(
   574 CMsgStoreMessagePart* CBasePlugin::GetCachedBodyL(
   553     TMsgStoreId aPartId )
   575     TMsgStoreId aPartId )
   554     {
   576     {
   555     __LOG_ENTER_SUPPRESS( "GetCachedBodyL" );
   577     __LOG_ENTER_SUPPRESS( "GetCachedBodyL" );
   556     __ASSERT_DEBUG( NULL != iCacheLine.iMsg,
   578     __ASSERT_DEBUG( NULL != iCacheLine.iMsg,
   557         BasePluginPanic( EInvalidMsgStoreCacheState ) );
   579         BasePluginPanic( EInvalidMsgStoreCacheState ) );
   575 
   597 
   576 /**
   598 /**
   577  *
   599  *
   578  */
   600  */
   579 /*protected*/
   601 /*protected*/
   580 EXPORT_C RPointerArray<CMsgStoreMessagePart>& CBasePlugin::GetCachedMsgChildrenL()
   602 RPointerArray<CMsgStoreMessagePart>& CBasePlugin::GetCachedMsgChildrenL()
   581     {
   603     {
   582     __LOG_ENTER_SUPPRESS( "GetCachedMsgChildrenL" );
   604     __LOG_ENTER_SUPPRESS( "GetCachedMsgChildrenL" );
   583 
   605 
   584     __ASSERT_DEBUG( NULL != iCacheLine.iMsg,
   606     __ASSERT_DEBUG( NULL != iCacheLine.iMsg,
   585         BasePluginPanic( EInvalidMsgStoreCacheState ) );
   607         BasePluginPanic( EInvalidMsgStoreCacheState ) );
   599 
   621 
   600 /**
   622 /**
   601  *
   623  *
   602  */
   624  */
   603 /*protected*/
   625 /*protected*/
   604 EXPORT_C RPointerArray<CMsgStoreMessagePart>& CBasePlugin::GetCachedBodyChildrenL()
   626 RPointerArray<CMsgStoreMessagePart>& CBasePlugin::GetCachedBodyChildrenL()
   605     {
   627     {
   606     __LOG_ENTER_SUPPRESS( "GetCachedBodyChildrenL" );
   628     __LOG_ENTER_SUPPRESS( "GetCachedBodyChildrenL" );
   607 
   629 
   608     __ASSERT_DEBUG( NULL != iCacheLine.iBody,
   630     __ASSERT_DEBUG( NULL != iCacheLine.iBody,
   609         BasePluginPanic( EInvalidMsgStoreCacheState ) );
   631         BasePluginPanic( EInvalidMsgStoreCacheState ) );
   622     }
   644     }
   623 
   645 
   624 /**
   646 /**
   625  *
   647  *
   626  */
   648  */
   627 /*protected*/ EXPORT_C void CBasePlugin::InvalidateCacheIfNecessary(
   649 /*protected*/ void CBasePlugin::InvalidateCacheIfNecessary(
   628     TMsgStoreId aId,
   650     TMsgStoreId aId,
   629     TMsgStoreId aParentId,
   651     TMsgStoreId aParentId,
   630     TMsgStoreId aOtherId )
   652     TMsgStoreId aOtherId )
   631     {
   653     {
   632     if ( iCacheLine.iMsg )
   654     if ( iCacheLine.iMsg )
   641 
   663 
   642 
   664 
   643 /**
   665 /**
   644  *
   666  *
   645  */
   667  */
   646 /*public*/ EXPORT_C MDelayedOpsManager& CBasePlugin::GetDelayedOpsManager()
   668 /*public*/ MDelayedOpsManager& CBasePlugin::GetDelayedOpsManager()
   647     {
   669     {
   648     return *iDelayedOpsManager;
   670     return *iDelayedOpsManager;
   649     }
   671     }
   650 
   672 
   651 /*protected*/ EXPORT_C const TDesC& CBasePlugin::CalendarFileName() const
   673 /*protected*/ const TDesC& CBasePlugin::CalendarFileName() const
   652     {
   674     {
   653     return KNullDesC();
   675     return KNullDesC();
   654     }
   676     }