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: File Manager application UI class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <akntitle.h> // CAknTitlePane |
|
22 #include <aknnavi.h> // CAknNavigationControlContainer |
|
23 #include <aknnavide.h> // CAknNavigationDecorator |
|
24 #include <sendui.h> // CSendAppUi |
|
25 #include <sendnorm.rsg> |
|
26 #include <avkon.rsg> |
|
27 #include <barsread.h> |
|
28 #include <hlplch.h> // HlpLauncher |
|
29 #include <eikapp.h> |
|
30 #include <AknDef.h> // For layout change event definitions |
|
31 #include <utf.h> |
|
32 #include <StringLoader.h> |
|
33 #include <AknsUtils.h> |
|
34 #include <centralrepository.h> |
|
35 #include <AiwCommon.h> |
|
36 #include <bautils.h> |
|
37 #include <pathinfo.h> |
|
38 #include <driveinfo.h> |
|
39 #include <ssm/ssmstate.h> |
|
40 #include <ssm/ssmdomaindefs.h> |
|
41 |
|
42 #include <CFileManagerEngine.h> |
|
43 #include <CFileManagerIRReceiver.h> |
|
44 #include <filemanager.rsg> |
|
45 #include <filemanagerview.rsg> |
|
46 #include <FileManagerDebug.h> |
|
47 #include <FileManagerUID.h> |
|
48 #include <CFileManagerFeatureManager.h> |
|
49 #include <CFileManagerUtils.h> |
|
50 #include "CFileManagerAppUi.h" |
|
51 #include "CFileManagerDocument.h" |
|
52 #include "CFileManagerMainView.h" |
|
53 #include "CFileManagerMemoryStoreView.h" |
|
54 #ifdef RD_FILE_MANAGER_BACKUP |
|
55 #include <FileManagerSchDefinitions.h> |
|
56 #include "CFileManagerBackupView.h" |
|
57 #include "CFileManagerRestoreView.h" |
|
58 #include "CFileManagerTaskScheduler.h" |
|
59 #include "CFileManagerSchBackupHandler.h" |
|
60 #endif // RD_FILE_MANAGER_BACKUP |
|
61 #include "CFileManagerFoldersView.h" |
|
62 #include "Cfilemanagersearchresultsview.h" |
|
63 #include "CFileManagerIconArray.h" |
|
64 #include "FileManager.hrh" |
|
65 |
|
66 |
|
67 // CONSTANTS |
|
68 const TUid CFileManagerAppUi::KFileManagerMainViewId = |
|
69 { EFileManagerMainViewId }; |
|
70 const TUid CFileManagerAppUi::KFileManagerMemoryStoreViewId = |
|
71 { EFileManagerMemoryStoreViewId }; |
|
72 const TUid CFileManagerAppUi::KFileManagerFoldersViewId = |
|
73 { EFileManagerFoldersViewId }; |
|
74 const TUid CFileManagerAppUi::KFileManagerSearchResultsViewId = |
|
75 { EFileManagerSearchResultsViewId }; |
|
76 const TUid CFileManagerAppUi::KFileManagerBackupViewId = |
|
77 { EFileManagerBackupViewId }; |
|
78 const TUid CFileManagerAppUi::KFileManagerRestoreViewId = |
|
79 { EFileManagerRestoreViewId }; |
|
80 |
|
81 const TUid KUidFileManager = { KFileManagerUID3 }; |
|
82 const TUid KUidGsRsfwPlugin = { 0x101F9778 }; |
|
83 const TUid KUidGsRsFwSettingsViewId = { 11 }; |
|
84 |
|
85 |
|
86 // ============================ LOCAL FUNCTIONS ================================ |
|
87 |
|
88 // --------------------------------------------------------------------------- |
|
89 // ProcessExists |
|
90 // --------------------------------------------------------------------------- |
|
91 // |
|
92 static TBool ProcessExists( const TSecureId& aSecureId ) |
|
93 { |
|
94 _LIT( KFindPattern, "*" ); |
|
95 TFindProcess finder( KFindPattern ); |
|
96 TFullName processName; |
|
97 while( finder.Next( processName ) == KErrNone ) |
|
98 { |
|
99 RProcess process; |
|
100 if ( process.Open( processName ) == KErrNone ) |
|
101 { |
|
102 TSecureId processId( process.SecureId() ); |
|
103 process.Close(); |
|
104 if( processId == aSecureId ) |
|
105 { |
|
106 return ETrue; |
|
107 } |
|
108 } |
|
109 } |
|
110 return EFalse; |
|
111 } |
|
112 |
|
113 // ============================ MEMBER FUNCTIONS =============================== |
|
114 |
|
115 // ----------------------------------------------------------------------------- |
|
116 // CFileManagerAppUi::CFileManagerAppUi |
|
117 // C++ default constructor can NOT contain any code, that |
|
118 // might leave. |
|
119 // ----------------------------------------------------------------------------- |
|
120 // |
|
121 CFileManagerAppUi::CFileManagerAppUi() : |
|
122 iInitialFolderLevel( KErrNotFound ) |
|
123 { |
|
124 FUNC_LOG |
|
125 } |
|
126 |
|
127 // ----------------------------------------------------------------------------- |
|
128 // CFileManagerAppUi::~CFileManagerAppUi |
|
129 // Destructor |
|
130 // ----------------------------------------------------------------------------- |
|
131 // |
|
132 CFileManagerAppUi::~CFileManagerAppUi() |
|
133 { |
|
134 FUNC_LOG |
|
135 |
|
136 iCoeEnv->RemoveForegroundObserver( *this ); |
|
137 delete iIRReceiver; |
|
138 delete iIRDeleteCB; |
|
139 delete iSendUi; |
|
140 #ifdef RD_FILE_MANAGER_BACKUP |
|
141 delete iTaskScheduler; |
|
142 delete iSchBackupHandler; |
|
143 #endif // RD_FILE_MANAGER_BACKUP |
|
144 CFileManagerEngine& engine = |
|
145 static_cast< CFileManagerDocument* >( Document() )->Engine(); |
|
146 engine.SetObserver( NULL ); |
|
147 iSAS.Close(); |
|
148 } |
|
149 |
|
150 // ----------------------------------------------------------------------------- |
|
151 // CFileManagerAppUi::ConstructL |
|
152 // |
|
153 // ----------------------------------------------------------------------------- |
|
154 // |
|
155 void CFileManagerAppUi::ConstructL() |
|
156 { |
|
157 FUNC_LOG |
|
158 |
|
159 // Construct only must have stuff required for app start here. |
|
160 // Other stuff is constructed later to decrease app start time. |
|
161 INFO_LOG( "CFileManagerAppUi::ConstructL()-BaseConstructL" ) |
|
162 BaseConstructL( EAknEnableSkin | EAknEnableMSK | EAknSingleClickCompatible ); |
|
163 |
|
164 INFO_LOG( "CFileManagerAppUi::ConstructL()-Setup panes" ) |
|
165 CEikStatusPane* sp = StatusPane(); |
|
166 iTitlePane = static_cast< CAknTitlePane* > |
|
167 ( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
168 |
|
169 INFO_LOG( "CFileManagerAppUi::ConstructL()-Create main view" ) |
|
170 CAknView* view = CFileManagerMainView::NewLC(); |
|
171 AddViewL( view ); // Takes ownership |
|
172 CleanupStack::Pop( view ); |
|
173 SetDefaultViewL( *view ); |
|
174 iActiveView = view->Id(); |
|
175 |
|
176 User::LeaveIfError( iSAS.Connect( KSM2GenMiddlewareDomain3 ) ); |
|
177 |
|
178 #ifdef RD_FILE_MANAGER_BACKUP |
|
179 CFileManagerDocument* doc = |
|
180 static_cast< CFileManagerDocument* >( Document() ); |
|
181 iSchBackupStandalone = doc->IsScheduledBackup(); |
|
182 if ( iSchBackupStandalone ) |
|
183 { |
|
184 // Do standalone scheduled backup startup |
|
185 INFO_LOG( "CFileManagerAppUi::ConstructL-Launch scheduled backup" ) |
|
186 iEikonEnv->WsSession().ComputeMode( RWsSession::EPriorityControlDisabled ); |
|
187 RThread().SetProcessPriority( EPriorityForeground ); |
|
188 sp->MakeVisible( EFalse ); |
|
189 sp->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_EMPTY ); |
|
190 StartSchBackupL(); |
|
191 } |
|
192 else |
|
193 { |
|
194 #endif // RD_FILE_MANAGER_BACKUP |
|
195 |
|
196 CFileManagerEngine& engine = |
|
197 static_cast< CFileManagerDocument* >( Document() )->Engine(); |
|
198 iWaitingForParams = engine.FeatureManager().IsEmbedded(); |
|
199 |
|
200 // Do normal application startup |
|
201 INFO_LOG( "CFileManagerAppUi::ConstructL()-Add foreground observer" ) |
|
202 iCoeEnv->AddForegroundObserverL( *this ); |
|
203 |
|
204 #ifdef RD_FILE_MANAGER_BACKUP |
|
205 } |
|
206 #endif // RD_FILE_MANAGER_BACKUP |
|
207 |
|
208 } |
|
209 |
|
210 // ----------------------------------------------------------------------------- |
|
211 // CFileManagerAppUi::HandleCommandL |
|
212 // |
|
213 // ----------------------------------------------------------------------------- |
|
214 // |
|
215 void CFileManagerAppUi::HandleCommandL( TInt aCommand ) |
|
216 { |
|
217 switch( aCommand ) |
|
218 { |
|
219 case EEikCmdExit: // FALLTHROUGH |
|
220 case EAknSoftkeyExit: |
|
221 { |
|
222 CFileManagerEngine& engine = |
|
223 static_cast< CFileManagerDocument* >( Document() )->Engine(); |
|
224 engine.CancelRefresh(); |
|
225 Exit(); |
|
226 break; |
|
227 } |
|
228 case EAknCmdHelp: |
|
229 { |
|
230 HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), |
|
231 AppHelpContextL()); |
|
232 break; |
|
233 } |
|
234 default: |
|
235 break; |
|
236 } |
|
237 } |
|
238 |
|
239 // ----------------------------------------------------------------------------- |
|
240 // CFileManagerAppUi::HandleViewDeactivation |
|
241 // |
|
242 // ----------------------------------------------------------------------------- |
|
243 // |
|
244 void CFileManagerAppUi::HandleViewDeactivation( |
|
245 const TVwsViewId& aViewIdToBeDeactivated, |
|
246 const TVwsViewId& aNewlyActivatedViewId ) |
|
247 { |
|
248 if ( aNewlyActivatedViewId.iAppUid == Application()->AppDllUid() ) |
|
249 { |
|
250 if ( IsFileManagerView( aNewlyActivatedViewId.iViewUid ) && |
|
251 View( aNewlyActivatedViewId.iViewUid ) ) |
|
252 { |
|
253 iActiveView = aNewlyActivatedViewId.iViewUid; |
|
254 } |
|
255 } |
|
256 CAknViewAppUi::HandleViewDeactivation( |
|
257 aViewIdToBeDeactivated, aNewlyActivatedViewId ); |
|
258 } |
|
259 |
|
260 // ----------------------------------------------------------------------------- |
|
261 // CFileManagerAppUi::ActivateFoldersViewL |
|
262 // |
|
263 // ----------------------------------------------------------------------------- |
|
264 // |
|
265 TBool CFileManagerAppUi::ActivateFoldersViewL() |
|
266 { |
|
267 if ( iActiveView != KFileManagerFoldersViewId ) |
|
268 { |
|
269 if ( iSearchViewOpen ) |
|
270 { |
|
271 CreateAndActivateLocalViewL( KFileManagerFoldersViewId, |
|
272 CFileManagerFoldersView::KOpenFromSearchResultsView, |
|
273 KNullDesC8 ); |
|
274 } |
|
275 else |
|
276 { |
|
277 CreateAndActivateLocalViewL( KFileManagerFoldersViewId ); |
|
278 } |
|
279 return ETrue; |
|
280 } |
|
281 return EFalse; |
|
282 } |
|
283 |
|
284 // ----------------------------------------------------------------------------- |
|
285 // CFileManagerAppUi::CloseFoldersViewL |
|
286 // |
|
287 // ----------------------------------------------------------------------------- |
|
288 // |
|
289 void CFileManagerAppUi::CloseFoldersViewL() |
|
290 { |
|
291 if ( iSearchViewOpen ) |
|
292 { |
|
293 CreateAndActivateLocalViewL( KFileManagerSearchResultsViewId ); |
|
294 iActiveView = KFileManagerSearchResultsViewId; |
|
295 } |
|
296 else |
|
297 { |
|
298 ExitEmbeddedAppIfNeededL(); |
|
299 ActivateMemoryStoreViewL(); |
|
300 iActiveView = KFileManagerMemoryStoreViewId; |
|
301 } |
|
302 } |
|
303 |
|
304 // ----------------------------------------------------------------------------- |
|
305 // CFileManagerAppUi::ActivateSearchResultsViewL |
|
306 // |
|
307 // ----------------------------------------------------------------------------- |
|
308 // |
|
309 void CFileManagerAppUi::ActivateSearchResultsViewL() |
|
310 { |
|
311 if ( iActiveView != KFileManagerSearchResultsViewId ) |
|
312 { |
|
313 // Activate with refresh |
|
314 CreateAndActivateLocalViewL( |
|
315 KFileManagerSearchResultsViewId, |
|
316 KNullUid, |
|
317 KFileManagerSearchViewRefreshMsg ); |
|
318 iSearchViewOpen = ETrue; |
|
319 } |
|
320 |
|
321 CFileManagerEngine& engine = |
|
322 static_cast< CFileManagerDocument* >( Document() )->Engine(); |
|
323 SetTitleL( engine.SearchString() ); |
|
324 } |
|
325 |
|
326 // ----------------------------------------------------------------------------- |
|
327 // CFileManagerAppUi::CloseSearchResultsViewL |
|
328 // |
|
329 // ----------------------------------------------------------------------------- |
|
330 // |
|
331 void CFileManagerAppUi::CloseSearchResultsViewL() |
|
332 { |
|
333 CFileManagerEngine& engine = |
|
334 static_cast< CFileManagerDocument* >( Document() )->Engine(); |
|
335 TInt level( engine.FolderLevel() ); |
|
336 |
|
337 // If embedded, then ensure that the return folder is not below given level |
|
338 // or on different drive |
|
339 if ( engine.FeatureManager().IsEmbedded() ) |
|
340 { |
|
341 TPtrC dir( engine.CurrentDirectory().Left( |
|
342 iFolderToOpenAtStartup.Length() ) ); |
|
343 if ( engine.FolderLevel() < iInitialFolderLevel || |
|
344 dir.CompareF( iFolderToOpenAtStartup ) ) |
|
345 { |
|
346 engine.SetDirectoryWithBackstepsL( iFolderToOpenAtStartup ); |
|
347 level = iInitialFolderLevel; |
|
348 } |
|
349 } |
|
350 |
|
351 if ( level > 0 ) |
|
352 { |
|
353 CreateAndActivateLocalViewL( KFileManagerFoldersViewId ); |
|
354 iActiveView = KFileManagerFoldersViewId; |
|
355 } |
|
356 else if ( !level ) |
|
357 { |
|
358 CreateAndActivateLocalViewL( KFileManagerMemoryStoreViewId ); |
|
359 iActiveView = KFileManagerMemoryStoreViewId; |
|
360 } |
|
361 else |
|
362 { |
|
363 CreateAndActivateLocalViewL( KFileManagerMainViewId ); |
|
364 iActiveView = KFileManagerMainViewId; |
|
365 } |
|
366 iSearchViewOpen = EFalse; |
|
367 } |
|
368 |
|
369 // ----------------------------------------------------------------------------- |
|
370 // CFileManagerAppUi::RestoreDefaultTitleL |
|
371 // |
|
372 // ----------------------------------------------------------------------------- |
|
373 // |
|
374 void CFileManagerAppUi::RestoreDefaultTitleL() |
|
375 { |
|
376 TResourceReader reader; |
|
377 iCoeEnv->CreateResourceReaderLC( reader, R_FILEMANAGER_TITLE_PANE ); |
|
378 iTitlePane->SetFromResourceL( reader ); // restore title pane |
|
379 CleanupStack::PopAndDestroy(); // reader |
|
380 } |
|
381 |
|
382 // ----------------------------------------------------------------------------- |
|
383 // CFileManagerAppUi::SendUiL |
|
384 // |
|
385 // ----------------------------------------------------------------------------- |
|
386 // |
|
387 CSendUi& CFileManagerAppUi::SendUiL() |
|
388 { |
|
389 if ( !iSendUi ) |
|
390 { |
|
391 iSendUi = CSendUi::NewL(); |
|
392 } |
|
393 return *iSendUi; |
|
394 } |
|
395 |
|
396 // ------------------------------------------------------------------------------ |
|
397 // CFileManagerAppUi::HandleResourceChangeL |
|
398 // |
|
399 // ------------------------------------------------------------------------------ |
|
400 // |
|
401 void CFileManagerAppUi::HandleResourceChangeL( TInt aType ) |
|
402 { |
|
403 if( aType == KAknsMessageSkinChange || |
|
404 aType == KEikDynamicLayoutVariantSwitch ) |
|
405 { |
|
406 CEikStatusPane* sp = StatusPane(); |
|
407 sp->HandleResourceChange( aType ); |
|
408 CFileManagerDocument* doc = |
|
409 static_cast< CFileManagerDocument* >( Document() ); |
|
410 doc->ClearStringCache(); |
|
411 doc->IconArray()->UpdateIconsL(); |
|
412 |
|
413 if ( iActiveView == KFileManagerFoldersViewId ) |
|
414 { |
|
415 CFileManagerFoldersView* view = |
|
416 static_cast< CFileManagerFoldersView* >( |
|
417 View( KFileManagerFoldersViewId ) ); |
|
418 view->HandleResourceChangeL( KAknsMessageSkinChange ); |
|
419 } |
|
420 NotifyViewScreenDeviceChanged(); |
|
421 } |
|
422 |
|
423 CAknViewAppUi::HandleResourceChangeL( aType ); |
|
424 } |
|
425 |
|
426 // ------------------------------------------------------------------------------ |
|
427 // CFileManagerAppUi::HandleGainingForeground |
|
428 // |
|
429 // ------------------------------------------------------------------------------ |
|
430 // |
|
431 void CFileManagerAppUi::HandleGainingForeground() |
|
432 { |
|
433 if ( !iForeGround ) |
|
434 { |
|
435 iForeGround = ETrue; |
|
436 |
|
437 CFileManagerViewBase* view = |
|
438 static_cast< CFileManagerViewBase* >( View( iActiveView ) ); |
|
439 |
|
440 CFileManagerEngine& engine = |
|
441 static_cast< CFileManagerDocument* >( Document() )->Engine(); |
|
442 |
|
443 engine.SetObserver( view ); |
|
444 view->NotifyForegroundStatusChange( iForeGround ); |
|
445 |
|
446 if ( view->CurrentProcess() == |
|
447 MFileManagerProcessObserver::ENoProcess ) |
|
448 { |
|
449 engine.FileSystemEvent( EFalse ); |
|
450 } |
|
451 } |
|
452 } |
|
453 |
|
454 // ------------------------------------------------------------------------------ |
|
455 // CFileManagerAppUi::HandleLosingForeground |
|
456 // |
|
457 // ------------------------------------------------------------------------------ |
|
458 // |
|
459 void CFileManagerAppUi::HandleLosingForeground() |
|
460 { |
|
461 iForeGround = EFalse; |
|
462 |
|
463 CFileManagerViewBase* view = |
|
464 static_cast< CFileManagerViewBase* >( View( iActiveView ) ); |
|
465 |
|
466 CFileManagerEngine& engine = |
|
467 static_cast< CFileManagerDocument* >( Document() )->Engine(); |
|
468 |
|
469 engine.SetObserver( view ); |
|
470 view->StoreIndex(); |
|
471 view->NotifyForegroundStatusChange( iForeGround ); |
|
472 |
|
473 if ( view->CurrentProcess() == |
|
474 MFileManagerProcessObserver::ENoProcess ) |
|
475 { |
|
476 engine.FileSystemEvent( ETrue ); |
|
477 } |
|
478 } |
|
479 |
|
480 // ------------------------------------------------------------------------------ |
|
481 // CFileManagerAppUi::IsFmgrForeGround |
|
482 // |
|
483 // ------------------------------------------------------------------------------ |
|
484 // |
|
485 TBool CFileManagerAppUi::IsFmgrForeGround() |
|
486 { |
|
487 return iForeGround; |
|
488 } |
|
489 |
|
490 // ----------------------------------------------------------------------------- |
|
491 // CFileManagerAppUi::HandleScreenDeviceChangedL() |
|
492 // |
|
493 // ----------------------------------------------------------------------------- |
|
494 // |
|
495 void CFileManagerAppUi::HandleScreenDeviceChangedL() |
|
496 { |
|
497 CAknViewAppUi::HandleScreenDeviceChangedL(); |
|
498 NotifyViewScreenDeviceChanged(); |
|
499 } |
|
500 |
|
501 // ----------------------------------------------------------------------------- |
|
502 // CFileManagerAppUi::HandleError() |
|
503 // |
|
504 // ----------------------------------------------------------------------------- |
|
505 // |
|
506 TErrorHandlerResponse CFileManagerAppUi::HandleError( TInt aError, |
|
507 const SExtendedError& aExtErr, TDes& aErrorText, TDes& aContextText ) |
|
508 { |
|
509 ERROR_LOG1( "CFileManagerAppUi::HandleError()-aError=%d", aError ) |
|
510 switch ( aError ) |
|
511 { |
|
512 case KErrCancel: // FALLTHROUGH |
|
513 case KErrNotReady: |
|
514 { |
|
515 // Suppress notes for canceled operations. |
|
516 // Suppress notes for not ready when caused by hotswap. |
|
517 if ( View( iActiveView ) ) |
|
518 { |
|
519 return ENoDisplay; |
|
520 } |
|
521 break; |
|
522 } |
|
523 case KErrNotFound: // Fall through |
|
524 case KErrPathNotFound: |
|
525 { |
|
526 CFileManagerViewBase* view = |
|
527 static_cast< CFileManagerViewBase* >( View( iActiveView ) ); |
|
528 TBool handled( EFalse ); |
|
529 TRAPD( err, handled = view->HandleFileNotFoundL( aError ) ); |
|
530 if ( err == KErrNone && handled ) |
|
531 { |
|
532 // Suppress not found when handled by refresh. |
|
533 return ENoDisplay; |
|
534 } |
|
535 break; |
|
536 } |
|
537 default: |
|
538 { |
|
539 break; |
|
540 } |
|
541 } |
|
542 return CAknViewAppUi::HandleError( |
|
543 aError, aExtErr, aErrorText, aContextText ); |
|
544 } |
|
545 |
|
546 // ----------------------------------------------------------------------------- |
|
547 // CFileManagerAppUi:ActivateMainViewL |
|
548 // |
|
549 // ----------------------------------------------------------------------------- |
|
550 // |
|
551 void CFileManagerAppUi::ActivateMainViewL() |
|
552 { |
|
553 if ( iActiveView != KFileManagerMainViewId ) |
|
554 { |
|
555 CreateAndActivateLocalViewL( KFileManagerMainViewId ); |
|
556 iSearchViewOpen = EFalse; |
|
557 } |
|
558 } |
|
559 |
|
560 // ----------------------------------------------------------------------------- |
|
561 // CFileManagerAppUi:ActivateMemoryStoreViewL |
|
562 // |
|
563 // ----------------------------------------------------------------------------- |
|
564 // |
|
565 void CFileManagerAppUi::ActivateMemoryStoreViewL() |
|
566 { |
|
567 if ( iActiveView != KFileManagerMemoryStoreViewId ) |
|
568 { |
|
569 CreateAndActivateLocalViewL( KFileManagerMemoryStoreViewId ); |
|
570 } |
|
571 } |
|
572 |
|
573 // ----------------------------------------------------------------------------- |
|
574 // CFileManagerAppUi::CloseMemoryStoreViewL |
|
575 // |
|
576 // ----------------------------------------------------------------------------- |
|
577 // |
|
578 void CFileManagerAppUi::CloseMemoryStoreViewL() |
|
579 { |
|
580 if ( iSearchViewOpen ) |
|
581 { |
|
582 CreateAndActivateLocalViewL( KFileManagerSearchResultsViewId ); |
|
583 } |
|
584 else |
|
585 { |
|
586 ExitEmbeddedAppIfNeededL(); |
|
587 CreateAndActivateLocalViewL( KFileManagerMainViewId ); |
|
588 iActiveView = KFileManagerMainViewId; |
|
589 } |
|
590 } |
|
591 |
|
592 // ----------------------------------------------------------------------------- |
|
593 // CFileManagerAppUi::DriveInfo |
|
594 // |
|
595 // ----------------------------------------------------------------------------- |
|
596 // |
|
597 TFileManagerDriveInfo& CFileManagerAppUi::DriveInfo() |
|
598 { |
|
599 return iDriveInfo; |
|
600 } |
|
601 |
|
602 // ----------------------------------------------------------------------------- |
|
603 // CFileManagerAppUi::ActivateRemoteDriveSettingsViewL |
|
604 // |
|
605 // ----------------------------------------------------------------------------- |
|
606 // |
|
607 void CFileManagerAppUi::ActivateRemoteDriveSettingsViewL( const TDesC& aDriveName ) |
|
608 { |
|
609 CFileManagerDocument* doc = |
|
610 static_cast< CFileManagerDocument* >( Document() ); |
|
611 CFileManagerFeatureManager& featureManager( doc->Engine().FeatureManager() ); |
|
612 |
|
613 if ( !featureManager.IsRemoteStorageFwSupported() ) |
|
614 { |
|
615 return; |
|
616 } |
|
617 |
|
618 if ( !View( KUidGsRsfwPlugin ) ) |
|
619 { |
|
620 TUid plugin_ID_Key; |
|
621 TAny* ptr = REComSession::CreateImplementationL( |
|
622 KUidGsRsfwPlugin, plugin_ID_Key ); |
|
623 CAknView* view = reinterpret_cast< CAknView* >( ptr ); |
|
624 |
|
625 TRAPD( err, |
|
626 { |
|
627 doc->StorePluginL( plugin_ID_Key ); |
|
628 AddViewL( view ); // Takes ownership |
|
629 } ); |
|
630 if ( err != KErrNone ) |
|
631 { |
|
632 REComSession::DestroyedImplementation( plugin_ID_Key ); |
|
633 User::Leave( err ); |
|
634 } |
|
635 } |
|
636 |
|
637 if ( aDriveName.Length() ) |
|
638 { |
|
639 // 16bit Unicode conversion to UTF8 takes max 3 bytes per char |
|
640 const TInt KUtf8Factor = 3; |
|
641 HBufC8* buffer8 = HBufC8::NewLC( aDriveName.Length() * KUtf8Factor ); |
|
642 TPtr8 ptr8( buffer8->Des() ); |
|
643 |
|
644 CnvUtfConverter::ConvertFromUnicodeToUtf8( ptr8, aDriveName ); |
|
645 CreateActivateViewEventL( |
|
646 TVwsViewId( KUidFileManager, KUidGsRsfwPlugin ), |
|
647 KUidGsRsFwSettingsViewId, |
|
648 *buffer8 ); |
|
649 CleanupStack::PopAndDestroy( buffer8 ); |
|
650 } |
|
651 else |
|
652 { |
|
653 CreateActivateViewEventL( |
|
654 TVwsViewId( KUidFileManager, KUidGsRsfwPlugin ), |
|
655 KUidGsRsFwSettingsViewId, |
|
656 KNullDesC8() ); |
|
657 } |
|
658 } |
|
659 |
|
660 #ifdef RD_FILE_MANAGER_BACKUP |
|
661 // ----------------------------------------------------------------------------- |
|
662 // CFileManagerAppUi:ActivateBackupViewL |
|
663 // |
|
664 // ----------------------------------------------------------------------------- |
|
665 // |
|
666 void CFileManagerAppUi::ActivateBackupViewL() |
|
667 { |
|
668 if ( iActiveView != KFileManagerBackupViewId ) |
|
669 { |
|
670 CAknView* view = View( KFileManagerBackupViewId ); |
|
671 if ( !view ) |
|
672 { |
|
673 view = CFileManagerBackupView::NewLC(); |
|
674 AddViewL( view ); // Takes ownership |
|
675 CleanupStack::Pop( view ); |
|
676 } |
|
677 CreateAndActivateLocalViewL( KFileManagerBackupViewId ); |
|
678 } |
|
679 } |
|
680 |
|
681 // ----------------------------------------------------------------------------- |
|
682 // CFileManagerAppUi:CloseBackupViewL |
|
683 // |
|
684 // ----------------------------------------------------------------------------- |
|
685 // |
|
686 void CFileManagerAppUi::CloseBackupViewL() |
|
687 { |
|
688 CreateAndActivateLocalViewL( KFileManagerMainViewId ); |
|
689 } |
|
690 |
|
691 // ----------------------------------------------------------------------------- |
|
692 // CFileManagerAppUi:ActivateRestoreViewL |
|
693 // |
|
694 // ----------------------------------------------------------------------------- |
|
695 // |
|
696 void CFileManagerAppUi::ActivateRestoreViewL( TBool aDeleteBackup ) |
|
697 { |
|
698 if ( iActiveView != KFileManagerRestoreViewId ) |
|
699 { |
|
700 if ( aDeleteBackup ) |
|
701 { |
|
702 CreateAndActivateLocalViewL( |
|
703 KFileManagerRestoreViewId, |
|
704 CFileManagerRestoreView::KDeleteBackups, |
|
705 KNullDesC8 ); |
|
706 } |
|
707 else |
|
708 { |
|
709 CreateAndActivateLocalViewL( KFileManagerRestoreViewId ); |
|
710 } |
|
711 } |
|
712 } |
|
713 |
|
714 // ----------------------------------------------------------------------------- |
|
715 // CFileManagerAppUi:CloseRestoreViewL |
|
716 // |
|
717 // ----------------------------------------------------------------------------- |
|
718 // |
|
719 void CFileManagerAppUi::CloseRestoreViewL() |
|
720 { |
|
721 CreateAndActivateLocalViewL( KFileManagerBackupViewId ); |
|
722 iActiveView = KFileManagerBackupViewId; |
|
723 } |
|
724 |
|
725 // ----------------------------------------------------------------------------- |
|
726 // CFileManagerAppUi::ProcessCommandParametersL |
|
727 // |
|
728 // ----------------------------------------------------------------------------- |
|
729 // |
|
730 TBool CFileManagerAppUi::ProcessCommandParametersL( |
|
731 TApaCommand aCommand, |
|
732 TFileName& aDocumentName, |
|
733 const TDesC8& aTail ) |
|
734 { |
|
735 switch( aCommand ) |
|
736 { |
|
737 case EApaCommandOpen: |
|
738 { |
|
739 TLex8 lex8( aTail ); |
|
740 TInt32 sortMode( 0 ); |
|
741 if ( lex8.Val( sortMode, EDecimal ) != KErrNone ) |
|
742 { |
|
743 sortMode = 0; // Use the default on error |
|
744 } |
|
745 SetFolderToOpenAtStartup( aDocumentName, sortMode ); |
|
746 break; |
|
747 } |
|
748 default: |
|
749 { |
|
750 break; |
|
751 } |
|
752 } |
|
753 aDocumentName.Zero(); |
|
754 return EFalse; |
|
755 } |
|
756 |
|
757 // ----------------------------------------------------------------------------- |
|
758 // CFileManagerAppUi:ProcessMessageL |
|
759 // |
|
760 // ----------------------------------------------------------------------------- |
|
761 // |
|
762 void CFileManagerAppUi::ProcessMessageL( |
|
763 TUid /*aUid*/, const TDesC8& aParams ) |
|
764 { |
|
765 if ( aParams.Length() ) |
|
766 { |
|
767 // Allow the backup only if scheduled backup starter exists |
|
768 const TSecureId KFileManagerSchBkupUid( KFileManagerSchBkupUID3 ); |
|
769 if( ProcessExists( KFileManagerSchBkupUid ) ) |
|
770 { |
|
771 HBufC* cmd = HBufC::NewLC( aParams.Length() ); |
|
772 TPtr ptr( cmd->Des() ); |
|
773 ptr.Copy( aParams ); |
|
774 if ( !ptr.Compare( KSchBackupTaskName ) ) |
|
775 { |
|
776 StartSchBackupL(); |
|
777 } |
|
778 CleanupStack::PopAndDestroy( cmd ); |
|
779 } |
|
780 } |
|
781 } |
|
782 |
|
783 // ----------------------------------------------------------------------------- |
|
784 // CFileManagerAppUi:StartSchBackupL |
|
785 // |
|
786 // ----------------------------------------------------------------------------- |
|
787 // |
|
788 void CFileManagerAppUi::StartSchBackupL() |
|
789 { |
|
790 CFileManagerViewBase* view = |
|
791 static_cast< CFileManagerViewBase* >( View( iActiveView ) ); |
|
792 view->StartSchBackupL(); |
|
793 } |
|
794 |
|
795 // ----------------------------------------------------------------------------- |
|
796 // CFileManagerAppUi::TaskSchedulerL |
|
797 // |
|
798 // ----------------------------------------------------------------------------- |
|
799 // |
|
800 CFileManagerTaskScheduler& CFileManagerAppUi::TaskSchedulerL() |
|
801 { |
|
802 if ( !iTaskScheduler ) |
|
803 { |
|
804 CFileManagerDocument* doc = |
|
805 static_cast< CFileManagerDocument* >( Document() ); |
|
806 iTaskScheduler = CFileManagerTaskScheduler::NewL( |
|
807 doc->Engine() ); |
|
808 } |
|
809 return *iTaskScheduler; |
|
810 } |
|
811 |
|
812 // ----------------------------------------------------------------------------- |
|
813 // CFileManagerAppUi::SchBackupHandlerL |
|
814 // |
|
815 // ----------------------------------------------------------------------------- |
|
816 // |
|
817 CFileManagerSchBackupHandler& CFileManagerAppUi::SchBackupHandlerL() |
|
818 { |
|
819 if ( !iSchBackupHandler ) |
|
820 { |
|
821 CFileManagerDocument* doc = |
|
822 static_cast< CFileManagerDocument* >( Document() ); |
|
823 iSchBackupHandler = CFileManagerSchBackupHandler::NewL( |
|
824 doc->Engine() ); |
|
825 iSchBackupHandler->SetObserver( this ); |
|
826 } |
|
827 return *iSchBackupHandler; |
|
828 } |
|
829 |
|
830 #endif // RD_FILE_MANAGER_BACKUP |
|
831 |
|
832 // ----------------------------------------------------------------------------- |
|
833 // CFileManagerAppUi::StartIRReceiveL() |
|
834 // |
|
835 // ----------------------------------------------------------------------------- |
|
836 // |
|
837 void CFileManagerAppUi::StartIRReceiveL( |
|
838 MFileManagerProcessObserver& aObserver ) |
|
839 { |
|
840 FUNC_LOG |
|
841 |
|
842 delete iIRDeleteCB; |
|
843 iIRDeleteCB = NULL; |
|
844 |
|
845 delete iIRReceiver; |
|
846 iIRReceiver = NULL; |
|
847 |
|
848 CFileManagerEngine& engine = |
|
849 static_cast< CFileManagerDocument* >( Document() )->Engine(); |
|
850 iIRReceiver = CFileManagerIRReceiver::NewL( |
|
851 aObserver, |
|
852 engine.CurrentDirectory(), |
|
853 engine ); |
|
854 iIRReceiver->ReceiveFileL(); |
|
855 } |
|
856 |
|
857 // ----------------------------------------------------------------------------- |
|
858 // CFileManagerAppUi::StopIRReceive() |
|
859 // |
|
860 // ----------------------------------------------------------------------------- |
|
861 // |
|
862 void CFileManagerAppUi::StopIRReceive() |
|
863 { |
|
864 FUNC_LOG |
|
865 |
|
866 if ( iIRReceiver ) |
|
867 { |
|
868 iIRReceiver->StopReceiving(); |
|
869 |
|
870 delete iIRDeleteCB; |
|
871 iIRDeleteCB = NULL; |
|
872 |
|
873 iIRDeleteCB = new CAsyncCallBack( |
|
874 TCallBack( DeleteIRReceiveCB, this ), |
|
875 CActive::EPriorityStandard ); |
|
876 if ( iIRDeleteCB ) |
|
877 { |
|
878 iIRDeleteCB->CallBack(); |
|
879 } |
|
880 } |
|
881 } |
|
882 |
|
883 // ------------------------------------------------------------------------------ |
|
884 // CFileManagerAppUi::DeleteIRReceiveCB |
|
885 // |
|
886 // ------------------------------------------------------------------------------ |
|
887 // |
|
888 TInt CFileManagerAppUi::DeleteIRReceiveCB( TAny* aPtr ) |
|
889 { |
|
890 FUNC_LOG |
|
891 |
|
892 CFileManagerAppUi* self = static_cast< CFileManagerAppUi* >( aPtr ); |
|
893 |
|
894 delete self->iIRReceiver; |
|
895 self->iIRReceiver = NULL; |
|
896 |
|
897 delete self->iIRDeleteCB; |
|
898 self->iIRDeleteCB = NULL; |
|
899 |
|
900 return KErrNone; |
|
901 } |
|
902 |
|
903 // ------------------------------------------------------------------------------ |
|
904 // CFileManagerAppUi::NotifyViewScreenDeviceChanged |
|
905 // |
|
906 // ------------------------------------------------------------------------------ |
|
907 // |
|
908 void CFileManagerAppUi::NotifyViewScreenDeviceChanged() |
|
909 { |
|
910 CAknView* activeView = View( iActiveView ); |
|
911 if ( activeView ) |
|
912 { |
|
913 CFileManagerViewBase* view = |
|
914 static_cast< CFileManagerViewBase* > ( activeView ); |
|
915 view->ScreenDeviceChanged(); |
|
916 } |
|
917 } |
|
918 |
|
919 // ------------------------------------------------------------------------------ |
|
920 // CFileManagerAppUi::SetTitleL |
|
921 // |
|
922 // ------------------------------------------------------------------------------ |
|
923 // |
|
924 void CFileManagerAppUi::SetTitleL( const TDesC& aTitle ) |
|
925 { |
|
926 iTitlePane->SetTextL( aTitle ); |
|
927 } |
|
928 |
|
929 // ------------------------------------------------------------------------------ |
|
930 // CFileManagerAppUi::SetTitleL |
|
931 // |
|
932 // ------------------------------------------------------------------------------ |
|
933 // |
|
934 void CFileManagerAppUi::SetTitleL( const TInt aTitle ) |
|
935 { |
|
936 HBufC* title = StringLoader::LoadLC( aTitle ); |
|
937 iTitlePane->SetTextL( *title ); |
|
938 CleanupStack::PopAndDestroy( title ); |
|
939 } |
|
940 |
|
941 // ------------------------------------------------------------------------------ |
|
942 // CFileManagerAppUi::ScheduledBackupFinishedL |
|
943 // |
|
944 // ------------------------------------------------------------------------------ |
|
945 // |
|
946 #ifdef RD_FILE_MANAGER_BACKUP |
|
947 void CFileManagerAppUi::SchBackupFinishedL( TInt /*aError*/ ) |
|
948 { |
|
949 CFileManagerViewBase* view = |
|
950 static_cast< CFileManagerViewBase* >( View( iActiveView ) ); |
|
951 if ( view->CurrentProcess() == MFileManagerProcessObserver::ESchBackupProcess ) |
|
952 { |
|
953 view->SchBackupFinishedL(); |
|
954 } |
|
955 if ( iSchBackupStandalone ) |
|
956 { |
|
957 ProcessCommandL( EAknCmdExit ); |
|
958 } |
|
959 } |
|
960 #else // RD_FILE_MANAGER_BACKUP |
|
961 void CFileManagerAppUi::SchBackupFinishedL( TInt /*aError*/ ) |
|
962 { |
|
963 } |
|
964 #endif // RD_FILE_MANAGER_BACKUP |
|
965 |
|
966 |
|
967 // ------------------------------------------------------------------------------ |
|
968 // CFileManagerAppUi::IsFileManagerView |
|
969 // |
|
970 // ------------------------------------------------------------------------------ |
|
971 // |
|
972 TBool CFileManagerAppUi::IsFileManagerView( const TUid aViewUid ) |
|
973 { |
|
974 return ( aViewUid == KFileManagerFoldersViewId || |
|
975 aViewUid == KFileManagerSearchResultsViewId || |
|
976 aViewUid == KFileManagerMainViewId || |
|
977 aViewUid == KFileManagerMemoryStoreViewId || |
|
978 aViewUid == KFileManagerBackupViewId || |
|
979 aViewUid == KFileManagerRestoreViewId ); |
|
980 } |
|
981 |
|
982 // ------------------------------------------------------------------------------ |
|
983 // CFileManagerAppUi::NotifyCbaUpdate |
|
984 // |
|
985 // ------------------------------------------------------------------------------ |
|
986 // |
|
987 void CFileManagerAppUi::NotifyCbaUpdate() |
|
988 { |
|
989 CAknView* activeView = View( iActiveView ); |
|
990 if ( activeView ) |
|
991 { |
|
992 CFileManagerViewBase* view = |
|
993 static_cast< CFileManagerViewBase* > ( activeView ); |
|
994 TRAP_IGNORE( view->UpdateCbaL() ); |
|
995 } |
|
996 } |
|
997 |
|
998 // ------------------------------------------------------------------------------ |
|
999 // CFileManagerAppUi::SetFolderToOpenAtStartup |
|
1000 // |
|
1001 // ------------------------------------------------------------------------------ |
|
1002 // |
|
1003 void CFileManagerAppUi::SetFolderToOpenAtStartup( |
|
1004 const TDesC& aFullPath, TInt aSortMode ) |
|
1005 { |
|
1006 FUNC_LOG |
|
1007 |
|
1008 INFO_LOG2( |
|
1009 "CFileManagerAppUi::SetFolderToOpenAtStartup-%S-%d", |
|
1010 &aFullPath, aSortMode ) |
|
1011 |
|
1012 // Validate given path |
|
1013 _LIT( KWild1, "*" ); |
|
1014 _LIT( KWild2, "?" ); |
|
1015 const TInt KWildLen = 1; |
|
1016 CFileManagerEngine& engine = |
|
1017 static_cast< CFileManagerDocument* >( Document() )->Engine(); |
|
1018 RFs& fs( iEikonEnv->FsSession() ); |
|
1019 TInt err( KErrNone ); |
|
1020 if ( !aFullPath.Length() || |
|
1021 !aFullPath.Left( KWildLen ).CompareF( KWild1 ) || |
|
1022 !aFullPath.Left( KWildLen ).CompareF( KWild2 ) ) |
|
1023 { |
|
1024 err = KErrBadName; // Ignore bad drives |
|
1025 } |
|
1026 else |
|
1027 { |
|
1028 TParsePtrC parse( aFullPath ); |
|
1029 if ( !parse.DrivePresent() || !parse.PathPresent() ) |
|
1030 { |
|
1031 err = KErrBadName; // Ignore bad paths |
|
1032 } |
|
1033 TUint driveStatus( 0 ); |
|
1034 if ( err == KErrNone ) |
|
1035 { |
|
1036 TInt drive = TDriveUnit( aFullPath ); |
|
1037 err = DriveInfo::GetDriveStatus( fs, drive, driveStatus ); |
|
1038 if ( err != KErrNone || |
|
1039 !( driveStatus & DriveInfo::EDriveUserVisible ) ) |
|
1040 { |
|
1041 err = KErrAccessDenied; // Ignore hidden drives |
|
1042 } |
|
1043 else |
|
1044 { |
|
1045 TFileName rootPath; |
|
1046 err = PathInfo::GetRootPath( rootPath, drive ); |
|
1047 if ( err == KErrNone && |
|
1048 rootPath.CompareF( aFullPath.Left( rootPath.Length() ) ) ) |
|
1049 { |
|
1050 err = KErrAccessDenied; // Ignore paths below root level |
|
1051 } |
|
1052 } |
|
1053 } |
|
1054 if ( err == KErrNone && |
|
1055 !( driveStatus & DriveInfo::EDriveRemote ) ) |
|
1056 { |
|
1057 if ( engine.IsSystemFolder( parse.DriveAndPath() ) ) |
|
1058 { |
|
1059 err = KErrAccessDenied; // Ignore system folders |
|
1060 } |
|
1061 else if ( !( driveStatus & DriveInfo::EDriveReadOnly ) ) |
|
1062 { |
|
1063 TRAP( err, BaflUtils::EnsurePathExistsL( |
|
1064 fs, parse.DriveAndPath() ) ); |
|
1065 } |
|
1066 } |
|
1067 if ( err == KErrNone ) |
|
1068 { |
|
1069 iFolderToOpenAtStartup.Copy( parse.DriveAndPath() ); |
|
1070 engine.SetSortMethod( |
|
1071 static_cast< CFileManagerEngine::TSortMethod >( aSortMode ) ); |
|
1072 engine.SetCurrentItemName(parse.NameAndExt()); |
|
1073 TRAP( err, OpenFolderViewAtStartupL() ); |
|
1074 } |
|
1075 } |
|
1076 if ( err != KErrNone ) |
|
1077 { |
|
1078 ERROR_LOG1( "CFileManagerAppUi::SetFolderToOpenAtStartup-err=%d", err ) |
|
1079 iWaitingForParams = EFalse; |
|
1080 |
|
1081 // Refresh only if embedded app |
|
1082 if ( engine.FeatureManager().IsEmbedded() ) |
|
1083 { |
|
1084 engine.RefreshDirectory(); |
|
1085 } |
|
1086 } |
|
1087 } |
|
1088 |
|
1089 // ------------------------------------------------------------------------------ |
|
1090 // CFileManagerAppUi::ProcessAiwParamListL |
|
1091 // |
|
1092 // ------------------------------------------------------------------------------ |
|
1093 // |
|
1094 void CFileManagerAppUi::ProcessAiwParamListL( |
|
1095 const CAiwGenericParamList& aInParams ) |
|
1096 { |
|
1097 FUNC_LOG |
|
1098 |
|
1099 iWaitingForParams = EFalse; |
|
1100 |
|
1101 TPtrC folder( KNullDesC ); |
|
1102 TInt folderSortMode( KErrNotFound ); |
|
1103 TInt i( 0 ); |
|
1104 // Get folder path |
|
1105 const TAiwGenericParam* param = aInParams.FindFirst( |
|
1106 i, EGenericParamDir, EVariantTypeDesC ); |
|
1107 if ( i != KErrNotFound && param ) |
|
1108 { |
|
1109 folder.Set( param->Value().AsDes() ); |
|
1110 } |
|
1111 // Get folder sort mode |
|
1112 param = aInParams.FindFirst( |
|
1113 i, EGenericParamDir, EVariantTypeTInt32 ); |
|
1114 if ( i != KErrNotFound && param ) |
|
1115 { |
|
1116 folderSortMode = param->Value().AsTInt32(); |
|
1117 } |
|
1118 SetFolderToOpenAtStartup( folder, folderSortMode ); |
|
1119 } |
|
1120 |
|
1121 // ------------------------------------------------------------------------------ |
|
1122 // CFileManagerAppUi::OpenFolderViewAtStartupL |
|
1123 // |
|
1124 // ------------------------------------------------------------------------------ |
|
1125 // |
|
1126 void CFileManagerAppUi::OpenFolderViewAtStartupL() |
|
1127 { |
|
1128 FUNC_LOG |
|
1129 |
|
1130 CFileManagerEngine& engine = |
|
1131 static_cast< CFileManagerDocument* >( Document() )->Engine(); |
|
1132 engine.SetDirectoryWithBackstepsL( iFolderToOpenAtStartup ); |
|
1133 if( engine.NavigationLevel() <= 0 ) |
|
1134 { |
|
1135 ActivateMemoryStoreViewL(); |
|
1136 // Ensure that view change gets updated when used during contruction |
|
1137 iActiveView = KFileManagerMemoryStoreViewId; |
|
1138 } |
|
1139 else |
|
1140 { |
|
1141 ActivateFoldersViewL(); |
|
1142 // Ensure that view change gets updated when used during contruction |
|
1143 iActiveView = KFileManagerFoldersViewId; |
|
1144 } |
|
1145 // Store initial folder level when embedded |
|
1146 if ( engine.FeatureManager().IsEmbedded() ) |
|
1147 { |
|
1148 iInitialFolderLevel = engine.FolderLevel(); |
|
1149 } |
|
1150 } |
|
1151 |
|
1152 // ------------------------------------------------------------------------------ |
|
1153 // CFileManagerAppUi::ExitEmbeddedAppIfNeededL |
|
1154 // |
|
1155 // ------------------------------------------------------------------------------ |
|
1156 // |
|
1157 void CFileManagerAppUi::ExitEmbeddedAppIfNeededL() |
|
1158 { |
|
1159 FUNC_LOG |
|
1160 |
|
1161 CFileManagerEngine& engine = |
|
1162 static_cast< CFileManagerDocument* >( Document() )->Engine(); |
|
1163 // Exit embedded app if the initial folder level is crossed |
|
1164 if ( engine.FeatureManager().IsEmbedded() && |
|
1165 engine.FolderLevel() < iInitialFolderLevel ) |
|
1166 { |
|
1167 ProcessCommandL( EAknCmdExit ); |
|
1168 User::Leave( KErrCancel ); // To abort current operation |
|
1169 } |
|
1170 } |
|
1171 |
|
1172 // ------------------------------------------------------------------------------ |
|
1173 // CFileManagerAppUi::WaitingForInputParams |
|
1174 // |
|
1175 // ------------------------------------------------------------------------------ |
|
1176 // |
|
1177 TBool CFileManagerAppUi::WaitingForInputParams() const |
|
1178 { |
|
1179 return iWaitingForParams; |
|
1180 } |
|
1181 |
|
1182 // ------------------------------------------------------------------------------ |
|
1183 // CFileManagerAppUi::CreateAndActivateLocalViewL |
|
1184 // |
|
1185 // ------------------------------------------------------------------------------ |
|
1186 // |
|
1187 void CFileManagerAppUi::CreateAndActivateLocalViewL( |
|
1188 TUid aViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage ) |
|
1189 { |
|
1190 FUNC_LOG |
|
1191 |
|
1192 CAknView* view = View( aViewId ); |
|
1193 if ( !view ) |
|
1194 { |
|
1195 if ( aViewId == KFileManagerMainViewId ) |
|
1196 { |
|
1197 view = CFileManagerMainView::NewLC(); |
|
1198 } |
|
1199 else if ( aViewId == KFileManagerMemoryStoreViewId ) |
|
1200 { |
|
1201 view = CFileManagerMemoryStoreView::NewLC(); |
|
1202 } |
|
1203 else if ( aViewId == KFileManagerFoldersViewId ) |
|
1204 { |
|
1205 view = CFileManagerFoldersView::NewLC(); |
|
1206 } |
|
1207 else if ( aViewId == KFileManagerSearchResultsViewId ) |
|
1208 { |
|
1209 view = CFileManagerSearchResultsView::NewLC(); |
|
1210 } |
|
1211 else if ( aViewId == KFileManagerBackupViewId ) |
|
1212 { |
|
1213 view = CFileManagerBackupView::NewLC(); |
|
1214 } |
|
1215 else if ( aViewId == KFileManagerRestoreViewId ) |
|
1216 { |
|
1217 view = CFileManagerRestoreView::NewLC(); |
|
1218 } |
|
1219 else |
|
1220 { |
|
1221 ERROR_LOG1( |
|
1222 "CFileManagerAppUi::CreateAndActivateLocalViewL-InvalidView=0x%x", |
|
1223 aViewId.iUid ) |
|
1224 User::Leave( KErrNotFound ); |
|
1225 } |
|
1226 AddViewL( view ); // Takes ownership |
|
1227 CleanupStack::Pop( view ); |
|
1228 } |
|
1229 ActivateLocalViewL( aViewId, aCustomMessageId, aCustomMessage ); |
|
1230 iActiveView = aViewId; |
|
1231 } |
|
1232 |
|
1233 // ------------------------------------------------------------------------------ |
|
1234 // CFileManagerAppUi::CreateAndActivateLocalViewL |
|
1235 // |
|
1236 // ------------------------------------------------------------------------------ |
|
1237 // |
|
1238 void CFileManagerAppUi::CreateAndActivateLocalViewL( TUid aViewId ) |
|
1239 { |
|
1240 FUNC_LOG |
|
1241 |
|
1242 CreateAndActivateLocalViewL( aViewId, KNullUid, KNullDesC8 ); |
|
1243 } |
|
1244 |
|
1245 // ------------------------------------------------------------------------------ |
|
1246 // CFileManagerAppUi::IsSearchViewOpen |
|
1247 // |
|
1248 // ------------------------------------------------------------------------------ |
|
1249 // |
|
1250 TBool CFileManagerAppUi::IsSearchViewOpen() const |
|
1251 { |
|
1252 return iSearchViewOpen; |
|
1253 } |
|
1254 // ------------------------------------------------------------------------------ |
|
1255 // CFileManagerAppUi::BackupOrRestoreStarted |
|
1256 // |
|
1257 // ------------------------------------------------------------------------------ |
|
1258 // |
|
1259 void CFileManagerAppUi::BackupOrRestoreStarted() |
|
1260 { |
|
1261 iManualBackupOrRestoreStarted.HomeTime(); |
|
1262 } |
|
1263 |
|
1264 // ------------------------------------------------------------------------------ |
|
1265 // CFileManagerAppUi::BackupOrRestoreEnded |
|
1266 // |
|
1267 // ------------------------------------------------------------------------------ |
|
1268 // |
|
1269 void CFileManagerAppUi::BackupOrRestoreEnded() |
|
1270 { |
|
1271 iManualBackupOrRestoreEnded.HomeTime(); |
|
1272 } |
|
1273 |
|
1274 // ------------------------------------------------------------------------------ |
|
1275 // CFileManagerAppUi::BackupOrRestoreStartTime |
|
1276 // |
|
1277 // ------------------------------------------------------------------------------ |
|
1278 // |
|
1279 TTime CFileManagerAppUi::BackupOrRestoreStartTime() const |
|
1280 { |
|
1281 return iManualBackupOrRestoreStarted; |
|
1282 } |
|
1283 |
|
1284 // ------------------------------------------------------------------------------ |
|
1285 // CFileManagerAppUi::BackupOrRestoreEndTime |
|
1286 // |
|
1287 // ------------------------------------------------------------------------------ |
|
1288 // |
|
1289 TTime CFileManagerAppUi::BackupOrRestoreEndTime() const |
|
1290 { |
|
1291 return iManualBackupOrRestoreEnded; |
|
1292 } |
|
1293 // ------------------------------------------------------------------------------ |
|
1294 // CFileManagerAppUi::ResetBackupOrRestoreEndTime |
|
1295 // |
|
1296 // ------------------------------------------------------------------------------ |
|
1297 // |
|
1298 void CFileManagerAppUi::ResetBackupOrRestoreEndTime() |
|
1299 { |
|
1300 iManualBackupOrRestoreStarted = 0; |
|
1301 iManualBackupOrRestoreEnded = 0; |
|
1302 } |
|
1303 |
|
1304 |
|
1305 // ------------------------------------------------------------------------------ |
|
1306 // CFileManagerAppUi::IsSystemStateNormal |
|
1307 // |
|
1308 // ------------------------------------------------------------------------------ |
|
1309 // |
|
1310 TBool CFileManagerAppUi::IsSystemStateNormal() const |
|
1311 { |
|
1312 TSsmState state = iSAS.State(); |
|
1313 return ( state.MainState() == ESsmNormal ); |
|
1314 } |
|
1315 |
|
1316 // End of File |
|
1317 |
|