|
1 /* |
|
2 * Copyright (c) 2007-2008 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: Handles disk drive information |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_AKNSSRVDRIVEMASTER_H |
|
20 #define C_AKNSSRVDRIVEMASTER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <f32file.h> |
|
24 #include <disknotifyhandler.h> |
|
25 #include <driveinfo.h> |
|
26 |
|
27 // path to available skin directory |
|
28 _LIT( KAknSkinSrvPrivateSkinPath, "\\private\\10207114\\import\\" ); |
|
29 |
|
30 // path to skin resource directory |
|
31 _LIT( KAknSkinSrvResourceDirectory, "\\resource\\skins\\" ); |
|
32 |
|
33 |
|
34 /** |
|
35 * Listens to drive status changes. |
|
36 * |
|
37 * @lib aknskinsrv.lib |
|
38 * @since S60 v5.0 |
|
39 */ |
|
40 class MAknsSrvDriveObserver |
|
41 { |
|
42 public: |
|
43 virtual void NotifyDriveStatusChange( |
|
44 const TInt& aDrive, const TBool& aMediaNotPresent ) =0; |
|
45 }; |
|
46 |
|
47 |
|
48 /** |
|
49 * Handles disk drive information |
|
50 * |
|
51 * Changes in drive statuses are received from MAknsSrvDriveObserver. |
|
52 * |
|
53 * @lib aknskinsrv.lib |
|
54 * @since S60 v5.0 |
|
55 */ |
|
56 NONSHARABLE_CLASS( CAknsSrvDriveMaster ) : |
|
57 public CBase, public MDiskNotifyHandlerCallback |
|
58 { |
|
59 |
|
60 public: |
|
61 |
|
62 // Type of drive list. |
|
63 enum TAknsSrvSkinDriveList |
|
64 { |
|
65 // Static, non-removable drive. |
|
66 EAknsSrvStaticDrive = 0, |
|
67 // Removable drive. |
|
68 EAknsSrvRemovableDrive = 1, |
|
69 // Any kind of drive. |
|
70 EAknsSrvAnyDrive = 2 |
|
71 }; |
|
72 |
|
73 /** |
|
74 * Constructor. |
|
75 * |
|
76 * @param aObserver observer for drive status changes. |
|
77 * @return new instance of CAknsSrvDriveMaster. |
|
78 */ |
|
79 static CAknsSrvDriveMaster* NewL( MAknsSrvDriveObserver* aObserver ); |
|
80 |
|
81 /** |
|
82 * Destructor. |
|
83 * |
|
84 */ |
|
85 virtual ~CAknsSrvDriveMaster(); |
|
86 |
|
87 /** |
|
88 * Returns skin directory on Rom. |
|
89 * |
|
90 * @param path to private skin directory on Rom. |
|
91 */ |
|
92 static void DefaultSkinDirectoryOnRom( TDes& aPath ); |
|
93 |
|
94 /** |
|
95 * Returns skin directory on memory card. |
|
96 * |
|
97 * @param path to private skin directory on memory card. |
|
98 */ |
|
99 static void DefaultSkinDirectoryOnMemoryCard( TDes& aPath ); |
|
100 |
|
101 /** |
|
102 * Returns skin directory on device drive. |
|
103 * |
|
104 * @param path to private skin directory on device drive. |
|
105 */ |
|
106 static void DefaultSkinDirectoryOnDevice( TDes& aPath ); |
|
107 |
|
108 /** |
|
109 * Returns a given default drive. |
|
110 * |
|
111 * @param aDriveType type of drive wanted (@see TDriveInfo) |
|
112 * @param aDrive returned drive (inluding a double colon e.g. "C:") |
|
113 */ |
|
114 static void GetDefaultDrive( const TInt& aDriveType, TDes& aDrive ); |
|
115 |
|
116 /** |
|
117 * Returns information whether or not the drive is removable. |
|
118 * |
|
119 * @param aFileSession File server session. |
|
120 * @param aDrive drive letter. |
|
121 * @return ETrue if drive is removable. |
|
122 */ |
|
123 static TBool IsRemovableDrive( RFs& aFileSession, const TDesC& aDrive ); |
|
124 |
|
125 /** |
|
126 * Returns information whether or not the drive is removable. |
|
127 * |
|
128 * @param aFileSession File server session. |
|
129 * @param aDrive drive enumeration. |
|
130 * @return ETrue if drive is removable. |
|
131 */ |
|
132 static TBool IsRemovableDrive( RFs& aFileSession, const TInt aDrive ); |
|
133 |
|
134 /** |
|
135 * Returns the number of drives. |
|
136 * |
|
137 * @param aDriveType type of drives counted. |
|
138 * @return number of drives in the device. |
|
139 */ |
|
140 TInt GetNumberOfDrives( TAknsSrvSkinDriveList aDriveType ) const; |
|
141 |
|
142 /** |
|
143 * Returns the path to private skin directory on a given drive. |
|
144 * |
|
145 * @param aDriveType type of drive to get. |
|
146 * @param aLocation index in drive array. |
|
147 * The max number to use can be retrieved with GetNumberOfDrives. |
|
148 * @param aPath returns path to private directory. |
|
149 */ |
|
150 void SkinDirectoryOnDrive( |
|
151 TAknsSrvSkinDriveList aDriveType, |
|
152 TInt aLocation, |
|
153 TDes& aPath ) const; |
|
154 |
|
155 /** |
|
156 * From MDiskNotifyHandlerCallback. |
|
157 */ |
|
158 void HandleNotifyDisk( |
|
159 TInt aError, |
|
160 const TDiskEvent& aEvent ); |
|
161 |
|
162 private: |
|
163 |
|
164 /* C++ constructor.*/ |
|
165 CAknsSrvDriveMaster( MAknsSrvDriveObserver* aObserver ); |
|
166 |
|
167 /* Second phase constructor. */ |
|
168 void ConstructL(); |
|
169 |
|
170 private: // data |
|
171 |
|
172 /** |
|
173 * Array of removable drives. Each drive is given as drive enumerable |
|
174 * (e.g. EDriveC). |
|
175 * Own. |
|
176 */ |
|
177 RArray<TInt> iRemovableDriveArray; |
|
178 |
|
179 /** |
|
180 * Array of non-removable drives. Each drive is given as drive enumerable |
|
181 * (e.g. EDriveC). |
|
182 * Own. |
|
183 */ |
|
184 RArray<TInt> iStaticDriveArray; |
|
185 |
|
186 /** |
|
187 * Notifier for disk drive status changes. |
|
188 * Own. |
|
189 */ |
|
190 CDiskNotifyHandler* iDiskNotifier; |
|
191 |
|
192 /** |
|
193 * File server session. |
|
194 * Own. |
|
195 */ |
|
196 RFs iFsSession; |
|
197 |
|
198 /** |
|
199 * Observer for drive status changes. |
|
200 * Not own. |
|
201 */ |
|
202 MAknsSrvDriveObserver* iObserver; |
|
203 |
|
204 }; |
|
205 |
|
206 |
|
207 #endif // C_AKNSSRVDRIVEMASTER_H |