20 // INCLUDE FILES |
20 // INCLUDE FILES |
21 #include <StringLoader.h> |
21 #include <StringLoader.h> |
22 #include <aknnotedialog.h> |
22 #include <aknnotedialog.h> |
23 #include <AknUtils.h> |
23 #include <AknUtils.h> |
24 #include <cmmanagerext.h> |
24 #include <cmmanagerext.h> |
|
25 #include <NIFVAR.H> |
25 #include <ConnectionMonitorUi.rsg> |
26 #include <ConnectionMonitorUi.rsg> |
26 #include "ConnectionMonitorUi.hrh" |
27 #include "ConnectionMonitorUi.hrh" |
27 #include "ConnectionMonitorUiAppUi.h" |
28 #include "ConnectionMonitorUiAppUi.h" |
28 #include "ConnectionMonitorUiView.h" |
29 #include "ConnectionMonitorUiView.h" |
29 #include "ConnectionMonitorUiDetailsView.h" |
30 #include "ConnectionMonitorUiDetailsView.h" |
315 if ( index >= 0 ) |
316 if ( index >= 0 ) |
316 { |
317 { |
317 connectionInfo = ( *iConnectionArray )[index]; |
318 connectionInfo = ( *iConnectionArray )[index]; |
318 |
319 |
319 if ( iView->Id() == KDetailsViewId ) |
320 if ( iView->Id() == KDetailsViewId ) |
320 { |
321 { |
321 CConnectionMonitorUiDetailsView* view = (CConnectionMonitorUiDetailsView*) iView; |
322 // Mark the connection as closed and refresh details view. |
322 if ( view->GetSelectedConnection() == ((TUint) index) ) |
323 // It will change the status there. |
323 { |
324 connectionInfo->RefreshConnectionStatus( KConnectionClosed ); |
324 view->CloseViewL(); |
325 connectionInfo->RefreshDetailsArrayL(); |
325 activateMainView = ETrue; |
|
326 } |
|
327 } |
326 } |
328 else // MainView |
327 else // MainView |
329 { |
328 { |
330 TBool deleting = connectionInfo->GetDeletedFromCMUI(); |
329 TBool deleting = connectionInfo->GetDeletedFromCMUI(); |
331 if ( deleting ) |
330 if ( deleting ) |
332 { |
331 { |
333 ShowConnectionSummaryInformationNoteL( connectionInfo ); |
332 ShowConnectionSummaryInformationNoteL( connectionInfo ); |
334 } |
333 } |
335 } |
334 // Mark the connection as closed. When the timer ticks the next |
336 iConnectionArray->Delete( connectionId ); |
335 // time the marked connection is deleted and removed from the main view. |
|
336 connectionInfo->RefreshConnectionStatus( KConnectionClosed ); |
|
337 } |
337 CMUILOGGER_WRITE_F( "Deleted: %d", connectionId ); |
338 CMUILOGGER_WRITE_F( "Deleted: %d", connectionId ); |
338 } |
339 } |
339 break; |
340 break; |
340 } |
341 } |
341 case EConnMonConnectionStatusChange: |
342 case EConnMonConnectionStatusChange: |
599 // CConnectionMonitorUiAppUi::OnTimerExpiredL |
600 // CConnectionMonitorUiAppUi::OnTimerExpiredL |
600 // --------------------------------------------------------- |
601 // --------------------------------------------------------- |
601 // |
602 // |
602 void CConnectionMonitorUiAppUi::OnTimerExpiredL() |
603 void CConnectionMonitorUiAppUi::OnTimerExpiredL() |
603 { |
604 { |
|
605 CMUILOGGER_WRITE_F( "MdcaCount: %d", iConnectionArray->MdcaCount()); |
|
606 // First check if there are connections that need to be deleted. |
|
607 // The conditions for deletion are: |
|
608 // 1. Connection status must be closed |
|
609 // 2. Main view must be active (details view should be shown also for closed connections) |
|
610 // 3. There must not be active request ongoing (otherwise deletion might cause crash) |
|
611 for(TUint i = 0; i < iConnectionArray->MdcaCount(); i++) |
|
612 { |
|
613 CMUILOGGER_WRITE_F( "i: %d", i ); |
|
614 CMUILOGGER_WRITE_F( "Status: %d", (*iConnectionArray)[i]->GetStatus() ); |
|
615 CMUILOGGER_WRITE_F( "active: %d", iActiveWrapper->IsActive() ); |
|
616 if( (*iConnectionArray)[i]->GetStatus() == EConnectionClosed |
|
617 && !iActiveWrapper->IsActive() |
|
618 && iView->Id() != KDetailsViewId) |
|
619 { |
|
620 CMUILOGGER_WRITE_F( "Delete conn id: %d", (*iConnectionArray)[i]->GetConnectionId() ); |
|
621 iConnectionArray->Delete( (*iConnectionArray)[i]->GetConnectionId() ); |
|
622 i--; |
|
623 } |
|
624 } |
|
625 |
|
626 |
604 TInt count = iNewConnectionIdArray.Count(); |
627 TInt count = iNewConnectionIdArray.Count(); |
605 if ( count > 0 ) |
628 if ( count > 0 ) |
606 { |
629 { |
607 for ( TInt i = 0; i < count; i++ ) |
630 for ( TInt i = 0; i < count; i++ ) |
608 { |
631 { |