diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/inc/mpxbrokenlinkcleanup.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/inc/mpxbrokenlinkcleanup.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,112 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Active object to cleanup broken links +* +*/ + + +#ifndef C_CMPXBROKENLINKCLEANUP_H +#define C_CMPXBROKENLINKCLEANUP_H + + +// FOWARD DECLARATION +class MMPXFileScanStateObserver; +class MMPXBrokenLinkObserver; + +/** + * Active Object to cleanup broken links + * + * @lib mpxfilehandler.lib + * @since S60 3.1 + */ +NONSHARABLE_CLASS( CMPXBrokenLinkCleanup ) : public CActive + { +public: + + static CMPXBrokenLinkCleanup* NewL( MMPXFileScanStateObserver& aObserver, + MMPXBrokenLinkObserver& aBrokenLinkObserver ); + + virtual ~CMPXBrokenLinkCleanup(); + +public: // New functions + + /** + * Start the cleanup operation + */ + void Start(); + + /** + * Reset the object + */ + void Reset(); + + /** + * Add a broken link for cleanup + * @param aFile file to remove + * @param aColid collection id of the file + * @param aDb database of the item, ownership not xfer + */ + void AddBrokenLinkL( const TDesC& aFile, + TInt aColId, + CMPXHarvesterDB* aDb ); + +protected: // From Base Class + + /** + * From CActive + */ + void DoCancel(); + + /** + * From CActive + */ + void RunL(); + + /** + * From CActive + */ + TInt RunError(TInt aError); + +private: // New functions + + /** + * Performs one iteration of the broken link check + * @return ETrue if all done, EFalse otherwise + */ + TBool DoBrokenLinkL(); + +private: + + /** + * Private constructor + */ + CMPXBrokenLinkCleanup( MMPXFileScanStateObserver& aObserver, + MMPXBrokenLinkObserver& aBrokenLinkObserver ); + + /** + * Two Phased Constructor + */ + void ConstructL(); + +private: // data + TBool iCleaningUp; // Currently cleaning up + + MMPXFileScanStateObserver& iStateObserver; // Observer for the state + MMPXBrokenLinkObserver& iBrokenLinkObserver; + CDesCArray* iBrokenLinks; + RArray iColIds; + RPointerArray iDBRefs; // objects not owned. + }; + +#endif // C_CMPXBROKENLINKCLEANUP_H