filebrowser/engine/engine.h
branchRCL_3
changeset 20 fad26422216a
parent 19 b3cee849fa46
child 21 f8280f3bfeb7
equal deleted inserted replaced
19:b3cee849fa46 20:fad26422216a
     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 
       
    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 CDictionaryFileStore;
       
    52 class MFileBrowserUI;
       
    53 
       
    54 // CLASS DECLARATIONS
       
    55 
       
    56 class TFileBrowserSettings
       
    57     {
       
    58 public:
       
    59     TInt                                        iDisplayMode;
       
    60     TInt                                        iFileViewMode;
       
    61     TBool                                       iShowSubDirectoryInfo;
       
    62     TBool                                       iShowAssociatedIcons;
       
    63     TBool                                       iRememberLastPath;
       
    64     TFileName                                   iLastPath;
       
    65     TBool                                       iRememberFolderSelection;
       
    66     TBool                                       iEnableToolbar;
       
    67 
       
    68     TBool                                       iSupportNetworkDrives;
       
    69     TBool                                       iBypassPlatformSecurity;
       
    70     TBool                                       iRemoveFileLocks;
       
    71     TBool                                       iIgnoreProtectionsAtts;
       
    72     TBool                                       iRemoveROMWriteProrection;
       
    73     };
       
    74 
       
    75 // INFERFACE FOR COMMUNICATION WITH UI
       
    76 
       
    77 class MFileBrowserUI
       
    78 {
       
    79 public:
       
    80 //    /**
       
    81 //      * Method from getting current index
       
    82 //      * @return current index.
       
    83 //      */
       
    84 //    virtual TInt QueryCurrentItemIndex() = 0;
       
    85 
       
    86     /**
       
    87      * Shows info message with text
       
    88      * @param A aText text to be shown in message body.
       
    89      * @param A aTitle text to be shown in message title.
       
    90      * @return None.
       
    91      */
       
    92     virtual void ShowInformationNote(const TDesC &aDescText, const TDesC &aDescTitle) = 0;
       
    93 
       
    94     /**
       
    95      * Shows error message with error text
       
    96      * @param aText An error text to be shown in message.
       
    97      * @return None.
       
    98      */
       
    99     virtual void ShowErrorNote(const TDesC& aText, TBool aNoTimeout = EFalse) = 0;
       
   100 
       
   101     /**
       
   102      * Shows confirmation message with text
       
   103      * @param aText An text to be shown in message.
       
   104      * @return None.
       
   105      */
       
   106     virtual void ShowConfirmationNote(const TDesC& aText, TBool aNoTimeout = EFalse) = 0;
       
   107 
       
   108     /**
       
   109      * Shows progress bar with text
       
   110      * @param aText A text to be shown at top of the progress bar.
       
   111      * @param aMinimum A minimum progress bar value.
       
   112      * @param aMaximum A maximum progress bar value.
       
   113      * @return None.
       
   114      */
       
   115     virtual void ShowProgressDialog(const TDesC& aDescText, TInt aMinimum, TInt aMaximum ) = 0;
       
   116 
       
   117     /**
       
   118      * Cancel progress dialog
       
   119      * @return None.
       
   120      */
       
   121     virtual void CancelProgressDialog() = 0;
       
   122 
       
   123     /**
       
   124       * Set progress dialog value
       
   125       * @param aValue A vaule to be shown at top of the progress dialog.
       
   126       */
       
   127     virtual void SetProgressValue(TInt aValue) = 0;
       
   128 //
       
   129 //    /**
       
   130 //     * Sets progress bar value
       
   131 //     * @param aValue A value between min and max value of the progress bar range
       
   132 //     * @return None.
       
   133 //     */
       
   134 //    virtual void SetProgressBarValue(TInt aValue) = 0;
       
   135 //
       
   136 //    /**
       
   137 //     * Hides progress bar
       
   138 //     * @return None.
       
   139 //     */
       
   140 //    virtual void HideProgressBar() = 0;
       
   141 //
       
   142     /**
       
   143      * Shows wait dialog with text
       
   144      * @param aText A text to be shown at top of the wait bar.
       
   145      * @return None.
       
   146      */
       
   147     virtual void ShowWaitDialog(const TDesC& aText) = 0;
       
   148 
       
   149     /**
       
   150      * Cancel wait dialog
       
   151      * @return None.
       
   152      */
       
   153     virtual void CancelWaitDialog() = 0;
       
   154 
       
   155     /**
       
   156      * Processes all pending events to allow wait/progresa dialog to update itself
       
   157      * @return None.
       
   158      */
       
   159     virtual void ProcessEvents() = 0;
       
   160 
       
   161     /**
       
   162      * Shows confirmation dialog
       
   163      * @param aFileName String contaning file name and path
       
   164      * @return ETrue if user pressed OK button, otherwise EFalse.
       
   165      */
       
   166     virtual TBool ShowConfirmationQuery(const TDesC& aDescText) = 0;
       
   167 
       
   168 };
       
   169 
       
   170 class CEngine : public CBase
       
   171     {
       
   172 public:
       
   173     static CEngine* NewL(MFileBrowserUI *aFileBrowserUI);
       
   174     ~CEngine();
       
   175 
       
   176 private:
       
   177     CEngine();
       
   178     void ConstructL(MFileBrowserUI *aFileBrowserUI);
       
   179     void LoadSettingsL();
       
   180     void LoadDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, TInt& aValue);
       
   181     void LoadDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, TDes& aValue);
       
   182     void SaveDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, const TInt& aValue);
       
   183     void SaveDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, const TDes& aValue);
       
   184 
       
   185 public:
       
   186     void ActivateEngineL();
       
   187     void DeActivateEngineL();
       
   188     void SaveSettingsL(TBool aNotifyModules=ETrue);
       
   189     TInt LaunchSettingsDialogL();
       
   190     inline TFileBrowserSettings& Settings() { return iSettings; }
       
   191     inline CEikonEnv* EikonEnv() { return iEnv; }
       
   192     inline RApaLsSession& LsSession() { return iLs; }
       
   193     inline CFileBrowserScreenCapture* ScreenCapture() { return iScreenCapture; }
       
   194     inline CFileBrowserFileUtils* FileUtils() { return iFileUtils; }
       
   195     inline MFileBrowserUI* FileBrowserUI() { return iFileBrowserUI; }
       
   196 
       
   197     void OpenWithApparcL(TFileName aFileName);
       
   198     void OpenWithDocHandlerL(TFileName aFileName, TBool aEmbed);
       
   199 //    TInt QueryCurrentItemIndex();
       
   200     TSearchAttributes GetSearchAttributes();
       
   201     void ChangeAttributes(TSearchAttributes attributes);
       
   202     TSearchResults SearchResults();
       
   203     CFileEntryList* FoundFiles();	
       
   204     void SearchL();
       
   205 
       
   206 private:
       
   207     MFileBrowserUI                  *iFileBrowserUI;
       
   208     CFileBrowserScreenCapture       *iScreenCapture;
       
   209     CFileBrowserFileUtils           *iFileUtils;
       
   210     CEikonEnv*                      iEnv;
       
   211     TFileBrowserSettings            iSettings;
       
   212     RApaLsSession                   iLs;
       
   213     TBool                           iIsHashKeySelectionInUse; 
       
   214     };
       
   215    
       
   216 
       
   217 #endif // __ENGINE_H__