101 DriveState mDriveState; |
129 DriveState mDriveState; |
102 DriveType mDriveType; |
130 DriveType mDriveType; |
103 }; |
131 }; |
104 Q_DECLARE_OPERATORS_FOR_FLAGS( FmDriverInfo::DriveState ) |
132 Q_DECLARE_OPERATORS_FOR_FLAGS( FmDriverInfo::DriveState ) |
105 |
133 |
|
134 /*! |
|
135 \class FmUtils |
|
136 \brief The class FmUtils provide util functions |
|
137 This class is implemented by three parts: |
|
138 fmutils.cpp for Qt Based functions |
|
139 fmutils_s60.cpp is symbian implement version for platform based functions |
|
140 fmutils_win.cpp is win32 implement version for platform based functions( a simple wrapper ) |
|
141 */ |
106 class FmUtils |
142 class FmUtils |
107 { |
143 { |
108 public: |
144 public: |
109 static QString getDriveNameFromPath( const QString &path ); |
145 ////////////////////////////////////////////////////////////////// |
110 static QString getDriveLetterFromPath( const QString &path ); |
146 // <QtBasedFunctions> |
|
147 static QString getDriveNameFromPath( const QString &path ); |
|
148 static QString getDriveLetterFromPath( const QString &path ); |
|
149 static QString formatStorageSize( quint64 size ); |
|
150 static bool isDrive( const QString &path ); |
|
151 static QString formatPath( const QString &path ); |
|
152 static QString fillPathWithSplash( const QString &filePath ); |
|
153 static QString removePathSplash( const QString &filePath ); |
|
154 static void getDriveList( QStringList &driveList, bool isHideUnAvailableDrive ); |
|
155 static QString fillDriveVolume( QString driveName, bool isFillWithDefaultVolume ); |
|
156 static QString getDefaultVolumeName( const QString &driveName ); |
|
157 static QString getVolumeNameWithDefaultNameIfNull( const QString &diskName, bool &defaultName ); |
|
158 static bool isPathEqual( const QString &pathFst, const QString &pathLast ); |
|
159 static bool checkFolderFileName( const QString& name ); |
|
160 static bool checkNewFolderOrFile( const QString& fileName, const QString &path, QString &errString ); |
|
161 static bool isSubLevelPath( const QString &src, const QString &dest ); |
|
162 // </QtBasedFunctions> |
|
163 ////////////////////////////////////////////////////////////////// |
|
164 |
|
165 |
|
166 ////////////////////////////////////////////////////////////////// |
|
167 // <platformBasedFunctions> |
111 static FmDriverInfo queryDriverInfo( const QString &driverName ); |
168 static FmDriverInfo queryDriverInfo( const QString &driverName ); |
112 static QString formatStorageSize( quint64 size ); |
169 |
113 static int removeDrivePwd( const QString &driverName, const QString &Pwd ); |
170 // password related functions |
114 static int unlockDrive( const QString &driverName, const QString &Pwd ); |
171 static int removeDrivePwd( const QString &driverName, const QString &Pwd ); |
115 static int checkDrivePwd( const QString &driverName, const QString &pwd); |
172 static int unlockDrive( const QString &driverName, const QString &Pwd ); |
116 static int setDrivePwd( const QString &driverName, const QString &oldPwd, const QString &newPwd); |
173 static int checkDrivePwd( const QString &driverName, const QString &pwd); |
117 static void emptyPwd( QString &pwd ); |
174 static int setDrivePwd( const QString &driverName, const QString &oldPwd, const QString &newPwd); |
118 static int renameDrive( const QString &driverName, const QString &newVolumeName); |
175 static void emptyPwd( QString &pwd ); |
119 static int ejectDrive( const QString &driverName ); |
176 |
120 static QString getFileType( const QString &filePath ); |
177 // external drive related functions |
121 static quint64 getDriveDetailsResult( const QString &folderPath, const QString &extension ); |
178 static int renameDrive( const QString &driverName, const QString &newVolumeName); |
122 static bool isDriveC( const QString &driverName ); |
179 static int ejectDrive( const QString &driverName ); |
123 static bool isDrive( const QString &path ); |
180 |
124 static void createDefaultFolders( const QString &driverName ); |
181 // drive security related functions |
125 static QString fillPathWithSplash( const QString &filePath ); |
182 static bool checkDriveAccessFilter( const QString &driveName ); |
126 static QString removePathSplash( const QString &filePath ); |
183 static QString checkDriveToFolderFilter( const QString &path ); |
127 static QString formatPath( const QString &path ); |
184 static QString checkFolderToDriveFilter( const QString &path ); |
128 static bool checkDriveAccessFilter( const QString &driveName ); |
185 static int isPathAccessabel( const QString &path ); |
129 static QString checkDriveToFolderFilter( const QString &path ); |
186 static bool isDriveAvailable( const QString &path ); |
130 static QString checkFolderToDriveFilter( const QString &path ); |
187 |
131 static int isPathAccessabel( const QString &path ); |
188 // system default folder related functions |
132 static bool isDriveAvailable( const QString &path ); |
189 static bool isDefaultFolder( const QString &folderPath ); |
133 static bool isPathEqual( const QString &pathFst, const QString &pathLast ); |
190 static void createDefaultFolders( const QString &driverName ); |
134 |
191 static QString localize( const QString &path ); |
135 /// fill driveList of drives can be shown in driveListView |
192 |
136 static void getDriveList( QStringList &driveList, bool isHideUnAvailableDrive ); |
193 // copy move related functions |
137 static QString fillDriveVolume( QString driveName, bool isFillWithDefaultVolume ); |
194 static int setFileAttributes( const QString &srcFile, const QString &desFile ); |
138 |
195 static bool hasEnoughSpace( const QString &targetDrive, qint64 size ); |
139 static int launchFile( const QString &filePath ); |
196 static int moveInsideDrive( const QString &source, const QString &target ); |
140 static void sendFiles( QStringList &filePathList ); |
197 |
141 static QString getBurConfigPath( QString appPath ); |
198 // other fucntions |
142 static bool isDefaultFolder( const QString &folderPath ); |
199 static int launchFile( const QString &filePath ); |
143 static QString Localize( const QString &path ); |
200 static void sendFiles( QStringList &filePathList ); |
144 |
201 static QString getBurConfigPath( QString appPath ); |
145 static int getMaxFileNameLength(); |
202 static QString getFileType( const QString &filePath ); |
146 static bool checkMaxPathLength( const QString& path ); |
203 static bool isDriveC( const QString &driverName ); |
147 static bool checkFolderFileName( const QString& name ); |
204 static int getMaxFileNameLength(); |
148 |
205 static bool checkMaxPathLength( const QString& path ); |
149 /** |
206 // </platformBasedFunctions> |
150 * check file or folder path is illegal or not. |
207 ////////////////////////////////////////////////////////////////// |
151 * |
|
152 * @param fileName file/folder name, used to check illegal characters |
|
153 * @param path file/folder path, used to check if path is available to use. |
|
154 * @param errString if return false, errString will be set for error note. |
|
155 * @return true for not illegal and false for illegal path. |
|
156 */ |
|
157 static bool checkNewFolderOrFile( const QString& fileName, const QString &path, QString &errString ); |
|
158 |
|
159 /* |
|
160 * get the volume name of the disk, if it is null, then return the default name. |
|
161 * @param diskName the driver letter. |
|
162 * @param defaultName whether it is the default name. |
|
163 * @return the volume name. |
|
164 */ |
|
165 static QString getVolumeNameWithDefaultNameIfNull( const QString &diskName, bool &defaultName ); |
|
166 |
|
167 static bool isSubLevelPath( const QString &src, const QString &dest ); |
|
168 |
|
169 static int setFileAttributes( const QString &srcFile, const QString &desFile ); |
|
170 }; |
208 }; |
171 |
209 |
172 #endif |
210 #endif |
173 |
211 |