|
1 /* |
|
2 * Copyright (c) 2008 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: This module contains the implementation of |
|
15 * CIAUpdateRoamingHandler class member functions. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 //INCLUDES |
|
22 #include <centralrepository.h> |
|
23 #include <avkon.hrh> |
|
24 #include <avkon.rsg> |
|
25 #include <iaupdate.rsg> |
|
26 |
|
27 #include "iaupdateroaminghandler.h" |
|
28 #include "iaupdateroaminghandlerobserver.h" |
|
29 #include "iaupdatenetworkregistration.h" |
|
30 #include "iaupdateprivatecrkeys.h" |
|
31 #include "iaupdatedialogutil.h" |
|
32 #include "iaupdate.hrh" |
|
33 |
|
34 // ================= MEMBER FUNCTIONS ======================= |
|
35 |
|
36 // --------------------------------------------------------------------------- |
|
37 // CIAUpdateRoamingHandler::NewL |
|
38 // Two-phased constructor. |
|
39 // --------------------------------------------------------------------------- |
|
40 // |
|
41 CIAUpdateRoamingHandler* CIAUpdateRoamingHandler::NewL() |
|
42 { |
|
43 CIAUpdateRoamingHandler* self = new (ELeave) CIAUpdateRoamingHandler(); |
|
44 CleanupStack::PushL( self ); |
|
45 self->ConstructL(); |
|
46 CleanupStack::Pop( self ); |
|
47 return self; |
|
48 } |
|
49 |
|
50 |
|
51 // --------------------------------------------------------------------------- |
|
52 // void CIAUpdateRoamingHandler::ConstructL |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 void CIAUpdateRoamingHandler::ConstructL() |
|
56 { |
|
57 iNwReg = CIAUpdateNetworkRegistration::NewL( *this ); |
|
58 } |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // CIAUpdateRoamingHandler::CIAUpdateRoamingHandler |
|
62 // constructor |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 CIAUpdateRoamingHandler::CIAUpdateRoamingHandler() |
|
66 { |
|
67 } |
|
68 |
|
69 // --------------------------------------------------------------------------- |
|
70 // CIAUpdateRoamingHandler::~CIAUpdateRoamingHandler |
|
71 // Destructor |
|
72 // --------------------------------------------------------------------------- |
|
73 // |
|
74 CIAUpdateRoamingHandler::~CIAUpdateRoamingHandler() |
|
75 { |
|
76 CancelPreparing(); |
|
77 delete iNwReg; |
|
78 } |
|
79 |
|
80 // --------------------------------------------------------------------------- |
|
81 // CIAUpdateRoamingHandler::StatusMonitored |
|
82 // |
|
83 // --------------------------------------------------------------------------- |
|
84 // |
|
85 void CIAUpdateRoamingHandler::StatusMonitored( TBool aRoaming ) |
|
86 { |
|
87 iRoaming = aRoaming; |
|
88 if ( iPreparing ) |
|
89 { |
|
90 iObserver->RoamingHandlerPrepared(); |
|
91 iObserver = NULL; |
|
92 iPreparing = EFalse; |
|
93 iPrepared = ETrue; |
|
94 } |
|
95 } |
|
96 |
|
97 |
|
98 |
|
99 // --------------------------------------------------------------------------- |
|
100 // CIAUpdateRoamingHandler::PrepareL |
|
101 // |
|
102 // --------------------------------------------------------------------------- |
|
103 // |
|
104 void CIAUpdateRoamingHandler::PrepareL( MIAUpdateRoamingHandlerObserver& aObserver ) |
|
105 { |
|
106 iObserver = &aObserver; |
|
107 iPreparing = ETrue; |
|
108 iNwReg->StartMonitoringL(); |
|
109 } |
|
110 |
|
111 // --------------------------------------------------------------------------- |
|
112 // CIAUpdateRoamingHandler::CancelPreparing |
|
113 // |
|
114 // --------------------------------------------------------------------------- |
|
115 // |
|
116 void CIAUpdateRoamingHandler::CancelPreparing() |
|
117 { |
|
118 iNwReg->Cancel(); |
|
119 } |
|
120 |
|
121 |
|
122 // --------------------------------------------------------------------------- |
|
123 // CIAUpdateRoamingHandler::Prepared() |
|
124 // |
|
125 // --------------------------------------------------------------------------- |
|
126 // |
|
127 TBool CIAUpdateRoamingHandler::Prepared() const |
|
128 { |
|
129 return iPrepared; |
|
130 } |
|
131 |
|
132 |
|
133 // --------------------------------------------------------------------------- |
|
134 // CIAUpdateRoamingHandler::IsRoaming() |
|
135 // |
|
136 // --------------------------------------------------------------------------- |
|
137 // |
|
138 TBool CIAUpdateRoamingHandler::IsRoaming() |
|
139 { |
|
140 return iRoaming; |
|
141 } |
|
142 |
|
143 // --------------------------------------------------------------------------- |
|
144 // CIAUpdateRoamingHandler::RoamingRejectionL() |
|
145 // |
|
146 // --------------------------------------------------------------------------- |
|
147 // |
|
148 TBool CIAUpdateRoamingHandler::RoamingRejectionL() |
|
149 { |
|
150 TBool rejected = EFalse; |
|
151 if ( ( iRoaming ) && ( !iRoamingConnectionAccepted ) ) |
|
152 { |
|
153 CRepository* cenrep = CRepository::NewLC( KCRUidIAUpdateSettings ); |
|
154 |
|
155 TInt num = KErrNotFound; |
|
156 User::LeaveIfError( cenrep->Get( KIAUpdateRoamingWarning, num ) ); |
|
157 |
|
158 CleanupStack::PopAndDestroy( cenrep ); |
|
159 if ( num == EIAUpdateSettingValueOn ) |
|
160 { |
|
161 TInt ret = IAUpdateDialogUtil::ShowConfirmationQueryL( |
|
162 R_IAUPDATE_CONNECT_TO_SERVER, |
|
163 R_AVKON_SOFTKEYS_YES_NO ); |
|
164 if ( ret == EAknSoftkeyYes ) |
|
165 { |
|
166 iRoamingConnectionAccepted = ETrue; |
|
167 } |
|
168 else |
|
169 { |
|
170 rejected = ETrue; |
|
171 } |
|
172 } |
|
173 } |
|
174 return rejected; |
|
175 } |
|
176 |
|
177 |
|
178 // End of File |