filebrowser/ui/inc/enginewrapper.h
changeset 55 2d9cac8919d3
parent 53 819e59dfc032
child 56 392f7045e621
equal deleted inserted replaced
53:819e59dfc032 55:2d9cac8919d3
     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 ENGINEWRAPPER_H
       
    19 #define ENGINEWRAPPER_H
       
    20 
       
    21 #include "fbdriveentry.h"
       
    22 #include "fbfileentry.h"
       
    23 #include "filebrowsersettings.h"
       
    24 
       
    25 #include "engine.h"
       
    26 #include "FBFileUtils.h"
       
    27 #include "FB.hrh"
       
    28 
       
    29 #include <QString>
       
    30 #include <QStringList>
       
    31 #include <QModelIndexList>
       
    32 
       
    33 class CEngine;
       
    34 class SearchAttributes;
       
    35 class SearchResults;
       
    36 class FileBrowserView;
       
    37 class HbProgressDialog;
       
    38 
       
    39 class QModelIndex;
       
    40 
       
    41 class OverwriteOptions
       
    42 {
       
    43 public:
       
    44     OverwriteOptions() :
       
    45             doFileOperations(true),
       
    46             queryIndex(0),
       
    47             overWriteFlags(CFileMan::EOverWrite)
       
    48     {}
       
    49 
       
    50     bool doFileOperations;
       
    51     int queryIndex;
       
    52     QString postFix;
       
    53     int overWriteFlags;
       
    54 };
       
    55 
       
    56 /**
       
    57  * class that is used for communicating between Symbian and Qt code.
       
    58  */
       
    59 class EngineWrapper : public QObject, public MFileBrowserUI
       
    60 {
       
    61     Q_OBJECT
       
    62 public:
       
    63     /**
       
    64      * Constructor
       
    65      */
       
    66     EngineWrapper();
       
    67     
       
    68     /**
       
    69      * Destructor
       
    70      */
       
    71     ~EngineWrapper();
       
    72     
       
    73     /**
       
    74      * Initializes Engine Wrapper
       
    75      * @return true if engine was started successfully
       
    76      */
       
    77     bool init();
       
    78 
       
    79 public: // from MFileBrowserUI
       
    80     /* Functions that are called from engine: */
       
    81     void ShowInformationNote(const TDesC &aDescText, const TDesC &aDescTitle);
       
    82     void ShowErrorNote(const TDesC& aDescText, TBool aNoTimeout = EFalse);
       
    83     void ShowConfirmationNote(const TDesC& aDescText, TBool aNoTimeout = EFalse);
       
    84 
       
    85     void ShowProgressDialog(const TDesC& aDescText, TInt aMinimum, TInt aMaximum);
       
    86     void CancelProgressDialog();
       
    87     void SetProgressValue(TInt aValue);
       
    88 
       
    89     void ShowWaitDialog(const TDesC& aText);
       
    90     void CancelWaitDialog();
       
    91     void ProcessEvents();
       
    92 
       
    93     TBool ShowConfirmationQuery(const TDesC& aDescText);
       
    94     void NotifyModelHasChanged();
       
    95 
       
    96 public: 
       
    97     /* Functions that are called from UI */
       
    98     bool searchFiles();
       
    99     SearchAttributes getFileSearchAttributes();
       
   100     int setFileSearchAttributes(SearchAttributes attributes);
       
   101     SearchResults getSearchResults();
       
   102 
       
   103     FileBrowserSettings &settings() { return mSettings; }
       
   104     const FileBrowserSettings &settings() const { return mSettings; }
       
   105 
       
   106     void saveSettings(bool aNotifyModules = true);
       
   107 
       
   108     void startExecutingCommands(const QString &aCommandsExecutionMessage);
       
   109     void refreshView();
       
   110     inline TListingMode listingMode() { return mEngine->FileUtils()->ListingMode(); }
       
   111 //    TBool IsCurrentDriveReadOnly();
       
   112 //    TBool IsCurrentItemDirectory();
       
   113     void moveUpOneLevel();
       
   114     void moveDownToDirectory(const QModelIndex& index);
       
   115     int clipboardCut(const QModelIndexList &aSelectionIndices);
       
   116     int clipboardCopy(const QModelIndexList &aSelectionIndices);
       
   117     void clipboardPaste(const OverwriteOptions &aOverwriteOptions);
       
   118     void copyToFolder(const QString &aTargetDir, const OverwriteOptions &aOverwriteOptions, bool aMove);
       
   119     void createNewFile(const QString &aNewFileName);
       
   120     void createNewDirectory(const QString &aNewDirectoryName);
       
   121     void deleteItems(const QModelIndexList& aSelectionIndices);
       
   122     bool selectionHasDirs();
       
   123     void rename(const QModelIndex& aIndex, const QString aNewName);
       
   124     void touch(bool aRecurse);
       
   125     void properties(const QModelIndex &aCurrentItemIndex, QStringList &aPropertyList, QString &aTitleText);
       
   126     void setAttributes(quint32 &, quint32 &, bool &);
       
   127 
       
   128     bool openAppArc(QString fileName);
       
   129     bool openDocHandler(QString fileName, bool embeddedVal = false);
       
   130 
       
   131     bool isDriveListViewActive();
       
   132     bool isCurrentDriveReadOnly();
       
   133     bool isClipBoardListInUse();
       
   134     int itemCount() const;
       
   135     FbDriveEntry getDriveEntry(const QModelIndex& aIndex) const;
       
   136     FbFileEntry getFileEntry(const QModelIndex& aIndex) const;
       
   137 	
       
   138     const CArrayFix<TInt> *convertSelectionList(const QModelIndexList &aSelectionIndices);
       
   139     void setCurrentSelection(const QModelIndexList &aSelectionIndices);
       
   140     bool isDestinationEntriesExists(const QModelIndexList &aSelectionIndices, QString aTargetDir);
       
   141     bool targetExists(const QModelIndex& aIndex, const QString aNewName);
       
   142     QString currentPath() const;
       
   143     TOverwriteOptions convertOverwriteOptions(const OverwriteOptions &aOverwriteOptions);
       
   144     bool hasDrivePassword(const QModelIndex &aIndex);
       
   145     bool isDriveRemovable(const QModelIndex &aIndex);
       
   146     bool isDriveLocked(const QModelIndex &aIndex);
       
   147     void GetDriveName(const QModelIndex &aIndex, QString &aDriveName);
       
   148     void GetDriveVolumeLabel(const QModelIndex &aIndex, QString &aDriveName);
       
   149 
       
   150     void DiskAdminSetDrivePassword(const QModelIndex &aIndex, const QString &aOldPassword, const QString &aNewPassword);
       
   151     void DiskAdminUnlockDrive(const QModelIndex &aIndex, const QString &aOldPassword);
       
   152     void DiskAdminClearDrivePassword(const QModelIndex &aIndex, const QString &aOldPassword);
       
   153     void DiskAdminEraseDrivePassword(const QModelIndex &aIndex);
       
   154     void DiskAdminFormatDrive(const QModelIndex &aIndex, bool aQuickFormat);
       
   155     void DiskAdminQuickFormatDrive(const QModelIndex &aIndex, bool aQuickFormat);
       
   156     void DiskAdminCheckDisk(const QModelIndex &aIndex);
       
   157     void DiskAdminScanDrive(const QModelIndex &aIndex);
       
   158     void DiskAdminSetDriveName(const QModelIndex &aIndex, const QString &aDriveName);
       
   159     void DiskAdminSetDriveVolumeLabel(const QModelIndex &aIndex, const QString &aVolumeLabel);
       
   160     void DiskAdminEjectDrive(const QModelIndex &aIndex);
       
   161     void DiskAdminDismountDrive(const QModelIndex &aIndex);
       
   162     void DiskAdminEraseMBR(const QModelIndex &aIndex);
       
   163     void DiskAdminPartitionDrive(const QModelIndex &aIndex, bool aEraseMBR, int aAmountOfPartitions);
       
   164 
       
   165     void ToolsSetErrRd(bool aEnable);
       
   166     bool ErrRdFileExists();
       
   167 
       
   168     void ToolsErrorSimulateLeave(int aLeaveCode);
       
   169     void ToolsErrorSimulatePanic(QString aPanicCategory, int aPanicCode);
       
   170     void ToolsErrorSimulateException(int aExceptionCode);
       
   171 
       
   172     quint32 getDebugMask();
       
   173     void toolsSetDebugMask(quint32 aDbgMask);
       
   174 
       
   175     void toolsWriteAllFiles();
       
   176 
       
   177     void showFileCheckSums(const QModelIndex &aIndex, TFileBrowserCmdFileChecksums checksumType);
       
   178 
       
   179     TClipBoardMode getClipBoardMode() { return mEngine->FileUtils()->GetClipBoardMode(); }
       
   180 
       
   181 signals:
       
   182     void fileSystemDataChanged();
       
   183 
       
   184 private slots:
       
   185         void progressDialogCancelled();
       
   186         void waitDialogCancelled();
       
   187 
       
   188 private:
       
   189     // FB engine
       
   190     CEngine *mEngine;
       
   191     // List of found files results for Ui
       
   192     QStringList mFilesFound;
       
   193     FileBrowserSettings mSettings;
       
   194     HbProgressDialog *mProgressDialog;
       
   195     HbProgressDialog *mWaitDialog;
       
   196     };
       
   197 
       
   198 #endif //ENGINEWRAPPER_H