filemanager/src/filemanager/src/components/fmdrivedetailstype.h
branchRCL_3
changeset 39 65326cf895ed
parent 38 491b3ed49290
child 42 f5c50b8af68c
equal deleted inserted replaced
38:491b3ed49290 39:65326cf895ed
     1 /*
       
     2  * Copyright (c) 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  * 
       
    15  * Description:
       
    16  *      The header file of the drive details type
       
    17  */
       
    18 
       
    19 #ifndef FMDRIVEDETAILSTYPE_H
       
    20 #define FMDRIVEDETAILSTYPE_H
       
    21 
       
    22 #include <QString>
       
    23 #include <QList>
       
    24 #include <QStringList>
       
    25 
       
    26 /*
       
    27     \class FmDriveDetailsSize
       
    28     \brief The class FmDriveDetailsSize used to store view details result.
       
    29  */
       
    30 class FmDriveDetailsSize
       
    31 {
       
    32 public:
       
    33     enum TDataType{
       
    34         ETypeImages = 0,
       
    35         ETypeSoundFiles,
       
    36         ETypeMidpJava,
       
    37         ETypeNativeApps,
       
    38         ETypeVideos,
       
    39         ETypeDocuments,
       
    40         ETypeCalendar,
       
    41         ETypeContacts,
       
    42         ETypeMessages,
       
    43         ETypeOthers
       
    44         };
       
    45     
       
    46 public:
       
    47     FmDriveDetailsSize( TDataType dataType, quint64 size ) 
       
    48         : mDataType( dataType ), mSize( size ) {}
       
    49     FmDriveDetailsSize( const FmDriveDetailsSize &other )
       
    50     {
       
    51         *this = other;
       
    52     }
       
    53     
       
    54     FmDriveDetailsSize &operator= ( const FmDriveDetailsSize &rhs )
       
    55     {
       
    56         this->mDataType = rhs.mDataType;
       
    57         this->mSize = rhs.mSize;
       
    58         return *this;
       
    59     }
       
    60     
       
    61     /*!
       
    62      request the stored data type
       
    63      */
       
    64     TDataType dataType() const { return mDataType; }
       
    65     
       
    66     /*!
       
    67      request the stored size that related to data type
       
    68      */
       
    69     quint64 size() const { return mSize; }
       
    70     
       
    71 private:
       
    72     /*!
       
    73      store the data type
       
    74      */
       
    75     TDataType mDataType;
       
    76     
       
    77     /*!
       
    78      store the size that related to mDataType
       
    79      */
       
    80     quint64 mSize;
       
    81 };
       
    82 
       
    83 /*
       
    84     \class FmDriveDetailsDataGroup
       
    85     \brief The class FmDriveDetailsDataGroup used to store command of get size of absolute file path.
       
    86  */
       
    87 class FmDriveDetailsDataGroup
       
    88 {
       
    89 public:
       
    90     FmDriveDetailsDataGroup( FmDriveDetailsSize::TDataType dataType,
       
    91                 QStringList filePathList ) 
       
    92                : mDataType( dataType ), mFilePath( filePathList )
       
    93     {
       
    94     }
       
    95     FmDriveDetailsDataGroup( const FmDriveDetailsDataGroup &other )
       
    96     {
       
    97         *this = other;
       
    98     }
       
    99     
       
   100     FmDriveDetailsDataGroup &operator= ( const FmDriveDetailsDataGroup &rhs )
       
   101     {
       
   102         this->mDataType = rhs.mDataType;
       
   103         this->mFilePath = rhs.mFilePath;
       
   104         return *this;
       
   105     }
       
   106     
       
   107     FmDriveDetailsSize::TDataType dataType() const { return mDataType; }
       
   108     QStringList pathList() const { return mFilePath; }
       
   109 private:
       
   110     /*!
       
   111      Store which data type does mFilePath belong to.
       
   112      */
       
   113     FmDriveDetailsSize::TDataType mDataType;
       
   114     
       
   115     /*!
       
   116      Store absolute file path that will used to calcuate whole data size related to mDataType
       
   117      */
       
   118     QStringList mFilePath;
       
   119 };
       
   120 
       
   121 /*
       
   122     \class FmDriveDetailsContent
       
   123     \brief The class FmDriveDetailsContent is the interface of view details feature
       
   124  */
       
   125 class FmDriveDetailsContent
       
   126 {
       
   127 public:
       
   128     /*!
       
   129      Gets data size for drive
       
   130      \a driveName which drive is searching
       
   131      \a detailsSizeList if got result, new FmDriveDetailsSize will be appended to detailsSizeList
       
   132      \a isStopped isStopped will be set as true if user cancel this operation
       
   133      return Filemanage wide error. Please refer to fmdefine.h
       
   134      */
       
   135     static int querySizeofContent(
       
   136             const QString &driveName, QList<FmDriveDetailsSize*> &detailsSizeList, volatile bool *isStopped );
       
   137     
       
   138 private:
       
   139     /*!
       
   140      Gets data size(related to file type,e.g. image, sound) by traverse designated drive name.
       
   141      provide size except the path related to absolute path(getDataSizeByAbsolutePath)
       
   142      \sa driveName which drive is searching
       
   143      \a detailsSizeList if got result, new FmDriveDetailsSize will be appended to detailsSizeList
       
   144      \a isStopped isStopped will be set as true if user cancel this operation
       
   145      return Filemanage wide error. Please refer to fmdefine.h
       
   146      */
       
   147     static int getDataSizeByTraversePath( const QString &driveName,
       
   148             QList<FmDriveDetailsSize*> &detailsSizeList, volatile bool *isStopped );
       
   149     
       
   150     /*!
       
   151      Gets data size for single FmDriveDetailsDataGroup, the method is find file of absolute path
       
   152      \a driveName which drive is searching
       
   153      \a dataGroup which dataGroup is searching, for example, EGroupContacts...
       
   154      \a detailsSizeList if got result, new FmDriveDetailsSize will be appended to detailsSizeList
       
   155      \a isStopped isStopped will be set as true if user cancel this operation
       
   156      return Filemanage wide error. Please refer to fmdefine.h
       
   157      */
       
   158     static int getDataSizeByAbsolutePath( const QString &driveName, const FmDriveDetailsDataGroup &dataGroup, 
       
   159                QList<FmDriveDetailsSize*> &detailsSizeList, volatile bool *isStopped );
       
   160 };
       
   161 
       
   162 class FmFolderDetails
       
   163 {
       
   164 public:
       
   165 
       
   166     /*!
       
   167      Gets details for a list of folders
       
   168      \a folderPathList folder path list
       
   169      \a numofFolders output how many folders and subfolders in the list
       
   170      \a numofFiles output how many files in the list
       
   171      \a totalSize output the total size
       
   172      \a isStopped isStopped will be set as true if user cancel this operation
       
   173      \a isSysHiddenIncluded will add QDir::Hidden | QDir::System into filter if true
       
   174      return Filemanage wide error. Please refer to fmdefine.h
       
   175      */
       
   176     static int queryDetailOfContentList( const QStringList folderPathList,int &numofFolders, 
       
   177                                     int &numofFiles, quint64 &totalSize, volatile bool *isStopped, bool isSysHiddenIncluded = false );
       
   178     /*!
       
   179      Gets details for a folder
       
   180      \a folderPath path of the folder
       
   181      \a numofSubFolders output how many subfolders in the list, not include itself
       
   182      \a numofFiles output how many files in the folder
       
   183      \a sizeofFolder output the size of folder
       
   184      \a isStopped isStopped will be set as true if user cancel this operation
       
   185      \a isSysHiddenIncluded will add QDir::Hidden | QDir::System into filter if true
       
   186      return Filemanage wide error. Please refer to fmdefine.h
       
   187      */
       
   188     static int getNumofSubfolders( const QString &folderPath, int &numofSubFolders, 
       
   189                                     int &numofFiles, quint64 &sizeofFolder,
       
   190                                     volatile bool *isStopped, bool  isSysHiddenIncluded = false );
       
   191 };
       
   192 
       
   193 #endif /* FMDRIVEDETAILSTYPE_H */
       
   194