ImagePrint/ImagePrintUI/imageprintapp/src/caiwmode.cpp
branchRCL_3
changeset 20 159fc2f68139
parent 17 26673e532f65
child 21 d59c248c9d36
equal deleted inserted replaced
17:26673e532f65 20:159fc2f68139
     1 /*
       
     2 * Copyright (c) 2005-2007 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "caiwmode.h"
       
    20 #include "muimodeobserver.h"
       
    21 #include "muimode.h"
       
    22 #include "mprintsettings.h"
       
    23 #include "cuiprotocolcontroller.h"
       
    24 #include "ciffactory.h"
       
    25 #include "mdiscoveryobserver.h" 
       
    26 
       
    27 CAiwMode* CAiwMode::NewL( MUIModeObserver* aUIModeObserver,
       
    28                           CIFFactory& aIFFactory )
       
    29     {
       
    30     CAiwMode* self = NewLC( aUIModeObserver, aIFFactory );
       
    31     CleanupStack::Pop( self );
       
    32     return self;
       
    33     }
       
    34 
       
    35 CAiwMode* CAiwMode::NewLC( MUIModeObserver* aUIModeObserver,
       
    36                            CIFFactory& aIFFactory )
       
    37     {
       
    38     CAiwMode* self = new ( ELeave ) CAiwMode( aUIModeObserver );
       
    39     CleanupStack::PushL( self );
       
    40     self->ConstructL( aIFFactory  );
       
    41     return self;
       
    42     }
       
    43 
       
    44 // Default constructor
       
    45 CAiwMode::CAiwMode( MUIModeObserver* aUIModeObserver  )
       
    46 	{
       
    47     iUIModeObserver = aUIModeObserver;
       
    48     }
       
    49 
       
    50 // 2nd phase constructor
       
    51 void CAiwMode::ConstructL( CIFFactory& aIFFactory )
       
    52     {
       
    53     iIFFactory = &aIFFactory;
       
    54     iUIProtocolController = CUIProtocolController::NewL( this, aIFFactory );
       
    55     }
       
    56 
       
    57 // Destructor
       
    58 CAiwMode::~CAiwMode()
       
    59     {
       
    60     delete iUIProtocolController;
       
    61 	}
       
    62 
       
    63 void CAiwMode::SearchDefaultPrinterL()
       
    64     {
       
    65     iUIProtocolController->SearchDefaultPrinterL();  
       
    66     iUIModeObserver->ChangeViewL( MUIModeObserver::SettingsView );
       
    67     }
       
    68 
       
    69 TBool CAiwMode::ChangeDefaultPrinterL( TInt aProtocol )
       
    70     {
       
    71     TBool printerFound = iUIProtocolController->
       
    72                                 ChangeDefaultPrinterL( aProtocol );
       
    73  
       
    74     return printerFound;
       
    75     }
       
    76 
       
    77 void CAiwMode::UsbCableDisconnected()
       
    78     {
       
    79     if ( iIFFactory->SettingsIF()->GetCurrentPrinterProtocol() == 
       
    80          MDiscoveryObserver::EUSB )
       
    81     	{    
       
    82     	iUIModeObserver->ExitApplication();
       
    83     	}
       
    84     }
       
    85 
       
    86 //  End of File