commonuis/CommonDialogs/src/CAknFileSelectionModel.h
branchRCL_3
changeset 55 aecbbf00d063
parent 38 c52421ed5f07
child 56 d48ab3b357f1
equal deleted inserted replaced
51:fcdfafb36fe7 55:aecbbf00d063
    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 class TResourceReader;
    32 
    33 class TCFDFileTypes;
       
    34 
    33 
    35 /**
    34 /**
    36  *  A model class for file selection dialog. It is derived from
    35  *  A model class for file selection dialog. It is derived from
    37  *  MDesCArray which provides an interface for listboxes to get items.
    36  *  MDesCArray which provides an interface for listboxes to get items.
    38  *  Model maintains a list of directory entries.
    37  *  Model maintains a list of directory entries.
    42  */
    41  */
    43 NONSHARABLE_CLASS(CAknFileSelectionModel) : public CBase, public MDesCArray
    42 NONSHARABLE_CLASS(CAknFileSelectionModel) : public CBase, public MDesCArray
    44     {
    43     {
    45 
    44 
    46 public:
    45 public:
    47     
    46 
       
    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         ESisFileIcon,
       
    67         EVideoFileIcon,
       
    68         EGameFileIcon,
       
    69         EJavaFileIcon,
       
    70         EUnknowTypeIcon,
       
    71         EFolderEmptyIcon,
       
    72         EFlashFileIcon
       
    73         };
       
    74 
    48 // Constructors and destructor
    75 // Constructors and destructor
    49 
    76 
    50     /**
    77     /**
    51      * Static constructor.
    78      * Static constructor.
    52      * @param aDialogType Dialog type.
    79      * @param aDialogType Dialog type.
   157      * @return Returns pointer to created CDir object.
   184      * @return Returns pointer to created CDir object.
   158      */
   185      */
   159     CDir* ReadDirectory( const TDesC& aDirectory );
   186     CDir* ReadDirectory( const TDesC& aDirectory );
   160 
   187 
   161     /**
   188     /**
   162      * Test if a folder contains subfolders.
   189      * Returns ETrue if a folder contains subfolders.
   163      * @param aFolder Relative folder to current path.
   190      * @param aFolder Relative folder to current path.
   164      * @return Returns ETrue if a folder contains subfolders.
   191      * @return Returns ETrue if a folder contains subfolders.
   165      */
   192      */
   166     TBool ContainsSubfolders( const TDesC& aFolder );
   193     TBool ContainsSubfolders( const TDesC& aFolder );
       
   194 
       
   195     void AppendIconForFileL(const TDesC& aFileName);
       
   196 
       
   197     TPtrC GetLocalizedName(const TDesC& aFileName);
   167     
   198     
   168     /**
   199     /**
   169      * Test if a folder contains files.
   200      * Returns ETrue if a folder contains files.
   170      * @param aFolder Relative folder to current path.
   201      * @param aFolder Relative folder to current path.
   171      * @return Returns ETrue if a folder contains files.
   202      * @return Returns ETrue if a folder contains files.
   172      */
   203      */
   173     TBool ContainsFiles( const TDesC& aFolder );
   204     TBool ContainsFiles( const TDesC& aFolder );
   174     /**
   205 
   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 );
       
   203 // Constructors and destructor
   206 // Constructors and destructor
   204 
   207 
   205     void ConstructL();
   208     void ConstructL();
   206 
   209 
   207     CAknFileSelectionModel(
   210     CAknFileSelectionModel(
   212     // Own: Current path being browsed.
   215     // Own: Current path being browsed.
   213     TParse iCurrentPath;
   216     TParse iCurrentPath;
   214 
   217 
   215     // Own: An array of filtered directory entries.
   218     // Own: An array of filtered directory entries.
   216     CArrayPakFlat<TEntry>* iEntryArray;
   219     CArrayPakFlat<TEntry>* iEntryArray;
   217     
   220 
   218     /* Own: An array which item has local name of file entry 
   221     // Own: An array for image indices
   219      * with icon index and entry index in iEntryArray
   222     RArray<TInt> iImageIndexArray;
   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;
       
   232 
   223 
   233     // Own: // An array of filters.
   224     // Own: // An array of filters.
   234     CArrayPtrSeg<MAknFileFilter>* iFilterArray;
   225     CArrayPtrSeg<MAknFileFilter>* iFilterArray;
   235 
   226 
   236     // Own: File server session.
   227     // Own: File server session.
   249     CCoeEnv& iCoeEnv;
   240     CCoeEnv& iCoeEnv;
   250 
   241 
   251     // Own: Root folder text
   242     // Own: Root folder text
   252     HBufC* iRootFolderText;
   243     HBufC* iRootFolderText;
   253 
   244 
       
   245     // Own: RApaLsSession for getting mime-types for files:
       
   246     RApaLsSession iApaSession;
       
   247 
       
   248     TEntry iFolderEntry;
       
   249 
   254     TParse iParse;
   250     TParse iParse;
   255     // Own: A buffer for using
   251 
   256     HBufC * iStringBuf;
   252     HBufC * iItemWithImageIndex;
   257 
   253 
   258     };
   254     };
   259 
   255 
   260 #endif // C_AKNFILESELECTIONMODEL_H
   256 #endif // C_AKNFILESELECTIONMODEL_H