connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/EasyWepDlgNotif.cpp
changeset 0 5a93021fdf25
child 26 0a9e01492035
child 41 bbb64eb3bdee
equal deleted inserted replaced
-1:000000000000 0:5a93021fdf25
       
     1 /*
       
     2 * Copyright (c) 2005 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:  Implementation of CEasyWepDlgNotif
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "EasyWepDlgNotif.h"
       
    21 #include "WepWpaQueryDlg.h"
       
    22 #include "ConnUiUtilsNotif.h"
       
    23 
       
    24 #include <ConnUiUtilsNotif.rsg>
       
    25 #include <StringLoader.h>
       
    26 #include <featmgr.h>
       
    27 
       
    28 
       
    29 // ================= MEMBER FUNCTIONS =======================
       
    30 
       
    31 // ---------------------------------------------------------
       
    32 // CEasyWepDlgNotif::TNotifierInfo CEasyWepDlgNotif::RegisterL()
       
    33 // ---------------------------------------------------------
       
    34 //
       
    35 CEasyWepDlgNotif::TNotifierInfo CEasyWepDlgNotif::RegisterL()
       
    36     {
       
    37     iInfo.iUid = KUidEasyWepDlg;
       
    38     iInfo.iPriority = ENotifierPriorityHigh;
       
    39     iInfo.iChannel = KUidEasyWepDlg;
       
    40 
       
    41     return iInfo;
       
    42     }
       
    43 
       
    44 // ---------------------------------------------------------
       
    45 // void CEasyWepDlgNotif::StartL
       
    46 // ---------------------------------------------------------
       
    47 //
       
    48 void CEasyWepDlgNotif::StartL( const TDesC8& /*aBuffer*/, 
       
    49                                     TInt aReplySlot,
       
    50                                     const RMessagePtr2& aMessage )
       
    51     {
       
    52     iReplySlot = aReplySlot;
       
    53     iMessage = aMessage;
       
    54     iCancelled = EFalse;
       
    55 
       
    56     aMessage.ReadL( aReplySlot, iKey );
       
    57 
       
    58     HBufC* msg = CCoeEnv::Static()->AllocReadResourceLC( 
       
    59                                                     R_EASY_WEP_QUERY_TEXT );
       
    60     iDialog = new ( ELeave ) CWepWpaQueryDlg( 
       
    61                                             iKey().iKey, this, EDialogWep, iHex );
       
    62     iDialog->SetPromptL( *msg );
       
    63 
       
    64     TBool isWEP256Enabled = ETrue;
       
    65     
       
    66     FeatureManager::InitializeLibL();
       
    67     isWEP256Enabled = FeatureManager::FeatureSupported( 
       
    68                                                 KFeatureIdWlanWep256Enabled );
       
    69     FeatureManager::UnInitializeLib();
       
    70 
       
    71     if ( isWEP256Enabled )
       
    72         {
       
    73         iDialog->SetMaxLength( KEasyWepQuery256BitMaxLength );
       
    74         }
       
    75     else
       
    76         {
       
    77         iDialog->SetMaxLength( KEasyWepQueryNon256BitMaxLength );
       
    78         }
       
    79 
       
    80     iDialog->ExecuteLD( R_EASY_WEP_WPA_DLG );
       
    81     CleanupStack::PopAndDestroy( msg );
       
    82     }
       
    83 
       
    84 // ---------------------------------------------------------
       
    85 // void CEasyWepDlgNotif::Cancel()
       
    86 // ---------------------------------------------------------
       
    87 //
       
    88 void CEasyWepDlgNotif::Cancel()
       
    89     {
       
    90     if ( !iCancelled )
       
    91         {
       
    92         iCancelled = ETrue;
       
    93         if ( !iMessage.IsNull() )
       
    94             {
       
    95             iMessage.Complete( KErrCancel );
       
    96             }
       
    97         
       
    98         delete iDialog;
       
    99         iDialog = NULL;
       
   100         }
       
   101     }
       
   102 
       
   103 
       
   104 // ---------------------------------------------------------
       
   105 // void CEasyWepDlgNotif::CompleteL( TInt aStatus )
       
   106 // ---------------------------------------------------------
       
   107 //
       
   108 void CEasyWepDlgNotif::CompleteL( TInt aStatus )
       
   109     {    
       
   110     iCancelled = ETrue;
       
   111     if ( !iMessage.IsNull() )
       
   112         {
       
   113         if ( aStatus == KErrNone )
       
   114             {
       
   115             iKey().iHex = iHex;
       
   116             iMessage.WriteL( iReplySlot, iKey );
       
   117             }
       
   118 
       
   119         iMessage.Complete( aStatus );
       
   120         }
       
   121     Cancel(); // Temporary solution
       
   122     }
       
   123 
       
   124 
       
   125 // ---------------------------------------------------------
       
   126 // CEasyWepDlgNotif* CEasyWepDlgNotif::NewL()
       
   127 // ---------------------------------------------------------
       
   128 //
       
   129 CEasyWepDlgNotif* CEasyWepDlgNotif::NewL( 
       
   130                                         const TBool aResourceFileResponsible )
       
   131     {
       
   132     CEasyWepDlgNotif* self = new ( ELeave ) CEasyWepDlgNotif();
       
   133     CleanupStack::PushL( self );
       
   134     self->ConstructL( KResourceFileName, aResourceFileResponsible );
       
   135     CleanupStack::Pop();
       
   136 
       
   137     return self;
       
   138     }
       
   139 
       
   140 // End of File