connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/EasyWepDlgNotif.cpp
changeset 0 5a93021fdf25
child 26 0a9e01492035
child 41 bbb64eb3bdee
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/EasyWepDlgNotif.cpp	Thu Dec 17 08:55:21 2009 +0200
@@ -0,0 +1,140 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of CEasyWepDlgNotif
+*
+*/
+
+
+// INCLUDE FILES
+#include "EasyWepDlgNotif.h"
+#include "WepWpaQueryDlg.h"
+#include "ConnUiUtilsNotif.h"
+
+#include <ConnUiUtilsNotif.rsg>
+#include <StringLoader.h>
+#include <featmgr.h>
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CEasyWepDlgNotif::TNotifierInfo CEasyWepDlgNotif::RegisterL()
+// ---------------------------------------------------------
+//
+CEasyWepDlgNotif::TNotifierInfo CEasyWepDlgNotif::RegisterL()
+    {
+    iInfo.iUid = KUidEasyWepDlg;
+    iInfo.iPriority = ENotifierPriorityHigh;
+    iInfo.iChannel = KUidEasyWepDlg;
+
+    return iInfo;
+    }
+
+// ---------------------------------------------------------
+// void CEasyWepDlgNotif::StartL
+// ---------------------------------------------------------
+//
+void CEasyWepDlgNotif::StartL( const TDesC8& /*aBuffer*/, 
+                                    TInt aReplySlot,
+                                    const RMessagePtr2& aMessage )
+    {
+    iReplySlot = aReplySlot;
+    iMessage = aMessage;
+    iCancelled = EFalse;
+
+    aMessage.ReadL( aReplySlot, iKey );
+
+    HBufC* msg = CCoeEnv::Static()->AllocReadResourceLC( 
+                                                    R_EASY_WEP_QUERY_TEXT );
+    iDialog = new ( ELeave ) CWepWpaQueryDlg( 
+                                            iKey().iKey, this, EDialogWep, iHex );
+    iDialog->SetPromptL( *msg );
+
+    TBool isWEP256Enabled = ETrue;
+    
+    FeatureManager::InitializeLibL();
+    isWEP256Enabled = FeatureManager::FeatureSupported( 
+                                                KFeatureIdWlanWep256Enabled );
+    FeatureManager::UnInitializeLib();
+
+    if ( isWEP256Enabled )
+        {
+        iDialog->SetMaxLength( KEasyWepQuery256BitMaxLength );
+        }
+    else
+        {
+        iDialog->SetMaxLength( KEasyWepQueryNon256BitMaxLength );
+        }
+
+    iDialog->ExecuteLD( R_EASY_WEP_WPA_DLG );
+    CleanupStack::PopAndDestroy( msg );
+    }
+
+// ---------------------------------------------------------
+// void CEasyWepDlgNotif::Cancel()
+// ---------------------------------------------------------
+//
+void CEasyWepDlgNotif::Cancel()
+    {
+    if ( !iCancelled )
+        {
+        iCancelled = ETrue;
+        if ( !iMessage.IsNull() )
+            {
+            iMessage.Complete( KErrCancel );
+            }
+        
+        delete iDialog;
+        iDialog = NULL;
+        }
+    }
+
+
+// ---------------------------------------------------------
+// void CEasyWepDlgNotif::CompleteL( TInt aStatus )
+// ---------------------------------------------------------
+//
+void CEasyWepDlgNotif::CompleteL( TInt aStatus )
+    {    
+    iCancelled = ETrue;
+    if ( !iMessage.IsNull() )
+        {
+        if ( aStatus == KErrNone )
+            {
+            iKey().iHex = iHex;
+            iMessage.WriteL( iReplySlot, iKey );
+            }
+
+        iMessage.Complete( aStatus );
+        }
+    Cancel(); // Temporary solution
+    }
+
+
+// ---------------------------------------------------------
+// CEasyWepDlgNotif* CEasyWepDlgNotif::NewL()
+// ---------------------------------------------------------
+//
+CEasyWepDlgNotif* CEasyWepDlgNotif::NewL( 
+                                        const TBool aResourceFileResponsible )
+    {
+    CEasyWepDlgNotif* self = new ( ELeave ) CEasyWepDlgNotif();
+    CleanupStack::PushL( self );
+    self->ConstructL( KResourceFileName, aResourceFileResponsible );
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+// End of File