|
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 |
|
38 class QModelIndex; |
|
39 |
|
40 class OverwriteOptions |
|
41 { |
|
42 public: |
|
43 OverwriteOptions() : |
|
44 doFileOperations(true), |
|
45 queryIndex(0), |
|
46 overWriteFlags(CFileMan::EOverWrite) |
|
47 {} |
|
48 |
|
49 bool doFileOperations; |
|
50 int queryIndex; |
|
51 QString postFix; |
|
52 int overWriteFlags; |
|
53 }; |
|
54 |
|
55 /** |
|
56 * class that is used for communicating between Symbian and Qt code. |
|
57 */ |
|
58 class EngineWrapper : MFileBrowserUI { |
|
59 public: |
|
60 |
|
61 /** |
|
62 * Constructor |
|
63 */ |
|
64 EngineWrapper(); |
|
65 |
|
66 /** |
|
67 * Destructor |
|
68 */ |
|
69 ~EngineWrapper(); |
|
70 |
|
71 /** |
|
72 * Initializes Engine Wrapper |
|
73 * @return true if engine was started successfully |
|
74 */ |
|
75 bool init(); |
|
76 |
|
77 public: // from MFileBrowserUI |
|
78 /* Functions that are called from engine: */ |
|
79 void ShowInformationNote(const TDesC &aDescText, const TDesC &aDescTitle); |
|
80 void ShowErrorNote(const TDesC& aDescText, TBool aNoTimeout = EFalse); |
|
81 void ShowConfirmationNote(const TDesC& aDescText, TBool aNoTimeout = EFalse); |
|
82 TBool ShowConfirmationQuery(const TDesC& aDescText); |
|
83 |
|
84 public: |
|
85 /* Functions that are called from UI */ |
|
86 bool searchFiles(); |
|
87 SearchAttributes getFileSearchAttributes(); |
|
88 int setFileSearchAttributes(SearchAttributes attributes); |
|
89 SearchResults getSearchResults(); |
|
90 |
|
91 FileBrowserSettings &settings() { return mSettings; } |
|
92 const FileBrowserSettings &settings() const { return mSettings; } |
|
93 |
|
94 void saveSettings(bool aNotifyModules = true); |
|
95 |
|
96 void startExecutingCommands(const QString &aCommandsExecutionMessage); |
|
97 void refreshView(); |
|
98 // TBool IsCurrentDriveReadOnly(); |
|
99 // TBool IsCurrentItemDirectory(); |
|
100 void moveUpOneLevel(); |
|
101 void moveDownToDirectory(const QModelIndex& index); |
|
102 int clipboardCut(const QModelIndexList &aSelectionIndices); |
|
103 int clipboardCopy(const QModelIndexList &aSelectionIndices); |
|
104 void clipboardPaste(const OverwriteOptions &aOverwriteOptions); |
|
105 void copyToFolder(const QString &aTargetDir, const OverwriteOptions &aOverwriteOptions, bool aMove); |
|
106 void createNewFile(const QString &aNewFileName); |
|
107 void createNewDirectory(const QString &aNewDirectoryName); |
|
108 void deleteItems(const QModelIndexList& aSelectionIndices); |
|
109 bool selectionHasDirs(); |
|
110 void rename(const QModelIndex& aIndex, const QString aNewName); |
|
111 void touch(bool aRecurse); |
|
112 void properties(const QModelIndex &aCurrentItemIndex, QStringList &aPropertyList, QString &aTitleText); |
|
113 |
|
114 bool openAppArc(QString fileName); |
|
115 bool openDocHandler(QString fileName, bool embeddedVal = false); |
|
116 |
|
117 bool isDriveListViewActive(); |
|
118 bool isCurrentDriveReadOnly(); |
|
119 bool isClipBoardListInUse(); |
|
120 int itemCount() const; |
|
121 DriveEntry getDriveEntry(const QModelIndex& aIndex) const; |
|
122 FileEntry getFileEntry(const QModelIndex& aIndex) const; |
|
123 |
|
124 const CArrayFix<TInt> *convertSelectionList(const QModelIndexList &aSelectionIndices); |
|
125 void setCurrentSelection(const QModelIndexList &aSelectionIndices); |
|
126 bool isDestinationEntriesExists(const QModelIndexList &aSelectionIndices, QString aTargetDir); |
|
127 bool targetExists(const QModelIndex& aIndex, const QString aNewName); |
|
128 QString currentPath() const; |
|
129 TOverwriteOptions convertOverwriteOptions(const OverwriteOptions &aOverwriteOptions); |
|
130 bool hasDrivePassword(const QModelIndex &aIndex); |
|
131 bool isDriveRemovable(const QModelIndex &aIndex); |
|
132 bool isDriveLocked(const QModelIndex &aIndex); |
|
133 void GetDriveName(const QModelIndex &aIndex, QString &aDriveName); |
|
134 void GetDriveVolumeLabel(const QModelIndex &aIndex, QString &aDriveName); |
|
135 |
|
136 void DiskAdminSetDrivePassword(const QModelIndex &aIndex, const QString &aOldPassword, const QString &aNewPassword); |
|
137 void DiskAdminUnlockDrive(const QModelIndex &aIndex, const QString &aOldPassword); |
|
138 void DiskAdminClearDrivePassword(const QModelIndex &aIndex, const QString &aOldPassword); |
|
139 void DiskAdminEraseDrivePassword(const QModelIndex &aIndex); |
|
140 void DiskAdminFormatDrive(const QModelIndex &aIndex, bool aQuickFormat); |
|
141 void DiskAdminQuickFormatDrive(const QModelIndex &aIndex, bool aQuickFormat); |
|
142 void DiskAdminCheckDisk(const QModelIndex &aIndex); |
|
143 void DiskAdminScanDrive(const QModelIndex &aIndex); |
|
144 void DiskAdminSetDriveName(const QModelIndex &aIndex, const QString &aDriveName); |
|
145 void DiskAdminSetDriveVolumeLabel(const QModelIndex &aIndex, const QString &aVolumeLabel); |
|
146 void DiskAdminEjectDrive(const QModelIndex &aIndex); |
|
147 void DiskAdminDismountDrive(const QModelIndex &aIndex); |
|
148 void DiskAdminEraseMBR(const QModelIndex &aIndex); |
|
149 void DiskAdminPartitionDrive(const QModelIndex &aIndex, bool aEraseMBR, int aAmountOfPartitions); |
|
150 |
|
151 void ToolsSetErrRd(bool aEnable); |
|
152 bool ErrRdFileExists(); |
|
153 |
|
154 void ToolsErrorSimulateLeave(int aLeaveCode); |
|
155 void ToolsErrorSimulatePanic(QString aPanicCategory, int aPanicCode); |
|
156 void ToolsErrorSimulateException(int aExceptionCode); |
|
157 |
|
158 quint32 getDebugMask(); |
|
159 void toolsSetDebugMask(quint32 aDbgMask); |
|
160 |
|
161 void showFileCheckSums(const QModelIndex &aIndex, TFileBrowserCmdFileChecksums checksumType); |
|
162 |
|
163 private: |
|
164 // FB engine |
|
165 CEngine *mEngine; |
|
166 // List of found files results for Ui |
|
167 QStringList mFilesFound; |
|
168 FileBrowserSettings mSettings; |
|
169 }; |
|
170 |
|
171 #endif //ENGINEWRAPPER_H |