commonuis/CommonDialogs/src/CAknFileSelectionModel.h
branchRCL_3
changeset 38 c52421ed5f07
parent 29 a8834a2e9a96
child 55 aecbbf00d063
equal deleted inserted replaced
29:a8834a2e9a96 38:c52421ed5f07
    27 #include "CAknFileSelectionDialog.h"
    27 #include "CAknFileSelectionDialog.h"
    28 
    28 
    29 class MAknFileFilter;
    29 class MAknFileFilter;
    30 class MAknFileSelectionObserver;
    30 class MAknFileSelectionObserver;
    31 class CDirectoryLocalizer;
    31 class CDirectoryLocalizer;
    32 
    32 class TResourceReader;
       
    33 class TCFDFileTypes;
    33 
    34 
    34 /**
    35 /**
    35  *  A model class for file selection dialog. It is derived from
    36  *  A model class for file selection dialog. It is derived from
    36  *  MDesCArray which provides an interface for listboxes to get items.
    37  *  MDesCArray which provides an interface for listboxes to get items.
    37  *  Model maintains a list of directory entries.
    38  *  Model maintains a list of directory entries.
    41  */
    42  */
    42 NONSHARABLE_CLASS(CAknFileSelectionModel) : public CBase, public MDesCArray
    43 NONSHARABLE_CLASS(CAknFileSelectionModel) : public CBase, public MDesCArray
    43     {
    44     {
    44 
    45 
    45 public:
    46 public:
    46 
    47     
    47 // Enumerations
       
    48 
       
    49     /**
       
    50      * Enumerations for images.
       
    51      */
       
    52     enum TFileTypeIcon
       
    53         {
       
    54         EFolderIcon,
       
    55         EFileIcon,
       
    56         ESubFolderIcon,
       
    57         EThisFolderIcon,
       
    58         EImageFileIcon,
       
    59         EGmsFileIcon,
       
    60         ELinkFileIcon,
       
    61         EVoiceRecFileIcon,
       
    62         ESoundFileIcon,
       
    63         EPlaylistFileIcon,
       
    64         ECompoFileIcon,
       
    65         ENoteFileIcon,
       
    66         EAppFileIcon,
       
    67         EVideoFileIcon,
       
    68         EGameFileIcon,
       
    69         EUnknowTypeIcon,
       
    70         EFolderEmptyIcon,
       
    71         EFlashFileIcon
       
    72         };
       
    73 
       
    74 // Constructors and destructor
    48 // Constructors and destructor
    75 
    49 
    76     /**
    50     /**
    77      * Static constructor.
    51      * Static constructor.
    78      * @param aDialogType Dialog type.
    52      * @param aDialogType Dialog type.
   183      * @return Returns pointer to created CDir object.
   157      * @return Returns pointer to created CDir object.
   184      */
   158      */
   185     CDir* ReadDirectory( const TDesC& aDirectory );
   159     CDir* ReadDirectory( const TDesC& aDirectory );
   186 
   160 
   187     /**
   161     /**
   188      * Returns ETrue if a folder contains subfolders.
   162      * Test if a folder contains subfolders.
   189      * @param aFolder Relative folder to current path.
   163      * @param aFolder Relative folder to current path.
   190      * @return Returns ETrue if a folder contains subfolders.
   164      * @return Returns ETrue if a folder contains subfolders.
   191      */
   165      */
   192     TBool ContainsSubfolders( const TDesC& aFolder );
   166     TBool ContainsSubfolders( const TDesC& aFolder );
   193 
   167     
   194     void AppendIconForFileL(const TDesC& aFileName);
   168     /**
   195 
   169      * Test if a folder contains files.
   196     TPtrC GetLocalizedName(const TDesC& aFileName);
       
   197     
       
   198     /**
       
   199      * Returns ETrue if a folder contains files.
       
   200      * @param aFolder Relative folder to current path.
   170      * @param aFolder Relative folder to current path.
   201      * @return Returns ETrue if a folder contains files.
   171      * @return Returns ETrue if a folder contains files.
   202      */
   172      */
   203     TBool ContainsFiles( const TDesC& aFolder );
   173     TBool ContainsFiles( const TDesC& aFolder );
   204 
   174     /**
       
   175      * Test if a folder contains contents.
       
   176      * @param aFolder Relative folder to current path.
       
   177      * @return Returns ETrue if a folder contains contents.
       
   178      */
       
   179     TBool ContainsContents( const TDesC& aFolder, TUint aAttMask );
       
   180     /**
       
   181      * Get the file type icon.
       
   182      * @param aFileName File name to get right icon.
       
   183      * return Return incon index base on the extname of file.
       
   184      */
       
   185     TInt GetIconForFileL( const TDesC& aFileName ) const;
       
   186     /**
       
   187      * Get the file local name.
       
   188      * @param aFileName File name to get its locallize name.
       
   189      * @return Returns file's local name.
       
   190      */
       
   191     TPtrC GetLocalizedName(const TDesC& aFileName);
       
   192     /**
       
   193      * Test if a entry can be added in listbox.
       
   194      * @param aEntry The entry which be added or not.
       
   195      * @return Returns ETrue if a entry can be added.
       
   196      */
       
   197     TBool EntryIsAccepted( const TEntry& aEntry ) const;
       
   198     /**
       
   199      * Read file type and icon index from reader
       
   200      * @param aReader Reader object
       
   201      */
       
   202     void ReadFileExtNameAndIconIndexL( TResourceReader& aReader );
   205 // Constructors and destructor
   203 // Constructors and destructor
   206 
   204 
   207     void ConstructL();
   205     void ConstructL();
   208 
   206 
   209     CAknFileSelectionModel(
   207     CAknFileSelectionModel(
   214     // Own: Current path being browsed.
   212     // Own: Current path being browsed.
   215     TParse iCurrentPath;
   213     TParse iCurrentPath;
   216 
   214 
   217     // Own: An array of filtered directory entries.
   215     // Own: An array of filtered directory entries.
   218     CArrayPakFlat<TEntry>* iEntryArray;
   216     CArrayPakFlat<TEntry>* iEntryArray;
   219 
   217     
   220     // Own: An array for image indices
   218     /* Own: An array which item has local name of file entry 
   221     RArray<TInt> iImageIndexArray;
   219      * with icon index and entry index in iEntryArray
       
   220      * */
       
   221     CDesC16ArraySeg * iLocalFileNameArray;
       
   222     
       
   223     /* Own: An array which item has local name of directory entry 
       
   224      * with icon index and entry index in iEntryArray
       
   225      * */
       
   226     CDesC16ArraySeg * iLocalDirNameArray;
       
   227     
       
   228     /* Own: An array which item has extent name of file entry 
       
   229      * with icon index for the file type
       
   230      * */
       
   231     CArrayFixFlat<TCFDFileTypes>* iFileTypeArray;
   222 
   232 
   223     // Own: // An array of filters.
   233     // Own: // An array of filters.
   224     CArrayPtrSeg<MAknFileFilter>* iFilterArray;
   234     CArrayPtrSeg<MAknFileFilter>* iFilterArray;
   225 
   235 
   226     // Own: File server session.
   236     // Own: File server session.
   239     CCoeEnv& iCoeEnv;
   249     CCoeEnv& iCoeEnv;
   240 
   250 
   241     // Own: Root folder text
   251     // Own: Root folder text
   242     HBufC* iRootFolderText;
   252     HBufC* iRootFolderText;
   243 
   253 
   244     // Own: RApaLsSession for getting mime-types for files:
       
   245     RApaLsSession iApaSession;
       
   246 
       
   247     TEntry iFolderEntry;
       
   248 
       
   249     TParse iParse;
   254     TParse iParse;
   250 
   255     // Own: A buffer for using
   251     HBufC * iItemWithImageIndex;
   256     HBufC * iStringBuf;
   252 
   257 
   253     };
   258     };
   254 
   259 
   255 #endif // C_AKNFILESELECTIONMODEL_H
   260 #endif // C_AKNFILESELECTIONMODEL_H