|
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 "driveentry.h" |
|
22 #include "fileentry.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 |
|
95 public: |
|
96 /* Functions that are called from UI */ |
|
97 bool searchFiles(); |
|
98 SearchAttributes getFileSearchAttributes(); |
|
99 int setFileSearchAttributes(SearchAttributes attributes); |
|
100 SearchResults getSearchResults(); |
|
101 |
|
102 FileBrowserSettings &settings() { return mSettings; } |
|
103 const FileBrowserSettings &settings() const { return mSettings; } |
|
104 |
|
105 void saveSettings(bool aNotifyModules = true); |
|
106 |
|
107 void startExecutingCommands(const QString &aCommandsExecutionMessage); |
|
108 void refreshView(); |
|
109 inline TListingMode listingMode() { return mEngine->FileUtils()->ListingMode(); } |
|
110 // TBool IsCurrentDriveReadOnly(); |
|
111 // TBool IsCurrentItemDirectory(); |
|
112 void moveUpOneLevel(); |
|
113 void moveDownToDirectory(const QModelIndex& index); |
|
114 int clipboardCut(const QModelIndexList &aSelectionIndices); |
|
115 int clipboardCopy(const QModelIndexList &aSelectionIndices); |
|
116 void clipboardPaste(const OverwriteOptions &aOverwriteOptions); |
|
117 void copyToFolder(const QString &aTargetDir, const OverwriteOptions &aOverwriteOptions, bool aMove); |
|
118 void createNewFile(const QString &aNewFileName); |
|
119 void createNewDirectory(const QString &aNewDirectoryName); |
|
120 void deleteItems(const QModelIndexList& aSelectionIndices); |
|
121 bool selectionHasDirs(); |
|
122 void rename(const QModelIndex& aIndex, const QString aNewName); |
|
123 void touch(bool aRecurse); |
|
124 void properties(const QModelIndex &aCurrentItemIndex, QStringList &aPropertyList, QString &aTitleText); |
|
125 |
|
126 bool openAppArc(QString fileName); |
|
127 bool openDocHandler(QString fileName, bool embeddedVal = false); |
|
128 |
|
129 bool isDriveListViewActive(); |
|
130 bool isCurrentDriveReadOnly(); |
|
131 bool isClipBoardListInUse(); |
|
132 int itemCount() const; |
|
133 DriveEntry getDriveEntry(const QModelIndex& aIndex) const; |
|
134 FileEntry getFileEntry(const QModelIndex& aIndex) const; |
|
135 |
|
136 const CArrayFix<TInt> *convertSelectionList(const QModelIndexList &aSelectionIndices); |
|
137 void setCurrentSelection(const QModelIndexList &aSelectionIndices); |
|
138 bool isDestinationEntriesExists(const QModelIndexList &aSelectionIndices, QString aTargetDir); |
|
139 bool targetExists(const QModelIndex& aIndex, const QString aNewName); |
|
140 QString currentPath() const; |
|
141 TOverwriteOptions convertOverwriteOptions(const OverwriteOptions &aOverwriteOptions); |
|
142 bool hasDrivePassword(const QModelIndex &aIndex); |
|
143 bool isDriveRemovable(const QModelIndex &aIndex); |
|
144 bool isDriveLocked(const QModelIndex &aIndex); |
|
145 void GetDriveName(const QModelIndex &aIndex, QString &aDriveName); |
|
146 void GetDriveVolumeLabel(const QModelIndex &aIndex, QString &aDriveName); |
|
147 |
|
148 void DiskAdminSetDrivePassword(const QModelIndex &aIndex, const QString &aOldPassword, const QString &aNewPassword); |
|
149 void DiskAdminUnlockDrive(const QModelIndex &aIndex, const QString &aOldPassword); |
|
150 void DiskAdminClearDrivePassword(const QModelIndex &aIndex, const QString &aOldPassword); |
|
151 void DiskAdminEraseDrivePassword(const QModelIndex &aIndex); |
|
152 void DiskAdminFormatDrive(const QModelIndex &aIndex, bool aQuickFormat); |
|
153 void DiskAdminQuickFormatDrive(const QModelIndex &aIndex, bool aQuickFormat); |
|
154 void DiskAdminCheckDisk(const QModelIndex &aIndex); |
|
155 void DiskAdminScanDrive(const QModelIndex &aIndex); |
|
156 void DiskAdminSetDriveName(const QModelIndex &aIndex, const QString &aDriveName); |
|
157 void DiskAdminSetDriveVolumeLabel(const QModelIndex &aIndex, const QString &aVolumeLabel); |
|
158 void DiskAdminEjectDrive(const QModelIndex &aIndex); |
|
159 void DiskAdminDismountDrive(const QModelIndex &aIndex); |
|
160 void DiskAdminEraseMBR(const QModelIndex &aIndex); |
|
161 void DiskAdminPartitionDrive(const QModelIndex &aIndex, bool aEraseMBR, int aAmountOfPartitions); |
|
162 |
|
163 void ToolsSetErrRd(bool aEnable); |
|
164 bool ErrRdFileExists(); |
|
165 |
|
166 void ToolsErrorSimulateLeave(int aLeaveCode); |
|
167 void ToolsErrorSimulatePanic(QString aPanicCategory, int aPanicCode); |
|
168 void ToolsErrorSimulateException(int aExceptionCode); |
|
169 |
|
170 quint32 getDebugMask(); |
|
171 void toolsSetDebugMask(quint32 aDbgMask); |
|
172 |
|
173 void toolsWriteAllFiles(); |
|
174 |
|
175 void showFileCheckSums(const QModelIndex &aIndex, TFileBrowserCmdFileChecksums checksumType); |
|
176 |
|
177 private slots: |
|
178 void progressDialogCancelled(); |
|
179 void waitDialogCancelled(); |
|
180 |
|
181 private: |
|
182 // FB engine |
|
183 CEngine *mEngine; |
|
184 // List of found files results for Ui |
|
185 QStringList mFilesFound; |
|
186 FileBrowserSettings mSettings; |
|
187 HbProgressDialog *mProgressDialog; |
|
188 HbProgressDialog *mWaitDialog; |
|
189 }; |
|
190 |
|
191 #endif //ENGINEWRAPPER_H |