connectionutilities/ConnectionDialogs/ConnectionUiUtilities/src/connectionstatuspopup.cpp
changeset 20 9c97ad6591ae
child 27 489cf6208544
equal deleted inserted replaced
18:fcbbe021d614 20:9c97ad6591ae
       
     1 /*
       
     2 * Copyright (c) 2009 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: 
       
    15 *      Implementation of class CConnectionStatusPopup.   
       
    16 *      
       
    17 *
       
    18 */
       
    19 
       
    20 #include "connectionstatuspopup.h"
       
    21 
       
    22 #include <cmmanager.h>
       
    23 #include <cmmanagerext.h>
       
    24 #include <cmconnectionmethod.h>
       
    25 #include <cmconnectionmethodext.h>
       
    26 #include <cmpluginwlandef.h>
       
    27 #include <cmpluginvpndef.h>
       
    28 
       
    29 #include <hbtextresolversymbian.h>
       
    30 
       
    31 #include "OstTraceDefinitions.h"
       
    32 #ifdef OST_TRACE_COMPILER_IN_USE
       
    33 #include "connectionstatuspopupTraces.h"
       
    34 #endif
       
    35 
       
    36 // Error code definitions are from these headers
       
    37 #include <wlanerrorcodes.h> // WLAN-specific error code definitions
       
    38 #include <in_iface.h>
       
    39 #include <etelpckt.h>       // GPRS-specific causes for Session Managemeei saant
       
    40 #include <nd_err.h>         // NetDial errors
       
    41 #include <inet6err.h>       // IPv6 error constants
       
    42 #include <rmmcustomapi.h>
       
    43 
       
    44 // Errors in UI spec not found elsewhere
       
    45 const TInt KErrPDPMaxContextsReached    = -6000;
       
    46 const TInt KErrDndNameNotFound          = -5120;
       
    47 const TInt KErrGeneralConnection        = -50000;
       
    48 const TInt KErrGenConnNoGPRSNetwork     = -3609;
       
    49 
       
    50 // Icons representing bearer
       
    51 _LIT( KIconCellular, "pri_small_wlan.svg" );
       
    52 _LIT( KIconWlan,     "pri_small_gprs.svg" );
       
    53 _LIT( KIconVpn,      "pri_small_vpn.svg" ); 
       
    54 _LIT( KIconNone,     "" );
       
    55 
       
    56 // Empty text
       
    57 _LIT( KTextNone,     "" );
       
    58 
       
    59 // Programs to fire at tap
       
    60 _LIT( KWlanViewExeFile, "wlansniffer.exe" );
       
    61 _LIT( KConnViewExeFile, "connview.exe" );
       
    62 // Command line
       
    63 _LIT( KExeFileCmd, "" );
       
    64 
       
    65 // Localization files and texts
       
    66 _LIT(KTrFile, "connectionstatuspopups_");
       
    67 _LIT(KTrFilePath, "z:\\resource\\qt\\translations");
       
    68 
       
    69 _LIT(Ktxt_occ_dpophead_connecting,
       
    70         "txt_occ_dpophead_connecting");
       
    71 _LIT(Ktxt_occ_dpophead_connection_failed,
       
    72         "txt_occ_dpophead_connection_failed");
       
    73 _LIT(Ktxt_occ_dpopinfo_internal_error,
       
    74         "txt_occ_dpopinfo_internal_error");
       
    75 _LIT(Ktxt_occ_dpopinfo_wlan_network_not_found,
       
    76         "txt_occ_dpopinfo_wlan_network_not_found");
       
    77 _LIT(Ktxt_occ_dpopinfo_authentication_unsuccessful,
       
    78         "txt_occ_dpopinfo_authentication_unsuccessful");
       
    79 _LIT(Ktxt_occ_dpopinfo_check_security_key,
       
    80         "txt_occ_dpopinfo_check_security_key");
       
    81 _LIT(Ktxt_occ_dpopinfo_check_connection_settings,
       
    82         "txt_occ_dpopinfo_check_connection_settings");
       
    83 _LIT(Ktxt_occ_dpopinfo_sim_card_missing,
       
    84         "txt_occ_dpopinfo_sim_card_missing");
       
    85 _LIT(Ktxt_occ_dpopinfo_service_unreachable,
       
    86         "txt_occ_dpopinfo_service_unreachable");
       
    87 _LIT(Ktxt_occ_dpopinfo_permission_denied,
       
    88         "txt_occ_dpopinfo_permission_denied");
       
    89 _LIT(Ktxt_occ_dpopinfo_connection_already_active,
       
    90         "txt_occ_dpopinfo_connection_already_active");
       
    91 _LIT(Ktxt_occ_dpopinfo_signal_too_weak,
       
    92         "txt_occ_dpopinfo_signal_too_weak");
       
    93 _LIT(Ktxt_occ_dpopinfo_please_try_again,
       
    94         "txt_occ_dpopinfo_please_try_again");
       
    95 _LIT(Ktxt_occ_dpopinfo_connection_unavailable,
       
    96         "txt_occ_dpopinfo_connection_unavailable");
       
    97 _LIT(Ktxt_occ_dpophead_configuration_failed,
       
    98         "txt_occ_dpophead_configuration_failed");
       
    99 
       
   100 
       
   101 //-----------------------------------------------------------------------------
       
   102 //  CConnectionStatusPopup::CConnectionStatusPopup()
       
   103 //-----------------------------------------------------------------------------
       
   104 //
       
   105 CConnectionStatusPopup::CConnectionStatusPopup()
       
   106 :iPopup( NULL ), iPopupState( EPopupClosed )
       
   107     {
       
   108     }
       
   109 
       
   110 //-----------------------------------------------------------------------------
       
   111 //  CConnectionStatusPopup::NewL()
       
   112 //-----------------------------------------------------------------------------
       
   113 //
       
   114 CConnectionStatusPopup* CConnectionStatusPopup::NewL()
       
   115     {
       
   116     OstTraceFunctionEntry0( CCONNECTIONSTATUSPOPUP_NEWL_ENTRY );
       
   117     
       
   118     CConnectionStatusPopup* popup = new ( ELeave ) CConnectionStatusPopup();
       
   119     CleanupStack::PushL( popup );
       
   120     popup->ConstructL();
       
   121     CleanupStack::Pop( popup ); 
       
   122     
       
   123     OstTraceFunctionExit0( CCONNECTIONSTATUSPOPUP_NEWL_EXIT );
       
   124     return popup;
       
   125     }
       
   126 
       
   127 //-----------------------------------------------------------------------------
       
   128 //  CConnectionStatusPopup::ConstructL()
       
   129 //-----------------------------------------------------------------------------
       
   130 //
       
   131 void CConnectionStatusPopup::ConstructL()
       
   132     {
       
   133     OstTraceFunctionEntry0( CCONNECTIONSTATUSPOPUP_CONSTRUCTL_ENTRY );
       
   134     
       
   135     iPopup = CHbDeviceNotificationDialogSymbian::NewL( this );
       
   136 
       
   137     TBool result = HbTextResolverSymbian::Init( KTrFile, KTrFilePath );
       
   138     if (!result)
       
   139         {
       
   140         OstTrace0( TRACE_FLOW, CCONNECTIONSTATUSPOPUP_CONSTRUCTL,"CConnectionStatusPopup::ConstructL; Loading of localization failed!" );
       
   141         }
       
   142     
       
   143     OstTraceFunctionExit0( CCONNECTIONSTATUSPOPUP_CONSTRUCTL_EXIT );
       
   144     }
       
   145 
       
   146 //-----------------------------------------------------------------------------
       
   147 //  CConnectionStatusPopup::~CConnectionStatusPopup()
       
   148 //-----------------------------------------------------------------------------
       
   149 //
       
   150 CConnectionStatusPopup::~CConnectionStatusPopup()
       
   151     {
       
   152     OstTraceFunctionEntry0( CCONNECTIONSTATUSPOPUP_CCONNECTIONSTATUSPOPUP_ENTRY );
       
   153     
       
   154     if (iPopup)
       
   155         {
       
   156         iPopup->Close();
       
   157         delete iPopup;
       
   158         }
       
   159     
       
   160     OstTraceFunctionExit0( CCONNECTIONSTATUSPOPUP_CCONNECTIONSTATUSPOPUP_EXIT );
       
   161     }
       
   162 
       
   163 //-----------------------------------------------------------------------------
       
   164 //  CConnectionStatusPopup::ConnectingDiscreetPopup()
       
   165 //-----------------------------------------------------------------------------
       
   166 //
       
   167 void CConnectionStatusPopup::ConnectingViaDiscreetPopup( )
       
   168     {
       
   169     OstTraceFunctionEntry0( CCONNECTIONSTATUSPOPUP_CONNECTINGVIADISCREETPOPUP_ENTRY );
       
   170 
       
   171     TRAP_IGNORE( 
       
   172         HBufC* title = HbTextResolverSymbian::LoadLC(
       
   173                 Ktxt_occ_dpophead_connecting );
       
   174         iPopup->SetTitleL( title->Des() );
       
   175         CleanupStack::PopAndDestroy( title );
       
   176         iPopup->SetTextL( KTextNone );
       
   177         iPopup->SetIconNameL( KIconNone );
       
   178         );
       
   179 
       
   180     SetState( EPopupConnecting );
       
   181  
       
   182     OstTraceFunctionExit0( CCONNECTIONSTATUSPOPUP_CONNECTINGVIADISCREETPOPUP_EXIT );
       
   183     }
       
   184 
       
   185 
       
   186 //-----------------------------------------------------------------------------
       
   187 //  CConnectionStatusPopup::ConnectingViaDiscreetPopup()
       
   188 //-----------------------------------------------------------------------------
       
   189 //
       
   190 void CConnectionStatusPopup::ConnectingViaDiscreetPopup(
       
   191         TUint32 aIapId,
       
   192         TBool aConnectionAlreadyActive )
       
   193     {
       
   194     OstTraceFunctionEntry0( DUP1_CCONNECTIONSTATUSPOPUP_CONNECTINGVIADISCREETPOPUP_ENTRY );
       
   195     OstTraceExt2( TRACE_FLOW, CCONNECTIONSTATUSPOPUP_CONNECTINGVIADISCREETPOPUP, "CConnectionStatusPopup::ConnectingViaDiscreetPopup;aIapId=%u;aConnectionAlreadyActive=%u", aIapId, aConnectionAlreadyActive );
       
   196 
       
   197     // Grab iap info even if we do not need it yet (when sharing),
       
   198     // because icon may be used later if general error happens.
       
   199     TRAP_IGNORE( FormatIapInfoL( aIapId ); );
       
   200 
       
   201     if (aConnectionAlreadyActive)
       
   202         {
       
   203         // If sharing a connection, do not show the popup.
       
   204         SetState( EPopupClosed );
       
   205         }
       
   206     else
       
   207         {
       
   208         SetState( EPopupConnectingIap );
       
   209         }
       
   210     
       
   211     OstTraceFunctionExit0( DUP1_CCONNECTIONSTATUSPOPUP_CONNECTINGVIADISCREETPOPUP_EXIT );
       
   212     }
       
   213 
       
   214 //-----------------------------------------------------------------------------
       
   215 //  CConnectionStatusPopup::CancelConnectingViaDiscreetPopup()
       
   216 //-----------------------------------------------------------------------------
       
   217 //
       
   218 void CConnectionStatusPopup::CancelConnectingViaDiscreetPopup()
       
   219     {
       
   220     OstTraceFunctionEntry0( CCONNECTIONSTATUSPOPUP_CANCELCONNECTINGVIADISCREETPOPUP_ENTRY );
       
   221     
       
   222     SetState( EPopupClosed );
       
   223 
       
   224     OstTraceFunctionExit0( CCONNECTIONSTATUSPOPUP_CANCELCONNECTINGVIADISCREETPOPUP_EXIT );
       
   225     }
       
   226 
       
   227 //-----------------------------------------------------------------------------
       
   228 //  CConnectionStatusPopup::ConnectionErrorDiscreetPopup()
       
   229 //-----------------------------------------------------------------------------
       
   230 //
       
   231 void CConnectionStatusPopup::ConnectionErrorDiscreetPopup( TInt aErrorCode )
       
   232     {
       
   233     OstTraceFunctionEntry0( CCONNECTIONSTATUSPOPUP_CONNECTIONERRORDISCREETPOPUP_ENTRY );
       
   234     
       
   235     TBool showPopup( EFalse );
       
   236     TRAP_IGNORE( showPopup = ResolveErrorCodeL( aErrorCode ); );
       
   237     
       
   238     OstTraceExt2( TRACE_FLOW, CCONNECTIONSTATUSPOPUP_CONNECTIONERRORDISCREETPOPUP, "CConnectionStatusPopup::ConnectionErrorDiscreetPopup;aErrorCode=%d;showPopup=%u", aErrorCode, showPopup );
       
   239     
       
   240     if (showPopup)
       
   241         {
       
   242         SetState( EPopupError );
       
   243         }
       
   244 
       
   245     OstTraceFunctionExit0( CCONNECTIONSTATUSPOPUP_CONNECTIONERRORDISCREETPOPUP_EXIT );
       
   246     }
       
   247 
       
   248 //-----------------------------------------------------------------------------
       
   249 //  CConnectionStatusPopup::SetState()
       
   250 //-----------------------------------------------------------------------------
       
   251 //
       
   252 void CConnectionStatusPopup::SetState( TPopupState aNewState )
       
   253     {
       
   254     OstTraceExt2( TRACE_FLOW, CCONNECTIONSTATUSPOPUP_SETSTATE, "CConnectionStatusPopup::SetState;iPopupState=%u;aNewState=%u", iPopupState, aNewState );
       
   255     
       
   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)
       
   285         {
       
   286         // Show or update popup
       
   287         if (iPopupState == EPopupClosed)
       
   288             {
       
   289             TRAP_IGNORE( iPopup->ShowL() );
       
   290             }
       
   291         else
       
   292             {
       
   293             TRAP_IGNORE( iPopup->UpdateL() );
       
   294             }
       
   295         }
       
   296     
       
   297     iPopupState = aNewState;
       
   298     }
       
   299 
       
   300 //-----------------------------------------------------------------------------
       
   301 //  CConnectionStatusPopup::FormatIapInfoL()
       
   302 //-----------------------------------------------------------------------------
       
   303 //
       
   304 void CConnectionStatusPopup::FormatIapInfoL( TUint32 aIapId )
       
   305     {
       
   306     OstTraceFunctionEntry0( CCONNECTIONSTATUSPOPUP_FORMATIAPINFOL_ENTRY );
       
   307     
       
   308     // Title
       
   309     HBufC* title = HbTextResolverSymbian::LoadLC(
       
   310             Ktxt_occ_dpophead_connecting );
       
   311     iPopup->SetTitleL( title->Des() );
       
   312     CleanupStack::PopAndDestroy( title );
       
   313 
       
   314     // Load iap info from cmmanager
       
   315     HBufC* connectionName( NULL );
       
   316     TUint bearerType( 0 );
       
   317 
       
   318     RCmManager cmMgr;
       
   319     CleanupClosePushL( cmMgr );
       
   320     RCmConnectionMethod plugin;
       
   321     CleanupClosePushL( plugin );
       
   322     cmMgr.OpenL();
       
   323     plugin = cmMgr.ConnectionMethodL( aIapId );
       
   324     bearerType = plugin.GetIntAttributeL( CMManager::ECmBearerType );
       
   325     connectionName = plugin.GetStringAttributeL( CMManager::ECmName );
       
   326     CleanupStack::PopAndDestroy( &plugin );
       
   327     CleanupStack::PopAndDestroy( &cmMgr );
       
   328     
       
   329     // Text
       
   330     CleanupStack::PushL( connectionName );
       
   331     if (connectionName)
       
   332         {
       
   333         iPopup->SetTextL( connectionName->Des() );
       
   334         }
       
   335     else
       
   336         {
       
   337         iPopup->SetTextL( KTextNone );
       
   338         }
       
   339     CleanupStack::PopAndDestroy( connectionName ); 
       
   340 
       
   341     // Icon
       
   342     switch (bearerType)
       
   343         {
       
   344         case KUidWlanBearerType:
       
   345             iPopup->SetIconNameL( KIconWlan );
       
   346             break;
       
   347         case KPluginVPNBearerTypeUid:
       
   348             iPopup->SetIconNameL( KIconVpn );
       
   349             break;
       
   350         default:
       
   351             iPopup->SetIconNameL( KIconCellular );
       
   352         }
       
   353     
       
   354     OstTraceFunctionExit0( CCONNECTIONSTATUSPOPUP_FORMATIAPINFOL_EXIT );
       
   355     }
       
   356 
       
   357 //-----------------------------------------------------------------------------
       
   358 //  CConnectionStatusPopup::ResolveErrorCodeL()
       
   359 //-----------------------------------------------------------------------------
       
   360 //
       
   361 TBool CConnectionStatusPopup::ResolveErrorCodeL( TInt aErrorCode )
       
   362     {
       
   363     OstTraceFunctionEntry0( CCONNECTIONSTATUSPOPUP_RESOLVEERRORCODEL_ENTRY );
       
   364     
       
   365     // Icons, which are resolved at the end
       
   366     enum TIconType
       
   367         {
       
   368         EIconWlan, EIconCellular, EIconNone
       
   369         };
       
   370     TIconType icon = EIconWlan;
       
   371 
       
   372     TPtrC titlePtr;
       
   373     titlePtr.Set( Ktxt_occ_dpophead_connection_failed );
       
   374     TPtrC textPtr;
       
   375 
       
   376     // Resolve title, text and icon of error code.
       
   377     // Groups are from OCC UI spec 1.0
       
   378     switch (aErrorCode)
       
   379         {
       
   380 
       
   381         // Skipped errors, for which the popup is not shown.
       
   382         case KErrNone:
       
   383         case KErrConnectionTerminated:
       
   384         case KErrDisconnected:
       
   385         case KErrCancel:
       
   386             return EFalse;
       
   387 
       
   388         // Group 1
       
   389         case KErrIfChangingPassword:
       
   390             icon = EIconCellular;
       
   391         // These were GPRS; fall through
       
   392         case KErrWlanInternalError:
       
   393             textPtr.Set( Ktxt_occ_dpopinfo_internal_error );
       
   394             break;
       
   395 
       
   396         // Group 2
       
   397         case KErrWlanNetworkNotFound:
       
   398             textPtr.Set( Ktxt_occ_dpopinfo_wlan_network_not_found );
       
   399             break;
       
   400 
       
   401         // Group 3
       
   402         case KErrGprsUserAuthenticationFailure:
       
   403             icon = EIconCellular;
       
   404         // These were GPRS; fall through
       
   405         case KErrWlanOpenAuthFailed:
       
   406         case KErrWlanSharedKeyAuthRequired:
       
   407         case KErrWlanWpaAuthRequired:
       
   408         case KErrWlanWpaAuthFailed:
       
   409         case KErrWlan802dot1xAuthFailed:
       
   410         case KErrWlanWpaCounterMeasuresActive:
       
   411         case KErrWlanPskModeRequired:
       
   412         case KErrWlanEapModeRequired:
       
   413         case KErrWlanEapSimFailed:
       
   414         case KErrWlanEapTlsFailed:
       
   415         case KErrWlanEapPeapFailed:
       
   416         case KErrWlanEapMsChapv2: // Is the same as KErrWlanEapMsChaPFailed
       
   417         case KErrWlanEapAkaFailed:
       
   418         case KErrWlanEapTtlsFailed:
       
   419         case KErrWlanLeapFailed:
       
   420         case KErrWlanEapGtcFailed:
       
   421         case KErrWlanWpa2OnlyModeNotSupported:
       
   422         case KErrWlanEapFastTunnelCompromiseError:
       
   423         case KErrWlanEapFastUnexpextedTlvExhanged:
       
   424         case KErrWlanEapFastNoPacNorCertsToAuthenticateWithProvDisabled:
       
   425         case KErrWlanEapFastNoMatchingPacForAid:
       
   426         case KErrWlanEapFastAuthFailed:
       
   427         case KErrWlanEapFastPacStoreCorrupted:
       
   428             textPtr.Set( Ktxt_occ_dpopinfo_authentication_unsuccessful );
       
   429             break;
       
   430 
       
   431         // Group 4
       
   432         case KErrWlanSharedKeyAuthFailed:
       
   433         case KErrWlanIllegalWpaPskKey:
       
   434         case KErrWlanIllegalEncryptionKeys:
       
   435             textPtr.Set( Ktxt_occ_dpopinfo_check_security_key );
       
   436             break;
       
   437 
       
   438         // Group 5
       
   439         case KErrExitModemError:
       
   440         case KErrExitLoginFail:
       
   441         case KErrExitScriptTimeOut:
       
   442         case KErrExitScriptError:
       
   443         case KErrIfAuthenticationFailure:
       
   444         case KErrIfAuthNotSecure:
       
   445         case KErrIfAccountDisabled:
       
   446         case KErrIfRestrictedLogonHours:
       
   447         case KErrIfPasswdExpired:
       
   448         case KErrIfNoDialInPermission:
       
   449         case KErrGprsMissingorUnknownAPN:
       
   450             icon = EIconCellular;
       
   451             textPtr.Set( Ktxt_occ_dpopinfo_check_connection_settings );
       
   452             break;
       
   453 
       
   454         // Group 6
       
   455         case KErrWlanSimNotInstalled:
       
   456             textPtr.Set( Ktxt_occ_dpopinfo_sim_card_missing );
       
   457             break;
       
   458 
       
   459         // Group 7
       
   460         case KErrWlanNotSubscribed:
       
   461         case KErrWlanAccessBarred:
       
   462             textPtr.Set( Ktxt_occ_dpopinfo_service_unreachable );
       
   463             break;
       
   464 
       
   465         // Group 8
       
   466         case KErrPermissionDenied:
       
   467         case KErrWlanPasswordExpired:
       
   468         case KErrWlanNoDialinPermissions:
       
   469         case KErrWlanAccountDisabled:
       
   470         case KErrWlanRestrictedLogonHours:
       
   471         case KErrWlanServerCertificateExpired:
       
   472         case KErrWlanCerficateVerifyFailed:
       
   473         case KErrWlanNoUserCertificate:
       
   474         case KErrWlanNoCipherSuite:
       
   475         case KErrWlanUserRejected:
       
   476         case KErrWlanUserCertificateExpired:
       
   477             textPtr.Set( Ktxt_occ_dpopinfo_permission_denied );
       
   478             break;
       
   479 
       
   480         // Group 9
       
   481         case KErrPDPMaxContextsReached:
       
   482             icon = EIconCellular;
       
   483             // These were GPRS; fall through
       
   484         case KErrWlanConnAlreadyActive:
       
   485             textPtr.Set( Ktxt_occ_dpopinfo_connection_already_active );
       
   486             break;
       
   487 
       
   488         // Group 10
       
   489         case KErrWlanSignalTooWeak:
       
   490             textPtr.Set( Ktxt_occ_dpopinfo_signal_too_weak );
       
   491             break;
       
   492 
       
   493         // Group 11
       
   494         case KErrIfCallbackNotAcceptable:
       
   495         case KErrIfDNSNotFound:
       
   496         case KErrIfLRDBadLine:
       
   497         case KErrNetUnreach:
       
   498         case KErrHostUnreach:
       
   499         case KErrNoProtocolOpt:
       
   500         case KErrUrgentData:
       
   501         case KErrInet6NoRoute:
       
   502         case KErrDndNameNotFound:
       
   503         case KErrGeneralConnection:
       
   504         case KErrGprsMSCTemporarilyNotReachable:
       
   505         case KErrGprsLlcOrSndcpFailure:
       
   506         case KErrGprsInsufficientResources:
       
   507         case KErrGprsActivationRejectedByGGSN:
       
   508         case KErrPacketDataTsyInvalidAPN:
       
   509             icon = EIconCellular;
       
   510             // These were GPRS; fall through
       
   511         case KErrWlanRoamingFailed:
       
   512             textPtr.Set( Ktxt_occ_dpopinfo_please_try_again );
       
   513             break;
       
   514 
       
   515         // Group 12
       
   516         case KErrGenConnNoGPRSNetwork:
       
   517         case KErrGprsServicesNotAllowed:
       
   518         case KErrGprsAndNonGprsServicesNotAllowed:
       
   519         case KErrGprsMSIdentityCannotBeDerivedByTheNetwork:
       
   520         case KErrGprsMSImplicitlyDetached:
       
   521         case KErrGsmMMNetworkFailure:
       
   522         case KErrGprsUnknownPDPAddress:
       
   523         case KErrGprsActivationRejected:
       
   524         case KErrGsmMMServiceOptionNotSubscribed:
       
   525         case KErrGsmMMServiceOptionTemporaryOutOfOrder:
       
   526         case KErrGprsNSAPIAlreadyUsed:
       
   527         case KErrGprsQoSNotAccepted:
       
   528         case KErrGprsReactivationRequested:
       
   529             icon = EIconCellular;
       
   530             textPtr.Set( Ktxt_occ_dpopinfo_connection_unavailable );
       
   531             break;
       
   532 
       
   533         // Group 13
       
   534         case KErrWlanProtectedSetupDevicePasswordAuthFailure:
       
   535         case KErrWlanProtectedSetupPINMethodNotSupported:
       
   536         case KErrWlanProtectedSetupPBMethodNotSupported:
       
   537             titlePtr.Set( Ktxt_occ_dpophead_configuration_failed );
       
   538             textPtr.Set( Ktxt_occ_dpopinfo_authentication_unsuccessful );
       
   539             break;
       
   540 
       
   541         // Group 14
       
   542         case KErrWlanProtectedSetupOOBInterfaceReadError:
       
   543         case KErrWlanProtectedSetupDecryptionCRCFailure:
       
   544         case KErrWlanProtectedSetup2_4ChannelNotSupported:
       
   545         case KErrWlanProtectedSetup5_0ChannelNotSupported:
       
   546         case KErrWlanProtectedSetupNetworkAuthFailure:
       
   547         case KErrWlanProtectedSetupNoDHCPResponse:
       
   548         case KErrWlanProtectedSetupFailedDHCPConfig:
       
   549         case KErrWlanProtectedSetupIPAddressConflict:
       
   550         case KErrWlanProtectedSetupCouldNotConnectToRegistrar:
       
   551         case KErrWlanProtectedSetupMultiplePBCSessionsDetected:
       
   552         case KErrWlanProtectedSetupRogueActivitySuspected:
       
   553         case KErrWlanProtectedSetupDeviceBusy:
       
   554         case KErrWlanProtectedSetupSetupLocked:
       
   555         case KErrWlanProtectedSetupMessageTimeout:
       
   556         case KErrWlanProtectedSetupRegistrationSessionTimeout:
       
   557             titlePtr.Set( Ktxt_occ_dpophead_configuration_failed );
       
   558             textPtr.Set( Ktxt_occ_dpopinfo_please_try_again );
       
   559             break;
       
   560 
       
   561         // For error values not specifically mapped to any error message
       
   562         // the discreet pop-up #12 is used.
       
   563         default:
       
   564             icon = EIconNone;
       
   565             textPtr.Set( Ktxt_occ_dpopinfo_connection_unavailable );
       
   566             break;
       
   567         }
       
   568 
       
   569     // Load and set title, text and icon
       
   570     HBufC* titleBuf = HbTextResolverSymbian::LoadLC( titlePtr );
       
   571     iPopup->SetTitleL( titleBuf->Des() );
       
   572     HBufC* textBuf = HbTextResolverSymbian::LoadLC( textPtr );
       
   573     iPopup->SetTextL( textBuf->Des() );
       
   574     CleanupStack::PopAndDestroy( 2, titleBuf );
       
   575 
       
   576     switch (icon)
       
   577         {
       
   578         case EIconWlan:
       
   579             iPopup->SetIconNameL( KIconWlan );
       
   580             break;
       
   581         case EIconCellular:
       
   582             iPopup->SetIconNameL( KIconCellular );
       
   583             break;
       
   584         default:
       
   585             __ASSERT_DEBUG( icon == EIconNone, User::Invariant());
       
   586             // Leave icon as-is, either set by ConnectingViaDiscreetPopup
       
   587             // or undefined.
       
   588             break;
       
   589         }
       
   590     
       
   591     OstTraceFunctionExit0( CCONNECTIONSTATUSPOPUP_RESOLVEERRORCODEL_EXIT );
       
   592     return ETrue;
       
   593     }
       
   594 
       
   595 
       
   596 //-----------------------------------------------------------------------------
       
   597 //  CConnectionStatusPopup::NotificationDialogActivated()
       
   598 //-----------------------------------------------------------------------------
       
   599 //
       
   600 void CConnectionStatusPopup::NotificationDialogActivated(
       
   601         const CHbDeviceNotificationDialogSymbian* /*aDialog*/ )
       
   602     {
       
   603     OstTraceFunctionEntry0( CCONNECTIONSTATUSPOPUP_NOTIFICATIONDIALOGACTIVATED_ENTRY );
       
   604     
       
   605     // Launch wlan view or connection view depending of bearer
       
   606     TPtrC procName; 
       
   607     if (iPopup->IconName().Compare( KIconWlan ) == 0)
       
   608         {
       
   609         procName.Set( KWlanViewExeFile );
       
   610         }
       
   611     else if (iPopup->IconName().Compare( KIconCellular ) == 0)
       
   612         {
       
   613         procName.Set( KConnViewExeFile );
       
   614         }
       
   615     else
       
   616         {
       
   617         OstTraceFunctionExit0( CCONNECTIONSTATUSPOPUP_NOTIFICATIONDIALOGACTIVATED_EXIT );
       
   618 
       
   619         return;
       
   620         }
       
   621 
       
   622     RProcess proc;
       
   623     TInt procError = proc.Create( procName, KExeFileCmd );
       
   624     OstTrace1( TRACE_FLOW, CCONNECTIONSTATUSPOPUP_NOTIFICATIONDIALOGACTIVATED, "CConnectionStatusPopup::NotificationDialogActivated;procError=%d", procError );
       
   625     if (!procError)
       
   626         {
       
   627         proc.Resume();
       
   628         proc.Close(); // Closes the handle, not the process.
       
   629         }
       
   630 
       
   631     OstTraceFunctionExit0( DUP1_CCONNECTIONSTATUSPOPUP_NOTIFICATIONDIALOGACTIVATED_EXIT );
       
   632     }
       
   633 
       
   634 //-----------------------------------------------------------------------------
       
   635 //  CConnectionStatusPopup::NotificationDialogClosed()
       
   636 //-----------------------------------------------------------------------------
       
   637 //
       
   638 void CConnectionStatusPopup::NotificationDialogClosed(
       
   639         const CHbDeviceNotificationDialogSymbian* /*aDialog*/,
       
   640         TInt /*aCompletionCode*/ )
       
   641     {
       
   642     OstTraceFunctionEntry0( CCONNECTIONSTATUSPOPUP_NOTIFICATIONDIALOGCLOSED_ENTRY );
       
   643     
       
   644     SetState( EPopupClosed );
       
   645     
       
   646     OstTraceFunctionExit0( CCONNECTIONSTATUSPOPUP_NOTIFICATIONDIALOGCLOSED_EXIT );
       
   647     }