840 // |
840 // |
841 TInt CCLFServerProxy::UpdateItemsL( const TArray< TCLFItemId >& aItemIDArray ) |
841 TInt CCLFServerProxy::UpdateItemsL( const TArray< TCLFItemId >& aItemIDArray ) |
842 { |
842 { |
843 CUpdateItemsHandler* handler = CUpdateIDsHandler::NewL( aItemIDArray ); |
843 CUpdateItemsHandler* handler = CUpdateIDsHandler::NewL( aItemIDArray ); |
844 |
844 |
845 CleanupStack::PushL( handler ); |
845 // Ownership tranferred |
846 StartHandlingL( handler ); |
846 StartHandlingL( handler ); |
847 CleanupStack::Pop( handler ); |
|
848 |
847 |
849 return KErrNone; |
848 return KErrNone; |
850 } |
849 } |
851 |
850 |
852 // ----------------------------------------------------------------------------- |
851 // ----------------------------------------------------------------------------- |
877 // Pass through; collections are not supported. |
876 // Pass through; collections are not supported. |
878 CleanupStack::PopAndDestroy( uriArray ); |
877 CleanupStack::PopAndDestroy( uriArray ); |
879 return KErrNone; |
878 return KErrNone; |
880 } |
879 } |
881 |
880 |
882 CleanupStack::PushL( handler ); |
881 // Ownership tranferred |
883 StartHandlingL( handler ); |
882 StartHandlingL( handler ); |
884 CleanupStack::Pop( handler ); |
|
885 } |
883 } |
886 CleanupStack::PopAndDestroy( uriArray ); |
884 CleanupStack::PopAndDestroy( uriArray ); |
887 |
885 |
888 return KErrNone; |
886 return KErrNone; |
889 } |
887 } |
894 // |
892 // |
895 TInt CCLFServerProxy::UpdateAllItemsL() |
893 TInt CCLFServerProxy::UpdateAllItemsL() |
896 { |
894 { |
897 CUpdateItemsHandler* handler = CUpdateFoldersHandler::NewL( iMdESession, |
895 CUpdateItemsHandler* handler = CUpdateFoldersHandler::NewL( iMdESession, |
898 *iUriArray, this, this, iFs, iHC, iExtensionArray ); |
896 *iUriArray, this, this, iFs, iHC, iExtensionArray ); |
899 CleanupStack::PushL( handler ); |
897 // Ownership tranferred |
900 StartHandlingL( handler ); |
898 StartHandlingL( handler ); |
901 CleanupStack::Pop( handler ); |
|
902 |
899 |
903 return KErrNone; |
900 return KErrNone; |
904 } |
901 } |
905 |
902 |
906 // --------------------------------------------------------------------------- |
903 // --------------------------------------------------------------------------- |
1000 // |
997 // |
1001 void CCLFServerProxy::StartHandlingL( CUpdateItemsHandler* aHandler ) |
998 void CCLFServerProxy::StartHandlingL( CUpdateItemsHandler* aHandler ) |
1002 { |
999 { |
1003 if ( aHandler ) |
1000 if ( aHandler ) |
1004 { |
1001 { |
|
1002 CleanupStack::PushL( aHandler ); |
1005 // Notify pending active objects about the event. |
1003 // Notify pending active objects about the event. |
1006 NotifyUpdateEvent( ECLFProcessStartEvent ); |
1004 NotifyUpdateEvent( ECLFProcessStartEvent ); |
1007 |
1005 |
1008 // Now wait until the update is over, then return. |
1006 // Now wait until the update is over, then return. |
1009 iUpdateItemsHandlerArray.Append( aHandler ); |
1007 iUpdateItemsHandlerArray.Append( aHandler ); |
1010 TRAPD( err, aHandler->StartHandlingL(); ); |
1008 TRAPD( err, aHandler->StartHandlingL(); ); |
1011 if( err != KErrNone ) |
1009 if( err != KErrNone ) |
1012 { |
1010 { |
1013 // Remove aHandler, because it is in clean up stack. |
1011 // Remove aHandler, because it is in clean up stack. |
1014 iUpdateItemsHandlerArray.Remove( iUpdateItemsHandlerArray.Count() - 1 ); |
1012 iUpdateItemsHandlerArray.Remove( iUpdateItemsHandlerArray.Count() - 1 ); |
|
1013 CleanupStack::PopAndDestroy( aHandler ); |
1015 User::LeaveIfError( err ); |
1014 User::LeaveIfError( err ); |
1016 } |
1015 } |
1017 if ( aHandler->AllDone() ) |
1016 if ( aHandler->AllDone() ) |
1018 { |
1017 { |
1019 delete aHandler; |
1018 CleanupStack::PopAndDestroy( aHandler ); |
1020 aHandler = NULL; |
|
1021 iUpdateItemsHandlerArray.Remove( iUpdateItemsHandlerArray.Count() - 1 ); |
1019 iUpdateItemsHandlerArray.Remove( iUpdateItemsHandlerArray.Count() - 1 ); |
1022 } |
1020 } |
1023 else |
1021 else |
1024 { |
1022 { |
|
1023 CleanupStack::Pop( aHandler ); |
1025 aHandler->StartScheduler(); |
1024 aHandler->StartScheduler(); |
1026 } |
1025 } |
1027 } |
1026 } |
1028 } |
1027 } |
1029 |
1028 |