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 "cidlemode.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 #include "clog.h" |
|
27 |
|
28 CIdleMode* CIdleMode::NewL( MUIModeObserver* aUIModeObserver, |
|
29 CIFFactory& aIFFactory ) |
|
30 { |
|
31 CIdleMode* self = NewLC( aUIModeObserver, aIFFactory ); |
|
32 CleanupStack::Pop( self ); |
|
33 return self; |
|
34 } |
|
35 |
|
36 CIdleMode* CIdleMode::NewLC( MUIModeObserver* aUIModeObserver, |
|
37 CIFFactory& aIFFactory ) |
|
38 { |
|
39 CIdleMode* self = new ( ELeave ) CIdleMode( aUIModeObserver ); |
|
40 CleanupStack::PushL( self ); |
|
41 self->ConstructL( aIFFactory ); |
|
42 return self; |
|
43 } |
|
44 |
|
45 // Default constructor |
|
46 CIdleMode::CIdleMode( MUIModeObserver* aUIModeObserver ) |
|
47 { |
|
48 iUIModeObserver = aUIModeObserver; |
|
49 } |
|
50 |
|
51 // 2nd phase constructor |
|
52 void CIdleMode::ConstructL( CIFFactory& aIFFactory ) |
|
53 { |
|
54 iIFFactory = &aIFFactory; |
|
55 iUIProtocolController = CUIProtocolController::NewL( this, aIFFactory ); |
|
56 } |
|
57 |
|
58 // Destructor |
|
59 CIdleMode::~CIdleMode() |
|
60 { |
|
61 delete iUIProtocolController; |
|
62 } |
|
63 |
|
64 void CIdleMode::SearchDefaultPrinterL() |
|
65 { |
|
66 LOG("void CIdleMode::SearchDefaultPrinterL() START"); |
|
67 TBool printerFound = iUIProtocolController->SearchDefaultPrinterL(); |
|
68 // If printer was found change to settings view |
|
69 if( printerFound ) |
|
70 { |
|
71 LOG("void CIdleMode::SearchDefaultPrinterL() Printer found"); |
|
72 iUIModeObserver->ChangeViewL( MUIModeObserver::SettingsView ); |
|
73 } |
|
74 // Printer was not found or discovery cancelled |
|
75 else |
|
76 { |
|
77 LOG("void CIdleMode::SearchDefaultPrinterL() Printer not found"); |
|
78 iUIModeObserver->ChangeViewL( MUIModeObserver::SettingsView ); |
|
79 } |
|
80 LOG("void CIdleMode::SearchDefaultPrinterL() END"); |
|
81 } |
|
82 |
|
83 TBool CIdleMode::ChangeDefaultPrinterL( TInt aProtocol ) |
|
84 { |
|
85 TBool printerFound = iUIProtocolController-> |
|
86 ChangeDefaultPrinterL( aProtocol ); |
|
87 |
|
88 return printerFound; |
|
89 } |
|
90 |
|
91 |
|
92 void CIdleMode::UsbCableDisconnected() |
|
93 { |
|
94 if ( iIFFactory->SettingsIF()->GetCurrentPrinterProtocol() == |
|
95 MDiscoveryObserver::EUSB ) |
|
96 { |
|
97 // No leaving function. Ignore leave. |
|
98 TRAP_IGNORE( iUIModeObserver->ChangeViewL( MUIModeObserver::ImageSelectionView )); |
|
99 } |
|
100 } |
|
101 |
|
102 // End of File |
|