connectionutilities/ConnectionDialogs/ConnectionUiUtilities/src/connectionstatuspopup.cpp
branchRCL_3
changeset 57 05bc53fe583b
equal deleted inserted replaced
55:fc7b30ed2058 57:05bc53fe583b
       
     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 <gsmerror.h>       // KErrPacketDataTsyMaxPdpContextsReached 
       
    39 #include <in_iface.h>
       
    40 #include <etelpckt.h>       // GPRS-specific causes for Session Management
       
    41 #include <nd_err.h>         // NetDial errors
       
    42 #include <inet6err.h>       // IPv6 error constants
       
    43 #include <rmmcustomapi.h>
       
    44 
       
    45 // Errors in UI spec not found elsewhere
       
    46 const TInt KErrDndNameNotFound          = -5120;
       
    47 const TInt KErrGeneralConnection        = -50000;
       
    48 const TInt KErrGenConnNoGPRSNetwork     = -3609;
       
    49 
       
    50 // Icons representing bearer
       
    51 _LIT( KIconCellular, "qtg_small_gprs" );
       
    52 _LIT( KIconWlan,     "qtg_small_wlan" );
       
    53 _LIT( KIconVpn,      "qtg_small_vpn" ); 
       
    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 _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");
       
   103 
       
   104 
       
   105 //-----------------------------------------------------------------------------
       
   106 //  CConnectionStatusPopup::CConnectionStatusPopup()
       
   107 //-----------------------------------------------------------------------------
       
   108 //
       
   109 CConnectionStatusPopup::CConnectionStatusPopup()
       
   110 :iPopup( NULL ), iPopupState( EPopupClosed ), iTouchAction( EDoNothing )
       
   111     {
       
   112     }
       
   113 
       
   114 //-----------------------------------------------------------------------------
       
   115 //  CConnectionStatusPopup::NewL()
       
   116 //-----------------------------------------------------------------------------
       
   117 //
       
   118 CConnectionStatusPopup* CConnectionStatusPopup::NewL()
       
   119     {
       
   120     OstTraceFunctionEntry0( CCONNECTIONSTATUSPOPUP_NEWL_ENTRY );
       
   121     
       
   122     CConnectionStatusPopup* popup = new ( ELeave ) CConnectionStatusPopup();
       
   123     CleanupStack::PushL( popup );
       
   124     popup->ConstructL();
       
   125     CleanupStack::Pop( popup ); 
       
   126     
       
   127     OstTraceFunctionExit0( CCONNECTIONSTATUSPOPUP_NEWL_EXIT );
       
   128     return popup;
       
   129     }
       
   130 
       
   131 //-----------------------------------------------------------------------------
       
   132 //  CConnectionStatusPopup::ConstructL()
       
   133 //-----------------------------------------------------------------------------
       
   134 //
       
   135 void CConnectionStatusPopup::ConstructL()
       
   136     {
       
   137     OstTraceFunctionEntry0( CCONNECTIONSTATUSPOPUP_CONSTRUCTL_ENTRY );
       
   138     
       
   139     iPopup = CHbDeviceNotificationDialogSymbian::NewL( this );
       
   140 
       
   141     TBool result = HbTextResolverSymbian::Init( KTrFile, KTrFilePath );
       
   142     if (!result)
       
   143         {
       
   144         OstTrace0( TRACE_FLOW, CCONNECTIONSTATUSPOPUP_CONSTRUCTL,"CConnectionStatusPopup::ConstructL; Loading of localization failed!" );
       
   145         }
       
   146     
       
   147     OstTraceFunctionExit0( CCONNECTIONSTATUSPOPUP_CONSTRUCTL_EXIT );
       
   148     }
       
   149 
       
   150 //-----------------------------------------------------------------------------
       
   151 //  CConnectionStatusPopup::~CConnectionStatusPopup()
       
   152 //-----------------------------------------------------------------------------
       
   153 //
       
   154 CConnectionStatusPopup::~CConnectionStatusPopup()
       
   155     {
       
   156     OstTraceFunctionEntry0( CCONNECTIONSTATUSPOPUP_CCONNECTIONSTATUSPOPUP_ENTRY );
       
   157     
       
   158     if (iPopup)
       
   159         {
       
   160         iPopup->Close();
       
   161         delete iPopup;
       
   162         }
       
   163     
       
   164     OstTraceFunctionExit0( CCONNECTIONSTATUSPOPUP_CCONNECTIONSTATUSPOPUP_EXIT );
       
   165     }
       
   166 
       
   167 //-----------------------------------------------------------------------------
       
   168 //  CConnectionStatusPopup::ConnectingDiscreetPopup()
       
   169 //-----------------------------------------------------------------------------
       
   170 //
       
   171 void CConnectionStatusPopup::ConnectingViaDiscreetPopup( )
       
   172     {
       
   173     OstTraceFunctionEntry0( CCONNECTIONSTATUSPOPUP_CONNECTINGVIADISCREETPOPUP_ENTRY );
       
   174 
       
   175     TRAP_IGNORE( 
       
   176         HBufC* title = HbTextResolverSymbian::LoadLC(
       
   177                 Ktxt_occ_dpophead_connecting );
       
   178         iPopup->SetTitleL( title->Des() );
       
   179         CleanupStack::PopAndDestroy( title );
       
   180         iPopup->SetTextL( KTextNone );
       
   181         iPopup->SetIconNameL( KIconNone );
       
   182         );
       
   183     iTouchAction = EDoNothing;
       
   184     iPopup->SetTimeout( KForeverTimeout );
       
   185 
       
   186     SetState( EPopupConnecting );
       
   187  
       
   188     OstTraceFunctionExit0( CCONNECTIONSTATUSPOPUP_CONNECTINGVIADISCREETPOPUP_EXIT );
       
   189     }
       
   190 
       
   191 
       
   192 //-----------------------------------------------------------------------------
       
   193 //  CConnectionStatusPopup::ConnectingViaDiscreetPopup()
       
   194 //-----------------------------------------------------------------------------
       
   195 //
       
   196 void CConnectionStatusPopup::ConnectingViaDiscreetPopup(
       
   197         TUint32 aIapId,
       
   198         TBool aConnectionAlreadyActive )
       
   199     {
       
   200     OstTraceFunctionEntry0( DUP1_CCONNECTIONSTATUSPOPUP_CONNECTINGVIADISCREETPOPUP_ENTRY );
       
   201     OstTraceExt2( TRACE_FLOW, CCONNECTIONSTATUSPOPUP_CONNECTINGVIADISCREETPOPUP, "CConnectionStatusPopup::ConnectingViaDiscreetPopup;aIapId=%u;aConnectionAlreadyActive=%u", aIapId, aConnectionAlreadyActive );
       
   202 
       
   203     // Grab iap info even if we do not need it yet (when sharing),
       
   204     // because icon may be used later if general error happens.
       
   205     TRAP_IGNORE( FormatIapInfoL( aIapId ); );
       
   206 
       
   207     if (aConnectionAlreadyActive)
       
   208         {
       
   209         // If sharing a connection, do not show the popup.
       
   210         SetState( EPopupClosed );
       
   211         }
       
   212     else
       
   213         {
       
   214         iPopup->SetTimeout( KForeverTimeout );
       
   215         SetState( EPopupConnectingIap );
       
   216         }
       
   217     
       
   218     OstTraceFunctionExit0( DUP1_CCONNECTIONSTATUSPOPUP_CONNECTINGVIADISCREETPOPUP_EXIT );
       
   219     }
       
   220 
       
   221 //-----------------------------------------------------------------------------
       
   222 //  CConnectionStatusPopup::CancelConnectingViaDiscreetPopup()
       
   223 //-----------------------------------------------------------------------------
       
   224 //
       
   225 void CConnectionStatusPopup::CancelConnectingViaDiscreetPopup()
       
   226     {
       
   227     OstTraceFunctionEntry0( CCONNECTIONSTATUSPOPUP_CANCELCONNECTINGVIADISCREETPOPUP_ENTRY );
       
   228     
       
   229     SetState( EPopupClosed );
       
   230 
       
   231     OstTraceFunctionExit0( CCONNECTIONSTATUSPOPUP_CANCELCONNECTINGVIADISCREETPOPUP_EXIT );
       
   232     }
       
   233 
       
   234 //-----------------------------------------------------------------------------
       
   235 //  CConnectionStatusPopup::ConnectionErrorDiscreetPopup()
       
   236 //-----------------------------------------------------------------------------
       
   237 //
       
   238 void CConnectionStatusPopup::ConnectionErrorDiscreetPopup( TInt aErrorCode )
       
   239     {
       
   240     OstTraceFunctionEntry0( CCONNECTIONSTATUSPOPUP_CONNECTIONERRORDISCREETPOPUP_ENTRY );
       
   241     
       
   242     TBool showPopup( EFalse );
       
   243     TRAP_IGNORE( showPopup = ResolveErrorCodeL( aErrorCode ); );
       
   244     
       
   245     OstTraceExt2( TRACE_FLOW, CCONNECTIONSTATUSPOPUP_CONNECTIONERRORDISCREETPOPUP, "CConnectionStatusPopup::ConnectionErrorDiscreetPopup;aErrorCode=%d;showPopup=%u", aErrorCode, showPopup );
       
   246     
       
   247     if (showPopup)
       
   248         {
       
   249         iPopup->SetTimeout( KHbLongNotificationDialogTimeout ); 
       
   250         SetState( EPopupError );
       
   251         }
       
   252 
       
   253     OstTraceFunctionExit0( CCONNECTIONSTATUSPOPUP_CONNECTIONERRORDISCREETPOPUP_EXIT );
       
   254     }
       
   255 
       
   256 //-----------------------------------------------------------------------------
       
   257 //  CConnectionStatusPopup::SetState()
       
   258 //-----------------------------------------------------------------------------
       
   259 //
       
   260 void CConnectionStatusPopup::SetState( TPopupState aNewState )
       
   261     {
       
   262     OstTraceExt2( TRACE_FLOW, CCONNECTIONSTATUSPOPUP_SETSTATE, "CConnectionStatusPopup::SetState;iPopupState=%u;aNewState=%u", iPopupState, aNewState );
       
   263 
       
   264     if (aNewState != EPopupClosed)
       
   265         {
       
   266         // Enable touch activation based on defined action
       
   267         iPopup->EnableTouchActivation( iTouchAction != EDoNothing );
       
   268 
       
   269         // Show or update popup
       
   270         if (iPopupState == EPopupClosed)
       
   271             {
       
   272             TRAP_IGNORE( iPopup->ShowL() );
       
   273             }
       
   274         else
       
   275             {
       
   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();
       
   285             }
       
   286         }
       
   287     
       
   288     iPopupState = aNewState;
       
   289     }
       
   290 
       
   291 //-----------------------------------------------------------------------------
       
   292 //  CConnectionStatusPopup::FormatIapInfoL()
       
   293 //-----------------------------------------------------------------------------
       
   294 //
       
   295 void CConnectionStatusPopup::FormatIapInfoL( TUint32 aIapId )
       
   296     {
       
   297     OstTraceFunctionEntry0( CCONNECTIONSTATUSPOPUP_FORMATIAPINFOL_ENTRY );
       
   298     
       
   299     // Title
       
   300     HBufC* title = HbTextResolverSymbian::LoadLC(
       
   301             Ktxt_occ_dpophead_connecting );
       
   302     iPopup->SetTitleL( title->Des() );
       
   303     CleanupStack::PopAndDestroy( title );
       
   304 
       
   305     // Load iap info from cmmanager
       
   306     HBufC* connectionName( NULL );
       
   307     TUint bearerType( 0 );
       
   308 
       
   309     RCmManager cmMgr;
       
   310     CleanupClosePushL( cmMgr );
       
   311     RCmConnectionMethod plugin;
       
   312     CleanupClosePushL( plugin );
       
   313     cmMgr.OpenL();
       
   314     plugin = cmMgr.ConnectionMethodL( aIapId );
       
   315     bearerType = plugin.GetIntAttributeL( CMManager::ECmBearerType );
       
   316     connectionName = plugin.GetStringAttributeL( CMManager::ECmName );
       
   317     CleanupStack::PopAndDestroy( &plugin );
       
   318     CleanupStack::PopAndDestroy( &cmMgr );
       
   319     
       
   320     // Text
       
   321     CleanupStack::PushL( connectionName );
       
   322     if (connectionName)
       
   323         {
       
   324         iPopup->SetTextL( connectionName->Des() );
       
   325         }
       
   326     else
       
   327         {
       
   328         iPopup->SetTextL( KTextNone );
       
   329         }
       
   330     CleanupStack::PopAndDestroy( connectionName ); 
       
   331 
       
   332     // Icon and action
       
   333     switch (bearerType)
       
   334         {
       
   335         case KUidWlanBearerType:
       
   336             iTouchAction = EOpenWlanView;
       
   337             iPopup->SetIconNameL( KIconWlan );
       
   338             break;
       
   339         case KPluginVPNBearerTypeUid:
       
   340             iTouchAction = EDoNothing;
       
   341             iPopup->SetIconNameL( KIconVpn );
       
   342             break;
       
   343         default:
       
   344             iTouchAction = EOpenCellularView;
       
   345             iPopup->SetIconNameL( KIconCellular );
       
   346         }
       
   347     
       
   348     OstTraceFunctionExit0( CCONNECTIONSTATUSPOPUP_FORMATIAPINFOL_EXIT );
       
   349     }
       
   350 
       
   351 //-----------------------------------------------------------------------------
       
   352 //  CConnectionStatusPopup::ResolveErrorCodeL()
       
   353 //-----------------------------------------------------------------------------
       
   354 //
       
   355 TBool CConnectionStatusPopup::ResolveErrorCodeL( TInt aErrorCode )
       
   356     {
       
   357     OstTraceFunctionEntry0( CCONNECTIONSTATUSPOPUP_RESOLVEERRORCODEL_ENTRY );
       
   358     
       
   359     // Icons, which are resolved at the end
       
   360     enum TIconType
       
   361         {
       
   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
       
   370         };
       
   371 
       
   372     // Most errors have following values
       
   373     TIconType icon = EIconWlan;
       
   374     iTouchAction = EDoNothing;
       
   375     TPtrC titlePtr;
       
   376     titlePtr.Set( Ktxt_occ_dpophead_connection_failed );
       
   377     
       
   378     TPtrC textPtr;
       
   379 
       
   380     // Resolve title, text and icon of error code.
       
   381     // Groups are from OCC UI spec 1.0
       
   382     switch (aErrorCode)
       
   383         {
       
   384 
       
   385         // Skipped errors, for which the popup is not shown.
       
   386         case KErrNone:
       
   387         case KErrConnectionTerminated:
       
   388         case KErrDisconnected:
       
   389         case KErrCancel:
       
   390             return EFalse;
       
   391 
       
   392         // Group 1
       
   393         case KErrIfChangingPassword:
       
   394             icon = EIconCellular;
       
   395         // These were GPRS; fall through
       
   396         case KErrWlanInternalError:
       
   397             textPtr.Set( Ktxt_occ_dpopinfo_internal_error );
       
   398             break;
       
   399 
       
   400         // Group 2
       
   401         case KErrWlanNetworkNotFound:
       
   402             textPtr.Set( Ktxt_occ_dpopinfo_wlan_network_not_found );
       
   403             break;
       
   404 
       
   405         // Group 3
       
   406         case KErrGprsUserAuthenticationFailure:
       
   407             icon = EIconCellular;
       
   408         // These were GPRS; fall through
       
   409         case KErrWlanOpenAuthFailed:
       
   410         case KErrWlanSharedKeyAuthRequired:
       
   411         case KErrWlanWpaAuthRequired:
       
   412         case KErrWlanWpaAuthFailed:
       
   413         case KErrWlan802dot1xAuthFailed:
       
   414         case KErrWlanWpaCounterMeasuresActive:
       
   415         case KErrWlanPskModeRequired:
       
   416         case KErrWlanEapModeRequired:
       
   417         case KErrWlanEapSimFailed:
       
   418         case KErrWlanEapTlsFailed:
       
   419         case KErrWlanEapPeapFailed:
       
   420         case KErrWlanEapMsChapv2: // Is the same as KErrWlanEapMsChaPFailed
       
   421         case KErrWlanEapAkaFailed:
       
   422         case KErrWlanEapTtlsFailed:
       
   423         case KErrWlanLeapFailed:
       
   424         case KErrWlanEapGtcFailed:
       
   425         case KErrWlanWpa2OnlyModeNotSupported:
       
   426         case KErrWlanEapFastTunnelCompromiseError:
       
   427         case KErrWlanEapFastUnexpextedTlvExhanged:
       
   428         case KErrWlanEapFastNoPacNorCertsToAuthenticateWithProvDisabled:
       
   429         case KErrWlanEapFastNoMatchingPacForAid:
       
   430         case KErrWlanEapFastAuthFailed:
       
   431         case KErrWlanEapFastPacStoreCorrupted:
       
   432             textPtr.Set( Ktxt_occ_dpopinfo_authentication_unsuccessful );
       
   433             break;
       
   434 
       
   435         // Group 4
       
   436         case KErrWlanSharedKeyAuthFailed:
       
   437         case KErrWlanIllegalWpaPskKey:
       
   438         case KErrWlanIllegalEncryptionKeys:
       
   439             textPtr.Set( Ktxt_occ_dpopinfo_check_security_key );
       
   440             break;
       
   441 
       
   442         // Group 5
       
   443         case KErrExitModemError:
       
   444         case KErrExitLoginFail:
       
   445         case KErrExitScriptTimeOut:
       
   446         case KErrExitScriptError:
       
   447         case KErrIfAuthenticationFailure:
       
   448         case KErrIfAuthNotSecure:
       
   449         case KErrIfAccountDisabled:
       
   450         case KErrIfRestrictedLogonHours:
       
   451         case KErrIfPasswdExpired:
       
   452         case KErrIfNoDialInPermission:
       
   453         case KErrGprsMissingorUnknownAPN:
       
   454             icon = EIconCellular;
       
   455             textPtr.Set( Ktxt_occ_dpopinfo_check_connection_settings );
       
   456             break;
       
   457 
       
   458         // Group 6
       
   459         case KErrWlanSimNotInstalled:
       
   460             textPtr.Set( Ktxt_occ_dpopinfo_sim_card_missing );
       
   461             break;
       
   462 
       
   463         // Group 7
       
   464         case KErrWlanNotSubscribed:
       
   465         case KErrWlanAccessBarred:
       
   466             textPtr.Set( Ktxt_occ_dpopinfo_service_unreachable );
       
   467             break;
       
   468 
       
   469         // Group 8
       
   470         case KErrPermissionDenied:
       
   471         case KErrWlanPasswordExpired:
       
   472         case KErrWlanNoDialinPermissions:
       
   473         case KErrWlanAccountDisabled:
       
   474         case KErrWlanRestrictedLogonHours:
       
   475         case KErrWlanServerCertificateExpired:
       
   476         case KErrWlanCerficateVerifyFailed:
       
   477         case KErrWlanNoUserCertificate:
       
   478         case KErrWlanNoCipherSuite:
       
   479         case KErrWlanUserRejected:
       
   480         case KErrWlanUserCertificateExpired:
       
   481             textPtr.Set( Ktxt_occ_dpopinfo_permission_denied );
       
   482             break;
       
   483 
       
   484         // Group 9
       
   485         case KErrWlanConnAlreadyActive:
       
   486             textPtr.Set( Ktxt_occ_dpopinfo_connection_already_active );
       
   487             break;
       
   488 
       
   489         // Group 10
       
   490         case KErrWlanSignalTooWeak:
       
   491             textPtr.Set( Ktxt_occ_dpopinfo_signal_too_weak );
       
   492             break;
       
   493 
       
   494         // Group 11
       
   495         case KErrIfCallbackNotAcceptable:
       
   496         case KErrIfDNSNotFound:
       
   497         case KErrIfLRDBadLine:
       
   498         case KErrNetUnreach:
       
   499         case KErrHostUnreach:
       
   500         case KErrNoProtocolOpt:
       
   501         case KErrUrgentData:
       
   502         case KErrInet6NoRoute:
       
   503         case KErrDndNameNotFound:
       
   504         case KErrGeneralConnection:
       
   505         case KErrGprsMSCTemporarilyNotReachable:
       
   506         case KErrGprsLlcOrSndcpFailure:
       
   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         case KErrGprsOfflineMode:
       
   530             icon = EIconCellular;
       
   531             // These were GPRS; fall through
       
   532         case KErrWlanOff:
       
   533         case KErrWlanForceOff:
       
   534             textPtr.Set( Ktxt_occ_dpopinfo_connection_unavailable );
       
   535             break;
       
   536 
       
   537         // Group 13
       
   538         case KErrWlanProtectedSetupDevicePasswordAuthFailure:
       
   539         case KErrWlanProtectedSetupPINMethodNotSupported:
       
   540         case KErrWlanProtectedSetupPBMethodNotSupported:
       
   541             titlePtr.Set( Ktxt_occ_dpophead_configuration_failed );
       
   542             textPtr.Set( Ktxt_occ_dpopinfo_authentication_unsuccessful );
       
   543             break;
       
   544 
       
   545         // Group 14
       
   546         case KErrWlanProtectedSetupOOBInterfaceReadError:
       
   547         case KErrWlanProtectedSetupDecryptionCRCFailure:
       
   548         case KErrWlanProtectedSetup2_4ChannelNotSupported:
       
   549         case KErrWlanProtectedSetup5_0ChannelNotSupported:
       
   550         case KErrWlanProtectedSetupNetworkAuthFailure:
       
   551         case KErrWlanProtectedSetupNoDHCPResponse:
       
   552         case KErrWlanProtectedSetupFailedDHCPConfig:
       
   553         case KErrWlanProtectedSetupIPAddressConflict:
       
   554         case KErrWlanProtectedSetupCouldNotConnectToRegistrar:
       
   555         case KErrWlanProtectedSetupMultiplePBCSessionsDetected:
       
   556         case KErrWlanProtectedSetupRogueActivitySuspected:
       
   557         case KErrWlanProtectedSetupDeviceBusy:
       
   558         case KErrWlanProtectedSetupSetupLocked:
       
   559         case KErrWlanProtectedSetupMessageTimeout:
       
   560         case KErrWlanProtectedSetupRegistrationSessionTimeout:
       
   561             titlePtr.Set( Ktxt_occ_dpophead_configuration_failed );
       
   562             textPtr.Set( Ktxt_occ_dpopinfo_please_try_again );
       
   563             break;
       
   564             
       
   565         // Group 15, errors related to maximum number of PDP contexts
       
   566         case KErrGprsInsufficientResources:
       
   567         case KErrUmtsMaxNumOfContextExceededByNetwork: 
       
   568         case KErrUmtsMaxNumOfContextExceededByPhone:
       
   569         case KErrPacketDataTsyMaxPdpContextsReached:
       
   570             // Open cellular view for these errors
       
   571             iTouchAction = EOpenCellularView;
       
   572             // The icon is left out from these popups in order to make room 
       
   573             // for the text which needs to be as descriptive as possible
       
   574             icon = EIconNoneSet;
       
   575             titlePtr.Set( Ktxt_occ_dpophead_maximum_connections_in_use );
       
   576             textPtr.Set( Ktxt_occ_dpopinfo_select_to_manage );
       
   577             break;
       
   578             
       
   579         // For error values not specifically mapped to any error message
       
   580         // the discreet pop-up #12 is used.
       
   581         default:
       
   582             icon = EIconUsePreviouslyDefined;
       
   583             textPtr.Set( Ktxt_occ_dpopinfo_connection_unavailable );
       
   584             break;
       
   585         }
       
   586 
       
   587     // Load and set title, text and icon
       
   588     HBufC* titleBuf = HbTextResolverSymbian::LoadLC( titlePtr );
       
   589     iPopup->SetTitleL( titleBuf->Des() );
       
   590     HBufC* textBuf = HbTextResolverSymbian::LoadLC( textPtr );
       
   591     iPopup->SetTextL( textBuf->Des() );
       
   592     CleanupStack::PopAndDestroy( 2, titleBuf );
       
   593 
       
   594     switch (icon)
       
   595         {
       
   596         case EIconWlan:
       
   597             iPopup->SetIconNameL( KIconWlan );
       
   598             break;
       
   599         case EIconCellular:
       
   600             iPopup->SetIconNameL( KIconCellular );
       
   601             break;
       
   602         case EIconNoneSet:
       
   603             iPopup->SetIconNameL( KIconNone );
       
   604             break;
       
   605         default:
       
   606             __ASSERT_DEBUG( icon == EIconUsePreviouslyDefined, User::Invariant());
       
   607             // Leave icon as-is, either set by ConnectingViaDiscreetPopup
       
   608             // or undefined.
       
   609             break;
       
   610         }
       
   611     
       
   612     OstTraceFunctionExit0( CCONNECTIONSTATUSPOPUP_RESOLVEERRORCODEL_EXIT );
       
   613     return ETrue;
       
   614     }
       
   615 
       
   616 
       
   617 //-----------------------------------------------------------------------------
       
   618 //  CConnectionStatusPopup::NotificationDialogActivated()
       
   619 //-----------------------------------------------------------------------------
       
   620 //
       
   621 void CConnectionStatusPopup::NotificationDialogActivated(
       
   622         const CHbDeviceNotificationDialogSymbian* /*aDialog*/ )
       
   623     {
       
   624     OstTraceFunctionEntry0( CCONNECTIONSTATUSPOPUP_NOTIFICATIONDIALOGACTIVATED_ENTRY );
       
   625     
       
   626     // Launch wlan view or connection view depending on bearer
       
   627     TPtrC procName; 
       
   628     if ( iTouchAction == EOpenWlanView )
       
   629         {
       
   630         procName.Set( KWlanViewExeFile );
       
   631         }
       
   632     else if ( iTouchAction == EOpenCellularView )
       
   633         {
       
   634         procName.Set( KConnViewExeFile );
       
   635         }
       
   636     else
       
   637         {
       
   638         OstTraceFunctionExit0( CCONNECTIONSTATUSPOPUP_NOTIFICATIONDIALOGACTIVATED_EXIT );
       
   639 
       
   640         return;
       
   641         }
       
   642 
       
   643     RProcess proc;
       
   644     TInt procError = proc.Create( procName, KExeFileCmd );
       
   645     OstTrace1( TRACE_FLOW, CCONNECTIONSTATUSPOPUP_NOTIFICATIONDIALOGACTIVATED, "CConnectionStatusPopup::NotificationDialogActivated;procError=%d", procError );
       
   646     if (!procError)
       
   647         {
       
   648         proc.Resume();
       
   649         proc.Close(); // Closes the handle, not the process.
       
   650         }
       
   651 
       
   652     OstTraceFunctionExit0( DUP1_CCONNECTIONSTATUSPOPUP_NOTIFICATIONDIALOGACTIVATED_EXIT );
       
   653     }
       
   654 
       
   655 //-----------------------------------------------------------------------------
       
   656 //  CConnectionStatusPopup::NotificationDialogClosed()
       
   657 //-----------------------------------------------------------------------------
       
   658 //
       
   659 void CConnectionStatusPopup::NotificationDialogClosed(
       
   660         const CHbDeviceNotificationDialogSymbian* /*aDialog*/,
       
   661         TInt /*aCompletionCode*/ )
       
   662     {
       
   663     OstTraceFunctionEntry0( CCONNECTIONSTATUSPOPUP_NOTIFICATIONDIALOGCLOSED_ENTRY );
       
   664     
       
   665     SetState( EPopupClosed );
       
   666     
       
   667     OstTraceFunctionExit0( CCONNECTIONSTATUSPOPUP_NOTIFICATIONDIALOGCLOSED_EXIT );
       
   668     }