emailservices/emailstore/base_plugin/src/basepluginnotifications.cpp
changeset 72 64e38f08e49c
parent 20 ecc8def7944a
equal deleted inserted replaced
65:478bc57ad291 72:64e38f08e49c
   298                     {
   298                     {
   299                     NotifyEventL( aMailBoxId, aId, aParentId, TFSEventMailDeleted );
   299                     NotifyEventL( aMailBoxId, aId, aParentId, TFSEventMailDeleted );
   300                     }
   300                     }
   301                 else if ( EMsgStoreFolderContainer == aType )
   301                 else if ( EMsgStoreFolderContainer == aType )
   302                     {
   302                     {
   303                     TRAPD( err, CMailboxInfo& mailBox = GetMailboxInfoL( aMailBoxId ) );
   303                     for ( TInt i = EFSInbox; i <= EFSDeleted; i++ )
   304                     
   304                         {
   305                     if ( KErrNone == err )
   305                         if ( mailBox.iRootFolders.iFolders[i] == aId )
   306                     	{
   306                             {
   307                     	for ( TInt i = EFSInbox; i <= EFSDeleted; i++ )
   307                             TMsgStoreId newId = 0;
   308                     		{
   308                             
   309                     		if ( mailBox.iRootFolders.iFolders[i] == aId )
   309                             /**@ this behavior is forced by the UI for some reason and should be revisited
   310                     			{
   310                              * in the future as it allows more than one inbox folder which is not recommended. */
   311                     			TMsgStoreId newId = 0;
   311                             
   312                     			
   312                             //loop over all of the root folders looking for a replacement.
   313                     			/**@ this behavior is forced by the UI for some reason and should be revisited
   313                             RPointerArray<CMsgStoreFolder> folders;
   314                     			 * in the future as it allows more than one inbox folder which is not recommended. */
   314                             CleanupResetAndDestroyClosePushL( folders );
   315                     			
   315 
   316                     			//loop over all of the root folders looking for a replacement.
   316                             mailBox().FoldersL( aMailBoxId, folders );
   317 								RPointerArray<CMsgStoreFolder> folders;
   317 
   318 								CleanupResetAndDestroyClosePushL( folders );
   318                             for ( int j = 0; j < folders.Count(); j++ )
   319 
   319                                 {
   320 								mailBox().FoldersL( aMailBoxId, folders );
   320                                 CMsgStoreFolder* folder = folders[j];
   321 
   321 
   322 								for ( int j = 0; j < folders.Count(); j++ )
   322                                 TUint index = 0;
   323 									{
   323                                 if ( folder->FindProperty( KMsgStorePropertyFolderType, index ) )
   324 									CMsgStoreFolder* folder = folders[j];
   324                                     {
   325 
   325                                     TUint32 type = folder->PropertyValueUint32L( index );
   326 									TUint index = 0;
   326 
   327 									if ( folder->FindProperty( KMsgStorePropertyFolderType, index ) )
   327                                     if ( type == i )	//i is a value in the folder type enum.
   328 										{
   328                                         {
   329 	                                    TUint32 type = folder->PropertyValueUint32L( index );
   329                                         newId = folder->Id();
   330 
   330                                         break;
   331 	                                    if ( type == i )	//i is a value in the folder type enum.
   331                                         }
   332 											{
   332                                     }
   333 											newId = folder->Id();
   333                                 }
   334 											break;
   334                             
   335 											}
   335                             CleanupStack::PopAndDestroy( &folders );
   336 	                                    }
   336                             
   337 									}
   337                             //set the new root folder info.
   338 								
   338                             mailBox.iRootFolders.iFolders[i] = newId;
   339 								CleanupStack::PopAndDestroy( &folders );
   339                             break;
   340                                 
   340                             }                    		
   341                     			//set the new root folder info.
   341                         }
   342                     			mailBox.iRootFolders.iFolders[i] = newId;
       
   343                     			break;
       
   344                     			}                    		
       
   345                     		}
       
   346 						}
       
   347                 
       
   348                     NotifyEventL( aMailBoxId, aId, aParentId, TFSEventFoldersDeleted );
   342                     NotifyEventL( aMailBoxId, aId, aParentId, TFSEventFoldersDeleted );
   349                     }
   343                     }
   350                 }
   344                 }
   351             break;
   345             break;
   352             
   346