filebrowser/engine/engine.h
changeset 17 4f2773374eff
child 19 4b22a598b890
equal deleted inserted replaced
15:e11368ed4880 17:4f2773374eff
       
     1 /*
       
     2 * Copyright (c) 2010 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 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __ENGINE_H__
       
    19 #define __ENGINE_H__
       
    20 
       
    21 // INCLUDES
       
    22 #include <e32std.h>
       
    23 #include <e32base.h>
       
    24 #include <apgcli.h>
       
    25 #include <CAknMemorySelectionSettingPage.h>
       
    26 #include "FBFileUtils.h"
       
    27 
       
    28 // setting keys (do not change uids of existing keys to maintain compatibility to older versions!)
       
    29 const TUid KFBSettingDisplayMode                   = { 0x00 };
       
    30 const TUid KFBSettingFileViewMode                  = { 0x01 };
       
    31 const TUid KFBSettingShowSubDirectoryInfo          = { 0x02 };
       
    32 const TUid KFBSettingShowAssociatedIcons           = { 0x03 };
       
    33 const TUid KFBSettingRememberLastPath              = { 0x04 };
       
    34 const TUid KFBSettingLastPath                      = { 0x05 };
       
    35 
       
    36 const TUid KFBSettingSupportNetworkDrives          = { 0x06 };
       
    37 const TUid KFBSettingBypassPlatformSecurity        = { 0x07 };
       
    38 const TUid KFBSettingRemoveFileLocks               = { 0x08 };
       
    39 const TUid KFBSettingIgnoreProtectionsAtts         = { 0x09 };
       
    40 const TUid KFBSettingRemoveROMWriteProtection      = { 0x0A };
       
    41 
       
    42 const TUid KFBSettingFolderSelection               = { 0x0B };
       
    43 const TUid KFBSettingEnableToolbar                 = { 0x0C };
       
    44 
       
    45 
       
    46 // FORWARD DECLARATIONS
       
    47 class CFileBrowserFileListContainer;
       
    48 class CFileBrowserScreenCapture;
       
    49 class CFileBrowserFileUtils;
       
    50 class CEikonEnv;
       
    51 class CAknGlobalConfirmationQuery;
       
    52 class CDictionaryFileStore;
       
    53 class MFileBrowserUI;
       
    54 
       
    55 // CLASS DECLARATIONS
       
    56 
       
    57 class TFileBrowserSettings
       
    58     {
       
    59 public:
       
    60     TInt                                        iDisplayMode;
       
    61     TInt                                        iFileViewMode;
       
    62     TBool                                       iShowSubDirectoryInfo;
       
    63     TBool                                       iShowAssociatedIcons;
       
    64     TBool                                       iRememberLastPath;
       
    65     TFileName                                   iLastPath;
       
    66     TBool                                       iRememberFolderSelection;
       
    67     TBool                                       iEnableToolbar;
       
    68 
       
    69     TBool                                       iSupportNetworkDrives;
       
    70     TBool                                       iBypassPlatformSecurity;
       
    71     TBool                                       iRemoveFileLocks;
       
    72     TBool                                       iIgnoreProtectionsAtts;
       
    73     TBool                                       iRemoveROMWriteProrection;
       
    74     };
       
    75 
       
    76 // INFERFACE FOR COMMUNICATION WITH UI
       
    77 
       
    78 class MFileBrowserUI
       
    79 {
       
    80 public:
       
    81     /**
       
    82       * Method from getting current index
       
    83       * @return current index.
       
    84       */
       
    85 //    virtual TInt QueryCurrentItemIndex() = 0;
       
    86 
       
    87     /**
       
    88      * Shows info message with text
       
    89      * @param A aText text to be shown in message body.
       
    90      * @param A aTitle text to be shown in message title.
       
    91      * @return None.
       
    92      */
       
    93     virtual void ShowInformationNote(const TDesC &aDescText, const TDesC &aDescTitle) = 0;
       
    94 
       
    95     /**
       
    96      * Shows error message with error text
       
    97      * @param aText An error text to be shown in message.
       
    98      * @return None.
       
    99      */
       
   100     virtual void ShowErrorNote(const TDesC& aText, TBool aNoTimeout = EFalse) = 0;
       
   101 
       
   102     /**
       
   103      * Shows confirmation message with text
       
   104      * @param aText An text to be shown in message.
       
   105      * @return None.
       
   106      */
       
   107     virtual void ShowConfirmationNote(const TDesC& aText, TBool aNoTimeout = EFalse) = 0;
       
   108 
       
   109 //    /**
       
   110 //     * Shows progress bar with text
       
   111 //     * @param aText A text to be shown at top of the progress bar.
       
   112 //     * @param aMinimum A minimum progress bar value.
       
   113 //     * @param aMaximum A maximum progress bar value.
       
   114 //     * @return None.
       
   115 //     */
       
   116 //    virtual void ShowProgressBar(const TDesC& aText, TInt aMinimum, TInt aMaximum ) = 0;
       
   117 //
       
   118 //    /**
       
   119 //     * Sets progress bar value
       
   120 //     * @param aValue A value between min and max value of the progress bar range
       
   121 //     * @return None.
       
   122 //     */
       
   123 //    virtual void SetProgressBarValue(TInt aValue) = 0;
       
   124 //
       
   125 //    /**
       
   126 //     * Hides progress bar
       
   127 //     * @return None.
       
   128 //     */
       
   129 //    virtual void HideProgressBar() = 0;
       
   130 //
       
   131 //    /**
       
   132 //     * Shows wait dialog with text
       
   133 //     * @param aText A text to be shown at top of the wait bar.
       
   134 //     * @return None.
       
   135 //     */
       
   136 //    virtual void ShowWaitDialog(const TDesC& aText) = 0;
       
   137 //
       
   138 //    /**
       
   139 //     * Hides wait dialog
       
   140 //     * @return None.
       
   141 //     */
       
   142 //    virtual void HideWaitDialog() = 0;
       
   143 
       
   144     /**
       
   145      * Shows confirmation dialog
       
   146      * @param aFileName String contaning file name and path
       
   147      * @return ETrue if user pressed OK button, otherwise EFalse.
       
   148      */
       
   149     virtual TBool ShowConfirmationQuery(const TDesC& aDescText) = 0;
       
   150 
       
   151 };
       
   152 
       
   153 class CEngine : public CBase
       
   154     {
       
   155 public:
       
   156     static CEngine* NewL(MFileBrowserUI *aFileBrowserUI);
       
   157     ~CEngine();
       
   158 
       
   159 private:
       
   160     CEngine();
       
   161     void ConstructL(MFileBrowserUI *aFileBrowserUI);
       
   162     void LoadSettingsL();
       
   163     void GetHashKeySelectionStatus();
       
   164     void LoadDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, TInt& aValue);
       
   165     void LoadDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, TDes& aValue);
       
   166     void SaveDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, const TInt& aValue);
       
   167     void SaveDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, const TDes& aValue);
       
   168 
       
   169 public:
       
   170     void ActivateEngineL();
       
   171     void DeActivateEngineL();
       
   172     void SaveSettingsL(TBool aNotifyModules=ETrue);
       
   173 //    void SetFileListContainer(CFileBrowserFileListContainer* aFileListContainer);
       
   174     TInt LaunchSettingsDialogL();
       
   175     inline TFileBrowserSettings& Settings() { return iSettings; }
       
   176     inline CEikonEnv* EikonEnv() { return iEnv; }
       
   177     inline RApaLsSession& LsSession() { return iLs; }
       
   178     inline CFileBrowserScreenCapture* ScreenCapture() { return iScreenCapture; }
       
   179     inline CFileBrowserFileUtils* FileUtils() { return iFileUtils; }
       
   180     inline MFileBrowserUI* FileBrowserUI() { return iFileBrowserUI; }
       
   181     inline CFileBrowserFileListContainer* FileListContainer() { return iFileListContainer; }
       
   182     inline TBool IsHashKeySelectionInUse() { return iIsHashKeySelectionInUse; }
       
   183 
       
   184     void OpenWithApparcL(TFileName aFileName);
       
   185     void OpenWithDocHandlerL(TFileName aFileName, TBool aEmbed);
       
   186 //    TInt QueryCurrentItemIndex();
       
   187 //    CArrayFix<TInt> *GetSelectedIndices();
       
   188     TSearchAttributes GetSearchAttributes();
       
   189     void ChangeAttributes(TSearchAttributes attributes);
       
   190     TSearchResults SearchResults();
       
   191     CFileEntryList* FoundFiles();	
       
   192     void SearchL();
       
   193 
       
   194 private:
       
   195     MFileBrowserUI                  *iFileBrowserUI;
       
   196     CFileBrowserFileListContainer   *iFileListContainer;
       
   197     CFileBrowserScreenCapture       *iScreenCapture;
       
   198     CFileBrowserFileUtils           *iFileUtils;
       
   199     CEikonEnv*                      iEnv;
       
   200     TFileBrowserSettings            iSettings;
       
   201     RApaLsSession                   iLs;
       
   202     TBool                           iIsHashKeySelectionInUse; 
       
   203     };
       
   204    
       
   205 
       
   206 #endif // __ENGINE_H__