ipsservices/ipssosplugin/src/ipsplgsyncstatehandler.cpp
branchRCL_3
changeset 64 3533d4323edc
parent 63 d189ee25cf9d
child 80 726fba06891a
equal deleted inserted replaced
63:d189ee25cf9d 64:3533d4323edc
    67 // ---------------------------------------------------------------------------
    67 // ---------------------------------------------------------------------------
    68 void CIpsPlgSyncStateHandler::HandlePropertyEventL( 
    68 void CIpsPlgSyncStateHandler::HandlePropertyEventL( 
    69         TInt aEvent, TInt aMailbox, TInt aPluginId ,TInt /*aError*/ )
    69         TInt aEvent, TInt aMailbox, TInt aPluginId ,TInt /*aError*/ )
    70     {
    70     {
    71     FUNC_LOG;
    71     FUNC_LOG;
    72     // <qmail> removed sync-on-hold state
    72     if ( iPlugin.PluginId() == aPluginId &&
    73     if ( ( iPlugin.PluginId() == aPluginId ) &&
    73             ( aEvent == KIpsSosEmailSyncStarted || 
    74         ( aEvent == KIpsSosEmailSyncStarted || aEvent == KIpsSosEmailSyncCompleted ) )
    74               aEvent == KIpsSosEmailSyncCompleted ||
    75         {
    75               aEvent == KIpsSosEmailSyncOnHold ) )
    76         AppendMailboxToSyncingMailboxL( aMailbox, aEvent );
    76         {
       
    77         AppendMailboxToSyncingMailbox( aMailbox, aEvent );
    77         }
    78         }
    78     }
    79     }
    79 
    80 
    80 // ---------------------------------------------------------------------------
    81 // ---------------------------------------------------------------------------
    81 // ---------------------------------------------------------------------------
    82 // ---------------------------------------------------------------------------
   111             // started
   112             // started
   112             return Idle;
   113             return Idle;
   113             }
   114             }
   114         }
   115         }
   115 
   116 
   116 #ifndef RD_101_EMAIL    
       
   117 // <cmail> RD_IPS_AO_PLUGIN flaf removed
       
   118     RAlwaysOnlineClientSession aosession;
   117     RAlwaysOnlineClientSession aosession;
   119     
   118     
   120     err = aosession.Connect();
   119     err = aosession.Connect();
   121     if ( err == KErrNone )
   120     if ( err == KErrNone )
   122         {
   121         {
   132             {
   131             {
   133             return EmailSyncing;
   132             return EmailSyncing;
   134             }
   133             }
   135         }
   134         }
   136     aosession.Close();
   135     aosession.Close();
   137 #endif
       
   138     
       
   139 // </cmail> 
       
   140    
   136    
   141    // found correct operation
   137    // found correct operation
   142    for ( TInt i = 0; i < iOperationsRef.Count(); i++ )
   138    for ( TInt i = 0; i < iOperationsRef.Count(); i++ )
   143        {
   139        {
   144        const CIpsPlgBaseOperation* baseOp = iOperationsRef[i]->BaseOperation();
   140        const CIpsPlgBaseOperation* baseOp = iOperationsRef[i]->BaseOperation();
   145        
   141        
   146        if ( baseOp && baseOp->FSMailboxId() == aMailboxId &&
   142        if ( baseOp && baseOp->FSMailboxId() == aMailboxId &&
   147             ( baseOp->IpsOpType() == EIpsOpTypePop3SyncOp ||
   143             ( baseOp->IpsOpType() == EIpsOpTypePop3SyncOp ||
       
   144               baseOp->IpsOpType() == EIpsOpTypePop3PopulateOp ||		
   148               baseOp->IpsOpType() == EIpsOpTypeImap4SyncOp ||
   145               baseOp->IpsOpType() == EIpsOpTypeImap4SyncOp ||
   149               baseOp->IpsOpType() == EIpsOpTypeImap4PopulateOp ) )
   146               baseOp->IpsOpType() == EIpsOpTypeImap4PopulateOp ) )
   150            {
   147            {
   151            // Due to timing problems we might in some rare cases report
   148            // Due to timing problems we might in some rare cases report
   152            // EmailSyncing here even if the actual syncing is already
   149            // EmailSyncing here even if the actual syncing is already
   170        {
   167        {
   171        const CIpsPlgBaseOperation* baseOp = iOperationsRef[i]->BaseOperation();
   168        const CIpsPlgBaseOperation* baseOp = iOperationsRef[i]->BaseOperation();
   172 
   169 
   173        if ( baseOp && baseOp->FSMailboxId() == aMailBoxId &&
   170        if ( baseOp && baseOp->FSMailboxId() == aMailBoxId &&
   174               ( baseOp->IpsOpType() == EIpsOpTypePop3SyncOp
   171               ( baseOp->IpsOpType() == EIpsOpTypePop3SyncOp
       
   172                || baseOp->IpsOpType() == EIpsOpTypePop3PopulateOp		  
   175                || baseOp->IpsOpType() == EIpsOpTypeImap4SyncOp
   173                || baseOp->IpsOpType() == EIpsOpTypeImap4SyncOp
   176                || baseOp->IpsOpType() == EIpsOpTypeOnlineOp
   174                || baseOp->IpsOpType() == EIpsOpTypeOnlineOp
   177                || baseOp->IpsOpType() == EIpsOpTypeImap4PopulateOp ) )
   175                || baseOp->IpsOpType() == EIpsOpTypeImap4PopulateOp ) )
   178            {
   176            {
   179            // Due to timing problems we might in some rare cases report
   177            // Due to timing problems we might in some rare cases report
   208             }
   206             }
   209         else
   207         else
   210             {
   208             {
   211             ipsState = KIpsSosEmailSyncCompleted;
   209             ipsState = KIpsSosEmailSyncCompleted;
   212             }
   210             }
   213         // the next call, FindMailbox, handles the case
   211         TInt count = iSyncingMailboxes.Append( 
   214         // if .Append is failing, thus the return value can
       
   215         // be ignored
       
   216         TInt ignore = iSyncingMailboxes.Append( 
       
   217                 TIpsMailboxState( aMailbox, ipsState ) );
   212                 TIpsMailboxState( aMailbox, ipsState ) );
   218         index = FindMailbox( aMailbox );
   213         index = FindMailbox( aMailbox );
   219         }
   214         }
   220 
   215 
   221     return index;
   216     return index;
   238     return index;
   233     return index;
   239     }
   234     }
   240 
   235 
   241 // ---------------------------------------------------------------------------
   236 // ---------------------------------------------------------------------------
   242 // --------------------------------------------------------------------------- 
   237 // --------------------------------------------------------------------------- 
   243 void CIpsPlgSyncStateHandler::AppendMailboxToSyncingMailboxL( 
   238 void CIpsPlgSyncStateHandler::AppendMailboxToSyncingMailbox( 
   244         TMsvId aMailbox, TInt aState )
   239         TMsvId aMailbox, TInt aState )
   245     {
   240     {
   246     FUNC_LOG;
   241     FUNC_LOG;
   247     TInt index = FindMailbox( aMailbox );
   242     TInt index = FindMailbox( aMailbox );
   248     if ( index == KErrNotFound )
   243     if ( index == KErrNotFound )
   249         {
   244         {
   250         iSyncingMailboxes.AppendL( TIpsMailboxState( aMailbox, aState ) );
   245         iSyncingMailboxes.Append( TIpsMailboxState( aMailbox, aState ) );
   251         }
   246         }
   252     else
   247     else
   253         {
   248         {
   254         iSyncingMailboxes[index].iState = aState; // faulty CS warning
   249         iSyncingMailboxes[index].iState = aState; // faulty CS warning
   255         }
   250         }
   300     }
   295     }
   301 
   296 
   302 // ---------------------------------------------------------------------------
   297 // ---------------------------------------------------------------------------
   303 // ---------------------------------------------------------------------------
   298 // ---------------------------------------------------------------------------
   304 void CIpsPlgSyncStateHandler::SaveSuccessfulSyncTimeL( 
   299 void CIpsPlgSyncStateHandler::SaveSuccessfulSyncTimeL( 
   305         CMsvSession& /*aSession*/, TMsvId /*aService*/ )
   300         CMsvSession& aSession, TMsvId aService )
   306     {
   301     {
   307     FUNC_LOG;
   302     FUNC_LOG;
   308     TTime now;
   303     TTime now;
   309     now.HomeTime();
   304     now.HomeTime();
   310 // <qmail>
   305     CIpsSetDataExtension* extendedSettings = CIpsSetDataExtension::NewLC();
   311     //CIpsSetDataExtension* extendedSettings = CIpsSetDataExtension::NewLC();
   306     CIpsSetDataApi* dataApi = CIpsSetDataApi::NewL( aSession );
   312     //CIpsSetDataApi* dataApi = CIpsSetDataApi::NewL( aSession );
   307     CleanupStack::PushL( dataApi );
   313     //CleanupStack::PushL( dataApi );
   308     dataApi->LoadExtendedSettingsL( aService, *extendedSettings );
   314     //dataApi->LoadExtendedSettingsL( aService, *extendedSettings );
   309     TAOInfo info;
   315     //TAOInfo info;
   310     info.iLastSuccessfulUpdate = now;
   316     //info.iLastSuccessfulUpdate = now;
   311     info.iUpdateSuccessfulWithCurSettings = ETrue;
   317     //info.iUpdateSuccessfulWithCurSettings = ETrue;
   312     info.iLastUpdateFailed = EFalse;
   318     //extendedSettings->SetLastUpdateInfo( info );
   313     extendedSettings->SetLastUpdateInfo( info );
   319     // clear flag
   314     // clear flag
   320     //extendedSettings->SetEmnReceivedButNotSyncedFlag( EFalse );
   315     extendedSettings->SetEmnReceivedButNotSyncedFlag( EFalse );
   321     //dataApi->SaveExtendedSettingsL( *extendedSettings );
   316     dataApi->SaveExtendedSettingsL( *extendedSettings );
   322     //CleanupStack::PopAndDestroy( 2, extendedSettings );
   317     CleanupStack::PopAndDestroy( 2, extendedSettings );
   323 // </qmail>
       
   324     }
   318     }
   325 
   319 
   326 
   320 
   327 // End of file
   321 // End of file
   328 
   322