25
|
1 |
/*
|
|
2 |
* Copyright (c) 2007-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: Implementation of TWsfDetailsViewController.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// CLASS HEADER
|
|
19 |
#include "wsfdetailsviewcontroller.h"
|
|
20 |
|
|
21 |
// EXTERNAL INCLUDES
|
|
22 |
|
|
23 |
// INTERNAL INCLUDES
|
|
24 |
#include "wsfdetailscontainer.h"
|
|
25 |
#include "wsfdetailsviewmodel.h"
|
|
26 |
#include "wsfdetailsviewpartner.h"
|
|
27 |
#include "wsfwlaninfo.h"
|
|
28 |
#include "wsfwlaninfoarray.h"
|
|
29 |
|
|
30 |
#include "wsflogger.h"
|
|
31 |
|
|
32 |
// LOCAL DEFINITIONS
|
|
33 |
#ifdef _DEBUG
|
|
34 |
_LIT( KDetailsViewControllerPanic, "TWsfDetailsViewController" );
|
|
35 |
#define _ASSERTD( cond ) __ASSERT_DEBUG( (cond), \
|
|
36 |
User::Panic( KDetailsViewControllerPanic, __LINE__) )
|
|
37 |
#else
|
|
38 |
#define _ASSERTD( cond ) {}
|
|
39 |
#endif //_DEBUG
|
|
40 |
|
|
41 |
// ---------------------------------------------------------------------------
|
|
42 |
// TWsfDetailsViewController::SetModel
|
|
43 |
// ---------------------------------------------------------------------------
|
|
44 |
//
|
|
45 |
void TWsfDetailsViewController::SetModel( CWsfDetailsViewModel* aModel )
|
|
46 |
{
|
|
47 |
iModel = aModel;
|
|
48 |
}
|
|
49 |
|
|
50 |
// ---------------------------------------------------------------------------
|
|
51 |
// TWsfDetailsViewController::SetContainer
|
|
52 |
// ---------------------------------------------------------------------------
|
|
53 |
//
|
|
54 |
void TWsfDetailsViewController::SetContainer(
|
|
55 |
MWsfDetailsContainerIf* aContainer )
|
|
56 |
{
|
|
57 |
iContainer = aContainer;
|
|
58 |
}
|
|
59 |
|
|
60 |
// ---------------------------------------------------------------------------
|
|
61 |
// TWsfDetailsViewController::SetWlanListL
|
|
62 |
// ---------------------------------------------------------------------------
|
|
63 |
//
|
|
64 |
void TWsfDetailsViewController::SetWlanListL(
|
|
65 |
CWsfWlanInfoArray* aWlanArray,
|
|
66 |
const TDesC8& aSelectedWlanSsid )
|
|
67 |
{
|
|
68 |
LOG_ENTERFN( "TWsfDetailsViewController::SetWlanListL" );
|
|
69 |
_ASSERTD( aWlanArray );
|
|
70 |
|
|
71 |
//Get selected Wlan info
|
|
72 |
TWsfWlanInfo* info = aWlanArray->Match( aSelectedWlanSsid,
|
|
73 |
aWlanArray->Count() );
|
|
74 |
|
|
75 |
CDesCArray* formattadList = NULL;
|
|
76 |
|
|
77 |
// If wlan info found
|
|
78 |
if( info )
|
|
79 |
{
|
|
80 |
// Update model
|
|
81 |
formattadList = iModel->FormatWlanInfoL( info, aWlanArray );
|
|
82 |
}
|
|
83 |
|
|
84 |
// if view active && and something to show
|
|
85 |
if( iContainer && formattadList )
|
|
86 |
{
|
|
87 |
//Draw view
|
|
88 |
iContainer->UpdateListBoxL( formattadList );
|
|
89 |
}
|
|
90 |
|
|
91 |
HandlePaneTextUpdateL();
|
|
92 |
}
|
|
93 |
|
|
94 |
// ---------------------------------------------------------------------------
|
|
95 |
// TWsfDetailsViewController::WlanListChangedL
|
|
96 |
// ---------------------------------------------------------------------------
|
|
97 |
//
|
|
98 |
void TWsfDetailsViewController::WlanListChangedL(
|
|
99 |
CWsfWlanInfoArray* aWlanArray )
|
|
100 |
{
|
|
101 |
LOG_ENTERFN( "TWsfDetailsViewController::WlanListChangedL" );
|
|
102 |
_ASSERTD( aWlanArray );
|
|
103 |
|
|
104 |
_ASSERTD( iModel );
|
|
105 |
|
|
106 |
//Get selected Wlan info
|
|
107 |
TWsfWlanInfo* info = aWlanArray->Match( iModel->WlanSsid(),
|
|
108 |
aWlanArray->Count() );
|
|
109 |
//If view active
|
|
110 |
if( iContainer )
|
|
111 |
{
|
|
112 |
CDesCArray* formattadList = NULL;
|
|
113 |
|
|
114 |
//Current info found from new list
|
|
115 |
if( info )
|
|
116 |
{
|
|
117 |
// Update model
|
|
118 |
formattadList = iModel->FormatWlanInfoL( info, aWlanArray );
|
|
119 |
HandlePaneTextUpdateL();
|
|
120 |
}
|
|
121 |
|
|
122 |
// Current Wlan has been dropped
|
|
123 |
else
|
|
124 |
{
|
|
125 |
// Update model get no signal list and dont update pane text
|
|
126 |
formattadList = iModel->FormatWlanInfoL( NULL, aWlanArray );
|
|
127 |
}
|
|
128 |
|
|
129 |
//Draw view
|
|
130 |
iContainer->UpdateListBoxL( formattadList );
|
|
131 |
HandlePaneTextUpdateL();
|
|
132 |
}
|
|
133 |
}
|
|
134 |
|
|
135 |
// ---------------------------------------------------------------------------
|
|
136 |
// TWsfDetailsViewController::RefreshL
|
|
137 |
// ---------------------------------------------------------------------------
|
|
138 |
//
|
|
139 |
void TWsfDetailsViewController::RefreshL( )
|
|
140 |
{
|
|
141 |
LOG_ENTERFN( "TWsfDetailsViewController::RefreshL" );
|
|
142 |
_ASSERTD( iModel );
|
|
143 |
|
|
144 |
if ( iContainer )
|
|
145 |
{
|
|
146 |
CDesCArray* formattedDetails = iModel->GetWlanDetails();
|
|
147 |
iContainer->UpdateListBoxL( formattedDetails );
|
|
148 |
HandlePaneTextUpdateL();
|
|
149 |
}
|
|
150 |
}
|
|
151 |
|
|
152 |
// ---------------------------------------------------------------------------
|
|
153 |
// TWsfDetailsViewController::SetPartner
|
|
154 |
// ---------------------------------------------------------------------------
|
|
155 |
//
|
|
156 |
void TWsfDetailsViewController::SetPartner( MWsfDetailsViewPartner& aPartner )
|
|
157 |
{
|
|
158 |
iPartner = &aPartner;
|
|
159 |
}
|
|
160 |
|
|
161 |
|
|
162 |
// ---------------------------------------------------------------------------
|
|
163 |
// TWsfDetailsViewController::HandleLeftKeyPressedL
|
|
164 |
// ---------------------------------------------------------------------------
|
|
165 |
//
|
|
166 |
void TWsfDetailsViewController::HandleLeftKeyPressedL()
|
|
167 |
{
|
|
168 |
LOG_ENTERFN( "TWsfDetailsViewController::HandleLeftKeyPressedL" );
|
|
169 |
_ASSERTD( iModel );
|
|
170 |
|
|
171 |
if( iContainer )
|
|
172 |
{
|
|
173 |
CDesCArray* formattadList = iModel->FormatPreviousWlanInfoL();
|
|
174 |
iContainer->UpdateListBoxL( formattadList );
|
|
175 |
HandlePaneTextUpdateL();
|
|
176 |
}
|
|
177 |
}
|
|
178 |
|
|
179 |
// ---------------------------------------------------------------------------
|
|
180 |
// TWsfDetailsViewController::HandleRightKeyPressedL
|
|
181 |
// ---------------------------------------------------------------------------
|
|
182 |
//
|
|
183 |
void TWsfDetailsViewController::HandleRightKeyPressedL()
|
|
184 |
{
|
|
185 |
LOG_ENTERFN( "TWsfDetailsViewController::HandleRightKeyPressedL" );
|
|
186 |
_ASSERTD( iModel );
|
|
187 |
|
|
188 |
if( iContainer )
|
|
189 |
{
|
|
190 |
CDesCArray* formattadList = iModel->FormatNextWlanInfoL();
|
|
191 |
iContainer->UpdateListBoxL( formattadList );
|
|
192 |
HandlePaneTextUpdateL();
|
|
193 |
}
|
|
194 |
}
|
|
195 |
|
|
196 |
// ---------------------------------------------------------------------------
|
|
197 |
// TWsfDetailsViewController::HandleSelectionKeyPressedL
|
|
198 |
// ---------------------------------------------------------------------------
|
|
199 |
//
|
|
200 |
void TWsfDetailsViewController::HandleSelectionKeyPressedL()
|
|
201 |
{
|
|
202 |
LOG_ENTERFN( "TWsfDetailsViewController::HandleSelectionKeyPressedL" );
|
|
203 |
if ( iPartner )
|
|
204 |
{
|
|
205 |
iPartner->CloseDetailsViewL();
|
|
206 |
}
|
|
207 |
}
|
|
208 |
|
|
209 |
// ---------------------------------------------------------------------------
|
|
210 |
// TWsfDetailsViewController::HandlePaneTextUpdateL
|
|
211 |
// ---------------------------------------------------------------------------
|
|
212 |
//
|
|
213 |
void TWsfDetailsViewController::HandlePaneTextUpdateL()
|
|
214 |
{
|
|
215 |
LOG_ENTERFN( "TWsfDetailsViewController::HandlePaneTextUpdateL" );
|
|
216 |
_ASSERTD( iModel );
|
|
217 |
|
|
218 |
if( iContainer )
|
|
219 |
{
|
|
220 |
HBufC* paneText = iModel->FormatPaneTextLC();
|
|
221 |
TPtr temp( paneText->Des() );
|
|
222 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion( temp );
|
|
223 |
iContainer->UpdateNaviPaneL( *paneText );
|
|
224 |
CleanupStack::PopAndDestroy( paneText );
|
|
225 |
}
|
|
226 |
}
|
|
227 |
|
|
228 |
// ---------------------------------------------------------------------------
|
|
229 |
// void TWsfDetailsViewController::UpdateActiveTimeL
|
|
230 |
// ---------------------------------------------------------------------------
|
|
231 |
//
|
|
232 |
void TWsfDetailsViewController::UpdateActiveTimeL()
|
|
233 |
{
|
|
234 |
LOG_ENTERFN( "TWsfDetailsViewController::UpdateActiveTimeL" );
|
|
235 |
if ( iPartner )
|
|
236 |
{
|
|
237 |
iPartner->DetailsScanL();
|
|
238 |
}
|
|
239 |
}
|
|
240 |
|
|
241 |
// End of file
|
|
242 |
|
|
243 |
|
|
244 |
|
|
245 |
|