|
1 /* |
|
2 * Copyright (c) 2006 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: Scans folders for media files |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CMPXFOLDERSCANNER_H |
|
20 #define CMPXFOLDERSCANNER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <f32file.h> |
|
24 #include <badesca.h> |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class MMPXFileAdditionObserver; |
|
28 class MMPXFileScanStateObserver; |
|
29 |
|
30 /** |
|
31 * CMPXFolderScanner |
|
32 * |
|
33 * Scans a particular drive for files |
|
34 * |
|
35 * @lib mpxfilehandler |
|
36 * @since S60 3.0 |
|
37 */ |
|
38 NONSHARABLE_CLASS( CMPXFolderScanner ) : public CActive |
|
39 { |
|
40 |
|
41 public: |
|
42 |
|
43 /** |
|
44 * Two-phased constructor |
|
45 * @param aObserver file addition observer |
|
46 * @param aStateObserver scanning state observer |
|
47 * @param aFs file session |
|
48 */ |
|
49 static CMPXFolderScanner* NewL( MMPXFileAdditionObserver& aObserver, |
|
50 MMPXFileScanStateObserver& aStateObs, |
|
51 RFs& aFs ); |
|
52 |
|
53 /** |
|
54 * Virtual destructor |
|
55 */ |
|
56 virtual ~CMPXFolderScanner(); |
|
57 |
|
58 /** |
|
59 * Scan a particular drive for files |
|
60 * @param aDrive the drive to scan |
|
61 */ |
|
62 void ScanL( RArray<TPath>& aDrive ); |
|
63 |
|
64 protected: // From Base Class |
|
65 |
|
66 /** |
|
67 * From CActive |
|
68 */ |
|
69 void RunL(); |
|
70 |
|
71 /** |
|
72 * From CActive |
|
73 */ |
|
74 void DoCancel(); |
|
75 |
|
76 /** |
|
77 * From CActive |
|
78 */ |
|
79 TInt RunError(TInt aError); |
|
80 |
|
81 private: // New Functions |
|
82 |
|
83 /** |
|
84 * Continues the scanning procedure |
|
85 * @return ETrue if it is done, EFalse if there is more work to do |
|
86 */ |
|
87 TBool DoScanL(); |
|
88 |
|
89 /** |
|
90 * Setup the object to scan the next drive |
|
91 * @return ETrue if there are more folders to scan |
|
92 * EFalse if the scanning process is complete |
|
93 */ |
|
94 TBool SetupNextDriveToScanL(); |
|
95 |
|
96 /** |
|
97 * Handles what to do when scanning is done |
|
98 * @param aErr error to return to the client |
|
99 */ |
|
100 void DoScanCompleteL( TInt aErr ); |
|
101 |
|
102 private: |
|
103 |
|
104 /** |
|
105 * Private constructor |
|
106 * @param aObserver file addition observer |
|
107 * @param aStateObserver scanning state observer |
|
108 * @param aFs file session |
|
109 */ |
|
110 CMPXFolderScanner( MMPXFileAdditionObserver& aObserver, |
|
111 MMPXFileScanStateObserver& aStateObs, |
|
112 RFs& aFs ); |
|
113 |
|
114 /** |
|
115 * 2nd Phase constructor |
|
116 */ |
|
117 void ConstructL(); |
|
118 |
|
119 private: // data |
|
120 |
|
121 MMPXFileAdditionObserver& iObserver; |
|
122 MMPXFileScanStateObserver& iStateObserver; |
|
123 |
|
124 RFs& iFs; // Not owned |
|
125 |
|
126 // Droves or folders that we want to scan |
|
127 RArray<TPath> iDrivesToScan; |
|
128 |
|
129 // Flag to indicate if we are scanning or not |
|
130 TBool iScanning; |
|
131 |
|
132 // Scanner objects |
|
133 CDirScan* iDirScan; |
|
134 CDir* iDir; |
|
135 TInt iCount; |
|
136 }; |
|
137 |
|
138 #endif // CMPXFOLDERSCANNER_H |