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