|
1 /* |
|
2 * Copyright (c) 2005-2009 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: CSConFSHandler header file |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef _SCONFSHANDLER_H_ |
|
20 #define _SCONFSHANDLER_H_ |
|
21 |
|
22 // INCLUDES |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <obexobjects.h> |
|
26 |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CDirectoryLocalizer; |
|
30 |
|
31 |
|
32 //============================================================ |
|
33 // Class CSConFsHandler declaration |
|
34 //============================================================ |
|
35 NONSHARABLE_CLASS( CSConFsHandler ) : public CBase |
|
36 { |
|
37 public: |
|
38 static CSConFsHandler* NewL( RFs& aFs ); |
|
39 ~CSConFsHandler(); |
|
40 /** |
|
41 * Parses folder and file listing from specified directory |
|
42 * @param aBuffer Buffer to store the folder list |
|
43 * @param aPathName Folder path |
|
44 * @param aMemNumber memory number (1= DEV or MMC, 2= DEV2 or MMC2..) |
|
45 * @return KErrNone if no errors, else system wide error codes. |
|
46 */ |
|
47 TInt ParseFolderListL( CBufFlat* aBuffer, const TPtrC aPathName, |
|
48 const TInt aMemNumber ); |
|
49 /** |
|
50 * Gets a file object |
|
51 * @param aBuffer CObexFileObject object where the file will be stored |
|
52 * @param aPathName The path of the file |
|
53 * @param aFileName The name of the file |
|
54 * @return KErrNone if no errors, else system wide error codes. |
|
55 */ |
|
56 TInt GetFileObjectL( CObexFileObject*& aBuffer, const TPtrC aPathName, |
|
57 const TPtrC aFileName ); |
|
58 /** |
|
59 * Stores a file object |
|
60 * @param aFullPathName The full path and name of the file |
|
61 * @param aTime The time stamp of the file |
|
62 * @param aTempFileName Data temp file |
|
63 * @return KErrNone if no errors, else system wide error codes. |
|
64 */ |
|
65 TInt SaveFileObjectL( const TPtrC aFullPathName, const TTime aTime, |
|
66 const TPtrC aTempFileName ); |
|
67 /** |
|
68 * Validates the file name |
|
69 * @param aName File name to be validated |
|
70 * @return KErrNone if no errors, else system wide error codes. |
|
71 */ |
|
72 TInt ValidateFileName( const TPtrC aName ); |
|
73 /** |
|
74 * Creates a folder |
|
75 * @param aFolderPath The name and the path of the folder |
|
76 * @return KErrNone if no errors, else system wide error codes. |
|
77 */ |
|
78 TInt CreateFolderL( const TPtrC aFolderPath ); |
|
79 /** |
|
80 * Removes a folder or a file |
|
81 * @param aFullPath The path and name of the object |
|
82 * @return KErrNone if no errors, else system wide error codes. |
|
83 */ |
|
84 TInt DeleteObjectL( const TPtrC aFullPath ); |
|
85 |
|
86 /** |
|
87 * Copy or Move file/folder |
|
88 * @param aSource |
|
89 * @param aTarget |
|
90 * @param aUseCopyCommand if ETrue does copy, else does move. |
|
91 * @return none. |
|
92 */ |
|
93 void DoCopyOrMoveFileL( const TDesC& aSource, const TDesC& aTarget, |
|
94 const TBool aUseCopyCommand ); |
|
95 |
|
96 /** |
|
97 * Check if folder can be showed |
|
98 * @param aFullPath The path of the object |
|
99 * @return ETrue if folder exists and can be showed. |
|
100 */ |
|
101 TBool IsFolderVisible( const TDesC& aFullPath ); |
|
102 |
|
103 private: |
|
104 CSConFsHandler( RFs& aFs ); |
|
105 void ConstructL(); |
|
106 /** |
|
107 * Updates the name of the data folder from a localized string |
|
108 * @param none |
|
109 * @return none |
|
110 */ |
|
111 void GetDataPathNameL(); |
|
112 |
|
113 /** |
|
114 * Check if folder is read only |
|
115 * @param aFullPath The path of the object |
|
116 * @return ETrue if folder is read only, or if folder does not exist |
|
117 */ |
|
118 TBool IsFolderReadOnly( const TDesC& aFullPath ) const; |
|
119 /** |
|
120 * Check if folder can be deleted |
|
121 * @param aFullPath The path of the object |
|
122 * @return ETrue if folder can be deleted |
|
123 */ |
|
124 TBool IsFolderDeletable( const TDesC& aFullPath ) const; |
|
125 /** |
|
126 * Get parent folder |
|
127 * @param aFullPath The folder full path with or without backlash ending |
|
128 * @param aParent The founded parent folder with backlash |
|
129 * @return KErrNone if parent folder founded |
|
130 */ |
|
131 TInt GetParentFolder( const TDesC& aFullPath, TDes& aParent); |
|
132 |
|
133 /** |
|
134 * Get folder (and subfolders) size |
|
135 * @param aFullPath The folder full path with backlash ending |
|
136 * @return folder total size |
|
137 */ |
|
138 TInt64 GetFolderSizeL( const TDesC& aFullPath ); |
|
139 |
|
140 /** |
|
141 * Replaces all special characters to xml compliant ones |
|
142 * @param aDes characters to be checked and replaced |
|
143 */ |
|
144 void ReplaceSpecialChars( TDes8& aDes ); |
|
145 |
|
146 /** |
|
147 * Check if folder is exluded and cannot be shown to user |
|
148 * @param aFullPath The full path with backlash ending |
|
149 * @return ETrue if folder is exluded |
|
150 */ |
|
151 TBool IsExludedPath( const TDesC& aFullPath ) const; |
|
152 |
|
153 /** |
|
154 * Prints folder information to obex-folder-list |
|
155 */ |
|
156 void PrintFolderL( CBufFlat* aBuffer, TInt& aOffset, const TDesC& aParentPath, |
|
157 const TDesC8& aMemType, const TEntry& aFolderEntry ); |
|
158 /** |
|
159 * Prints file information to obex-folder-list |
|
160 */ |
|
161 void PrintFileL( CBufFlat* aBuffer, TInt& aOffset, const TEntry& aFileEntry ); |
|
162 |
|
163 private: |
|
164 RFs& iFs; // not own |
|
165 CDirectoryLocalizer* iLocalizer; |
|
166 TBuf8<KMaxFileName> iDataPathName; // Localized data path |
|
167 }; |
|
168 |
|
169 #endif |
|
170 |
|
171 // End of file |
|
172 |