55
|
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 |
int getFilesCount(const QString &aDriveRoot);
|
|
126 |
int getFilesCountAndSize(const QString &aDriveRoot, qint64 &aSize);
|
|
127 |
int getEntriesCount(const QString &aDriveRoot);
|
|
128 |
QString getMimeType(const QString &aFullPath);
|
|
129 |
QString getOpenWith(const QString &aFullPath);
|
|
130 |
void setAttributes(quint32 &, quint32 &, bool &);
|
|
131 |
|
|
132 |
bool openAppArc(QString fileName);
|
|
133 |
bool openDocHandler(QString fileName, bool embeddedVal = false);
|
|
134 |
|
|
135 |
bool isDriveListViewActive();
|
|
136 |
bool isCurrentDriveReadOnly();
|
|
137 |
bool isClipBoardListInUse();
|
|
138 |
int itemCount() const;
|
|
139 |
FbDriveEntry getDriveEntry(const QModelIndex& aIndex) const;
|
|
140 |
FbFileEntry getFileEntry(const QModelIndex& aIndex) const;
|
|
141 |
|
|
142 |
const CArrayFix<TInt> *convertSelectionList(const QModelIndexList &aSelectionIndices);
|
|
143 |
void setCurrentSelection(const QModelIndexList &aSelectionIndices);
|
|
144 |
bool isDestinationEntriesExists(const QModelIndexList &aSelectionIndices, QString aTargetDir);
|
|
145 |
bool targetExists(const QModelIndex& aIndex, const QString aNewName);
|
|
146 |
QString currentPath() const;
|
|
147 |
TOverwriteOptions convertOverwriteOptions(const OverwriteOptions &aOverwriteOptions);
|
|
148 |
bool hasDrivePassword(const QModelIndex &aIndex);
|
|
149 |
bool isDriveRemovable(const QModelIndex &aIndex);
|
|
150 |
bool isDriveLocked(const QModelIndex &aIndex);
|
|
151 |
void GetDriveName(const QModelIndex &aIndex, QString &aDriveName);
|
|
152 |
void GetDriveVolumeLabel(const QModelIndex &aIndex, QString &aDriveName);
|
|
153 |
|
|
154 |
void DiskAdminSetDrivePassword(const QModelIndex &aIndex, const QString &aOldPassword, const QString &aNewPassword);
|
|
155 |
void DiskAdminUnlockDrive(const QModelIndex &aIndex, const QString &aOldPassword);
|
|
156 |
void DiskAdminClearDrivePassword(const QModelIndex &aIndex, const QString &aOldPassword);
|
|
157 |
void DiskAdminEraseDrivePassword(const QModelIndex &aIndex);
|
|
158 |
void DiskAdminFormatDrive(const QModelIndex &aIndex, bool aQuickFormat);
|
|
159 |
void DiskAdminQuickFormatDrive(const QModelIndex &aIndex, bool aQuickFormat);
|
|
160 |
void DiskAdminCheckDisk(const QModelIndex &aIndex);
|
|
161 |
void DiskAdminScanDrive(const QModelIndex &aIndex);
|
|
162 |
void DiskAdminSetDriveName(const QModelIndex &aIndex, const QString &aDriveName);
|
|
163 |
void DiskAdminSetDriveVolumeLabel(const QModelIndex &aIndex, const QString &aVolumeLabel);
|
|
164 |
void DiskAdminEjectDrive(const QModelIndex &aIndex);
|
|
165 |
void DiskAdminDismountDrive(const QModelIndex &aIndex);
|
|
166 |
void DiskAdminEraseMBR(const QModelIndex &aIndex);
|
|
167 |
void DiskAdminPartitionDrive(const QModelIndex &aIndex, bool aEraseMBR, int aAmountOfPartitions);
|
|
168 |
|
|
169 |
void ToolsSetErrRd(bool aEnable);
|
|
170 |
bool ErrRdFileExists();
|
|
171 |
|
|
172 |
void ToolsErrorSimulateLeave(int aLeaveCode);
|
|
173 |
void ToolsErrorSimulatePanic(QString aPanicCategory, int aPanicCode);
|
|
174 |
void ToolsErrorSimulateException(int aExceptionCode);
|
|
175 |
|
|
176 |
quint32 getDebugMask();
|
|
177 |
void toolsSetDebugMask(quint32 aDbgMask);
|
|
178 |
|
|
179 |
void toolsWriteAllFiles();
|
|
180 |
|
|
181 |
void showFileCheckSums(const QModelIndex &aIndex, TFileBrowserCmdFileChecksums checksumType);
|
|
182 |
|
|
183 |
TClipBoardMode getClipBoardMode() { return mEngine->FileUtils()->GetClipBoardMode(); }
|
|
184 |
|
|
185 |
signals:
|
|
186 |
void fileSystemDataChanged();
|
|
187 |
|
|
188 |
private slots:
|
|
189 |
void progressDialogCancelled();
|
|
190 |
void waitDialogCancelled();
|
|
191 |
|
|
192 |
private:
|
|
193 |
// FB engine
|
|
194 |
CEngine *mEngine;
|
|
195 |
// List of found files results for Ui
|
|
196 |
QStringList mFilesFound;
|
|
197 |
FileBrowserSettings mSettings;
|
|
198 |
HbProgressDialog *mProgressDialog;
|
|
199 |
HbProgressDialog *mWaitDialog;
|
|
200 |
};
|
|
201 |
|
|
202 |
#endif //ENGINEWRAPPER_H
|