58
|
1 |
/*
|
|
2 |
* Copyright (c) 2002 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: container control class
|
|
15 |
*
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
// INCLUDE FILES
|
|
21 |
#include <aknnavi.h> //for CNaviPane
|
|
22 |
#include <aknnavide.h> //for CAknNavigationDecorator
|
|
23 |
|
|
24 |
#include <AknIconArray.h>
|
|
25 |
#include <aknlists.h>
|
|
26 |
#include <StringLoader.h>
|
|
27 |
#include <AknQueryDialog.h>
|
|
28 |
#include <AknsUtils.h>
|
|
29 |
#include <AknGlobalNote.h>
|
|
30 |
|
|
31 |
#include "ConnectionArray.h"
|
|
32 |
#include "ConnectionMonitorUiContainer.h"
|
|
33 |
#include "FeatureManagerWrapper.h"
|
|
34 |
#include "ActiveWrapper.h"
|
|
35 |
|
|
36 |
#include <ConnectionMonitorUi.rsg>
|
|
37 |
#include <ConnectionMonitorUi.mbg>
|
|
38 |
#include <data_caging_path_literals.hrh>
|
|
39 |
|
|
40 |
#include <hlplch.h>
|
|
41 |
#include <csxhelp/cmon.hlp.hrh>
|
|
42 |
|
|
43 |
// CONSTANTS
|
|
44 |
/**
|
|
45 |
* UID of ConnectionMonitorUi App.
|
|
46 |
*/
|
|
47 |
LOCAL_D const TUid KUidConnMonUI = { 0x101F84D0 };
|
|
48 |
|
|
49 |
|
|
50 |
// CONSTANTS
|
|
51 |
// Granularity of the model array.
|
|
52 |
/**
|
|
53 |
* Granularity of icon array
|
|
54 |
*/
|
|
55 |
LOCAL_D const TInt KGranularity = 5;
|
|
56 |
|
|
57 |
|
|
58 |
_LIT( KEmpty, ""); ///< Empty string
|
|
59 |
|
|
60 |
// ROM folder
|
|
61 |
_LIT( KDriveZ, "z:" );
|
|
62 |
|
|
63 |
// Name of the MBM file containing bitmaps
|
|
64 |
_LIT( KConnectionMonitorUiMBMFile, "ConnectionMonitorUi.mbm" );
|
|
65 |
|
|
66 |
// ================= MEMBER FUNCTIONS =======================
|
|
67 |
// ---------------------------------------------------------
|
|
68 |
// CConnectionMonitorUiContainer::CConnectionMonitorUiContainer
|
|
69 |
// ---------------------------------------------------------
|
|
70 |
//
|
|
71 |
CConnectionMonitorUiContainer::CConnectionMonitorUiContainer(
|
|
72 |
CConnectionArray* const aConnectionArray,
|
|
73 |
RConnectionMonitor* aMonitor,
|
|
74 |
CActiveWrapper* aActiveWrapper )
|
|
75 |
: CCoeControl(),
|
|
76 |
iMonitor( aMonitor ),
|
|
77 |
iConnectionArray( aConnectionArray ),
|
|
78 |
isWlanSupported( EFalse ),
|
|
79 |
iActiveWrapper( aActiveWrapper ),
|
|
80 |
iFocusChanged( EFalse )
|
|
81 |
{
|
|
82 |
}
|
|
83 |
|
|
84 |
// ---------------------------------------------------------
|
|
85 |
// CConnectionMonitorUiContainer::ConstructL
|
|
86 |
// EPOC two phased constructor
|
|
87 |
// ---------------------------------------------------------
|
|
88 |
//
|
|
89 |
void CConnectionMonitorUiContainer::ConstructL( TInt aSelectedItem, const TRect& aRect )
|
|
90 |
{
|
|
91 |
CMUILOGGER_ENTERFN( "CConnectionMonitorUiContainer::ConstructL" );
|
|
92 |
|
|
93 |
CreateWindowL();
|
|
94 |
|
|
95 |
iListBox = new( ELeave ) CAknDoubleGraphicStyleListBox;
|
|
96 |
TInt flags( EAknGenericListBoxFlags );
|
|
97 |
iListBox->ConstructL( this, flags );
|
|
98 |
iListBox->CreateScrollBarFrameL( ETrue );
|
|
99 |
iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
|
|
100 |
CEikScrollBarFrame::EOff,
|
|
101 |
CEikScrollBarFrame::EAuto );
|
|
102 |
iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray
|
|
103 |
/*ELbmDoesNotOwnItemArray*/ );
|
|
104 |
iListBox->Model()->SetItemTextArray( iConnectionArray );
|
|
105 |
iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
|
|
106 |
|
|
107 |
TInt actCount = iConnectionArray->MdcaCount() - 1;
|
|
108 |
|
|
109 |
if ( actCount > KErrNotFound )
|
|
110 |
{
|
|
111 |
iListBox->SetCurrentItemIndex( aSelectedItem > actCount ? actCount : aSelectedItem );
|
|
112 |
}
|
|
113 |
|
|
114 |
SetIconsL();
|
|
115 |
|
|
116 |
HBufC* noConn = StringLoader::LoadLC( R_QTN_CMON_NO_ACTIVE_CONNECTIONS,
|
|
117 |
iEikonEnv );
|
|
118 |
|
|
119 |
CListBoxView *lbview = iListBox->View();
|
|
120 |
lbview->SetListEmptyTextL( *noConn );
|
|
121 |
CleanupStack::PopAndDestroy( noConn );
|
|
122 |
|
|
123 |
GetPanesL();
|
|
124 |
SetRect( aRect );
|
|
125 |
ActivateL();
|
|
126 |
|
|
127 |
isWlanSupported = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan );
|
|
128 |
iOldConnectionCount = iConnectionArray->MdcaCount();
|
|
129 |
|
|
130 |
CMUILOGGER_LEAVEFN( "CConnectionMonitorUiContainer::ConstructL" );
|
|
131 |
}
|
|
132 |
|
|
133 |
// ---------------------------------------------------------
|
|
134 |
// CConnectionMonitorUiContainer::OfferKeyEventL
|
|
135 |
// ---------------------------------------------------------
|
|
136 |
//
|
|
137 |
TKeyResponse CConnectionMonitorUiContainer::OfferKeyEventL(
|
|
138 |
const TKeyEvent& aKeyEvent,
|
|
139 |
TEventCode aType )
|
|
140 |
{
|
|
141 |
TKeyResponse result( EKeyWasNotConsumed );
|
|
142 |
if ( aType == EEventKey )
|
|
143 |
{
|
|
144 |
TInt index = iListBox->CurrentItemIndex();
|
|
145 |
if ( ( aKeyEvent.iCode == EKeyBackspace ) && ( index != -1 ) )
|
|
146 |
{
|
|
147 |
if ( !( *iConnectionArray )[index]->IsSuspended() )
|
|
148 |
{
|
|
149 |
EndConnectionL();
|
|
150 |
result = EKeyWasConsumed;
|
|
151 |
}
|
|
152 |
}
|
|
153 |
else
|
|
154 |
{
|
|
155 |
result = iListBox->OfferKeyEventL( aKeyEvent, aType );
|
|
156 |
}
|
|
157 |
}
|
|
158 |
return result;
|
|
159 |
}
|
|
160 |
|
|
161 |
// ---------------------------------------------------------
|
|
162 |
// CConnectionMonitorUiContainer::~CConnectionMonitorUiContainer
|
|
163 |
// ---------------------------------------------------------
|
|
164 |
//
|
|
165 |
CConnectionMonitorUiContainer::~CConnectionMonitorUiContainer()
|
|
166 |
{
|
|
167 |
delete iListBox;
|
|
168 |
delete iNaviDecorator;
|
|
169 |
}
|
|
170 |
|
|
171 |
// ---------------------------------------------------------
|
|
172 |
// CConnectionMonitorUiContainer::SizeChanged()
|
|
173 |
// Called by framework when the view size is changed
|
|
174 |
// ---------------------------------------------------------
|
|
175 |
//
|
|
176 |
void CConnectionMonitorUiContainer::SizeChanged()
|
|
177 |
{
|
|
178 |
iListBox->SetRect( Rect() );
|
|
179 |
}
|
|
180 |
|
|
181 |
// ---------------------------------------------------------
|
|
182 |
// CConnectionMonitorUiContainer::CountComponentControls
|
|
183 |
// ---------------------------------------------------------
|
|
184 |
//
|
|
185 |
TInt CConnectionMonitorUiContainer::CountComponentControls() const
|
|
186 |
{
|
|
187 |
return 1; // only iListBox
|
|
188 |
}
|
|
189 |
|
|
190 |
// ---------------------------------------------------------
|
|
191 |
// CConnectionMonitorUiContainer::ComponentControl( TInt aIndex ) const
|
|
192 |
// ---------------------------------------------------------
|
|
193 |
//
|
|
194 |
CCoeControl* CConnectionMonitorUiContainer::ComponentControl(
|
|
195 |
TInt aIndex ) const
|
|
196 |
{
|
|
197 |
switch ( aIndex )
|
|
198 |
{
|
|
199 |
case 0:
|
|
200 |
return iListBox;
|
|
201 |
default:
|
|
202 |
return NULL;
|
|
203 |
}
|
|
204 |
}
|
|
205 |
|
|
206 |
// ---------------------------------------------------------
|
|
207 |
// CConnectionMonitorUiContainer::OnEventL
|
|
208 |
// ---------------------------------------------------------
|
|
209 |
//
|
|
210 |
void CConnectionMonitorUiContainer::OnEventL(
|
|
211 |
const CConnMonEventBase& aConnMonEvent,
|
|
212 |
const TInt aIndex )
|
|
213 |
{
|
|
214 |
CMUILOGGER_ENTERFN( "CConnectionMonitorUiContainer::OnEventL" );
|
|
215 |
CMUILOGGER_WRITE_F( "OnEventL type: %d", aConnMonEvent.EventType() );
|
|
216 |
CMUILOGGER_WRITE_F( "OnEventL index: %d", aIndex );
|
|
217 |
|
|
218 |
TBool validIndex =( iListBox->Model()->NumberOfItems() > KErrNotFound ) &&
|
|
219 |
( aIndex > KErrNotFound ) &&
|
|
220 |
( iListBox->Model()->NumberOfItems() >= aIndex );
|
|
221 |
|
|
222 |
if ( aConnMonEvent.ConnectionId() )
|
|
223 |
{
|
|
224 |
switch ( aConnMonEvent.EventType() )
|
|
225 |
{
|
|
226 |
case EConnMonCreateConnection:
|
|
227 |
{
|
|
228 |
CMUILOGGER_WRITE( "OnEventL EConnMonCreateConnection" );
|
|
229 |
iListBox->HandleItemAdditionL();
|
|
230 |
break;
|
|
231 |
}
|
|
232 |
case EConnMonDeleteConnection:
|
|
233 |
{
|
|
234 |
CMUILOGGER_WRITE( "OnEventL EConnMonDeleteConnection" );
|
|
235 |
CMUILOGGER_WRITE_F( "validIndex: %b", validIndex );
|
|
236 |
|
|
237 |
iListBox->UpdateScrollBarsL();
|
|
238 |
break;
|
|
239 |
}
|
|
240 |
case EConnMonConnectionStatusChange:
|
|
241 |
case EConnMonCreateSubConnection:
|
|
242 |
case EConnMonDeleteSubConnection:
|
|
243 |
{
|
|
244 |
CMUILOGGER_WRITE( "OnEventL StatusChange SubConnection" );
|
|
245 |
break;
|
|
246 |
}
|
|
247 |
default:
|
|
248 |
{
|
|
249 |
CMUILOGGER_WRITE( "OnEventL default" );
|
|
250 |
break;
|
|
251 |
}
|
|
252 |
}
|
|
253 |
}
|
|
254 |
PushAndRefreshNaviPaneL();
|
|
255 |
|
|
256 |
CMUILOGGER_LEAVEFN( "CConnectionMonitorUiContainer::OnEventL" );
|
|
257 |
}
|
|
258 |
|
|
259 |
// ---------------------------------------------------------
|
|
260 |
// CConnectionMonitorUiContainer::OnTimerEventL
|
|
261 |
// ---------------------------------------------------------
|
|
262 |
//
|
|
263 |
void CConnectionMonitorUiContainer::OnTimerEventL()
|
|
264 |
{
|
|
265 |
iListBox->DrawNow();
|
|
266 |
TInt iNewConnectionCount = iConnectionArray->MdcaCount();
|
|
267 |
if( iOldConnectionCount < iNewConnectionCount )
|
|
268 |
{
|
|
269 |
iListBox->HandleItemAdditionL();
|
|
270 |
}
|
|
271 |
else if ( iOldConnectionCount > iNewConnectionCount )
|
|
272 |
{
|
|
273 |
iListBox->HandleItemRemovalL();
|
|
274 |
}
|
|
275 |
|
|
276 |
//Update the scrollbar only if lisbox focus
|
|
277 |
//has changed
|
|
278 |
//
|
|
279 |
if ( iFocusChanged )
|
|
280 |
{
|
|
281 |
iListBox->UpdateScrollBarsL();
|
|
282 |
iFocusChanged = EFalse;
|
|
283 |
}
|
|
284 |
iOldConnectionCount = iNewConnectionCount;
|
|
285 |
PushAndRefreshNaviPaneL();
|
|
286 |
}
|
|
287 |
|
|
288 |
// ---------------------------------------------------------
|
|
289 |
// CConnectionMonitorUiContainer::DrawFirstAllListBoxItem
|
|
290 |
// ---------------------------------------------------------
|
|
291 |
//
|
|
292 |
void CConnectionMonitorUiContainer::DrawFirstAllListBoxItem()
|
|
293 |
{
|
|
294 |
TInt count = iListBox->Model()->NumberOfItems() - 1;
|
|
295 |
for ( TInt i = count; i > -1; --i )
|
|
296 |
{
|
|
297 |
iListBox->DrawItem( i );
|
|
298 |
}
|
|
299 |
}
|
|
300 |
|
|
301 |
// ---------------------------------------------------------
|
|
302 |
// CConnectionMonitorUiContainer::SelectedConnection
|
|
303 |
// ---------------------------------------------------------
|
|
304 |
//
|
|
305 |
TInt CConnectionMonitorUiContainer::SelectedConnection()
|
|
306 |
{
|
|
307 |
return iListBox->CurrentItemIndex();
|
|
308 |
}
|
|
309 |
|
|
310 |
// ---------------------------------------------------------
|
|
311 |
// CConnectionMonitorUiContainer::EndConnectionL
|
|
312 |
// ---------------------------------------------------------
|
|
313 |
//
|
|
314 |
void CConnectionMonitorUiContainer::EndConnectionL()
|
|
315 |
{
|
|
316 |
CMUILOGGER_ENTERFN( "CConnectionMonitorUiContainer::EndConnectionL " );
|
|
317 |
TInt index = iListBox->CurrentItemIndex();
|
|
318 |
if ( ( index >= 0 ) && ( index < iConnectionArray->MdcaCount() ) )
|
|
319 |
{
|
|
320 |
CConnectionInfoBase* connection = ( *iConnectionArray )[index];
|
|
321 |
TUint connectionId = connection->GetConnectionId();
|
|
322 |
HBufC* connectionName = NULL;
|
|
323 |
HBufC* promptConnectionName = NULL;
|
|
324 |
|
|
325 |
// Get the bearertype of a single connection
|
|
326 |
TConnMonBearerType bearer;
|
|
327 |
bearer = connection->GetBearerType();
|
|
328 |
|
|
329 |
if ( isWlanSupported ) // WLAN ON
|
|
330 |
{
|
|
331 |
if ( ( bearer == EBearerWLAN ) && connection->IsEasyWLAN() )
|
|
332 |
{
|
|
333 |
/* check and load the SSID for EasyWLAN */
|
|
334 |
connectionName = connection->GetWlanNetworkNameLC();
|
|
335 |
CMUILOGGER_WRITE_F( "GetWlanNetworkNameLC: %S",
|
|
336 |
connectionName );
|
|
337 |
}
|
|
338 |
else
|
|
339 |
{
|
|
340 |
connectionName = connection->GetNameLC();
|
|
341 |
CMUILOGGER_WRITE_F( "GetNameLC: %S", connectionName );
|
|
342 |
}
|
|
343 |
}
|
|
344 |
else // WLAN OFF
|
|
345 |
{
|
|
346 |
connectionName = connection->GetNameLC();
|
|
347 |
CMUILOGGER_WRITE_F( "GetNameLC: %S", connectionName );
|
|
348 |
}
|
|
349 |
|
|
350 |
if ( bearer >= EBearerExternalCSD )
|
|
351 |
{
|
|
352 |
CMUILOGGER_WRITE( "R_QTN_CMON_CONF_END_MODEM_CONN" );
|
|
353 |
promptConnectionName = StringLoader::LoadLC(
|
|
354 |
R_QTN_CMON_CONF_END_MODEM_CONN );
|
|
355 |
}
|
|
356 |
else
|
|
357 |
{
|
|
358 |
CMUILOGGER_WRITE( "R_QTN_CMON_CONF_END_SINGLE_CONN" );
|
|
359 |
promptConnectionName = StringLoader::LoadLC(
|
|
360 |
R_QTN_CMON_CONF_END_SINGLE_CONN,
|
|
361 |
*connectionName );
|
|
362 |
}
|
|
363 |
|
|
364 |
CAknQueryDialog* dlg = CAknQueryDialog::NewL();
|
|
365 |
TInt ret = dlg->ExecuteLD( R_END_CONN_CONFIRMATION_QUERY,
|
|
366 |
*promptConnectionName );
|
|
367 |
|
|
368 |
CleanupStack::PopAndDestroy( promptConnectionName );
|
|
369 |
CleanupStack::PopAndDestroy( connectionName );
|
|
370 |
|
|
371 |
TInt connStatus;
|
|
372 |
iActiveWrapper->StartGetIntAttribute( connectionId,
|
|
373 |
iMonitor,
|
|
374 |
KConnectionStatus,
|
|
375 |
( ( TInt& )( connStatus ) ) );
|
|
376 |
CMUILOGGER_WRITE_F( "KConnectionStatus status.Int(): %d",
|
|
377 |
iActiveWrapper->iStatus.Int() );
|
|
378 |
CMUILOGGER_WRITE_F( "KConnectionStatus connStatus: %d",
|
|
379 |
connStatus );
|
|
380 |
CMUILOGGER_WRITE_F( "ret ret: %d", ret );
|
|
381 |
|
|
382 |
if ( ( ret == EAknSoftkeyOk ) || ( ret == EAknSoftkeyYes ) )
|
|
383 |
{
|
|
384 |
if ( KErrNone == iActiveWrapper->iStatus.Int() )
|
|
385 |
{
|
|
386 |
connection->SetDeletedFromCMUI();
|
|
387 |
|
|
388 |
connection->RefreshConnectionListBoxItemTextL();
|
|
389 |
DrawFirstAllListBoxItem();
|
|
390 |
|
|
391 |
iMonitor->SetBoolAttribute( connectionId, 0,
|
|
392 |
KConnectionStop, ETrue );
|
|
393 |
CMUILOGGER_WRITE( "after SetBoolAttribute" );
|
|
394 |
}
|
|
395 |
}
|
|
396 |
else
|
|
397 |
{
|
|
398 |
if ( KErrNotFound == iActiveWrapper->iStatus.Int() )
|
|
399 |
{
|
|
400 |
/* It is already closed */
|
|
401 |
/* An information note must be displayed */
|
|
402 |
CAknGlobalNote * note = CAknGlobalNote::NewL();
|
|
403 |
CleanupStack::PushL( note );
|
|
404 |
HBufC* informationText =
|
|
405 |
StringLoader::LoadLC( R_QTN_CMON_INFO_CONN_ALREADY_END );
|
|
406 |
|
|
407 |
note->ShowNoteL(EAknGlobalInformationNote, *informationText );
|
|
408 |
CleanupStack::PopAndDestroy( informationText );
|
|
409 |
CleanupStack::PopAndDestroy( note );
|
|
410 |
CMUILOGGER_WRITE( "It is already closed" );
|
|
411 |
}
|
|
412 |
}
|
|
413 |
}
|
|
414 |
CMUILOGGER_LEAVEFN( "CConnectionMonitorUiContainer::EndConnectionL " );
|
|
415 |
}
|
|
416 |
|
|
417 |
// ---------------------------------------------------------
|
|
418 |
// CConnectionMonitorUiContainer::EndAllConnectionL
|
|
419 |
// ---------------------------------------------------------
|
|
420 |
//
|
|
421 |
void CConnectionMonitorUiContainer::EndAllConnectionL()
|
|
422 |
{
|
|
423 |
CMUILOGGER_ENTERFN( "EndAllConnectionL - start" );
|
|
424 |
|
|
425 |
const TInt KOnlyOneConnection = 1;
|
|
426 |
const TInt KFirstConnection = 0;
|
|
427 |
CConnectionArray* tempConnArray = iConnectionArray->DeepCopyL();
|
|
428 |
CleanupStack::PushL( tempConnArray );
|
|
429 |
|
|
430 |
TInt connectionCount = tempConnArray->MdcaCount();
|
|
431 |
HBufC* promptTxt = NULL;
|
|
432 |
if ( connectionCount == KOnlyOneConnection )
|
|
433 |
{
|
|
434 |
HBufC* temp = ( *tempConnArray )[KFirstConnection]->GetNameLC();
|
|
435 |
TName iapName = *temp;
|
|
436 |
CleanupStack::PopAndDestroy( temp );
|
|
437 |
promptTxt = StringLoader::LoadLC( R_QTN_CMON_CONF_END_SINGLE_CONN,
|
|
438 |
iapName );
|
|
439 |
}
|
|
440 |
else
|
|
441 |
{
|
|
442 |
promptTxt = StringLoader::LoadLC( R_QTN_CMON_CONF_END_ALL_CONNS,
|
|
443 |
connectionCount );
|
|
444 |
TPtr temp( promptTxt->Des() );
|
|
445 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion( temp );
|
|
446 |
|
|
447 |
}
|
|
448 |
CAknQueryDialog* dlg = CAknQueryDialog::NewL();
|
|
449 |
TInt ret = dlg->ExecuteLD( R_END_CONN_CONFIRMATION_QUERY, *promptTxt );
|
|
450 |
CleanupStack::PopAndDestroy( promptTxt );
|
|
451 |
|
|
452 |
CConnectionInfoBase* connection = NULL;
|
|
453 |
TUint connectionId( 0 );
|
|
454 |
|
|
455 |
CMUILOGGER_WRITE_F( "ret: %d", ret );
|
|
456 |
|
|
457 |
/* End connections one by one, First CSD, after GPRS and WLAN. */
|
|
458 |
if ( ( ret == EAknSoftkeyOk ) || ( ret == EAknSoftkeyYes ) )
|
|
459 |
{
|
|
460 |
for ( TUint i = 0; i < iConnectionArray->MdcaCount(); ++i )
|
|
461 |
{
|
|
462 |
connection = ( *iConnectionArray )[i];
|
|
463 |
connection->SetAllDeletedFromCMUI();
|
|
464 |
connection->RefreshConnectionListBoxItemTextL();
|
|
465 |
}
|
|
466 |
|
|
467 |
DrawFirstAllListBoxItem();
|
|
468 |
|
|
469 |
TConnMonBearerType bearer;
|
|
470 |
for ( TUint i = 0; i < connectionCount; ++i )
|
|
471 |
{
|
|
472 |
CMUILOGGER_WRITE_F( "i: %d", i );
|
|
473 |
|
|
474 |
connection = ( *tempConnArray )[i];
|
|
475 |
|
|
476 |
bearer = connection->GetBearerType();
|
|
477 |
switch ( bearer )
|
|
478 |
{
|
|
479 |
case EBearerCSD:
|
|
480 |
case EBearerExternalCSD:
|
|
481 |
case EBearerWcdmaCSD:
|
|
482 |
case EBearerExternalWcdmaCSD:
|
|
483 |
case EBearerHSCSD:
|
|
484 |
case EBearerExternalHSCSD:
|
|
485 |
{
|
|
486 |
connectionId = connection->GetConnectionId();
|
|
487 |
iMonitor->SetBoolAttribute( connectionId, 0,
|
|
488 |
KConnectionStop, ETrue );
|
|
489 |
CMUILOGGER_WRITE_F( "CSD i: %d", i );
|
|
490 |
CMUILOGGER_WRITE_F( "connectionId: %d", connectionId );
|
|
491 |
break;
|
|
492 |
}
|
|
493 |
default :
|
|
494 |
{
|
|
495 |
break;
|
|
496 |
}
|
|
497 |
}
|
|
498 |
}
|
|
499 |
|
|
500 |
for ( TUint i = 0; i < connectionCount; ++i )
|
|
501 |
{
|
|
502 |
CMUILOGGER_WRITE_F( "i: %d", i );
|
|
503 |
|
|
504 |
connection = ( *tempConnArray )[i];
|
|
505 |
|
|
506 |
bearer = connection->GetBearerType();
|
|
507 |
switch ( bearer )
|
|
508 |
{
|
|
509 |
case EBearerGPRS:
|
|
510 |
case EBearerWCDMA:
|
|
511 |
case EBearerEdgeGPRS:
|
|
512 |
case EBearerExternalGPRS:
|
|
513 |
case EBearerExternalWCDMA:
|
|
514 |
case EBearerExternalEdgeGPRS:
|
|
515 |
case EBearerWLAN:
|
|
516 |
{
|
|
517 |
connectionId = connection->GetConnectionId();
|
|
518 |
iMonitor->SetBoolAttribute( connectionId, 0,
|
|
519 |
KConnectionStop, ETrue );
|
|
520 |
CMUILOGGER_WRITE_F( "GPRS i: %d", i );
|
|
521 |
CMUILOGGER_WRITE_F( "connectionId: %d", connectionId );
|
|
522 |
break;
|
|
523 |
}
|
|
524 |
default :
|
|
525 |
{
|
|
526 |
break;
|
|
527 |
}
|
|
528 |
}
|
|
529 |
}
|
|
530 |
}
|
|
531 |
else
|
|
532 |
{
|
|
533 |
for ( TUint i = 0;
|
|
534 |
( ( i < connectionCount ) &&
|
|
535 |
( KErrNotFound != iActiveWrapper->iStatus.Int() ) ); ++i )
|
|
536 |
{
|
|
537 |
connection = ( *tempConnArray )[i];
|
|
538 |
connectionId = connection->GetConnectionId();
|
|
539 |
TInt connStatus;
|
|
540 |
iActiveWrapper->StartGetIntAttribute( connectionId,
|
|
541 |
iMonitor,
|
|
542 |
KConnectionStatus,
|
|
543 |
( ( TInt& )( connStatus ) ) );
|
|
544 |
}
|
|
545 |
|
|
546 |
if ( KErrNotFound == iActiveWrapper->iStatus.Int() )
|
|
547 |
{
|
|
548 |
/* It is already closed */
|
|
549 |
/* An information note must be displayed */
|
|
550 |
CAknGlobalNote * note = CAknGlobalNote::NewL();
|
|
551 |
CleanupStack::PushL( note );
|
|
552 |
HBufC* informationText =
|
|
553 |
StringLoader::LoadLC( R_QTN_CMON_INFO_CONN_ALREADY_END );
|
|
554 |
|
|
555 |
note->ShowNoteL(EAknGlobalInformationNote, *informationText );
|
|
556 |
CleanupStack::PopAndDestroy( informationText );
|
|
557 |
CleanupStack::PopAndDestroy( note );
|
|
558 |
CMUILOGGER_WRITE( "It is already closed in All" );
|
|
559 |
}
|
|
560 |
}
|
|
561 |
|
|
562 |
CleanupStack::PopAndDestroy( tempConnArray );
|
|
563 |
|
|
564 |
CMUILOGGER_LEAVEFN( "EndAllConnectionL - end" );
|
|
565 |
}
|
|
566 |
|
|
567 |
// ---------------------------------------------------------
|
|
568 |
// CConnectionMonitorUiContainer::ListBox
|
|
569 |
// ---------------------------------------------------------
|
|
570 |
//
|
|
571 |
CAknDoubleGraphicStyleListBox* CConnectionMonitorUiContainer::ListBox() const
|
|
572 |
{
|
|
573 |
return iListBox;
|
|
574 |
}
|
|
575 |
|
|
576 |
// ---------------------------------------------------------
|
|
577 |
// CConnectionMonitorUiContainer::SetIconsL()
|
|
578 |
// ---------------------------------------------------------
|
|
579 |
//
|
|
580 |
void CConnectionMonitorUiContainer::SetIconsL()
|
|
581 |
{
|
|
582 |
CMUILOGGER_ENTERFN( "SetIconsL" );
|
|
583 |
|
|
584 |
TFileName iconsFileName;
|
|
585 |
|
|
586 |
iconsFileName.Append( KDriveZ );
|
|
587 |
|
|
588 |
iconsFileName.Append( KDC_APP_BITMAP_DIR );
|
|
589 |
|
|
590 |
iconsFileName.Append( KConnectionMonitorUiMBMFile );
|
|
591 |
|
|
592 |
CArrayPtr< CGulIcon >* icons = new( ELeave ) CAknIconArray( KGranularity );
|
|
593 |
CleanupStack::PushL( icons );
|
|
594 |
|
|
595 |
MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
|
|
596 |
|
|
597 |
icons->AppendL( AknsUtils::CreateGulIconL( skinInstance,
|
|
598 |
KAknsIIDQgnPropWmlGprs,
|
|
599 |
iconsFileName,
|
|
600 |
EMbmConnectionmonitoruiQgn_prop_wml_gprs,
|
|
601 |
EMbmConnectionmonitoruiQgn_prop_wml_gprs_mask ) );
|
|
602 |
|
|
603 |
icons->AppendL( AknsUtils::CreateGulIconL( skinInstance,
|
|
604 |
KAknsIIDQgnPropWmlCsd,
|
|
605 |
iconsFileName,
|
|
606 |
EMbmConnectionmonitoruiQgn_prop_wml_csd,
|
|
607 |
EMbmConnectionmonitoruiQgn_prop_wml_csd_mask ) );
|
|
608 |
|
|
609 |
icons->AppendL( AknsUtils::CreateGulIconL( skinInstance,
|
|
610 |
KAknsIIDQgnPropWmlHscsd,
|
|
611 |
iconsFileName,
|
|
612 |
EMbmConnectionmonitoruiQgn_prop_wml_hscsd,
|
|
613 |
EMbmConnectionmonitoruiQgn_prop_wml_hscsd_mask ) );
|
|
614 |
|
|
615 |
icons->AppendL( AknsUtils::CreateGulIconL( skinInstance,
|
|
616 |
KAknsIIDQgnPropEmpty,
|
|
617 |
iconsFileName,
|
|
618 |
EMbmConnectionmonitoruiQgn_prop_empty,
|
|
619 |
EMbmConnectionmonitoruiQgn_prop_empty_mask ) );
|
|
620 |
|
|
621 |
icons->AppendL( AknsUtils::CreateGulIconL( skinInstance,
|
|
622 |
KAknsIIDQgnPropWmlSms,
|
|
623 |
iconsFileName,
|
|
624 |
EMbmConnectionmonitoruiQgn_prop_cmon_gprs_suspended,
|
|
625 |
EMbmConnectionmonitoruiQgn_prop_cmon_gprs_suspended_mask ) );
|
|
626 |
|
|
627 |
icons->AppendL( AknsUtils::CreateGulIconL( skinInstance,
|
|
628 |
KAknsIIDQgnPropWlanBearer,
|
|
629 |
iconsFileName,
|
|
630 |
EMbmConnectionmonitoruiQgn_prop_wlan_bearer,
|
|
631 |
EMbmConnectionmonitoruiQgn_prop_wlan_bearer_mask ) );
|
|
632 |
|
|
633 |
iListBox->ItemDrawer()->FormattedCellData()->SetIconArrayL( icons );
|
|
634 |
CleanupStack::Pop( icons ); // icons
|
|
635 |
CMUILOGGER_LEAVEFN( "SetIconsL" );
|
|
636 |
|
|
637 |
}
|
|
638 |
|
|
639 |
// ---------------------------------------------------------------------------
|
|
640 |
// void CConnectionMonitorUiContainer::HandleResourceChange( TInt aType )
|
|
641 |
// Handle resource change events.
|
|
642 |
// ---------------------------------------------------------------------------
|
|
643 |
//
|
|
644 |
void CConnectionMonitorUiContainer::HandleResourceChange( TInt aType )
|
|
645 |
{
|
|
646 |
CMUILOGGER_ENTERFN( "HandleResourceChange" );
|
|
647 |
CMUILOGGER_WRITE_F( "aType: %d", aType );
|
|
648 |
|
|
649 |
CCoeControl::HandleResourceChange( aType );
|
|
650 |
|
|
651 |
if ( aType == KAknsMessageSkinChange )
|
|
652 |
{
|
|
653 |
TInt error( KErrNone );
|
|
654 |
TRAP( error, SetIconsL() );
|
|
655 |
CMUILOGGER_WRITE_F( "KAknsMessageSkinChange error: %d", error );
|
|
656 |
SizeChanged();
|
|
657 |
}
|
|
658 |
|
|
659 |
if ( aType == KEikDynamicLayoutVariantSwitch )
|
|
660 |
{
|
|
661 |
TRect mainPaneRect;
|
|
662 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,
|
|
663 |
mainPaneRect );
|
|
664 |
SetRect( mainPaneRect );
|
|
665 |
DrawNow();
|
|
666 |
}
|
|
667 |
CMUILOGGER_LEAVEFN( "HandleResourceChange" );
|
|
668 |
}
|
|
669 |
|
|
670 |
// ---------------------------------------------------------
|
|
671 |
// CConnectionMonitorUiContainer::GetPanesL
|
|
672 |
// ---------------------------------------------------------
|
|
673 |
//
|
|
674 |
void CConnectionMonitorUiContainer::GetPanesL()
|
|
675 |
{
|
|
676 |
CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane();
|
|
677 |
|
|
678 |
iNaviPane = STATIC_CAST( CAknNavigationControlContainer*,
|
|
679 |
statusPane->ControlL( TUid::Uid(EEikStatusPaneUidNavi ) ) );
|
|
680 |
|
|
681 |
PushAndRefreshNaviPaneL();
|
|
682 |
}
|
|
683 |
|
|
684 |
// ---------------------------------------------------------
|
|
685 |
// CConnectionMonitorUiContainer::PushAndRefreshNaviPaneL
|
|
686 |
// ---------------------------------------------------------
|
|
687 |
//
|
|
688 |
void CConnectionMonitorUiContainer::PushAndRefreshNaviPaneL()
|
|
689 |
{
|
|
690 |
CMUILOGGER_ENTERFN( "PushAndRefreshNaviPaneL - start" );
|
|
691 |
|
|
692 |
HBufC* textOfNaviPane = NULL;
|
|
693 |
TUint countOfConnection = iConnectionArray->NumberOfActiveConnections();
|
|
694 |
CMUILOGGER_WRITE_F( "countOfConnection: %d", countOfConnection );
|
|
695 |
|
|
696 |
if ( iNaviDecorator )
|
|
697 |
{
|
|
698 |
PopNaviPane();
|
|
699 |
}
|
|
700 |
|
|
701 |
if ( countOfConnection )
|
|
702 |
{
|
|
703 |
if ( countOfConnection == 1 )
|
|
704 |
{
|
|
705 |
textOfNaviPane = StringLoader::LoadLC(
|
|
706 |
R_QTN_CMON_NAVI_ONE_ACTIVE_CONN );
|
|
707 |
}
|
|
708 |
else
|
|
709 |
{
|
|
710 |
textOfNaviPane = StringLoader::LoadLC(
|
|
711 |
R_QTN_CMON_NAVI_MANY_ACTIVE_CONNS,
|
|
712 |
countOfConnection );
|
|
713 |
}
|
|
714 |
}
|
|
715 |
else
|
|
716 |
{
|
|
717 |
textOfNaviPane = KEmpty().AllocLC();
|
|
718 |
}
|
|
719 |
|
|
720 |
TPtr temp( textOfNaviPane->Des() );
|
|
721 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion( temp );
|
|
722 |
|
|
723 |
iNaviDecorator = iNaviPane->CreateNavigationLabelL( *textOfNaviPane );
|
|
724 |
CleanupStack::PopAndDestroy( textOfNaviPane );
|
|
725 |
|
|
726 |
iNaviPane->PushL( *iNaviDecorator );
|
|
727 |
CMUILOGGER_LEAVEFN( "PushAndRefreshNaviPaneL - end" );
|
|
728 |
}
|
|
729 |
|
|
730 |
// ---------------------------------------------------------
|
|
731 |
// CConnectionMonitorUiContainer::PopNaviPane
|
|
732 |
// ---------------------------------------------------------
|
|
733 |
//
|
|
734 |
void CConnectionMonitorUiContainer::PopNaviPane()
|
|
735 |
{
|
|
736 |
iNaviPane->Pop( iNaviDecorator );
|
|
737 |
delete iNaviDecorator;
|
|
738 |
iNaviDecorator = NULL;
|
|
739 |
}
|
|
740 |
|
|
741 |
// ---------------------------------------------------------
|
|
742 |
// CConnectionMonitorUiContainer::FocusChanged
|
|
743 |
// ---------------------------------------------------------
|
|
744 |
//
|
|
745 |
void CConnectionMonitorUiContainer::FocusChanged( TDrawNow aDrawNow )
|
|
746 |
{
|
|
747 |
CMUILOGGER_ENTERFN( "CConnectionMonitorUiContainer::FocusChanged" );
|
|
748 |
CCoeControl::FocusChanged( aDrawNow );
|
|
749 |
iFocusChanged = ETrue;
|
|
750 |
if ( iListBox )
|
|
751 |
{
|
|
752 |
iListBox->SetFocus( IsFocused() );
|
|
753 |
}
|
|
754 |
CMUILOGGER_LEAVEFN( "CConnectionMonitorUiContainer::FocusChanged" );
|
|
755 |
}
|
|
756 |
|
|
757 |
// ---------------------------------------------------------
|
|
758 |
// CConnectionMonitorUiContainer::GetHelpContext()
|
|
759 |
// ---------------------------------------------------------
|
|
760 |
//
|
|
761 |
void CConnectionMonitorUiContainer::GetHelpContext( TCoeHelpContext& aContext) const
|
|
762 |
{
|
|
763 |
aContext.iMajor = KUidConnMonUI;
|
|
764 |
aContext.iContext = KCMON_HLP_CMON_MAIN_VIEW;
|
|
765 |
}
|
|
766 |
|
|
767 |
|
|
768 |
// End of File
|