filemanager/src/inc/fmutils.h
changeset 25 b7bfdea70ca2
parent 16 ada7962b4308
child 27 df183af6b92f
--- a/filemanager/src/inc/fmutils.h	Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/inc/fmutils.h	Fri Jun 25 17:08:34 2010 +0800
@@ -28,23 +28,24 @@
 public:
     enum driveState
     {
-        EDriveNotPresent = 0x1,
-        EDriveLocked = 0x2,
-        EDriveCorrupted = 0x4,
-        EDriveWriteProtected = 0x8,
-        EDriveRemovable = 0x10,
-        EDriveRom = 0x20,
-        EDriveFormattable = 0x40,
-        EDriveFormatted = 0x80,
-        EDriveLockable = 0x100,
-        EDrivePasswordProtected = 0x200,
-        EDriveBackupped = 0x400,
-        EDriveConnected = 0x800,
-        EDriveEjectable = 0x1000,
-        EDriveInUse = 0x2000,
-        EDriveMassStorage = 0x4000,
-        EDriveRam = 0x8000,
-        EDriveAvailable = 0x10000
+        EDriveNotPresent = 0x1, // true when Drive have not inserted, for example, MMC Card
+        EDriveAvailable = 0x2,  // false when drive is locked or corrupted, for example MMC Card
+        EDriveLocked = 0x4,
+        EDriveCorrupted = 0x8,
+        EDriveWriteProtected = 0x10,
+        EDriveRemovable = 0x20,
+        EDriveRom = 0x40,
+        EDriveFormattable = 0x80,
+        EDriveFormatted = 0x100,
+        EDriveLockable = 0x200,
+        EDrivePasswordProtected = 0x400,
+        EDriveBackupped = 0x800,
+        EDriveConnected = 0x1000,
+        EDriveEjectable = 0x2000,
+        EDriveInUse = 0x4000,
+        EDriveMassStorage = 0x8000,
+        EDriveRam = 0x10000,
+        EDriveUsbMemory = 0x20000,
      };
     Q_DECLARE_FLAGS( DriveState, driveState )
     
@@ -87,14 +88,13 @@
 	static QString getDriveLetterFromPath( const QString &path );
     static FmDriverInfo queryDriverInfo( const QString &driverName );
     static QString formatStorageSize( quint64 size );
-    //static quint32 getDriverState( const QString &driverName );
     static int removeDrivePwd( const QString &driverName, const QString &Pwd );
     static int unlockDrive( const QString &driverName, const QString &Pwd );
     static int checkDrivePwd( const QString &driverName, const QString &pwd);
     static int setDrivePwd( const QString &driverName, const QString &oldPwd, const QString &newPwd);
     static void emptyPwd( QString &pwd );
     static int renameDrive( const QString &driverName, const QString &newVolumeName);
-    static void ejectDrive( const QString &driverName );
+    static int ejectDrive( const QString &driverName );
     static QString getFileType( const QString &filePath  );
     static quint64 getDriveDetailsResult( const QString &folderPath, const QString &extension );
     static bool isDriveC( const QString &driverName );
@@ -103,10 +103,10 @@
     static QString fillPathWithSplash( const QString &filePath );
     static QString removePathSplash( const QString &filePath );
     static QString formatPath( const QString &path  );
-    static bool checkDriveFilter( const QString &driveName );
+    static bool checkDriveAccessFilter( const QString &driveName );
     static QString checkDriveToFolderFilter( const QString &path );
     static QString checkFolderToDriveFilter( const QString &path );
-    static bool isPathAccessabel( const QString &path );
+    static int isPathAccessabel( const QString &path );
     static bool isDriveAvailable( const QString &path );
     static bool isPathEqual( const QString &pathFst, const QString &pathLast );
 
@@ -119,6 +119,19 @@
     static QString getBurConfigPath( QString appPath );
     static bool isDefaultFolder( const QString &folderPath  );
     static QString Localize( const QString &path );
+    
+    static int getMaxFileNameLength();
+    static bool checkMaxPathLength( const QString& path );
+    static bool checkFolderFileName( const QString& name );
+    
+    /**
+     * check file or folder path is illegal or not.
+     *
+     * @param  path file/folder path.
+     * @param  errString if return false, errString will be set for error note.
+     * @return true for not illegal and false for illegal path.
+     */
+    static bool checkNewFolderOrFile( const QString &path, QString &errString );
 
 };