26 class FmDriverInfo |
26 class FmDriverInfo |
27 { |
27 { |
28 public: |
28 public: |
29 enum driveState |
29 enum driveState |
30 { |
30 { |
31 EDriveNotPresent = 0x1, |
31 EDriveNotPresent = 0x1, // true when Drive have not inserted, for example, MMC Card |
32 EDriveLocked = 0x2, |
32 EDriveAvailable = 0x2, // false when drive is locked or corrupted, for example MMC Card |
33 EDriveCorrupted = 0x4, |
33 EDriveLocked = 0x4, |
34 EDriveWriteProtected = 0x8, |
34 EDriveCorrupted = 0x8, |
35 EDriveRemovable = 0x10, |
35 EDriveWriteProtected = 0x10, |
36 EDriveRom = 0x20, |
36 EDriveRemovable = 0x20, |
37 EDriveFormattable = 0x40, |
37 EDriveRom = 0x40, |
38 EDriveFormatted = 0x80, |
38 EDriveFormattable = 0x80, |
39 EDriveLockable = 0x100, |
39 EDriveFormatted = 0x100, |
40 EDrivePasswordProtected = 0x200, |
40 EDriveLockable = 0x200, |
41 EDriveBackupped = 0x400, |
41 EDrivePasswordProtected = 0x400, |
42 EDriveConnected = 0x800, |
42 EDriveBackupped = 0x800, |
43 EDriveEjectable = 0x1000, |
43 EDriveConnected = 0x1000, |
44 EDriveInUse = 0x2000, |
44 EDriveEjectable = 0x2000, |
45 EDriveMassStorage = 0x4000, |
45 EDriveInUse = 0x4000, |
46 EDriveRam = 0x8000, |
46 EDriveMassStorage = 0x8000, |
47 EDriveAvailable = 0x10000 |
47 EDriveRam = 0x10000, |
|
48 EDriveUsbMemory = 0x20000, |
48 }; |
49 }; |
49 Q_DECLARE_FLAGS( DriveState, driveState ) |
50 Q_DECLARE_FLAGS( DriveState, driveState ) |
50 |
51 |
51 FmDriverInfo( quint64 s, quint64 f, const QString &n, const QString &vN, const quint32 driveState ) : |
52 FmDriverInfo( quint64 s, quint64 f, const QString &n, const QString &vN, const quint32 driveState ) : |
52 mSize( s ), mFreeSize( f ), mName( n ), mVolumeName( vN ), mDriveState( driveState ) {} |
53 mSize( s ), mFreeSize( f ), mName( n ), mVolumeName( vN ), mDriveState( driveState ) {} |
85 public: |
86 public: |
86 static QString getDriveNameFromPath( const QString &path ); |
87 static QString getDriveNameFromPath( const QString &path ); |
87 static QString getDriveLetterFromPath( const QString &path ); |
88 static QString getDriveLetterFromPath( const QString &path ); |
88 static FmDriverInfo queryDriverInfo( const QString &driverName ); |
89 static FmDriverInfo queryDriverInfo( const QString &driverName ); |
89 static QString formatStorageSize( quint64 size ); |
90 static QString formatStorageSize( quint64 size ); |
90 //static quint32 getDriverState( const QString &driverName ); |
|
91 static int removeDrivePwd( const QString &driverName, const QString &Pwd ); |
91 static int removeDrivePwd( const QString &driverName, const QString &Pwd ); |
92 static int unlockDrive( const QString &driverName, const QString &Pwd ); |
92 static int unlockDrive( const QString &driverName, const QString &Pwd ); |
93 static int checkDrivePwd( const QString &driverName, const QString &pwd); |
93 static int checkDrivePwd( const QString &driverName, const QString &pwd); |
94 static int setDrivePwd( const QString &driverName, const QString &oldPwd, const QString &newPwd); |
94 static int setDrivePwd( const QString &driverName, const QString &oldPwd, const QString &newPwd); |
95 static void emptyPwd( QString &pwd ); |
95 static void emptyPwd( QString &pwd ); |
96 static int renameDrive( const QString &driverName, const QString &newVolumeName); |
96 static int renameDrive( const QString &driverName, const QString &newVolumeName); |
97 static void ejectDrive( const QString &driverName ); |
97 static int ejectDrive( const QString &driverName ); |
98 static QString getFileType( const QString &filePath ); |
98 static QString getFileType( const QString &filePath ); |
99 static quint64 getDriveDetailsResult( const QString &folderPath, const QString &extension ); |
99 static quint64 getDriveDetailsResult( const QString &folderPath, const QString &extension ); |
100 static bool isDriveC( const QString &driverName ); |
100 static bool isDriveC( const QString &driverName ); |
101 static bool isDrive( const QString &path ); |
101 static bool isDrive( const QString &path ); |
102 static void createDefaultFolders( const QString &driverName ); |
102 static void createDefaultFolders( const QString &driverName ); |
103 static QString fillPathWithSplash( const QString &filePath ); |
103 static QString fillPathWithSplash( const QString &filePath ); |
104 static QString removePathSplash( const QString &filePath ); |
104 static QString removePathSplash( const QString &filePath ); |
105 static QString formatPath( const QString &path ); |
105 static QString formatPath( const QString &path ); |
106 static bool checkDriveFilter( const QString &driveName ); |
106 static bool checkDriveAccessFilter( const QString &driveName ); |
107 static QString checkDriveToFolderFilter( const QString &path ); |
107 static QString checkDriveToFolderFilter( const QString &path ); |
108 static QString checkFolderToDriveFilter( const QString &path ); |
108 static QString checkFolderToDriveFilter( const QString &path ); |
109 static bool isPathAccessabel( const QString &path ); |
109 static int isPathAccessabel( const QString &path ); |
110 static bool isDriveAvailable( const QString &path ); |
110 static bool isDriveAvailable( const QString &path ); |
111 static bool isPathEqual( const QString &pathFst, const QString &pathLast ); |
111 static bool isPathEqual( const QString &pathFst, const QString &pathLast ); |
112 |
112 |
113 /// fill driveList of drives can be shown in driveListView |
113 /// fill driveList of drives can be shown in driveListView |
114 static void getDriveList( QStringList &driveList, bool isHideUnAvailableDrive ); |
114 static void getDriveList( QStringList &driveList, bool isHideUnAvailableDrive ); |
117 static int launchFile( const QString &filePath ); |
117 static int launchFile( const QString &filePath ); |
118 static void sendFiles( QStringList &filePathList ); |
118 static void sendFiles( QStringList &filePathList ); |
119 static QString getBurConfigPath( QString appPath ); |
119 static QString getBurConfigPath( QString appPath ); |
120 static bool isDefaultFolder( const QString &folderPath ); |
120 static bool isDefaultFolder( const QString &folderPath ); |
121 static QString Localize( const QString &path ); |
121 static QString Localize( const QString &path ); |
|
122 |
|
123 static int getMaxFileNameLength(); |
|
124 static bool checkMaxPathLength( const QString& path ); |
|
125 static bool checkFolderFileName( const QString& name ); |
|
126 |
|
127 /** |
|
128 * check file or folder path is illegal or not. |
|
129 * |
|
130 * @param path file/folder path. |
|
131 * @param errString if return false, errString will be set for error note. |
|
132 * @return true for not illegal and false for illegal path. |
|
133 */ |
|
134 static bool checkNewFolderOrFile( const QString &path, QString &errString ); |
122 |
135 |
123 }; |
136 }; |
124 |
137 |
125 #endif |
138 #endif |
126 |
139 |