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