usbuis/imageprintui/src/settingsview.cpp
changeset 93 2dc695882abd
parent 89 3592750162a5
equal deleted inserted replaced
89:3592750162a5 93:2dc695882abd
     1 /*
       
     2 * Copyright (c) 2006 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:  Settings view for UI
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <aknViewAppUi.h>
       
    20 #include <imageprintui.rsg>
       
    21 #include <coecntrl.h>
       
    22 
       
    23 #include "imageprintui.hrh"
       
    24 #include "settingsview.h"
       
    25 #include "settingscontainer.h"
       
    26 #include "imageprintuidebug.h"
       
    27 #include "imageprintuiappui.h"
       
    28 
       
    29 #ifdef __SERIES60_HELP
       
    30 #include <hlplch.h>         // Help launcher
       
    31 #endif
       
    32 
       
    33 
       
    34 
       
    35 // ======== MEMBER FUNCTIONS ========
       
    36 
       
    37 // ---------------------------------------------------------------------------
       
    38 // 
       
    39 // ---------------------------------------------------------------------------
       
    40 //
       
    41 CSettingsView* CSettingsView::NewL()
       
    42     {
       
    43     FLOG(_L("[IMAGEPRINTUI]\t CSettingsView::NewL()"));
       
    44     CSettingsView* self = CSettingsView::NewLC();
       
    45     CleanupStack::Pop( self );
       
    46     FLOG(_L("[IMAGEPRINTUI]\t CSettingsView::NewL() complete"));
       
    47     return self;
       
    48     }
       
    49 
       
    50 
       
    51 // ---------------------------------------------------------------------------
       
    52 // 
       
    53 // ---------------------------------------------------------------------------
       
    54 //
       
    55 CSettingsView* CSettingsView::NewLC()
       
    56     {
       
    57     FLOG(_L("[IMAGEPRINTUI]\t CSettingsView::NewLC()"));
       
    58     CSettingsView* self = new( ELeave ) CSettingsView;
       
    59     CleanupStack::PushL( self );
       
    60     self->ConstructL();
       
    61     FLOG(_L("[IMAGEPRINTUI]\t CSettingsView::NewLC() complete"));
       
    62     return self;
       
    63     }
       
    64 
       
    65 
       
    66 // ---------------------------------------------------------------------------
       
    67 // 
       
    68 // ---------------------------------------------------------------------------
       
    69 //
       
    70 CSettingsView::~CSettingsView()
       
    71     {
       
    72     FLOG(_L("[IMAGEPRINTUI]\t CSettingsView::Destructor"));
       
    73     if ( iContainer )
       
    74         {
       
    75         AppUi()->RemoveFromViewStack( *this, iContainer );
       
    76         delete iContainer;
       
    77         }
       
    78     FLOG(_L("[IMAGEPRINTUI]\t CSettingsView::Destructor complete"));
       
    79 
       
    80     }
       
    81 
       
    82 // ---------------------------------------------------------------------------
       
    83 // 
       
    84 // ---------------------------------------------------------------------------
       
    85 //
       
    86 CSettingsView::CSettingsView()
       
    87     {
       
    88     }
       
    89 
       
    90 
       
    91 // ---------------------------------------------------------------------------
       
    92 // 
       
    93 // ---------------------------------------------------------------------------
       
    94 //
       
    95 void CSettingsView::ConstructL()
       
    96     {
       
    97     FLOG(_L("[IMAGEPRINTUI]\t CSettingsView::ConstructL()"));
       
    98     BaseConstructL( R_SETTINGS_VIEW );
       
    99     FLOG(_L("[IMAGEPRINTUI]\t CSettingsView::ConstructL() complete"));
       
   100     }
       
   101 
       
   102 // ---------------------------------------------------------------------------
       
   103 // 
       
   104 // ---------------------------------------------------------------------------
       
   105 //
       
   106 TUid CSettingsView::Id() const
       
   107     {
       
   108     FLOG(_L("[IMAGEPRINTUI]\t CSettingsView::Id"));
       
   109     return KImagePrintSettingsViewId;
       
   110     }
       
   111 
       
   112 
       
   113 // ---------------------------------------------------------------------------
       
   114 // 
       
   115 // ---------------------------------------------------------------------------
       
   116 //
       
   117 void CSettingsView::HandleCommandL(
       
   118     TInt aCommand )
       
   119     {
       
   120     FLOG(_L("[IMAGEPRINTUI]\t CSettingsView::HandleCommandL"));
       
   121 
       
   122     switch ( aCommand )
       
   123         {
       
   124         case EAknSoftkeyExit:
       
   125              {
       
   126              FLOG(_L("[IMAGEPRINTUI]\t CSettingsView::Softkey exit"));
       
   127              AppUi()->Exit();
       
   128              break;
       
   129              }
       
   130                 
       
   131         case EEikCmdExit:
       
   132             {
       
   133             FLOG(_L("[IMAGEPRINTUI]\t CSettingsView::cmd exit"));
       
   134             AppUi()->Exit();
       
   135             break;
       
   136             }
       
   137         
       
   138         #ifdef __SERIES60_HELP
       
   139         case ECmdSettingsHelp:
       
   140             {
       
   141             HlpLauncher::LaunchHelpApplicationL( 
       
   142                 iEikonEnv->WsSession(), AppUi()->AppHelpContextL() );
       
   143             break;
       
   144             }
       
   145         #endif //__SERIES60_HELP    
       
   146         
       
   147         case ECmdSettingsPrint:
       
   148             {
       
   149             static_cast<CImagePrintUiAppUi*>(AppUi() )->StartPrinting();
       
   150             break;  
       
   151             }
       
   152              
       
   153         case ECmdSettingsChange:
       
   154             {
       
   155             iContainer->HandleChange(); 
       
   156             break; 
       
   157             }
       
   158          default:
       
   159             {
       
   160             FLOG( _L("[IMAGEPRINTUI]\t CSettingsView::HandleCommandL default switch"));    
       
   161             break;
       
   162             }
       
   163             
       
   164         }
       
   165     FLOG(_L("[IMAGEPRINTUI]\t CSettingsView::HandleCommandL complete"));
       
   166     }
       
   167 
       
   168 
       
   169 // ---------------------------------------------------------------------------
       
   170 // 
       
   171 // ---------------------------------------------------------------------------
       
   172 //
       
   173 void CSettingsView::DoActivateL(
       
   174    const TVwsViewId& /*aPrevViewId*/,
       
   175    TUid /*aCustomMessageId*/,
       
   176    const TDesC8& /*aCustomMessage*/)
       
   177     {       
       
   178     FLOG(_L("[IMAGEPRINTUI]\t CSettingsView::DoActivateL"));
       
   179 
       
   180 	iContainer = CSettingsContainer::NewL( ClientRect(), static_cast<CImagePrintUiAppUi*>(AppUi() ));
       
   181 	iContainer->SetMopParent( this );
       
   182 	AppUi()->AddToStackL( *this, iContainer );
       
   183     FLOG(_L("[IMAGEPRINTUI]\t CSettingsView::DoActivateL complete"));
       
   184     }
       
   185 
       
   186 
       
   187 // ---------------------------------------------------------------------------
       
   188 // 
       
   189 // ---------------------------------------------------------------------------
       
   190 //
       
   191 void CSettingsView::DoDeactivate()
       
   192     {
       
   193     FLOG(_L("[IMAGEPRINTUI]\t CSettingsView::DoDeactivate()"));
       
   194     if ( iContainer )
       
   195         {
       
   196         AppUi()->RemoveFromViewStack( *this, iContainer );
       
   197         delete iContainer;
       
   198 	    iContainer = NULL;
       
   199         }
       
   200     FLOG(_L("[IMAGEPRINTUI]\t CSettingsView::DoDeactivate() complete"));
       
   201 
       
   202     }
       
   203 
       
   204 //End of File
       
   205