deviceencryption/DevEncUi/inc/DevEncUiAppui.h
changeset 0 6a9f87576119
equal deleted inserted replaced
-1:000000000000 0:6a9f87576119
       
     1 /*
       
     2 * Copyright (c) 2005 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:  AppUi class of the application.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __DEVENCUIAPPUI_H__
       
    19 #define __DEVENCUIAPPUI_H__
       
    20 
       
    21 // INCLUDES
       
    22 #include <aknViewAppUi.h>
       
    23 #include <AknQueryDialog.h>
       
    24 #include <DevEncMmcObserver.h>
       
    25 #include "DevEncUiMemInfoObserver.h"
       
    26 #include "DevEncUiTimer.h"
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CDevEncUiEncrView;
       
    30 class CDevEncUiEncryptionOperator;
       
    31 class CDevEncUiDecrView;
       
    32 class CDevEncUiMainView;
       
    33 class CDevEncUiMemoryEntity;
       
    34 class CRepository;
       
    35 
       
    36 // CLASS DECLARATION
       
    37 /**
       
    38 * CDevEncUiAppUi application UI class.
       
    39 * Interacts with the user through the UI and request message processing
       
    40 * from the handler class
       
    41 */
       
    42 class CDevEncUiAppUi : public CAknViewAppUi,
       
    43                        public MMemoryCardObserver,
       
    44                        public MDevEncUiMemInfoObserver,
       
    45                        public MDevEncUiTimerCallback
       
    46     {
       
    47     public: // Constructors and destructor
       
    48 
       
    49         /**
       
    50         * ConstructL.
       
    51         * 2nd phase constructor.
       
    52         */
       
    53         void ConstructL();
       
    54 
       
    55         /**
       
    56         * CDevEncUiAppUi.
       
    57         * C++ default constructor. This needs to be public due to
       
    58         * the way the framework constructs the AppUi
       
    59         */
       
    60         CDevEncUiAppUi();
       
    61 
       
    62         /**
       
    63         * Virtual Destructor.
       
    64         */
       
    65         virtual ~CDevEncUiAppUi();
       
    66 
       
    67         /**
       
    68         * Dynamically initialises a menu pane.
       
    69         * The Uikon framework calls this function, if it is implemented in a
       
    70         * menu's observer, immediately before the menu pane is activated.
       
    71         */
       
    72         void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
       
    73 
       
    74         /**
       
    75         * From MMemoryCardObserver.
       
    76         */
       
    77         void MMCStatusChangedL();
       
    78 
       
    79         /**
       
    80         * From MDevEncUiMemInfoObserver.
       
    81         */
       
    82         void UpdateInfo( TDevEncUiMemoryType aType,
       
    83                          TUint aState,
       
    84                          TUint aProgress );
       
    85         
       
    86         /**
       
    87          * From MDevEncUiTimerCallback
       
    88          */
       
    89         void Timeout();
       
    90         
       
    91     protected:
       
    92         /**
       
    93         * From CAknViewAppUi. Handles changes in keyboard focus when an
       
    94         * application switches to foreground.
       
    95         */
       
    96         void HandleForegroundEventL( TBool aForeground );
       
    97 
       
    98     private:  // Functions from base classes
       
    99 
       
   100         /**
       
   101         * From CEikAppUi, HandleCommandL.
       
   102         * Takes care of command handling.
       
   103         * @param aCommand Command to be handled.
       
   104         */
       
   105         void HandleCommandL( TInt aCommand );
       
   106 
       
   107         /**
       
   108         * Displays the context-sensitive help.
       
   109         */
       
   110         void DisplayHelpL();
       
   111 
       
   112         void DoUpdateInfoL( TDevEncUiMemoryType aType,
       
   113                             TUint aState );
       
   114 
       
   115         /**
       
   116          * From CEikAppUi.
       
   117          * Command line processing.
       
   118          *
       
   119          * When DocumentHandler wants to launch NpdViewer as a standalone
       
   120          * application, it use RApaLsSession::StartDocument(filename, ...).
       
   121          *
       
   122          * CEikonEnv::ConstructAppFromCommandLineL(...), at first, pass 
       
   123          * the filename information to ProcessCommandParametersL 
       
   124          * correctly. But default CEikAppUi::ProcessCommandParametersL 
       
   125          * overwrite it's reference parameter (TFileName& aDocumentName) to 
       
   126          * application's defualt document name such as "NpdViewer.ini".
       
   127          * (In EikAppUi.cpp, 
       
   128          * Application()->GetDefaultDocumentFileName(aDocumentName);
       
   129          * do this). 
       
   130          * So,  when CEikonEnv::ConstructAppFromCommandLineL(...) calls
       
   131          * CApaDocument::OpenFileL(...), the filename information from 
       
   132          * Document Handler had been lost.
       
   133          * 
       
   134          * On the other hand, when DocumentHandler wants to launch NpdViewer 
       
   135          * as a embeded application, it use CApaDocument::OpenFileL() directly 
       
   136          * and never call ProcessCommandParametersL.
       
   137          *
       
   138          * So, in order to pass a correct filename information to OpenFileL 
       
   139          * in both case, we decide to override this function.
       
   140          *
       
   141          * @param aCommand command. (ignored)
       
   142          * @param aDocumentName Filename.
       
   143          * @param aTail optional command line parampeter. (ignored)
       
   144          * @return ETrue if aDocumentName file exists.
       
   145          */
       
   146          TBool ProcessCommandParametersL(
       
   147              TApaCommand aCommand,
       
   148              TFileName& aDocumentName,
       
   149              const TDesC8& aTail);
       
   150 
       
   151          /**
       
   152          * From CEikAppUi.
       
   153          * Start fileviewer with specified filename.
       
   154          * Both standalone and embeded case, this function is really called 
       
   155          *
       
   156          * @param aFilename Filename to view.
       
   157          */
       
   158          void OpenFileL(const TDesC& aFilename);
       
   159          
       
   160          /** 
       
   161           * Copy a file to a new path (Others folder)
       
   162           **/
       
   163          void CopyL(const TDesC &anOld, const TDesC &aNew);
       
   164 
       
   165  	public:
       
   166  	
       
   167          /**
       
   168          * Start fileviewer with specified file handle.
       
   169          * Both standalone and embeded case, this function is really called 
       
   170          *
       
   171          * @param aFile File handle.
       
   172          */
       
   173          void OpenFileL(RFile& aFile);
       
   174 
       
   175     private: // Data
       
   176 
       
   177         /** Created by this class, ownership transferred to CAknAppUi */
       
   178         CDevEncUiMainView* iMainView;
       
   179 
       
   180         /** Created by this class, ownership transferred to CAknAppUi */
       
   181         CDevEncUiEncrView* iEncryptionView;
       
   182 
       
   183         /** Created by this class, ownership transferred to CAknAppUi */
       
   184         CDevEncUiDecrView* iDecryptionView;
       
   185 
       
   186         /** Owned */
       
   187         CDevEncUiEncryptionOperator* iEncOperator;
       
   188 
       
   189         /** Owned */
       
   190         RArray<CDevEncUiMemoryEntity*> iMemEntities;
       
   191         
       
   192         /** Owned */
       
   193         CRepository* iCrSettings;
       
   194 
       
   195         /** Owned */
       
   196         CMmcObserver* iObserver;
       
   197         
       
   198         /** Owned */
       
   199         RFs iFs;
       
   200         
       
   201         /** Holds the current MMC mount status (from file server) */
       
   202         TInt iMmcStatus;
       
   203         
       
   204         /** Hold the current MMC encryption status (from NFE) */
       
   205         TInt iMmcEncState;
       
   206         
       
   207         /** ETrue if a Mmc status update is ongoing (to prevent re-entry) */
       
   208         TBool iStatusUpdateOngoing;
       
   209         
       
   210         /** Owned */
       
   211         CDevEncUiTimer* iTimer;
       
   212         
       
   213         /** ETrue if the application is foreground */
       
   214         TBool iForeground;
       
   215         
       
   216         /** ETrue if the application hasn't completed yet the construction phase */
       
   217         TBool iConstructionOnGoing;
       
   218     };
       
   219 
       
   220 #endif // __DEVENCUIAPPUI_H__
       
   221 
       
   222 // End of File