emailservices/emailstore/base_plugin/src/basepluginnotifications.cpp
changeset 20 ecc8def7944a
parent 18 578830873419
child 66 084b5b1f02a7
equal deleted inserted replaced
18:578830873419 20:ecc8def7944a
   124 void CBasePlugin::SystemEventNotifyL( TMsgStoreSystemEvent aEvent )
   124 void CBasePlugin::SystemEventNotifyL( TMsgStoreSystemEvent aEvent )
   125     
   125     
   126     {
   126     {
   127     switch ( aEvent )
   127     switch ( aEvent )
   128         {
   128         {
   129         // A backup or restore is in progress.  The message store is unavailable.
   129         // The message store is unavailable.  This may be due to 
   130         case EMsgStoreBackupOrRestoreInProgress:
   130         // a backup or restore being in progress, a Pointsec lock being issued,
   131         // The message store has been wiped, including the password.
   131         // the disk drive being unavailable, etc.
   132         case EMsgStoreDatabaseWiped:
   132         case EMsgStoreUnavailable:
   133         // The message store has transitioned from an authenticated state to an unauthenticated state.
   133             {
   134         case EMsgStoreNotAuthenticated:
   134             // since the store is unavailabe we are unable to get 
   135             {
   135             // list of mailboxes, setting plugin id only
   136             NotifyGlobalEventL( TFSMailboxUnavailable );
   136             TFSMailMsgId id;
       
   137             id.SetPluginId( TUid::Uid( GetPluginId() ) );
       
   138             NotifyGlobalEventL( TFSMailboxUnavailable, id );
   137             }
   139             }
   138         break;
   140         break;
   139 
   141 
   140         // The backup or restore completed.  The message store is available again.   
   142         // The message store is available again.
   141         case EMsgStoreBackupOrRestoreCompleted:
   143         case EMsgStoreAvailable:
   142         // The message store has transitioned from an unauthenticated state to an authenticated state.
   144             {
   143         case EMsgStoreAuthenticated:
   145             RArray<TFSMailMsgId> mailboxes;
   144             {
   146             CleanupClosePushL( mailboxes );
   145             NotifyGlobalEventL( TFSMailboxAvailable );
   147             ListMailBoxesL( mailboxes );
       
   148 
       
   149             for ( TInt i( 0 ); i < mailboxes.Count(); i++ )
       
   150                 {
       
   151                 NotifyGlobalEventL( TFSMailboxAvailable, mailboxes[i] );
       
   152                 }
       
   153 
       
   154             CleanupStack::PopAndDestroy( &mailboxes );
   146             }
   155             }
   147         break;
   156         break;
   148 
   157 
   149         // The observer event queue has overflowed and has been reset, so events have been lost.  This
   158         // The observer event queue has overflowed and has been reset, so events have been lost.  This
   150         // shouldn't happen unless the client thread has been starved for an extended period of time, during
   159         // shouldn't happen unless the client thread has been starved for an extended period of time, during
   151         // which many message store operations have occurred.
   160         // which many message store operations have occurred.
   152         case EObserverEventQueueOverflow:
   161         case EObserverEventQueueOverflow:
   153         //don't see anything meaningful to do here.
   162         //don't see anything meaningful to do here.
       
   163         default:
   154         break;
   164         break;
   155         };
   165         };
   156     }
   166     }
   157 
   167 
   158 
   168 
   356                     }
   366                     }
   357                 else if ( EMsgStoreFolderContainer == aType )
   367                 else if ( EMsgStoreFolderContainer == aType )
   358                     {
   368                     {
   359                     NotifyEventL( aMailBoxId, aId, aParentId, TFSEventFolderChanged );
   369                     NotifyEventL( aMailBoxId, aId, aParentId, TFSEventFolderChanged );
   360                     }
   370                     }
   361                 else if ( EMsgStorePartContainer == aType )
       
   362                     {
       
   363                     ReportRequestStatusL( aMailBoxId, aOtherId, aParentId, aId );
       
   364                     }
       
   365                 else if ( EMsgStoreMailboxContainer == aType )
   371                 else if ( EMsgStoreMailboxContainer == aType )
   366                     {
   372                     {
   367                     TBool mailBoxNameHasChanged( EFalse );
   373                     TBool mailBoxNameHasChanged( EFalse );
   368                     TRAP_IGNORE( RefreshCachedMailBoxDisplayNameL( mailBoxNameHasChanged, aMailBoxId ) );
   374                     TRAP_IGNORE( RefreshCachedMailBoxDisplayNameL( mailBoxNameHasChanged, aMailBoxId ) );
   369                     
   375                     
   373                         }
   379                         }
   374                     }
   380                     }
   375                 }
   381                 }
   376             break;
   382             break;
   377 
   383 
       
   384             case EMsgStoreRemoveContent:
       
   385                 break;
       
   386 
       
   387             default:
       
   388                 break;
       
   389             }
       
   390         }
       
   391         /* Reporting request status moved from above if-statement here. Now, request status is reported even there is no
       
   392          * mailbox observers.
       
   393          */ 
       
   394         switch ( aOperation )
       
   395             {
       
   396             case EMsgStoreUpdateProperties:
       
   397                 {
       
   398                 if ( EMsgStorePartContainer == aType )
       
   399                     {
       
   400                     ReportRequestStatusL( aMailBoxId, aOtherId, aParentId, aId );
       
   401                     }
       
   402                 }
       
   403                 break;
   378             /**@ check whether the ui removes the observer - then the observer must be kept
   404             /**@ check whether the ui removes the observer - then the observer must be kept
   379             until there are pending reqs ?*/
   405             until there are pending reqs ?*/
   380             //attachment download request handling.
   406             //attachment download request handling.
   381             case EMsgStoreUpdateContent:
   407             case EMsgStoreUpdateContent:
   382                 {
   408                 {
   383                 __LOG_WRITE_INFO( "EMsgStoreUpdateContent." );
   409                 __LOG_WRITE_INFO( "EMsgStoreUpdateContent." );
   384                 ReportRequestStatusL( aMailBoxId, aOtherId, aParentId, aId, ETrue );
   410                 ReportRequestStatusL( aMailBoxId, aOtherId, aParentId, aId, ETrue );
   385                 }
   411                 }
   386                 break;
   412                 break;
   387             case EMsgStoreRemoveContent:
   413                 
   388                 break;
       
   389 
       
   390             default:
   414             default:
   391                 break;
   415                 break;
   392             }
   416         }
   393         }
   417     
   394         
   418         
   395         __LOG_EXIT;
   419         __LOG_EXIT;
   396     } //ModificationNotifyL.
   420     } //ModificationNotifyL.
   397 
   421 
   398 
   422 
   519             }
   543             }
   520         
   544         
   521         CleanupStack::PopAndDestroy( part );
   545         CleanupStack::PopAndDestroy( part );
   522         CleanupStack::PopAndDestroy( msg );
   546         CleanupStack::PopAndDestroy( msg );
   523 
   547 
       
   548 //<qmail>
   524         TFSProgress progress = TFSProgress();
   549         TFSProgress progress = TFSProgress();
       
   550 //</qmail>
   525         progress.iError = KErrNone;
   551         progress.iError = KErrNone;
   526         progress.iMaxCount = size;
   552         progress.iMaxCount = size;
   527         progress.iCounter = fetchedSize;
   553         progress.iCounter = fetchedSize;
   528         
   554         
   529         __LOG_WRITE_FORMAT2_INFO(
   555         __LOG_WRITE_FORMAT2_INFO(