filemanager/src/inc/fmutils.h
changeset 35 060d0b1ab845
parent 30 6e96d2143d46
child 41 fc4654ce4fcb
--- a/filemanager/src/inc/fmutils.h	Tue Jul 06 14:06:28 2010 +0300
+++ b/filemanager/src/inc/fmutils.h	Wed Aug 18 09:39:39 2010 +0300
@@ -26,6 +26,10 @@
 class FmDriverInfo
 {
 public:
+    /*!
+        Used to get drive status for convenience.
+        /sa DriveType is used to get drive type.
+    */
     enum driveState
     {
         EDriveNotPresent = 0x1, // true when Drive have not inserted, for example, MMC Card
@@ -46,7 +50,23 @@
         EDriveMassStorage = 0x8000,
         EDriveRam = 0x10000,
         EDriveUsbMemory = 0x20000,
+        EDriveRemote = 0x40000,
      };
+    
+    /*!
+        Used to get drive type for convenience.
+    */
+    enum DriveType
+    {
+        EDriveTypeRom,
+        EDriveTypeRam,
+        EDriveTypePhoneMemory,
+        EDriveTypeMassStorage,
+        EDriveTypeMemoryCard,
+        EDriveTypeUsbMemory,
+        EDriveTypeRemote,
+    };
+    
     Q_DECLARE_FLAGS( DriveState, driveState )
     
     FmDriverInfo( quint64 s, quint64 f, const QString &n, const QString &vN, const quint32 driveState ) :
@@ -71,6 +91,7 @@
     QString name() const { return mName; }
     QString volumeName() const { return mVolumeName; }
     DriveState driveState() const { return mDriveState; }
+    FmDriverInfo::DriveType driveType();
     
 private:
     quint64 mSize;
@@ -78,6 +99,7 @@
     QString mName;
     QString mVolumeName;
     DriveState mDriveState;
+    DriveType mDriveType;
 };
 Q_DECLARE_OPERATORS_FOR_FLAGS( FmDriverInfo::DriveState )
 
@@ -127,12 +149,24 @@
     /**
      * check file or folder path is illegal or not.
      *
-     * @param  path file/folder path.
+	 * @param  fileName file/folder name, used to check illegal characters
+     * @param  path file/folder path, used to check if path is available to use.
      * @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 );
+    static bool checkNewFolderOrFile( const QString& fileName, const QString &path, QString &errString );
+    
+    /*
+     * get the volume name of the disk, if it is null, then return the default name.
+     * @param diskName the driver letter.
+     * @param defaultName whether it is the default name.
+     * @return the volume name.
+     */
+    static QString getVolumeNameWithDefaultNameIfNull( const QString &diskName, bool &defaultName );
 
+    static bool isSubLevelPath( const QString &src, const QString &dest );
+
+	static int setFileAttributes( const QString &srcFile, const QString &desFile ); 
 };
 
 #endif