1 /* |
|
2 * Copyright (c) 2002-2008 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: Document class of the file manager |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <gulicon.h> // to make iIconArray->ResetAndDestroy work |
|
21 #include <coemain.h> |
|
22 #include <apgwgnam.h> |
|
23 #include <data_caging_path_literals.hrh> |
|
24 #include <FileManagerUID.h> |
|
25 #include <CFileManagerIconArray.h> |
|
26 #include <CFileManagerEngine.h> |
|
27 #include <FileManagerDebug.h> |
|
28 #include <CFileManagerUtils.h> |
|
29 #include "CFileManagerDocument.h" |
|
30 #include "CFileManagerAppUi.h" |
|
31 #include "CFileManagerStringCache.h" |
|
32 |
|
33 |
|
34 // CONSTANTS |
|
35 _LIT( KFileManagerEngineResource, "filemanagerengine.rsc" ); |
|
36 _LIT( KFileManagerViewResource, "filemanagerview.rsc" ); |
|
37 _LIT_SECURE_ID( KFileManagerSchBkupSID, KFileManagerSchBkupUID3 ); |
|
38 |
|
39 |
|
40 // ============================ MEMBER FUNCTIONS =============================== |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // CFileManagerDocument::CFileManagerDocument |
|
44 // C++ default constructor can NOT contain any code, that |
|
45 // might leave. |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 CFileManagerDocument::CFileManagerDocument( CEikApplication& aApp ) : |
|
49 CAiwGenericParamConsumer( aApp ), |
|
50 iViewResourceLoader( *CCoeEnv::Static() ), |
|
51 iEngineResourceLoader( *CCoeEnv::Static() ) |
|
52 { |
|
53 FUNC_LOG |
|
54 } |
|
55 |
|
56 // ----------------------------------------------------------------------------- |
|
57 // CFileManagerDocument::ConstructL |
|
58 // Symbian 2nd phase constructor can leave. |
|
59 // ----------------------------------------------------------------------------- |
|
60 // |
|
61 void CFileManagerDocument::ConstructL() |
|
62 { |
|
63 FUNC_LOG |
|
64 |
|
65 // Get resource drive from exe location |
|
66 TFileName exeFileName( RProcess().FileName() ); |
|
67 TParsePtrC exeParse( exeFileName ); |
|
68 TPtrC exeDrive( exeParse.Drive() ); |
|
69 |
|
70 TFileName fileName; |
|
71 fileName.Copy( exeDrive ); |
|
72 fileName.Append( KDC_RESOURCE_FILES_DIR ); |
|
73 CFileManagerUtils::EnsureFinalBackslash( fileName ); |
|
74 fileName.Append( KFileManagerViewResource ); |
|
75 iViewResourceLoader.OpenL( fileName ); |
|
76 |
|
77 fileName.Copy( exeDrive ); |
|
78 fileName.Append( KDC_RESOURCE_FILES_DIR ); |
|
79 CFileManagerUtils::EnsureFinalBackslash( fileName ); |
|
80 fileName.Append( KFileManagerEngineResource ); |
|
81 iEngineResourceLoader.OpenL( fileName ); |
|
82 |
|
83 INFO_LOG( "CFileManagerDocument::ConstructL()-Create engine" ) |
|
84 RFs& fs( CCoeEnv::Static()->FsSession() ); |
|
85 User::LeaveIfError( fs.ShareProtected() ); // Make shareable |
|
86 iEngine = CFileManagerEngine::NewL( fs ); |
|
87 |
|
88 INFO_LOG( "CFileManagerDocument::ConstructL()-Create icon array" ) |
|
89 iIconArray = CFileManagerIconArray::NewL(); |
|
90 |
|
91 INFO_LOG( "CFileManagerDocument::ConstructL()-Create string cache" ) |
|
92 iStringCache = CFileManagerStringCache::NewL( *iEngine, *iIconArray ); |
|
93 } |
|
94 |
|
95 // ----------------------------------------------------------------------------- |
|
96 // CFileManagerDocument::NewL |
|
97 // Two-phased constructor. |
|
98 // ----------------------------------------------------------------------------- |
|
99 // |
|
100 CFileManagerDocument* CFileManagerDocument::NewL( CEikApplication& aApp ) |
|
101 { |
|
102 CFileManagerDocument* self = new( ELeave ) CFileManagerDocument( aApp ); |
|
103 |
|
104 CleanupStack::PushL( self ); |
|
105 self->ConstructL(); |
|
106 CleanupStack::Pop( self ); |
|
107 |
|
108 return self; |
|
109 } |
|
110 |
|
111 // ----------------------------------------------------------------------------- |
|
112 // CFileManagerDocument::~CFileManagerDocument |
|
113 // Destructor |
|
114 // ----------------------------------------------------------------------------- |
|
115 // |
|
116 CFileManagerDocument::~CFileManagerDocument() |
|
117 { |
|
118 FUNC_LOG |
|
119 |
|
120 DeletePlugins(); |
|
121 iPluginArray.Close(); |
|
122 REComSession::FinalClose(); |
|
123 iViewResourceLoader.Close(); |
|
124 iEngineResourceLoader.Close(); |
|
125 if ( iIconArray ) |
|
126 { |
|
127 iIconArray->ResetAndDestroy(); |
|
128 delete iIconArray; |
|
129 } |
|
130 delete iStringCache; |
|
131 delete iEngine; |
|
132 } |
|
133 |
|
134 // ----------------------------------------------------------------------------- |
|
135 // CFileManagerDocument::CreateAppUiL |
|
136 // |
|
137 // ----------------------------------------------------------------------------- |
|
138 // |
|
139 CEikAppUi* CFileManagerDocument::CreateAppUiL() |
|
140 { |
|
141 return new( ELeave ) CFileManagerAppUi; |
|
142 } |
|
143 |
|
144 // ----------------------------------------------------------------------------- |
|
145 // CFileManagerDocument::IconArray |
|
146 // |
|
147 // ----------------------------------------------------------------------------- |
|
148 // |
|
149 CFileManagerIconArray* CFileManagerDocument::IconArray() const |
|
150 { |
|
151 return iIconArray; |
|
152 } |
|
153 |
|
154 // ----------------------------------------------------------------------------- |
|
155 // CFileManagerDocument::Engine |
|
156 // |
|
157 // ----------------------------------------------------------------------------- |
|
158 // |
|
159 CFileManagerEngine& CFileManagerDocument::Engine() const |
|
160 { |
|
161 return *iEngine; |
|
162 } |
|
163 |
|
164 // ----------------------------------------------------------------------------- |
|
165 // CFileManagerDocument::ClearStringCache |
|
166 // |
|
167 // ----------------------------------------------------------------------------- |
|
168 // |
|
169 void CFileManagerDocument::ClearStringCache() |
|
170 { |
|
171 iStringCache->Clear(); |
|
172 } |
|
173 |
|
174 // ----------------------------------------------------------------------------- |
|
175 // CFileManagerDocument::FileList |
|
176 // |
|
177 // ----------------------------------------------------------------------------- |
|
178 // |
|
179 MDesCArray* CFileManagerDocument::FileList() const |
|
180 { |
|
181 return iStringCache; |
|
182 } |
|
183 |
|
184 // ----------------------------------------------------------------------------- |
|
185 // CFileManagerDocument::LastError |
|
186 // |
|
187 // ----------------------------------------------------------------------------- |
|
188 // |
|
189 TInt CFileManagerDocument::LastError() const |
|
190 { |
|
191 return iStringCache->LastError(); |
|
192 } |
|
193 |
|
194 // ----------------------------------------------------------------------------- |
|
195 // CFileManagerDocument::UpdateTaskNameL |
|
196 // |
|
197 // ----------------------------------------------------------------------------- |
|
198 // |
|
199 void CFileManagerDocument::UpdateTaskNameL( CApaWindowGroupName* aWgName ) |
|
200 { |
|
201 CAknDocument::UpdateTaskNameL( aWgName ); |
|
202 #ifdef RD_FILE_MANAGER_BACKUP |
|
203 if ( IsScheduledBackup() ) |
|
204 { |
|
205 aWgName->SetHidden( ETrue ); |
|
206 } |
|
207 #endif // RD_FILE_MANAGER_BACKUP |
|
208 } |
|
209 |
|
210 // ----------------------------------------------------------------------------- |
|
211 // CFileManagerDocument::IsScheduledBackup |
|
212 // |
|
213 // ----------------------------------------------------------------------------- |
|
214 // |
|
215 TBool CFileManagerDocument::IsScheduledBackup() |
|
216 { |
|
217 // Check is started by file manager schedule starter |
|
218 return ( User::CreatorSecureId() == KFileManagerSchBkupSID ); |
|
219 } |
|
220 |
|
221 // ----------------------------------------------------------------------------- |
|
222 // CFileManagerDocument::StorePluginL |
|
223 // |
|
224 // ----------------------------------------------------------------------------- |
|
225 // |
|
226 void CFileManagerDocument::StorePluginL( const TUid& aUid ) |
|
227 { |
|
228 iPluginArray.AppendL( aUid ); |
|
229 } |
|
230 |
|
231 // ----------------------------------------------------------------------------- |
|
232 // CFileManagerDocument::DeletePlugins |
|
233 // |
|
234 // ----------------------------------------------------------------------------- |
|
235 // |
|
236 void CFileManagerDocument::DeletePlugins() |
|
237 { |
|
238 TInt count( iPluginArray.Count() ); |
|
239 for ( TInt i( 0 ); i < count; ++i ) |
|
240 { |
|
241 REComSession::DestroyedImplementation( iPluginArray[ i ] ); |
|
242 } |
|
243 iPluginArray.Reset(); |
|
244 } |
|
245 |
|
246 // ----------------------------------------------------------------------------- |
|
247 // CFileManagerDocument::OpenFileL() |
|
248 // |
|
249 // ----------------------------------------------------------------------------- |
|
250 CFileStore* CFileManagerDocument::OpenFileL( |
|
251 TBool /*aDoOpen*/, const TDesC& /*aFilename*/, RFs& /*aFs*/ ) |
|
252 { |
|
253 const CAiwGenericParamList* inParams = GetInputParameters(); |
|
254 CFileManagerAppUi* appUi = static_cast< CFileManagerAppUi* >( iAppUi ); |
|
255 if ( appUi && inParams ) |
|
256 { |
|
257 appUi->ProcessAiwParamListL( *inParams ); |
|
258 } |
|
259 return NULL; |
|
260 } |
|
261 |
|
262 // End of File |
|