emailservices/emailstore/base_plugin/src/basepluginnotifications.cpp
changeset 20 ecc8def7944a
parent 18 578830873419
child 66 084b5b1f02a7
--- a/emailservices/emailstore/base_plugin/src/basepluginnotifications.cpp	Fri Apr 16 14:51:52 2010 +0300
+++ b/emailservices/emailstore/base_plugin/src/basepluginnotifications.cpp	Mon May 03 12:23:15 2010 +0300
@@ -126,23 +126,32 @@
     {
     switch ( aEvent )
         {
-        // A backup or restore is in progress.  The message store is unavailable.
-        case EMsgStoreBackupOrRestoreInProgress:
-        // The message store has been wiped, including the password.
-        case EMsgStoreDatabaseWiped:
-        // The message store has transitioned from an authenticated state to an unauthenticated state.
-        case EMsgStoreNotAuthenticated:
+        // The message store is unavailable.  This may be due to 
+        // a backup or restore being in progress, a Pointsec lock being issued,
+        // the disk drive being unavailable, etc.
+        case EMsgStoreUnavailable:
             {
-            NotifyGlobalEventL( TFSMailboxUnavailable );
+            // since the store is unavailabe we are unable to get 
+            // list of mailboxes, setting plugin id only
+            TFSMailMsgId id;
+            id.SetPluginId( TUid::Uid( GetPluginId() ) );
+            NotifyGlobalEventL( TFSMailboxUnavailable, id );
             }
         break;
 
-        // The backup or restore completed.  The message store is available again.   
-        case EMsgStoreBackupOrRestoreCompleted:
-        // The message store has transitioned from an unauthenticated state to an authenticated state.
-        case EMsgStoreAuthenticated:
+        // The message store is available again.
+        case EMsgStoreAvailable:
             {
-            NotifyGlobalEventL( TFSMailboxAvailable );
+            RArray<TFSMailMsgId> mailboxes;
+            CleanupClosePushL( mailboxes );
+            ListMailBoxesL( mailboxes );
+
+            for ( TInt i( 0 ); i < mailboxes.Count(); i++ )
+                {
+                NotifyGlobalEventL( TFSMailboxAvailable, mailboxes[i] );
+                }
+
+            CleanupStack::PopAndDestroy( &mailboxes );
             }
         break;
 
@@ -151,6 +160,7 @@
         // which many message store operations have occurred.
         case EObserverEventQueueOverflow:
         //don't see anything meaningful to do here.
+        default:
         break;
         };
     }
@@ -358,10 +368,6 @@
                     {
                     NotifyEventL( aMailBoxId, aId, aParentId, TFSEventFolderChanged );
                     }
-                else if ( EMsgStorePartContainer == aType )
-                    {
-                    ReportRequestStatusL( aMailBoxId, aOtherId, aParentId, aId );
-                    }
                 else if ( EMsgStoreMailboxContainer == aType )
                     {
                     TBool mailBoxNameHasChanged( EFalse );
@@ -375,6 +381,26 @@
                 }
             break;
 
+            case EMsgStoreRemoveContent:
+                break;
+
+            default:
+                break;
+            }
+        }
+        /* Reporting request status moved from above if-statement here. Now, request status is reported even there is no
+         * mailbox observers.
+         */ 
+        switch ( aOperation )
+            {
+            case EMsgStoreUpdateProperties:
+                {
+                if ( EMsgStorePartContainer == aType )
+                    {
+                    ReportRequestStatusL( aMailBoxId, aOtherId, aParentId, aId );
+                    }
+                }
+                break;
             /**@ check whether the ui removes the observer - then the observer must be kept
             until there are pending reqs ?*/
             //attachment download request handling.
@@ -384,13 +410,11 @@
                 ReportRequestStatusL( aMailBoxId, aOtherId, aParentId, aId, ETrue );
                 }
                 break;
-            case EMsgStoreRemoveContent:
-                break;
-
+                
             default:
                 break;
-            }
         }
+    
         
         __LOG_EXIT;
     } //ModificationNotifyL.
@@ -521,7 +545,9 @@
         CleanupStack::PopAndDestroy( part );
         CleanupStack::PopAndDestroy( msg );
 
+//<qmail>
         TFSProgress progress = TFSProgress();
+//</qmail>
         progress.iError = KErrNone;
         progress.iMaxCount = size;
         progress.iCounter = fetchedSize;