| 21 |      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 | #ifndef CFILEMANAGERAPPUI_H
 | 
|  |     21 | #define CFILEMANAGERAPPUI_H
 | 
|  |     22 | 
 | 
|  |     23 | //  INCLUDES
 | 
|  |     24 | #include <aknViewAppUi.h>       // CAknViewAppUi
 | 
|  |     25 | #include <TFileManagerDriveInfo.h>
 | 
|  |     26 | #include <ssm/ssmstateawaresession.h>
 | 
|  |     27 | 
 | 
|  |     28 | #include "MFileManagerSchBackupObserver.h"
 | 
|  |     29 | 
 | 
|  |     30 | // FORWARD DECLARATIONS
 | 
|  |     31 | class CAknNavigationControlContainer;
 | 
|  |     32 | class CAknTitlePane;
 | 
|  |     33 | class CAknNavigationDecorator;
 | 
|  |     34 | class CSendUi;
 | 
|  |     35 | class CAiwGenericParamList;
 | 
|  |     36 | class CFileManagerIRReceiver;
 | 
|  |     37 | class MFileManagerProcessObserver;
 | 
|  |     38 | class CFileManagerTaskScheduler;
 | 
|  |     39 | class CFileManagerSchBackupHandler;
 | 
|  |     40 | 
 | 
|  |     41 | 
 | 
|  |     42 | // CLASS DECLARATION
 | 
|  |     43 | /**
 | 
|  |     44 |  * FileManager application UI class. 
 | 
|  |     45 |  * An object of this class is created by the Symbian OS framework by a call to 
 | 
|  |     46 |  * CFileManagerDocument::CreateAppUiL(). The application UI object creates 
 | 
|  |     47 |  * and owns the application's views and handles system commands selected 
 | 
|  |     48 |  * from the menu.
 | 
|  |     49 |  */
 | 
|  |     50 | class CFileManagerAppUi : public CAknViewAppUi,
 | 
|  |     51 |                           public MCoeForegroundObserver,
 | 
|  |     52 |                           public MFileManagerSchBackupObserver
 | 
|  |     53 |     {
 | 
|  |     54 |     public: // Constants and types
 | 
|  |     55 |         static const TUid KFileManagerMainViewId;
 | 
|  |     56 |         static const TUid KFileManagerMemoryStoreViewId;
 | 
|  |     57 |         static const TUid KFileManagerFoldersViewId;
 | 
|  |     58 |         static const TUid KFileManagerSearchResultsViewId;
 | 
|  |     59 |         static const TUid KFileManagerBackupViewId;
 | 
|  |     60 |         static const TUid KFileManagerRestoreViewId;
 | 
|  |     61 | 
 | 
|  |     62 |     public:  // Constructors and destructor
 | 
|  |     63 |         /**
 | 
|  |     64 |          * Standard C++ constructor.
 | 
|  |     65 |          */
 | 
|  |     66 |         CFileManagerAppUi();
 | 
|  |     67 | 
 | 
|  |     68 |         /**
 | 
|  |     69 |          * Destructor.
 | 
|  |     70 |          */
 | 
|  |     71 |         ~CFileManagerAppUi();
 | 
|  |     72 | 
 | 
|  |     73 |         /**
 | 
|  |     74 |          * Constructs the CFileManagerAppUi class.
 | 
|  |     75 |          */
 | 
|  |     76 |         void ConstructL();
 | 
|  |     77 | 
 | 
|  |     78 |     public:
 | 
|  |     79 |         /**
 | 
|  |     80 |          * Activates folders view if it is not already 
 | 
|  |     81 |          * activated.
 | 
|  |     82 |          * @since 2.0
 | 
|  |     83 |          * @return  ETrue if activated
 | 
|  |     84 |          *          EFalse if view already activated
 | 
|  |     85 |          */
 | 
|  |     86 |         TBool ActivateFoldersViewL();
 | 
|  |     87 | 
 | 
|  |     88 |         /**
 | 
|  |     89 |          * Closes folders view and goes back to view in which the
 | 
|  |     90 |          * application was before folders view was activated.
 | 
|  |     91 |          * @since 2.0
 | 
|  |     92 |          */
 | 
|  |     93 |         void CloseFoldersViewL();
 | 
|  |     94 | 
 | 
|  |     95 |         /**
 | 
|  |     96 |          * Activates search results view if it is not already 
 | 
|  |     97 |          * activated.
 | 
|  |     98 |          * @since 2.0
 | 
|  |     99 |          */
 | 
|  |    100 |         void ActivateSearchResultsViewL();
 | 
|  |    101 | 
 | 
|  |    102 |         /**
 | 
|  |    103 |          * Closes search results view and goes back to view in which
 | 
|  |    104 |          * the application was before search results view was 
 | 
|  |    105 |          * activated
 | 
|  |    106 |          * @since 2.0
 | 
|  |    107 |          */
 | 
|  |    108 |         void CloseSearchResultsViewL();
 | 
|  |    109 | 
 | 
|  |    110 |         /**
 | 
|  |    111 |          * Restores the default title of application to title pane.
 | 
|  |    112 |          * @since 2.0
 | 
|  |    113 |          */
 | 
|  |    114 |         void RestoreDefaultTitleL();
 | 
|  |    115 |         /**
 | 
|  |    116 |          * Returns the CSendUi2 of this application.
 | 
|  |    117 |          *
 | 
|  |    118 |          * @since 3.0
 | 
|  |    119 |          * @return The CSendUi2 of this application.
 | 
|  |    120 |          */
 | 
|  |    121 |         CSendUi& SendUiL();
 | 
|  |    122 |         /**
 | 
|  |    123 |          * This is called if resource is changed. Needed for skin feature
 | 
|  |    124 |          *
 | 
|  |    125 |          * @since 2.0
 | 
|  |    126 |          */
 | 
|  |    127 |         void HandleResourceChangeL(TInt aType);
 | 
|  |    128 | 
 | 
|  |    129 |         /**
 | 
|  |    130 |          * Is application foreground
 | 
|  |    131 |          *
 | 
|  |    132 |          * @since 2.0
 | 
|  |    133 |          * @return ETrue if application is foreground
 | 
|  |    134 |          *         EFalse if application is not foreground
 | 
|  |    135 |          */
 | 
|  |    136 |         TBool IsFmgrForeGround();
 | 
|  |    137 | 
 | 
|  |    138 |         /**
 | 
|  |    139 |          * Activates main view
 | 
|  |    140 |          * activated.
 | 
|  |    141 |          * @since 3.1
 | 
|  |    142 |          */
 | 
|  |    143 |         void ActivateMainViewL();
 | 
|  |    144 | 
 | 
|  |    145 |         /**
 | 
|  |    146 |          * Activates memory store view
 | 
|  |    147 |          * activated.
 | 
|  |    148 |          * @since 3.1
 | 
|  |    149 |          */
 | 
|  |    150 |         void ActivateMemoryStoreViewL();
 | 
|  |    151 | 
 | 
|  |    152 |         /**
 | 
|  |    153 |          * Closes memory store view and goes back to main view
 | 
|  |    154 |          * @since 3.1
 | 
|  |    155 |          */
 | 
|  |    156 |         void CloseMemoryStoreViewL();
 | 
|  |    157 | 
 | 
|  |    158 |         /**
 | 
|  |    159 |          * Gets reference to drive info
 | 
|  |    160 |          * @since 3.1
 | 
|  |    161 |          */
 | 
|  |    162 |         TFileManagerDriveInfo& DriveInfo();
 | 
|  |    163 | 
 | 
|  |    164 |         /**
 | 
|  |    165 |          * Activates remote drive settings view
 | 
|  |    166 |          * @since 3.1
 | 
|  |    167 |          */
 | 
|  |    168 |         void ActivateRemoteDriveSettingsViewL(
 | 
|  |    169 |             const TDesC& aDriveName = KNullDesC );
 | 
|  |    170 | 
 | 
|  |    171 | #ifdef RD_FILE_MANAGER_BACKUP
 | 
|  |    172 |         /**
 | 
|  |    173 |          * Activates backup view if not already active
 | 
|  |    174 |          * @since 3.1
 | 
|  |    175 |          */
 | 
|  |    176 |          void ActivateBackupViewL();
 | 
|  |    177 | 
 | 
|  |    178 |         /**
 | 
|  |    179 |          * Closes backup view and goes back to main view
 | 
|  |    180 |          * @since 3.1
 | 
|  |    181 |          */
 | 
|  |    182 |          void CloseBackupViewL();
 | 
|  |    183 | 
 | 
|  |    184 |         /**
 | 
|  |    185 |          * Activates restore view if not already active
 | 
|  |    186 |          *
 | 
|  |    187 |          * @since 3.1
 | 
|  |    188 |          * @param aDeleteBackup Indicates if delete backup selection is used.
 | 
|  |    189 |          */
 | 
|  |    190 |          void ActivateRestoreViewL( TBool aDeleteBackup = EFalse );
 | 
|  |    191 | 
 | 
|  |    192 |         /**
 | 
|  |    193 |          * Closes restore view and goes back to backup view
 | 
|  |    194 |          * @since 3.1
 | 
|  |    195 |          */
 | 
|  |    196 |          void CloseRestoreViewL();
 | 
|  |    197 | 
 | 
|  |    198 | 		 /**
 | 
|  |    199 | 		  * Starts scheduled backup
 | 
|  |    200 | 		  */
 | 
|  |    201 |          void StartSchBackupL();
 | 
|  |    202 | 
 | 
|  |    203 | 		 /**
 | 
|  |    204 | 		  * Gets task scheduler
 | 
|  |    205 | 		  */
 | 
|  |    206 |          CFileManagerTaskScheduler& TaskSchedulerL();
 | 
|  |    207 | 
 | 
|  |    208 | 		 /**
 | 
|  |    209 | 		  * Gets scheduled backup handler
 | 
|  |    210 | 		  */
 | 
|  |    211 |          CFileManagerSchBackupHandler& SchBackupHandlerL();
 | 
|  |    212 | #endif // RD_FILE_MANAGER_BACKUP
 | 
|  |    213 | 
 | 
|  |    214 |         /**
 | 
|  |    215 |          * Activates IR receive
 | 
|  |    216 |          * @since 3.1
 | 
|  |    217 |          */
 | 
|  |    218 |         void StartIRReceiveL( MFileManagerProcessObserver& aObserver );
 | 
|  |    219 | 
 | 
|  |    220 |         /**
 | 
|  |    221 |          * Stops IR receive
 | 
|  |    222 |          * @since 3.1
 | 
|  |    223 |          */
 | 
|  |    224 |         void StopIRReceive();
 | 
|  |    225 | 
 | 
|  |    226 |         /**
 | 
|  |    227 |          * Sets title
 | 
|  |    228 |          * @since 3.1
 | 
|  |    229 |          */
 | 
|  |    230 |         void SetTitleL( const TDesC& aTitle );
 | 
|  |    231 | 
 | 
|  |    232 |         /**
 | 
|  |    233 |          * Sets title
 | 
|  |    234 |          * @since 3.1
 | 
|  |    235 |          */
 | 
|  |    236 |         void SetTitleL( const TInt aTitle );
 | 
|  |    237 | 
 | 
|  |    238 |         /**
 | 
|  |    239 |          * Checks if view is file manager based view
 | 
|  |    240 |          * @since 3.1
 | 
|  |    241 |          */
 | 
|  |    242 |         TBool IsFileManagerView( const TUid aViewUid );
 | 
|  |    243 | 
 | 
|  |    244 |         /**
 | 
|  |    245 |         * Informs active view to update its cba
 | 
|  |    246 |         * @since 3.2
 | 
|  |    247 |         */
 | 
|  |    248 |         void NotifyCbaUpdate();
 | 
|  |    249 | 
 | 
|  |    250 |         /**
 | 
|  |    251 |         * Processes AIW input parameters
 | 
|  |    252 |         * @since 5.0
 | 
|  |    253 |         */
 | 
|  |    254 |         void ProcessAiwParamListL( const CAiwGenericParamList& aInParams );
 | 
|  |    255 | 
 | 
|  |    256 |         /**
 | 
|  |    257 |         * Indicates are all required input params received
 | 
|  |    258 |         * @since 5.0
 | 
|  |    259 |         */
 | 
|  |    260 |         TBool WaitingForInputParams() const;
 | 
|  |    261 | 
 | 
|  |    262 |         /**
 | 
|  |    263 |         * Exits the embedded open application if needed
 | 
|  |    264 |         * @since 5.0
 | 
|  |    265 |         */
 | 
|  |    266 |         void ExitEmbeddedAppIfNeededL();
 | 
|  |    267 | 
 | 
|  |    268 |         /**
 | 
|  |    269 |         * Checks is search view open
 | 
|  |    270 |         * @since 5.0
 | 
|  |    271 |         */
 | 
|  |    272 |         TBool IsSearchViewOpen() const;
 | 
|  |    273 | 
 | 
|  |    274 |         /**
 | 
|  |    275 |         * Save the time when backup/restore started.
 | 
|  |    276 |         * @since 5.0
 | 
|  |    277 |         */
 | 
|  |    278 |         void BackupOrRestoreStarted();
 | 
|  |    279 | 
 | 
|  |    280 |         /**
 | 
|  |    281 |         * Save the time when backup/restore ended.
 | 
|  |    282 |         * @since 5.0
 | 
|  |    283 |         */
 | 
|  |    284 |         void BackupOrRestoreEnded();
 | 
|  |    285 | 
 | 
|  |    286 |         /**
 | 
|  |    287 |         * Returns the time when backup/restore started.
 | 
|  |    288 |         * @since 5.0
 | 
|  |    289 |         */
 | 
|  |    290 |         TTime BackupOrRestoreStartTime() const;
 | 
|  |    291 | 
 | 
|  |    292 |         /**
 | 
|  |    293 |         * Returns the time when backup/restore ended.
 | 
|  |    294 |         * @since 5.0
 | 
|  |    295 |         */
 | 
|  |    296 |         TTime BackupOrRestoreEndTime() const;
 | 
|  |    297 | 
 | 
|  |    298 |         /**
 | 
|  |    299 |         * Resets the time when backup/restore start and end times.
 | 
|  |    300 |         * @since 5.0
 | 
|  |    301 |         */
 | 
|  |    302 |         void ResetBackupOrRestoreEndTime();
 | 
|  |    303 |         
 | 
|  |    304 |         /**
 | 
|  |    305 |         * after startup finish, the system state will get normal, backup/restore need check the status before get started.
 | 
|  |    306 |         * @since 5.2
 | 
|  |    307 | 		* @return ETrue if system state is normal, EFalse if not
 | 
|  |    308 |         */
 | 
|  |    309 |         TBool IsSystemStateNormal() const;
 | 
|  |    310 |         
 | 
|  |    311 |     public: // MCoeForegroundObserver
 | 
|  |    312 | 
 | 
|  |    313 |         /** Handles the application coming to the foreground. */
 | 
|  |    314 |         void HandleGainingForeground();
 | 
|  |    315 |         /** Handles the application going into the background. */
 | 
|  |    316 |         void HandleLosingForeground();
 | 
|  |    317 | 
 | 
|  |    318 |     public: // From CAknViewAppUi
 | 
|  |    319 |         /**
 | 
|  |    320 |          * @see CAknViewAppUi
 | 
|  |    321 |          */
 | 
|  |    322 |         void HandleViewDeactivation( const TVwsViewId &aViewIdToBeDeactivated, 
 | 
|  |    323 |                                      const TVwsViewId &aNewlyActivatedViewId );
 | 
|  |    324 | 
 | 
|  |    325 |         /**
 | 
|  |    326 |          * @see CAknViewAppUi
 | 
|  |    327 |          */
 | 
|  |    328 |         void HandleCommandL( TInt aCommand );
 | 
|  |    329 | 
 | 
|  |    330 |         /**
 | 
|  |    331 |         * From CAknViewAppUi, called when screen layout changes 
 | 
|  |    332 |         */
 | 
|  |    333 |         void HandleScreenDeviceChangedL();
 | 
|  |    334 | 
 | 
|  |    335 |         /**
 | 
|  |    336 |          * @see CAknViewAppUi
 | 
|  |    337 |          */
 | 
|  |    338 |         TErrorHandlerResponse HandleError( TInt aError,
 | 
|  |    339 |             const SExtendedError& aExtErr, TDes& aErrorText, TDes& aContextText );
 | 
|  |    340 | 
 | 
|  |    341 |         /**
 | 
|  |    342 |          * @see CAknViewAppUi
 | 
|  |    343 |          */
 | 
|  |    344 |          TBool ProcessCommandParametersL(
 | 
|  |    345 |             TApaCommand aCommand,
 | 
|  |    346 |             TFileName& aDocumentName,
 | 
|  |    347 |             const TDesC8& aTail );
 | 
|  |    348 | 
 | 
|  |    349 | #ifdef RD_FILE_MANAGER_BACKUP
 | 
|  |    350 |         /**
 | 
|  |    351 |          * @see CAknViewAppUi
 | 
|  |    352 |          */
 | 
|  |    353 |         void ProcessMessageL( TUid aUid, const TDesC8& aParams );
 | 
|  |    354 | #endif // RD_FILE_MANAGER_BACKUP
 | 
|  |    355 | 
 | 
|  |    356 |     public: // From MFileManagerSchBackupObserver
 | 
|  |    357 |         /**
 | 
|  |    358 |          * @see MFileManagerSchBackupObserver
 | 
|  |    359 |          */
 | 
|  |    360 |         void SchBackupFinishedL( TInt aError );
 | 
|  |    361 | 
 | 
|  |    362 |     private:
 | 
|  |    363 |         /** Deletes IR receive after timeout. */
 | 
|  |    364 |         static TInt DeleteIRReceiveCB( TAny* aPtr );
 | 
|  |    365 | 
 | 
|  |    366 |         /** Informs active view when screen device has changed. */
 | 
|  |    367 |         void NotifyViewScreenDeviceChanged();
 | 
|  |    368 | 
 | 
|  |    369 |         void SetFolderToOpenAtStartup(
 | 
|  |    370 |             const TDesC& aFullPath, TInt aSortMode );
 | 
|  |    371 | 
 | 
|  |    372 |         void OpenFolderViewAtStartupL();
 | 
|  |    373 | 
 | 
|  |    374 |         void CreateAndActivateLocalViewL(
 | 
|  |    375 |             TUid aViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage );
 | 
|  |    376 | 
 | 
|  |    377 |         void CreateAndActivateLocalViewL( TUid aViewId );
 | 
|  |    378 | 
 | 
|  |    379 |     private:    // Data
 | 
|  |    380 |         /// Ref: Title pane of the application
 | 
|  |    381 |         CAknTitlePane* iTitlePane;
 | 
|  |    382 |         // Own: CSendAppUi for send menu item and sending files
 | 
|  |    383 |         CSendUi* iSendUi;
 | 
|  |    384 |         /// Uid of currently active view
 | 
|  |    385 |         TUid iActiveView;
 | 
|  |    386 |         /// Flag to indicate if search view is open
 | 
|  |    387 |         TBool iSearchViewOpen;
 | 
|  |    388 |         // For some reason IsForeGround() does not return correct state of the application
 | 
|  |    389 |         // so own boolean is updated according MCoeForegroundObserver callbacks.
 | 
|  |    390 |         TBool iForeGround;
 | 
|  |    391 |         // Own: Infrared receiver for receive via IR functionality
 | 
|  |    392 |         CFileManagerIRReceiver* iIRReceiver;
 | 
|  |    393 |         // Own: Callback to delete CFileManagerIrReceiver
 | 
|  |    394 |         CAsyncCallBack* iIRDeleteCB;
 | 
|  |    395 |         // Own: Drive info
 | 
|  |    396 |         TFileManagerDriveInfo iDriveInfo;
 | 
|  |    397 | 		// Task scheduler
 | 
|  |    398 |         CFileManagerTaskScheduler* iTaskScheduler;
 | 
|  |    399 | 		// Handler for scheduled backup
 | 
|  |    400 |         CFileManagerSchBackupHandler* iSchBackupHandler;
 | 
|  |    401 |         // Flag to indicate if started for scheduled backup only
 | 
|  |    402 |         TBool iSchBackupStandalone;
 | 
|  |    403 |         // Indicates the folder to be opened at startup
 | 
|  |    404 |         TFileName iFolderToOpenAtStartup;
 | 
|  |    405 |         // Indicates the folder level at startup when the app is embedded
 | 
|  |    406 |         TInt iInitialFolderLevel;
 | 
|  |    407 |         // Indicates the parameter ready status
 | 
|  |    408 |         TBool iWaitingForParams;
 | 
|  |    409 |         
 | 
|  |    410 |         // Own: Stores the start time
 | 
|  |    411 |         TTime iManualBackupOrRestoreStarted;
 | 
|  |    412 |         // Own: Stores the end time
 | 
|  |    413 |         TTime iManualBackupOrRestoreEnded;
 | 
|  |    414 |         
 | 
|  |    415 |         // State aware session.
 | 
|  |    416 |         RSsmStateAwareSession iSAS;
 | 
|  |    417 |         
 | 
|  |    418 |     };
 | 
|  |    419 | 
 | 
|  |    420 | #endif // CFILEMANAGERAPPUI_H
 | 
|  |    421 |             
 | 
|  |    422 | // End of File
 |