connectionutilities/ConnectionDialogs/ConnectionUiUtilities/src/connectionstatuspopup.cpp
changeset 40 c5b848e6c7d1
parent 32 5c4486441ae6
child 41 bbb64eb3bdee
equal deleted inserted replaced
34:3b0cec605979 40:c5b848e6c7d1
    33 #include "connectionstatuspopupTraces.h"
    33 #include "connectionstatuspopupTraces.h"
    34 #endif
    34 #endif
    35 
    35 
    36 // Error code definitions are from these headers
    36 // Error code definitions are from these headers
    37 #include <wlanerrorcodes.h> // WLAN-specific error code definitions
    37 #include <wlanerrorcodes.h> // WLAN-specific error code definitions
       
    38 #include <gsmerror.h>       // KErrPacketDataTsyMaxPdpContextsReached 
    38 #include <in_iface.h>
    39 #include <in_iface.h>
    39 #include <etelpckt.h>       // GPRS-specific causes for Session Managemeei saant
    40 #include <etelpckt.h>       // GPRS-specific causes for Session Management
    40 #include <nd_err.h>         // NetDial errors
    41 #include <nd_err.h>         // NetDial errors
    41 #include <inet6err.h>       // IPv6 error constants
    42 #include <inet6err.h>       // IPv6 error constants
    42 #include <rmmcustomapi.h>
    43 #include <rmmcustomapi.h>
    43 
    44 
    44 // Errors in UI spec not found elsewhere
    45 // Errors in UI spec not found elsewhere
    45 const TInt KErrPDPMaxContextsReached    = -6000;
       
    46 const TInt KErrDndNameNotFound          = -5120;
    46 const TInt KErrDndNameNotFound          = -5120;
    47 const TInt KErrGeneralConnection        = -50000;
    47 const TInt KErrGeneralConnection        = -50000;
    48 const TInt KErrGenConnNoGPRSNetwork     = -3609;
    48 const TInt KErrGenConnNoGPRSNetwork     = -3609;
    49 
    49 
    50 // Icons representing bearer
    50 // Icons representing bearer
    51 _LIT( KIconCellular, "qtg_small_gprs.svg" );
    51 _LIT( KIconCellular, "qtg_small_gprs" );
    52 _LIT( KIconWlan,     "qtg_small_wlan.svg" );
    52 _LIT( KIconWlan,     "qtg_small_wlan" );
    53 _LIT( KIconVpn,      "qtg_small_vpn.svg" ); 
    53 _LIT( KIconVpn,      "qtg_small_vpn" ); 
    54 _LIT( KIconNone,     "" );
    54 _LIT( KIconNone,     "" );
    55 
    55 
    56 // Empty text
    56 // Empty text
    57 _LIT( KTextNone,     "" );
    57 _LIT( KTextNone,     "" );
    58 
    58 
    94         "txt_occ_dpopinfo_please_try_again");
    94         "txt_occ_dpopinfo_please_try_again");
    95 _LIT(Ktxt_occ_dpopinfo_connection_unavailable,
    95 _LIT(Ktxt_occ_dpopinfo_connection_unavailable,
    96         "txt_occ_dpopinfo_connection_unavailable");
    96         "txt_occ_dpopinfo_connection_unavailable");
    97 _LIT(Ktxt_occ_dpophead_configuration_failed,
    97 _LIT(Ktxt_occ_dpophead_configuration_failed,
    98         "txt_occ_dpophead_configuration_failed");
    98         "txt_occ_dpophead_configuration_failed");
       
    99 _LIT(Ktxt_occ_dpophead_maximum_connections_in_use,
       
   100         "txt_occ_dpophead_maximum_connections_in_use");
       
   101 _LIT(Ktxt_occ_dpopinfo_select_to_manage,
       
   102         "txt_occ_dpopinfo_select_to_manage");
    99 
   103 
   100 
   104 
   101 //-----------------------------------------------------------------------------
   105 //-----------------------------------------------------------------------------
   102 //  CConnectionStatusPopup::CConnectionStatusPopup()
   106 //  CConnectionStatusPopup::CConnectionStatusPopup()
   103 //-----------------------------------------------------------------------------
   107 //-----------------------------------------------------------------------------
   104 //
   108 //
   105 CConnectionStatusPopup::CConnectionStatusPopup()
   109 CConnectionStatusPopup::CConnectionStatusPopup()
   106 :iPopup( NULL ), iPopupState( EPopupClosed )
   110 :iPopup( NULL ), iPopupState( EPopupClosed ), iTouchAction( EDoNothing )
   107     {
   111     {
   108     }
   112     }
   109 
   113 
   110 //-----------------------------------------------------------------------------
   114 //-----------------------------------------------------------------------------
   111 //  CConnectionStatusPopup::NewL()
   115 //  CConnectionStatusPopup::NewL()
   174         iPopup->SetTitleL( title->Des() );
   178         iPopup->SetTitleL( title->Des() );
   175         CleanupStack::PopAndDestroy( title );
   179         CleanupStack::PopAndDestroy( title );
   176         iPopup->SetTextL( KTextNone );
   180         iPopup->SetTextL( KTextNone );
   177         iPopup->SetIconNameL( KIconNone );
   181         iPopup->SetIconNameL( KIconNone );
   178         );
   182         );
       
   183     iTouchAction = EDoNothing;
       
   184     iPopup->SetTimeout( KForeverTimeout );
   179 
   185 
   180     SetState( EPopupConnecting );
   186     SetState( EPopupConnecting );
   181  
   187  
   182     OstTraceFunctionExit0( CCONNECTIONSTATUSPOPUP_CONNECTINGVIADISCREETPOPUP_EXIT );
   188     OstTraceFunctionExit0( CCONNECTIONSTATUSPOPUP_CONNECTINGVIADISCREETPOPUP_EXIT );
   183     }
   189     }
   203         // If sharing a connection, do not show the popup.
   209         // If sharing a connection, do not show the popup.
   204         SetState( EPopupClosed );
   210         SetState( EPopupClosed );
   205         }
   211         }
   206     else
   212     else
   207         {
   213         {
       
   214         iPopup->SetTimeout( KForeverTimeout );
   208         SetState( EPopupConnectingIap );
   215         SetState( EPopupConnectingIap );
   209         }
   216         }
   210     
   217     
   211     OstTraceFunctionExit0( DUP1_CCONNECTIONSTATUSPOPUP_CONNECTINGVIADISCREETPOPUP_EXIT );
   218     OstTraceFunctionExit0( DUP1_CCONNECTIONSTATUSPOPUP_CONNECTINGVIADISCREETPOPUP_EXIT );
   212     }
   219     }
   237     
   244     
   238     OstTraceExt2( TRACE_FLOW, CCONNECTIONSTATUSPOPUP_CONNECTIONERRORDISCREETPOPUP, "CConnectionStatusPopup::ConnectionErrorDiscreetPopup;aErrorCode=%d;showPopup=%u", aErrorCode, showPopup );
   245     OstTraceExt2( TRACE_FLOW, CCONNECTIONSTATUSPOPUP_CONNECTIONERRORDISCREETPOPUP, "CConnectionStatusPopup::ConnectionErrorDiscreetPopup;aErrorCode=%d;showPopup=%u", aErrorCode, showPopup );
   239     
   246     
   240     if (showPopup)
   247     if (showPopup)
   241         {
   248         {
       
   249         iPopup->SetTimeout( KHbLongNotificationDialogTimeout ); 
   242         SetState( EPopupError );
   250         SetState( EPopupError );
   243         }
   251         }
   244 
   252 
   245     OstTraceFunctionExit0( CCONNECTIONSTATUSPOPUP_CONNECTIONERRORDISCREETPOPUP_EXIT );
   253     OstTraceFunctionExit0( CCONNECTIONSTATUSPOPUP_CONNECTIONERRORDISCREETPOPUP_EXIT );
   246     }
   254     }
   250 //-----------------------------------------------------------------------------
   258 //-----------------------------------------------------------------------------
   251 //
   259 //
   252 void CConnectionStatusPopup::SetState( TPopupState aNewState )
   260 void CConnectionStatusPopup::SetState( TPopupState aNewState )
   253     {
   261     {
   254     OstTraceExt2( TRACE_FLOW, CCONNECTIONSTATUSPOPUP_SETSTATE, "CConnectionStatusPopup::SetState;iPopupState=%u;aNewState=%u", iPopupState, aNewState );
   262     OstTraceExt2( TRACE_FLOW, CCONNECTIONSTATUSPOPUP_SETSTATE, "CConnectionStatusPopup::SetState;iPopupState=%u;aNewState=%u", iPopupState, aNewState );
   255     
   263 
   256     switch (aNewState)
       
   257         {
       
   258         
       
   259         case EPopupClosed:
       
   260             // Close popup if it's not already closing or closed
       
   261             if (iPopupState != EPopupClosed && iPopupState != EPopupError)
       
   262                 {
       
   263                 iPopup->Close();
       
   264                 }
       
   265             break;
       
   266             
       
   267         case EPopupConnecting:
       
   268             iPopup->EnableTouchActivation( EFalse );
       
   269             iPopup->SetTimeout( KForeverTimeout );
       
   270             break;
       
   271             
       
   272         case EPopupConnectingIap:
       
   273             iPopup->EnableTouchActivation( ETrue );
       
   274             iPopup->SetTimeout( KForeverTimeout );
       
   275             break;
       
   276             
       
   277         default: // EPopupError
       
   278             __ASSERT_DEBUG( aNewState == EPopupError, User::Invariant() );
       
   279             iPopup->EnableTouchActivation( EFalse );
       
   280             iPopup->SetTimeout( KHbLongNotificationDialogTimeout ); 
       
   281             break;
       
   282         }
       
   283     
       
   284     if (aNewState != EPopupClosed)
   264     if (aNewState != EPopupClosed)
   285         {
   265         {
       
   266         // Enable touch activation based on defined action
       
   267         iPopup->EnableTouchActivation( iTouchAction != EDoNothing );
       
   268 
   286         // Show or update popup
   269         // Show or update popup
   287         if (iPopupState == EPopupClosed)
   270         if (iPopupState == EPopupClosed)
   288             {
   271             {
   289             TRAP_IGNORE( iPopup->ShowL() );
   272             TRAP_IGNORE( iPopup->ShowL() );
   290             }
   273             }
   291         else
   274         else
   292             {
   275             {
   293             TRAP_IGNORE( iPopup->UpdateL() );
   276             TRAP_IGNORE( iPopup->UpdateL() );
       
   277             }
       
   278         }
       
   279     else
       
   280         {
       
   281         // Close popup if it's not already closed or closing 
       
   282         if (iPopupState != EPopupClosed && iPopupState != EPopupError)
       
   283             {
       
   284             iPopup->Close();
   294             }
   285             }
   295         }
   286         }
   296     
   287     
   297     iPopupState = aNewState;
   288     iPopupState = aNewState;
   298     }
   289     }
   336         {
   327         {
   337         iPopup->SetTextL( KTextNone );
   328         iPopup->SetTextL( KTextNone );
   338         }
   329         }
   339     CleanupStack::PopAndDestroy( connectionName ); 
   330     CleanupStack::PopAndDestroy( connectionName ); 
   340 
   331 
   341     // Icon
   332     // Icon and action
   342     switch (bearerType)
   333     switch (bearerType)
   343         {
   334         {
   344         case KUidWlanBearerType:
   335         case KUidWlanBearerType:
       
   336             iTouchAction = EOpenWlanView;
   345             iPopup->SetIconNameL( KIconWlan );
   337             iPopup->SetIconNameL( KIconWlan );
   346             break;
   338             break;
   347         case KPluginVPNBearerTypeUid:
   339         case KPluginVPNBearerTypeUid:
       
   340             iTouchAction = EDoNothing;
   348             iPopup->SetIconNameL( KIconVpn );
   341             iPopup->SetIconNameL( KIconVpn );
   349             break;
   342             break;
   350         default:
   343         default:
       
   344             iTouchAction = EOpenCellularView;
   351             iPopup->SetIconNameL( KIconCellular );
   345             iPopup->SetIconNameL( KIconCellular );
   352         }
   346         }
   353     
   347     
   354     OstTraceFunctionExit0( CCONNECTIONSTATUSPOPUP_FORMATIAPINFOL_EXIT );
   348     OstTraceFunctionExit0( CCONNECTIONSTATUSPOPUP_FORMATIAPINFOL_EXIT );
   355     }
   349     }
   363     OstTraceFunctionEntry0( CCONNECTIONSTATUSPOPUP_RESOLVEERRORCODEL_ENTRY );
   357     OstTraceFunctionEntry0( CCONNECTIONSTATUSPOPUP_RESOLVEERRORCODEL_ENTRY );
   364     
   358     
   365     // Icons, which are resolved at the end
   359     // Icons, which are resolved at the end
   366     enum TIconType
   360     enum TIconType
   367         {
   361         {
   368         EIconWlan, EIconCellular, EIconNone
   362         // WLAN icon
       
   363         EIconWlan, 
       
   364         // Cellular icon
       
   365         EIconCellular, 
       
   366         // No icon to be used
       
   367         EIconNoneSet, 
       
   368         // Icon from connecting popup to be used
       
   369         EIconUsePreviouslyDefined
   369         };
   370         };
       
   371 
       
   372     // Most errors have following values
   370     TIconType icon = EIconWlan;
   373     TIconType icon = EIconWlan;
   371 
   374     iTouchAction = EDoNothing;
   372     TPtrC titlePtr;
   375     TPtrC titlePtr;
   373     titlePtr.Set( Ktxt_occ_dpophead_connection_failed );
   376     titlePtr.Set( Ktxt_occ_dpophead_connection_failed );
       
   377     
   374     TPtrC textPtr;
   378     TPtrC textPtr;
   375 
   379 
   376     // Resolve title, text and icon of error code.
   380     // Resolve title, text and icon of error code.
   377     // Groups are from OCC UI spec 1.0
   381     // Groups are from OCC UI spec 1.0
   378     switch (aErrorCode)
   382     switch (aErrorCode)
   476         case KErrWlanUserCertificateExpired:
   480         case KErrWlanUserCertificateExpired:
   477             textPtr.Set( Ktxt_occ_dpopinfo_permission_denied );
   481             textPtr.Set( Ktxt_occ_dpopinfo_permission_denied );
   478             break;
   482             break;
   479 
   483 
   480         // Group 9
   484         // Group 9
   481         case KErrPDPMaxContextsReached:
       
   482             icon = EIconCellular;
       
   483             // These were GPRS; fall through
       
   484         case KErrWlanConnAlreadyActive:
   485         case KErrWlanConnAlreadyActive:
   485             textPtr.Set( Ktxt_occ_dpopinfo_connection_already_active );
   486             textPtr.Set( Ktxt_occ_dpopinfo_connection_already_active );
   486             break;
   487             break;
   487 
   488 
   488         // Group 10
   489         // Group 10
   501         case KErrInet6NoRoute:
   502         case KErrInet6NoRoute:
   502         case KErrDndNameNotFound:
   503         case KErrDndNameNotFound:
   503         case KErrGeneralConnection:
   504         case KErrGeneralConnection:
   504         case KErrGprsMSCTemporarilyNotReachable:
   505         case KErrGprsMSCTemporarilyNotReachable:
   505         case KErrGprsLlcOrSndcpFailure:
   506         case KErrGprsLlcOrSndcpFailure:
   506         case KErrGprsInsufficientResources:
       
   507         case KErrGprsActivationRejectedByGGSN:
   507         case KErrGprsActivationRejectedByGGSN:
   508         case KErrPacketDataTsyInvalidAPN:
   508         case KErrPacketDataTsyInvalidAPN:
   509             icon = EIconCellular;
   509             icon = EIconCellular;
   510             // These were GPRS; fall through
   510             // These were GPRS; fall through
   511         case KErrWlanRoamingFailed:
   511         case KErrWlanRoamingFailed:
   525         case KErrGsmMMServiceOptionTemporaryOutOfOrder:
   525         case KErrGsmMMServiceOptionTemporaryOutOfOrder:
   526         case KErrGprsNSAPIAlreadyUsed:
   526         case KErrGprsNSAPIAlreadyUsed:
   527         case KErrGprsQoSNotAccepted:
   527         case KErrGprsQoSNotAccepted:
   528         case KErrGprsReactivationRequested:
   528         case KErrGprsReactivationRequested:
   529         case KErrGprsOfflineMode:
   529         case KErrGprsOfflineMode:
   530             icon = EIconCellular;           
   530             icon = EIconCellular;
   531         case KErrWlanOff:
   531         case KErrWlanOff:
   532         case KErrWlanForceOff:
   532         case KErrWlanForceOff:
   533             textPtr.Set( Ktxt_occ_dpopinfo_connection_unavailable );
   533             textPtr.Set( Ktxt_occ_dpopinfo_connection_unavailable );
   534             break;
   534             break;
   535 
   535 
   558         case KErrWlanProtectedSetupMessageTimeout:
   558         case KErrWlanProtectedSetupMessageTimeout:
   559         case KErrWlanProtectedSetupRegistrationSessionTimeout:
   559         case KErrWlanProtectedSetupRegistrationSessionTimeout:
   560             titlePtr.Set( Ktxt_occ_dpophead_configuration_failed );
   560             titlePtr.Set( Ktxt_occ_dpophead_configuration_failed );
   561             textPtr.Set( Ktxt_occ_dpopinfo_please_try_again );
   561             textPtr.Set( Ktxt_occ_dpopinfo_please_try_again );
   562             break;
   562             break;
   563 
   563             
       
   564         // Group 15, errors related to maximum number of PDP contexts
       
   565         case KErrGprsInsufficientResources:
       
   566         case KErrUmtsMaxNumOfContextExceededByNetwork: 
       
   567         case KErrUmtsMaxNumOfContextExceededByPhone:
       
   568         case KErrPacketDataTsyMaxPdpContextsReached:
       
   569             // Open cellular view for these errors
       
   570             iTouchAction = EOpenCellularView;
       
   571             // The icon is left out from these popups in order to make room 
       
   572             // for the text which needs to be as descriptive as possible
       
   573             icon = EIconNoneSet;
       
   574             titlePtr.Set( Ktxt_occ_dpophead_maximum_connections_in_use );
       
   575             textPtr.Set( Ktxt_occ_dpopinfo_select_to_manage );
       
   576             break;
       
   577             
   564         // For error values not specifically mapped to any error message
   578         // For error values not specifically mapped to any error message
   565         // the discreet pop-up #12 is used.
   579         // the discreet pop-up #12 is used.
   566         default:
   580         default:
   567             icon = EIconNone;
   581             icon = EIconUsePreviouslyDefined;
   568             textPtr.Set( Ktxt_occ_dpopinfo_connection_unavailable );
   582             textPtr.Set( Ktxt_occ_dpopinfo_connection_unavailable );
   569             break;
   583             break;
   570         }
   584         }
   571 
   585 
   572     // Load and set title, text and icon
   586     // Load and set title, text and icon
   582             iPopup->SetIconNameL( KIconWlan );
   596             iPopup->SetIconNameL( KIconWlan );
   583             break;
   597             break;
   584         case EIconCellular:
   598         case EIconCellular:
   585             iPopup->SetIconNameL( KIconCellular );
   599             iPopup->SetIconNameL( KIconCellular );
   586             break;
   600             break;
       
   601         case EIconNoneSet:
       
   602             iPopup->SetIconNameL( KIconNone );
       
   603             break;
   587         default:
   604         default:
   588             __ASSERT_DEBUG( icon == EIconNone, User::Invariant());
   605             __ASSERT_DEBUG( icon == EIconUsePreviouslyDefined, User::Invariant());
   589             // Leave icon as-is, either set by ConnectingViaDiscreetPopup
   606             // Leave icon as-is, either set by ConnectingViaDiscreetPopup
   590             // or undefined.
   607             // or undefined.
   591             break;
   608             break;
   592         }
   609         }
   593     
   610     
   603 void CConnectionStatusPopup::NotificationDialogActivated(
   620 void CConnectionStatusPopup::NotificationDialogActivated(
   604         const CHbDeviceNotificationDialogSymbian* /*aDialog*/ )
   621         const CHbDeviceNotificationDialogSymbian* /*aDialog*/ )
   605     {
   622     {
   606     OstTraceFunctionEntry0( CCONNECTIONSTATUSPOPUP_NOTIFICATIONDIALOGACTIVATED_ENTRY );
   623     OstTraceFunctionEntry0( CCONNECTIONSTATUSPOPUP_NOTIFICATIONDIALOGACTIVATED_ENTRY );
   607     
   624     
   608     // Launch wlan view or connection view depending of bearer
   625     // Launch wlan view or connection view depending on bearer
   609     TPtrC procName; 
   626     TPtrC procName; 
   610     if (iPopup->IconName().Compare( KIconWlan ) == 0)
   627     if ( iTouchAction == EOpenWlanView )
   611         {
   628         {
   612         procName.Set( KWlanViewExeFile );
   629         procName.Set( KWlanViewExeFile );
   613         }
   630         }
   614     else if (iPopup->IconName().Compare( KIconCellular ) == 0)
   631     else if ( iTouchAction == EOpenCellularView )
   615         {
   632         {
   616         procName.Set( KConnViewExeFile );
   633         procName.Set( KConnViewExeFile );
   617         }
   634         }
   618     else
   635     else
   619         {
   636         {