1 /* |
|
2 * Copyright (c) 2002-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: Resolves different media types' drive letters |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CGFLMDRIVERESOLVER_H |
|
20 #define CGFLMDRIVERESOLVER_H |
|
21 |
|
22 |
|
23 // INCLUDES |
|
24 #include <f32file.h> |
|
25 #include "GFLM.hrh" |
|
26 |
|
27 // CONSTANTS |
|
28 const TInt KGflmReadBufferLen = 256; |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class CGflmDriveItem; |
|
32 class MGflmItemFilter; |
|
33 |
|
34 |
|
35 // CLASS DECLARATION |
|
36 /** |
|
37 * Resolves different media types' drive letters |
|
38 * |
|
39 * @lib GFLM.lib |
|
40 * @since 2.0 |
|
41 */ |
|
42 NONSHARABLE_CLASS(CGflmDriveResolver) : public CBase |
|
43 { |
|
44 public: // Constructors and destructor |
|
45 |
|
46 /** |
|
47 * Two-phased constructor. |
|
48 */ |
|
49 static CGflmDriveResolver* NewL( RFs& aFs ); |
|
50 |
|
51 /** |
|
52 * Destructor. |
|
53 */ |
|
54 virtual ~CGflmDriveResolver(); |
|
55 |
|
56 public: // New functions |
|
57 /** |
|
58 * Refreshes drive information |
|
59 * @param aFs Reference to file system handle |
|
60 * @param aFilter Pointer to filter |
|
61 * @return System wide error code. |
|
62 * @since 3.2 |
|
63 */ |
|
64 TInt RefreshDrives( MGflmItemFilter* aFilter ); |
|
65 |
|
66 /** |
|
67 * Gets number of drives |
|
68 * @since 3.1 |
|
69 * @return A number of drives |
|
70 */ |
|
71 TInt DriveCount() const; |
|
72 |
|
73 /** |
|
74 * Gets drive item at position |
|
75 * @since 3.1 |
|
76 * @param aIndex Given position |
|
77 * @return A pointer to drive item (not owned). |
|
78 */ |
|
79 CGflmDriveItem* DriveAt( const TInt aIndex ) const; |
|
80 |
|
81 /** |
|
82 * Gets drive item from given path |
|
83 * @since 3.1 |
|
84 * @param aPath Given path |
|
85 * @return A pointer to drive item (not owned) |
|
86 * or NULL if drive not found. |
|
87 */ |
|
88 CGflmDriveItem* DriveFromPath( const TDesC& aPath ) const; |
|
89 |
|
90 /** |
|
91 * Clears drive information |
|
92 * @since 3.1 |
|
93 */ |
|
94 void ClearDrives(); |
|
95 |
|
96 /** |
|
97 * Checks if path is drive root path |
|
98 * @since 3.1 |
|
99 */ |
|
100 TBool IsRootPath( const TDesC& aPath ) const; |
|
101 |
|
102 /** |
|
103 * Checks if path is on remote drive |
|
104 * @since 3.1 |
|
105 */ |
|
106 TBool IsRemoteDrive( const TDesC& aPath ) const; |
|
107 |
|
108 /** |
|
109 * Gets drive item from given id |
|
110 * @since 3.2 |
|
111 * @param aDrive Given drive id |
|
112 * @return A pointer to drive item (not owned) |
|
113 * or NULL if drive not found. |
|
114 */ |
|
115 CGflmDriveItem* DriveFromId( const TInt aDrive ) const; |
|
116 |
|
117 private: |
|
118 |
|
119 /** |
|
120 * C++ default constructor. |
|
121 */ |
|
122 CGflmDriveResolver( RFs& aFs ); |
|
123 |
|
124 void ConstructL(); |
|
125 |
|
126 void AppendDriveL( |
|
127 const TInt aDrive, MGflmItemFilter* aFilter ); |
|
128 |
|
129 void RefreshDrivesL( MGflmItemFilter* aFilter ); |
|
130 |
|
131 private: // Data |
|
132 // Shareable file server session. |
|
133 RFs& iFs; |
|
134 |
|
135 // List of drives. Owned. |
|
136 RPointerArray< CGflmDriveItem > iDrives; |
|
137 |
|
138 TBool iRefreshed; |
|
139 |
|
140 RCriticalSection iCs; |
|
141 |
|
142 TBuf< KGflmReadBufferLen > iReadBuffer; |
|
143 }; |
|
144 |
|
145 #endif // CGFLMDRIVERESOLVER_H |
|
146 |
|
147 // End of File |
|