fotaapplication/fotaserver/FotaServer/src/FotaSrvUi.cpp
branchRCL_3
changeset 62 19bba8228ff0
parent 0 b497e44ab2fc
equal deleted inserted replaced
61:b183ec05bd8c 62:19bba8228ff0
       
     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:   Methods for CFotaSrvUi
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDES 
       
    21 
       
    22 #include <apgwgnam.h>
       
    23 #include <aknnotewrappers.h>
       
    24 #include <StringLoader.h>
       
    25 #include <textresolver.h>
       
    26 #include "FotaSrvUI.h"
       
    27 #include "FotaSrvApp.h"
       
    28 #include "FotaSrvDebug.h"
       
    29 
       
    30 // ============================ MEMBER FUNCTIONS =============================
       
    31 //
       
    32 
       
    33 // ---------------------------------------------------------------------------
       
    34 // CFotaSrvUi::ConstructL
       
    35 // Symbian 2nd phase constructor can leave.
       
    36 // ---------------------------------------------------------------------------
       
    37 //
       
    38 void CFotaSrvUi::ConstructL()
       
    39     {
       
    40     FLOG( _L( "[FotaServer] CFotaSrvUi::ConstructL:" ) );
       
    41     TInt        flags = EStandardApp|EAknEnableSkin|EAknEnableMSK;
       
    42     CAknAppUi::BaseConstructL( flags );
       
    43     CFotaSrvApp* app = (CFotaSrvApp*) Application();
       
    44     app->SetUIVisibleL(EFalse);
       
    45     iNeedToClose = EFalse;
       
    46     }
       
    47 
       
    48 // ---------------------------------------------------------------------------
       
    49 // Destructor
       
    50 // ---------------------------------------------------------------------------
       
    51 CFotaSrvUi::~CFotaSrvUi()
       
    52     {
       
    53 	}
       
    54 
       
    55 // ---------------------------------------------------------------------------
       
    56 // CFotaSrvUi::DynInitMenuPaneL
       
    57 // ---------------------------------------------------------------------------
       
    58 //
       
    59 void CFotaSrvUi::DynInitMenuPaneL( TInt /*aResourceId*/,
       
    60                                          CEikMenuPane* /*aMenuPane*/ )
       
    61     {
       
    62     FLOG( _L( "[FotaServer] CFotaSrvUi::DynInitMenuPaneL:" ) );
       
    63     }
       
    64 
       
    65 // ---------------------------------------------------------------------------
       
    66 // CFotaSrvUi::HandleKeyEventL
       
    67 // ---------------------------------------------------------------------------
       
    68 //
       
    69 TKeyResponse CFotaSrvUi::HandleKeyEventL( const TKeyEvent& aKeyEvent,
       
    70                                             	TEventCode aType )
       
    71     {
       
    72     FLOG(_L( "[FotaServer] CFotaSrvUi::HandleKeyEventL: %d  %d" ), aType
       
    73             , aKeyEvent.iCode ); 
       
    74     if (aType == EEventKey && aKeyEvent.iCode == EKeyEscape )
       
    75     	{
       
    76     	FLOG(_L("Application requested to shutdown..."));
       
    77         CFotaSrvApp* app = (CFotaSrvApp*) Application();
       
    78         CFotaServer* server = app->Server();
       
    79 
       
    80     	server->iNeedToClose = ETrue;
       
    81     	}
       
    82     return EKeyWasNotConsumed;
       
    83 	}
       
    84 
       
    85 // ---------------------------------------------------------------------------
       
    86 // CFotaSrvUi::HandleCommandL
       
    87 // ---------------------------------------------------------------------------
       
    88 //
       
    89 void CFotaSrvUi::HandleCommandL( TInt aCommand )
       
    90     {
       
    91     FLOG(_L( "[FotaServer] CFotaSrvUi::HandleCommandL >> %d" ),aCommand  );
       
    92     switch ( aCommand )
       
    93         {
       
    94 	    case EAknCmdExit:
       
    95         case EEikCmdExit:		// quit application
       
    96 		    {
       
    97             
       
    98 	        CFotaSrvApp* app = (CFotaSrvApp*) Application();
       
    99 	        CFotaServer* server = app->Server();
       
   100 	        if (!server->GetDEOperation())
       
   101 	            {
       
   102 	            FLOG(_L("Exitting FotaServer!!"));
       
   103 	            server->iNeedToClose = ETrue;
       
   104 	            Exit();
       
   105 	            }
       
   106 	        else
       
   107 	            {
       
   108 	            FLOG(_L("Defering exit!"));
       
   109 	            }
       
   110 		    }
       
   111 		    break;
       
   112 
       
   113         default:
       
   114             break;      
       
   115         }
       
   116     FLOG(_L( "[FotaServer] CFotaSrvUi::HandleCommandL << %d" ),aCommand  );
       
   117     }
       
   118 
       
   119 // ---------------------------------------------------------------------------
       
   120 // CIVAppUi::OpenFileL
       
   121 // This is called by framework when application is already open in background
       
   122 // and user open other file in eg. FileBrowse.
       
   123 // New file to been shown is passed via aFileName.
       
   124 // ---------------------------------------------------------------------------
       
   125 //
       
   126 void CFotaSrvUi::OpenFileL(const TDesC& aFileName)
       
   127     {
       
   128     FLOG(_L("CFotaSrvUi::OpenFileL(%S)"),&aFileName);
       
   129     }
       
   130 
       
   131 
       
   132 // ---------------------------------------------------------------------------
       
   133 // CFotaAppUi::PrepareToExit
       
   134 // This is called by framework when application is about to exit
       
   135 // and server can prepare to stop any active downloads
       
   136 // ---------------------------------------------------------------------------
       
   137 //
       
   138 void CFotaSrvUi::PrepareToExit()
       
   139     {
       
   140     FLOG(_L("CFotaSrvUi::PrepareToExit >>"));
       
   141 	
       
   142     CFotaSrvApp* app = (CFotaSrvApp*) Application();
       
   143     CFotaServer* server = app->Server();
       
   144     server->iNeedToClose = ETrue;
       
   145 
       
   146     FLOG(_L("CFotaSrvUi::PrepareToExit <<"));
       
   147     }