|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Active object to cleanup broken links |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CMPXBROKENLINKCLEANUP_H |
|
20 #define C_CMPXBROKENLINKCLEANUP_H |
|
21 |
|
22 |
|
23 // FOWARD DECLARATION |
|
24 class MMPXFileScanStateObserver; |
|
25 class MMPXBrokenLinkObserver; |
|
26 |
|
27 /** |
|
28 * Active Object to cleanup broken links |
|
29 * |
|
30 * @lib mpxfilehandler.lib |
|
31 * @since S60 3.1 |
|
32 */ |
|
33 NONSHARABLE_CLASS( CMPXBrokenLinkCleanup ) : public CActive |
|
34 { |
|
35 public: |
|
36 |
|
37 static CMPXBrokenLinkCleanup* NewL( MMPXFileScanStateObserver& aObserver, |
|
38 MMPXBrokenLinkObserver& aBrokenLinkObserver ); |
|
39 |
|
40 virtual ~CMPXBrokenLinkCleanup(); |
|
41 |
|
42 public: // New functions |
|
43 |
|
44 /** |
|
45 * Start the cleanup operation |
|
46 */ |
|
47 void Start(); |
|
48 |
|
49 /** |
|
50 * Reset the object |
|
51 */ |
|
52 void Reset(); |
|
53 |
|
54 /** |
|
55 * Add a broken link for cleanup |
|
56 * @param aFile file to remove |
|
57 * @param aColid collection id of the file |
|
58 * @param aDb database of the item, ownership not xfer |
|
59 */ |
|
60 void AddBrokenLinkL( const TDesC& aFile, |
|
61 TInt aColId, |
|
62 CMPXHarvesterDB* aDb ); |
|
63 |
|
64 protected: // From Base Class |
|
65 |
|
66 /** |
|
67 * From CActive |
|
68 */ |
|
69 void DoCancel(); |
|
70 |
|
71 /** |
|
72 * From CActive |
|
73 */ |
|
74 void RunL(); |
|
75 |
|
76 /** |
|
77 * From CActive |
|
78 */ |
|
79 TInt RunError(TInt aError); |
|
80 |
|
81 private: // New functions |
|
82 |
|
83 /** |
|
84 * Performs one iteration of the broken link check |
|
85 * @return ETrue if all done, EFalse otherwise |
|
86 */ |
|
87 TBool DoBrokenLinkL(); |
|
88 |
|
89 private: |
|
90 |
|
91 /** |
|
92 * Private constructor |
|
93 */ |
|
94 CMPXBrokenLinkCleanup( MMPXFileScanStateObserver& aObserver, |
|
95 MMPXBrokenLinkObserver& aBrokenLinkObserver ); |
|
96 |
|
97 /** |
|
98 * Two Phased Constructor |
|
99 */ |
|
100 void ConstructL(); |
|
101 |
|
102 private: // data |
|
103 TBool iCleaningUp; // Currently cleaning up |
|
104 |
|
105 MMPXFileScanStateObserver& iStateObserver; // Observer for the state |
|
106 MMPXBrokenLinkObserver& iBrokenLinkObserver; |
|
107 CDesCArray* iBrokenLinks; |
|
108 RArray<TInt> iColIds; |
|
109 RPointerArray<CMPXHarvesterDB> iDBRefs; // objects not owned. |
|
110 }; |
|
111 |
|
112 #endif // C_CMPXBROKENLINKCLEANUP_H |